fix enterModality/exitModality

This commit is contained in:
Eugene Vigdorchik
2006-09-26 19:50:29 +04:00
parent 930b1f638a
commit c177b16e8f
@@ -47,24 +47,30 @@ public class ProgressIndicatorBase implements ProgressIndicator {
enterModality();
}
protected final synchronized void enterModality() {
if (myModalityProgress == this && !myModalityEntered){
myModalityEntered = true;
protected final void enterModality() {
if (myModalityProgress == this){
if (!EventQueue.isDispatchThread()){
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
LaterInvocator.enterModal(ProgressIndicatorBase.this);
doEnterModality();
}
}
);
}
else{
LaterInvocator.enterModal(this);
doEnterModality();
}
}
}
private void doEnterModality() {
if (!myModalityEntered) {
LaterInvocator.enterModal(this);
myModalityEntered = true;
}
}
public void stop(){
LOG.assertTrue(myRunning, "stop() should be called only if start() called before");
myRunning = false;
@@ -72,24 +78,30 @@ public class ProgressIndicatorBase implements ProgressIndicator {
exitModality();
}
protected final synchronized void exitModality() {
if (myModalityProgress == this && myModalityEntered){
myModalityEntered = false;
protected final void exitModality() {
if (myModalityProgress == this){
if (!EventQueue.isDispatchThread()){
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
LaterInvocator.leaveModal(ProgressIndicatorBase.this);
doExitModality();
}
}
);
}
else{
LaterInvocator.leaveModal(this);
doExitModality();
}
}
}
private void doExitModality() {
if (myModalityEntered) {
LaterInvocator.leaveModal(this);
myModalityEntered = false;
}
}
public boolean isRunning() {
return myRunning;
}