Search in sources :

Example 1 with DialogWrapperPeerImpl

use of com.intellij.openapi.ui.impl.DialogWrapperPeerImpl 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();
}
Also used : DialogWrapperPeerImpl(com.intellij.openapi.ui.impl.DialogWrapperPeerImpl) FocusTrackback(com.intellij.ui.FocusTrackback) FocusTrackbackProvider(com.intellij.openapi.ui.impl.FocusTrackbackProvider)

Aggregations

DialogWrapperPeerImpl (com.intellij.openapi.ui.impl.DialogWrapperPeerImpl)1 FocusTrackbackProvider (com.intellij.openapi.ui.impl.FocusTrackbackProvider)1 FocusTrackback (com.intellij.ui.FocusTrackback)1