use of com.intellij.openapi.ui.impl.FocusTrackbackProvider in project intellij-community by JetBrains.
the class ProgressDialog method show.
void show() {
myWasShown = true;
if (ApplicationManager.getApplication().isHeadlessEnvironment())
return;
if (myParentWindow == null)
return;
if (myPopup != null) {
myPopup.close(DialogWrapper.CANCEL_EXIT_CODE);
}
myPopup = myParentWindow.isShowing() ? new MyDialogWrapper(myParentWindow, myProgressWindow.myShouldShowCancel) : new MyDialogWrapper(myProgressWindow.myProject, myProgressWindow.myShouldShowCancel);
myPopup.setUndecorated(true);
if (SystemInfo.isAppleJvm) {
// With Apple JDK we look for MacMessage parent by the window title.
// Let's set just the title as the window title for simplicity.
myPopup.setTitle(myProgressWindow.getTitle());
}
if (myPopup.getPeer() instanceof DialogWrapperPeerImpl) {
((DialogWrapperPeerImpl) myPopup.getPeer()).setAutoRequestFocus(false);
if (isWriteActionProgress()) {
// display the dialog and continue with EDT execution, don't block it forever
myPopup.setModal(false);
}
}
myPopup.pack();
SwingUtilities.invokeLater(() -> {
if (myPopup != null) {
if (myPopup.getPeer() instanceof FocusTrackbackProvider) {
final FocusTrackback focusTrackback = ((FocusTrackbackProvider) myPopup.getPeer()).getFocusTrackback();
if (focusTrackback != null) {
focusTrackback.consume();
}
}
myProgressWindow.getFocusManager().requestFocusInProject(myCancelButton, myProgressWindow.myProject).doWhenDone(myRepaintRunnable);
}
});
myPopup.show();
}
Aggregations