コード例 #1
0
  /**
   * sets the window passed as a current ('focused') window among all splitters. All file openings
   * will be done inside this current window
   *
   * @param window a window to be set as current
   * @param requestFocus whether to request focus to the editor currently selected in this window
   */
  public void setCurrentWindow(@Nullable final EditorWindow window, final boolean requestFocus) {
    final EditorWithProviderComposite newEditor =
        window != null ? window.getSelectedEditor() : null;

    Runnable fireRunnable =
        new Runnable() {
          public void run() {
            getManager().fireSelectionChanged(newEditor);
          }
        };

    setCurrentWindow(window);

    getManager().updateFileName(window == null ? null : window.getSelectedFile());

    if (window != null) {
      final EditorWithProviderComposite selectedEditor = window.getSelectedEditor();
      if (selectedEditor != null) {
        fireRunnable.run();
      }

      if (requestFocus) {
        window.requestFocus(true);
      }
    } else {
      fireRunnable.run();
    }
  }
コード例 #2
0
  @Override
  @SuppressWarnings("SSBasedInspection")
  protected void dispose() {
    LOG.assertTrue(
        EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only");
    for (Runnable runnable : myDisposeActions) {
      runnable.run();
    }
    myDisposeActions.clear();
    final JRootPane root = myDialog.getRootPane();

    Runnable disposer =
        new Runnable() {
          @Override
          public void run() {
            myDialog.dispose();
            myProject = null;

            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    if (myDialog != null && root != null) {
                      myDialog.remove(root);
                    }
                  }
                });
          }
        };

    if (EventQueue.isDispatchThread()) {
      disposer.run();
    } else {
      SwingUtilities.invokeLater(disposer);
    }
  }