Java 类com.intellij.openapi.ui.impl.DialogWrapperPeerImpl 实例源码

项目:intellij-ce-playground    文件:ProgressDialog.java   
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);
  }
  myPopup.pack();

  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      if (myPopup != null) {
        if (myPopup.getPeer() instanceof FocusTrackbackProvider) {
          final FocusTrackback focusTrackback = ((FocusTrackbackProvider)myPopup.getPeer()).getFocusTrackback();
          if (focusTrackback != null) {
            focusTrackback.consume();
          }
        }

        myProgressWindow.getFocusManager().requestFocus(myCancelButton, true).doWhenDone(myRepaintRunnable);
      }
    }
  });

  myPopup.show();
}
项目:consulo    文件:ProgressDialog.java   
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 (myPopup.getPeer() instanceof DialogWrapperPeerImpl) {
    ((DialogWrapperPeerImpl)myPopup.getPeer()).setAutoRequestFocus(false);
    if (isWriteActionProgress()) {
      myPopup.setModal(false); // display the dialog and continue with EDT execution, don't block it forever
    }
  }
  myPopup.pack();

  SwingUtilities.invokeLater(() -> {
    if (myPopup != null) {
      myProgressWindow.getFocusManager().requestFocusInProject(myCancelButton, myProgressWindow.myProject).doWhenDone(myRepaintRunnable);
    }
  });

  Disposer.register(myPopup.getDisposable(), () -> myProgressWindow.exitModality());

  myPopup.show();
}
项目:consulo    文件:TipDialog.java   
public TipDialog(){
  super(true);
  setModal(false);
  setTitle(IdeBundle.message("title.tip.of.the.day"));
  setCancelButtonText(CommonBundle.getCloseButtonText());
  myTipPanel = new TipPanel();
  myTipPanel.nextTip();
  setHorizontalStretch(1.33f);
  setVerticalStretch(1.25f);
  init();
  if (getPeer() instanceof DialogWrapperPeerImpl) {
    ((DialogWrapperPeerImpl)getPeer()).setAutoRequestFocus(false);
  }
}