modal progress already has its own modality state, don't start another one bound to its dialog (IDEA-137750)

This commit is contained in:
peter
2015-04-13 19:23:41 +03:00
parent ecab324ae0
commit b40b00c498
@@ -214,8 +214,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
@Deprecated
public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper,final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) {
this(wrapper, owner, canBeParent,
applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT);
this(wrapper, owner, canBeParent, applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT);
}
@Override
@@ -302,6 +301,10 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
}
}
private boolean isProgressDialog() {
return myWrapper.isModalProgress();
}
@Override
@Nullable
public Container getContentPane() {
@@ -449,7 +452,9 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
ApplicationManager.getApplication() != null ? (CommandProcessorEx)CommandProcessor.getInstance() : null;
final boolean appStarted = commandProcessor != null;
if (myDialog.isModal() && appStarted) {
boolean changeModalityState = appStarted && myDialog.isModal()
&& !isProgressDialog(); // ProgressWindow starts a modality state itself
if (changeModalityState) {
commandProcessor.enterModal();
LaterInvocator.enterModal(myDialog);
}
@@ -462,7 +467,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
myDialog.show();
}
finally {
if (myDialog.isModal() && appStarted) {
if (changeModalityState) {
commandProcessor.leaveModal();
LaterInvocator.leaveModal(myDialog);
}