当前位置: 首页>>代码示例>>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;未经允许,请勿转载。