oracle.ide.controls
Interface ProgressTracker
public interface ProgressTracker
The ProgressTracker
interface provides a way to have
progress indicated in the IDE status bar for background tasks.
The following is an example of using the interface for a background task
whose progress cannot be determined.
// Get the progress Tracker
ProgressTracker tracker = ProgressTracker.getProgressTracker();
tracker.addTask(new ProgressTrackedTask()
{
public boolean isIndeterminate() { return true; }
public void run() { }
public int getCurrentValue() { return 0; }
public int getMinimum() { return 0; }
public int getMaximum() { return 0; }
public String getCurrentText() { return null; }
public String getTaskDescription() { return "MyBackgroundTask"; }
});
Here's an example when progress can be determined:
// Get the progress Tracker
ProgressTracker tracker = ProgressTracker.getProgressTracker();
tracker.addTask(new MyTrackedTask());
}
private static class MyTrackedTask implements ProgressTrackedTask
{
private int _curValue = 0;
public boolean isIndeterminate() { return false; }
public void run()
{
for (int i=0; i<100; i++)
{
_curValue = i;
}
}
public int getCurrentValue() { return _curValue; }
public int getMinimum() { return 0; }
public int getMaximum() { return 99; }
public String getCurrentText() { return null; }
public String getTaskDescription() { return "MyBackgroundTask"; }
}
addTask
void addTask(ProgressTrackedTask task)
- Adds a
ProgressTrackedTask
to the set of tasks whose progress
is displayed in the IDE's status bar. The ProgressTracker
will create a Thread
for the task, start the thread, and
remove the task when the thread is completed.
- Parameters:
task
-
addTask
void addTask(ProgressTrackedTask task,
java.lang.String threadName)
- Adds a
ProgressTrackedTask
to the set of tasks whose progress
is displayed in the IDE's status bar. The ProgressTracker
will create a Thread
with the give name for the task, start the
thread, and remove the task when the thread is completed.
- Parameters:
task
- threadName
-
getThread
java.lang.Thread getThread(ProgressTrackedTask task)
- Gets the
Thread
used to run the given task.
- Returns:
- the thread used to run the given task or null if the task
is completed
Copyright © 1997, 2011, Oracle. All rights reserved.