コード例 #1
0
 public void dispose() {
   myDisposed = true;
   myDiffUpdater.dispose();
   Disposer.dispose(myScrollSupport);
   Disposer.dispose(myData);
   myPanel.cancelScrollEditors();
   JComponent component = myPanel.getBottomComponent();
   if (component instanceof Disposable) {
     Disposer.dispose((Disposable) component);
   }
   myPanel.setBottomComponent(null);
   myPanel.setDataProvider(null);
   myPanel.setScrollingPanel(null);
 }
コード例 #2
0
  public void setDiffRequest(DiffRequest data) {
    myDiffRequest = data;
    if (data.getHints().contains(DiffTool.HINT_DO_NOT_IGNORE_WHITESPACES)) {
      setComparisonPolicy(ComparisonPolicy.DEFAULT, false);
    }
    myDataProvider.putData(myDiffRequest.getGenericData());

    DiffContent content1 = data.getContents()[0];
    DiffContent content2 = data.getContents()[1];

    setContents(content1, content2);
    setTitles(data);

    setWindowTitle(myOwnerWindow, data.getWindowTitle());
    myPanel.setToolbarActions(createToolbar());
    data.customizeToolbar(myPanel.resetToolbar());
    myPanel.registerToolbarActions();
    initEditorSettings(getEditor1());
    initEditorSettings(getEditor2());

    final JComponent oldBottomComponent = myPanel.getBottomComponent();
    if (oldBottomComponent instanceof Disposable) {
      Disposer.dispose((Disposable) oldBottomComponent);
    }
    final JComponent newBottomComponent = data.getBottomComponent();
    myPanel.setBottomComponent(newBottomComponent);

    if (myIsRequestFocus) {
      IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
      boolean isEditor1Focused =
          getEditor1() != null && fm.getFocusedDescendantFor(getEditor1().getComponent()) != null;

      boolean isEditor2Focused =
          myData.getContent2() != null
              && getEditor2() != null
              && fm.getFocusedDescendantFor(getEditor2().getComponent()) != null;

      if (isEditor1Focused || isEditor2Focused) {
        Editor e = isEditor2Focused ? getEditor2() : getEditor1();
        if (e != null) {
          fm.requestFocus(e.getContentComponent(), true);
        }
      }

      myPanel.requestScrollEditors();
    }
  }