本文整理汇总了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();
}
示例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();
}
}
示例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();
}