public class MainWindowOperator.StatusTextTracer extends Object implements ChangeListener
Usage:
MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer(); // start tracing stt.start(); // compile action will produce at least two messages: "Compiling ...", // "Finished ..." new CompileAction().performAPI(); // waits for "Compiling" status text stt.waitText("Compiling"); // waits for "Finished" status text stt.waitText("Finished"); // order is not significant => following works as well stt.waitText("Finished"); stt.waitText("Compiling"); // to be order significant, set removedCompared parameter to true stt.waitText("Compiling", true); stt.waitText("Finished", true); // history was removed by above methods => need to produce a new messages new CompileAction().performAPI(); // order is significant if removedCompared parameter is true => // => following fails because Finished is shown as second stt.waitText("Finished", true); stt.waitText("Compiling", true); // stop tracing stt.stop();
Constructor and Description |
---|
StatusTextTracer()
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears status text history array.
|
boolean |
contains(String text,
boolean removeCompared)
Checks whether given text equals to any of messages in the history
array.
|
protected void |
finalize()
Calls
MainWindowOperator.StatusTextTracer.stop() at the end of life cycle of this class. |
ArrayList |
getStatusTextHistory()
Returns list of elements collected from the moment method
MainWindowOperator.StatusTextTracer.start() was called. |
void |
printStatusTextHistory(PrintStream outputPrintStream)
Prints list of elements collected from the moment method
MainWindowOperator.StatusTextTracer.start() was called. |
void |
start()
Starts to register all status messages into history array.
|
void |
stateChanged(ChangeEvent evt)
Called when status text was changed.
|
void |
stop()
Stops registering of status messages.
|
void |
waitText(String text)
Waits for text to be shown in the Main Window status bar not
removing any message from history.
|
void |
waitText(String text,
boolean removeCompared)
Waits for text to be shown in the Main Window status bar.
|
public void start()
public void stop()
public void stateChanged(ChangeEvent evt)
stateChanged
in interface ChangeListener
evt
- change event - not usedpublic void clear()
public boolean contains(String text, boolean removeCompared)
MainWindowOperator.StatusTextTracer.clear()
or MainWindowOperator.StatusTextTracer.start()
are
called.text
- a text to be comparedremoveCompared
- whether to remove already compared messages from
history arraypublic void waitText(String text)
text
- a text to wait forpublic void waitText(String text, boolean removeCompared)
MainWindowOperator.StatusTextTracer.clear()
or MainWindowOperator.StatusTextTracer.start()
are
called and its order is not taken into account.text
- a text to wait forremoveCompared
- whether to remove already compared messages from
history arrayprotected void finalize()
MainWindowOperator.StatusTextTracer.stop()
at the end of life cycle of this class.public ArrayList getStatusTextHistory()
MainWindowOperator.StatusTextTracer.start()
was called. Remember, if removeCompared
parameter is set to true in some of methods,
messages already compared are removed from history array.public void printStatusTextHistory(PrintStream outputPrintStream)
MainWindowOperator.StatusTextTracer.start()
was called. Remember, if removeCompared
parameter is set to true in some of methods,
messages already compared are removed from history array.outputPrintStream
- stream to print output in