本文整理汇总了Java中com.intellij.openapi.actionSystem.DataProvider.getData方法的典型用法代码示例。如果您正苦于以下问题:Java DataProvider.getData方法的具体用法?Java DataProvider.getData怎么用?Java DataProvider.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.DataProvider
的用法示例。
在下文中一共展示了DataProvider.getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(final DataProvider dataProvider) {
final Object psiFile = dataProvider.getData(CommonDataKeys.PSI_FILE.getName());
if (psiFile instanceof PsiJavaFile) {
return new JavaAnalysisScope((PsiJavaFile)psiFile);
}
Object psiTarget = dataProvider.getData(CommonDataKeys.PSI_ELEMENT.getName());
if (psiTarget instanceof PsiPackage) {
PsiPackage pack = (PsiPackage)psiTarget;
PsiManager manager = pack.getManager();
if (!manager.isInProject(pack)) return null;
PsiDirectory[] dirs = pack.getDirectories(GlobalSearchScope.projectScope(manager.getProject()));
if (dirs.length == 0) return null;
return new JavaAnalysisScope(pack, (Module)dataProvider.getData(LangDataKeys.MODULE.getName()));
}
return null;
}
示例2: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
@Nullable
public Object getData(@NonNls String dataId) {
if (PlatformDataKeys.CONTENT_MANAGER.is(dataId) || PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.is(dataId) && getContentCount() > 1) {
return ContentManagerImpl.this;
}
for (DataProvider dataProvider : dataProviders) {
Object data = dataProvider.getData(dataId);
if (data != null) {
return data;
}
}
if (myUI instanceof DataProvider) {
return ((DataProvider)myUI).getData(dataId);
}
DataProvider provider = DataManager.getDataProvider(this);
return provider == null ? null : provider.getData(dataId);
}
示例3: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
public Object getData(DataProvider dataProvider) {
final VirtualFile virtualFile = (VirtualFile)dataProvider.getData(CommonDataKeys.VIRTUAL_FILE.getName());
if (virtualFile == null) {
return null;
}
final FileType fileType = virtualFile.getFileType();
if (fileType.isBinary() || fileType.isReadOnly()) {
return null;
}
final Project project = (Project)dataProvider.getData(CommonDataKeys.PROJECT.getName());
if (project == null) {
return null;
}
final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
if (document == null) {
return null;
}
return document.getText();
}
示例4: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
final Object[] objects = (Object[])dataProvider.getData(PlatformDataKeys.SELECTED_ITEMS.getName());
if (objects != null) {
final PsiElement[] elements = new PsiElement[objects.length];
for (int i = 0, objectsLength = objects.length; i < objectsLength; i++) {
Object object = objects[i];
if (!(object instanceof PsiElement)) return null;
if (!((PsiElement)object).isValid()) return null;
elements[i] = (PsiElement)object;
}
return elements;
}
return null;
}
示例5: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(final DataProvider dataProvider) {
final Object psiFile = dataProvider.getData(LangDataKeys.PSI_FILE.getName());
if (psiFile instanceof PsiJavaFile) {
return new JavaAnalysisScope((PsiJavaFile)psiFile);
}
Object psiTarget = dataProvider.getData(LangDataKeys.PSI_ELEMENT.getName());
if (psiTarget instanceof PsiPackage) {
PsiPackage pack = (PsiPackage)psiTarget;
PsiManager manager = pack.getManager();
if (!manager.isInProject(pack)) return null;
PsiDirectory[] dirs = pack.getDirectories(GlobalSearchScope.projectScope(manager.getProject()));
if (dirs.length == 0) return null;
return new JavaAnalysisScope(pack, (Module)dataProvider.getData(LangDataKeys.MODULE.getName()));
}
return null;
}
示例6: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
@Nullable
public Object getData(@NonNls final String dataId) {
if (PlatformDataKeys.CONTENT_MANAGER.is(dataId)) return ContentManagerImpl.this;
if (PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.is(dataId) && getContentCount() > 1) {
return ContentManagerImpl.this;
}
for (DataProvider each : myProviders) {
final Object data = each.getData(dataId);
if (data != null) return data;
}
if (myUI instanceof DataProvider) {
return ((DataProvider)myUI).getData(dataId);
}
return null;
}
示例7: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
public Object getData(DataProvider dataProvider) {
final VirtualFile virtualFile = (VirtualFile)dataProvider.getData(PlatformDataKeys.VIRTUAL_FILE.getName());
if (virtualFile == null) {
return null;
}
final FileType fileType = virtualFile.getFileType();
if (fileType.isBinary() || fileType.isReadOnly()) {
return null;
}
final Project project = (Project)dataProvider.getData(PlatformDataKeys.PROJECT.getName());
if (project == null) {
return null;
}
final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
if (document == null) {
return null;
}
return document.getText();
}
示例8: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(@NonNls String dataId) {
if (SwitchProvider.KEY.getName().equals(dataId)) {
return myContentUI;
}
if (QuickActionProvider.KEY.getName().equals(dataId)) {
return myContentUI;
}
if (RunnerContentUi.KEY.getName().equals(dataId)) {
return myContentUI;
}
final DataProvider provider = DataManager.getDataProvider(this);
return provider != null ? provider.getData(dataId) : null;
}
示例9: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
@Nullable
public Object getData(@Nonnull @NonNls Key<?> dataId) {
if (PlatformDataKeys.CONTENT_MANAGER == dataId || PlatformDataKeys.NONEMPTY_CONTENT_MANAGER == dataId && getContentCount() > 1) {
return DesktopContentManagerImpl.this;
}
for (DataProvider dataProvider : myDataProviders) {
Object data = dataProvider.getData(dataId);
if (data != null) {
return data;
}
}
if (myUI instanceof DataProvider) {
return ((DataProvider)myUI).getData(dataId);
}
DataProvider provider = DataManager.getDataProvider(this);
return provider == null ? null : provider.getData(dataId);
}
示例10: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
public Object getData(@NonNls String dataId) {
if (myEditor instanceof DataProvider) {
DataProvider provider = (DataProvider)myEditor;
return provider.getData(dataId);
}
return null;
}
示例11: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
final Editor editor = (Editor)dataProvider.getData(CommonDataKeys.EDITOR.getName());
if (editor == null || editor.isDisposed()) {
return null;
}
final Boolean aBoolean = editor.getUserData(EditorTextField.SUPPLEMENTARY_KEY);
if (aBoolean != null && aBoolean.booleanValue()) {
return null;
}
return TextEditorProvider.getInstance().getTextEditor(editor);
}
示例12: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
final Object element = dataProvider.getData(PlatformDataKeys.SELECTED_ITEM.getName());
if (element instanceof PsiElement) {
PsiElement psiElement = (PsiElement)element;
if (psiElement.isValid()) {
return element;
}
}
return null;
}
示例13: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
@Nullable
public Object getData(final DataProvider dataProvider) {
UsageInfo usageInfo = (UsageInfo)dataProvider.getData(UsageView.USAGE_INFO_KEY.getName());
if (usageInfo != null) return Collections.singletonList(usageInfo);
return null;
}
示例14: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
final Editor editor = (Editor)dataProvider.getData(PlatformDataKeys.EDITOR.getName());
if (editor == null || editor.isDisposed()) {
return null;
}
final Boolean aBoolean = editor.getUserData(EditorTextField.SUPPLEMENTARY_KEY);
if (aBoolean != null && aBoolean.booleanValue()) {
return null;
}
return TextEditorProvider.getInstance().getTextEditor(editor);
}
示例15: getData
import com.intellij.openapi.actionSystem.DataProvider; //导入方法依赖的package包/类
@Nullable
public Object getData(final DataProvider dataProvider) {
return dataProvider.getData(CommonDataKeys.EDITOR.getName());
}