當前位置: 首頁>>代碼示例>>Java>>正文


Java DataManager.removeDataProvider方法代碼示例

本文整理匯總了Java中com.intellij.ide.DataManager.removeDataProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java DataManager.removeDataProvider方法的具體用法?Java DataManager.removeDataProvider怎麽用?Java DataManager.removeDataProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.ide.DataManager的用法示例。


在下文中一共展示了DataManager.removeDataProvider方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clearDiffPanel

import com.intellij.ide.DataManager; //導入方法依賴的package包/類
private void clearDiffPanel() {
  if (myDiffPanelComponent != null) {
    myDiffPanel.remove(myDiffPanelComponent);
    myDiffPanelComponent = null;
    if (myCurrentElement != null) {
      myCurrentElement.disposeDiffComponent();
    }
  }
  if (myViewComponent != null) {
    myDiffPanel.remove(myViewComponent);
    myViewComponent = null;
    if (myCurrentElement != null) {
      myCurrentElement.disposeViewComponent();
    }
  }
  myCurrentElement = null;
  myDiffPanel.remove(getErrorLabel());
  DataManager.removeDataProvider(myDiffPanel);
  myDiffPanel.repaint();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:DirDiffPanel.java

示例2: setEditorSource

import com.intellij.ide.DataManager; //導入方法依賴的package包/類
public void setEditorSource(final Project project, final EditorSource source) {
  MyState state = new MyState();
  myEditorSource = source;
  myLineMarker.attach(myEditorSource);
  Editor editor = myEditorSource.getEditor();
  final FileEditor fileEditor = myEditorSource.getFileEditor();
  if (editor == null) {
    insertComponent(fileEditor == null ? MOCK_COMPONENT : fileEditor.getComponent());
    DataManager.registerDataProvider(myPanel, new DataProvider() {
      @Override
      public Object getData(@NonNls String dataId) {
        if (CommonDataKeys.PROJECT.is(dataId)) {return project;}
        if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {return fileEditor;}
        return null;
      }
    });
    if (fileEditor != null) {
      ScrollUtil.scrollVertically(fileEditor.getComponent(), 0);
      ScrollUtil.scrollHorizontally(fileEditor.getComponent(), 0);
      UIUtil.removeScrollBorder(fileEditor.getComponent());
    }
  } else {
    DataManager.removeDataProvider(myPanel);
    editor.getScrollingModel().scrollHorizontally(0);
    insertComponent(editor.getComponent());
    applyHighlighter();
    setMouseListeners(source);
    MyEditorFocusListener.install(this);
    UIUtil.removeScrollBorder(editor.getComponent());

    state.restore();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:DiffSideView.java

示例3: update

import com.intellij.ide.DataManager; //導入方法依賴的package包/類
public void update(boolean force) {
  final Project project = myModel.getProject();
  final DirDiffElementImpl element = myModel.getElementAt(myTable.getSelectedRow());
  if (element == null) {
    clearDiffPanel();
    return;
  }
  if (!force
      && myCurrentElement != null
      && (myCurrentElement == element.getSource() || myCurrentElement == element.getTarget())) {
    return;
  }
  clearDiffPanel();
  if (element.getType() == DiffType.CHANGED) {
    try {
      myDiffPanelComponent = element.getSource().getDiffComponent(element.getTarget(), project, myDiffWindow.getWindow(), myModel);
    }
    catch (FilesTooBigForDiffException e) {
      // todo KB: check
      myDiffPanelComponent = null;
      myErrorLabel = new JLabel("Can not build diff for file " + element.getTarget().getPath() + ". File is too big and there are too many changes.");
    }
    if (myDiffPanelComponent != null) {
      myDiffPanel.add(myDiffPanelComponent, BorderLayout.CENTER);
      myCurrentElement = element.getSource();
    } else {
      myDiffPanel.add(getErrorLabel(), BorderLayout.CENTER);
    }
  } else {
    final DiffElement object;
    final DiffElement target;
    if (element.getType() == DiffType.ERROR) {
      object = element.getSource() == null ? element.getTarget() : element.getSource();
      target = element.getSource() == null ? element.getSource() : element.getTarget();
    } else {
      object = element.isSource() ? element.getSource() : element.getTarget();
      target = element.isSource() ? element.getTarget() : element.getSource();
    }
    myViewComponent = object.getViewComponent(project, target, myModel);

    if (myViewComponent != null) {
      myCurrentElement = object;
      myDiffPanel.add(myViewComponent, BorderLayout.CENTER);
      DataProvider dataProvider = myCurrentElement.getDataProvider(project);
      if (dataProvider != null) {
        DataManager.registerDataProvider(myDiffPanel, dataProvider);
      }
      else {
        DataManager.removeDataProvider(myDiffPanel);
      }
    } else {
      myDiffPanel.add(getErrorLabel(), BorderLayout.CENTER);
    }
  }
  myDiffPanel.revalidate();
  myDiffPanel.repaint();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:58,代碼來源:DirDiffPanel.java


注:本文中的com.intellij.ide.DataManager.removeDataProvider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。