• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.actionSystem.DataProvider的典型用法代码示例。如果您正苦于以下问题:Java DataProvider类的具体用法?Java DataProvider怎么用?Java DataProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataProvider类属于com.intellij.openapi.actionSystem包,在下文中一共展示了DataProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AnalysisScopeRule.java


示例2: DirDiffFrame

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public DirDiffFrame(Project project, DirDiffTableModel model) {
  super(project, "DirDiffDialog");
  setSize(JBUI.size(800, 600));
  setTitle(model.getTitle());
  myPanel = new DirDiffPanel(model, new DirDiffWindow(this));
  Disposer.register(this, myPanel);
  setComponent(myPanel.getPanel());
  if (project != null) {
    setProject(project);
  }
  closeOnEsc();
  DataManager.registerDataProvider(myPanel.getPanel(), new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      if (PlatformDataKeys.HELP_ID.is(dataId)) {
        return "reference.dialogs.diff.folder";
      }
      return null;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DirDiffFrame.java


示例3: DiffPanelBase

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public DiffPanelBase(@Nullable Project project,
                     @NotNull DataProvider provider,
                     @NotNull DiffContext context) {
  super(new BorderLayout());
  myProject = project;
  myDataProvider = provider;
  myContext = context;

  myCardLayout = new CardLayout();
  myContentPanel = new JPanel(myCardLayout);

  myNotificationsPanel = new JPanel();
  myNotificationsPanel.setLayout(new BoxLayout(myNotificationsPanel, BoxLayout.Y_AXIS));

  myNorthPanel = new Wrapper();
  mySouthPanel = new Wrapper();

  add(myContentPanel, BorderLayout.CENTER);
  add(myNorthPanel, BorderLayout.NORTH);
  add(mySouthPanel, BorderLayout.SOUTH);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DiffPanelBase.java


示例4: getData

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
@Override
public final Object getData(String dataId){
  if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
    return getSelectedEditor();
  }
  else if(CommonDataKeys.VIRTUAL_FILE.is(dataId)){
    return myFile.isValid() ? myFile : null;
  }
  else if(CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)){
    return myFile.isValid() ? new VirtualFile[] {myFile} : null;
  }
  else{
    JComponent component = getPreferredFocusedComponent();
    if(component instanceof DataProvider && component != this){
      return ((DataProvider)component).getData(dataId);
    }
    else{
      return null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:EditorComposite.java


示例5: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ContentManagerImpl.java


示例6: showSettingsDialog

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
  ConfigurableGroup[] group = getConfigurableGroups(project, true);

  group = filterEmptyGroups(group);
  final Configurable configurable2Select = id2Select == null ? null : new ConfigurableVisitor.ByID(id2Select).find(group);

  if (Registry.is("ide.new.settings.view")) {
    new SettingsDialog(getProject(project), group, configurable2Select, filter).show();
    return;
  }
  final DialogWrapper dialog = getDialog(project, group, configurable2Select);

  new UiNotifyConnector.Once(dialog.getContentPane(), new Activatable.Adapter() {
    @Override
    public void showNotify() {
      final OptionsEditor editor = (OptionsEditor)((DataProvider)dialog).getData(OptionsEditor.KEY.getName());
      LOG.assertTrue(editor != null);
      editor.select(configurable2Select, filter);
    }
  });
  dialog.show();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ShowSettingsUtilImpl.java


示例7: 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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FileTextRule.java


示例8: XDebuggerFramesList

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public XDebuggerFramesList(@NotNull final Project project) {
  super(project);

  doInit();
  setTransferHandler(DEFAULT_TRANSFER_HANDLER);
  setDataProvider(new DataProvider() {
    @Nullable
    @Override
    public Object getData(@NonNls String dataId) {
      if (mySelectedFrame != null) {
        if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) {
          return getFile(mySelectedFrame);
        }
        else if (CommonDataKeys.PSI_FILE.is(dataId)) {
          VirtualFile file = getFile(mySelectedFrame);
          if (file != null && file.isValid()) {
            return PsiManager.getInstance(myProject).findFile(file);
          }
        }
      }
      return null;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:XDebuggerFramesList.java


示例9: getRevisionNumbers

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
@Nullable
public List<VcsRevisionNumber> getRevisionNumbers(@NotNull DataProvider dataProvider) {
  VcsRevisionNumber revisionNumber = VcsDataKeys.VCS_REVISION_NUMBER.getData(dataProvider);
  if (revisionNumber != null) {
    return Collections.singletonList(revisionNumber);
  }

  ChangeList[] changeLists = VcsDataKeys.CHANGE_LISTS.getData(dataProvider);
  if (changeLists != null && changeLists.length > 0) {
    List<CommittedChangeList> committedChangeLists = ContainerUtil.findAll(changeLists, CommittedChangeList.class);

    if (!committedChangeLists.isEmpty()) {
      ContainerUtil.sort(committedChangeLists, CommittedChangeListByDateComparator.DESCENDING);

      return ContainerUtil.mapNotNull(committedChangeLists, CommittedChangeListToRevisionNumberFunction.INSTANCE);
    }
  }

  VcsFileRevision[] fileRevisions = VcsDataKeys.VCS_FILE_REVISIONS.getData(dataProvider);
  if (fileRevisions != null && fileRevisions.length > 0) {
    return ContainerUtil.mapNotNull(fileRevisions, FileRevisionToRevisionNumberFunction.INSTANCE);
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VcsRevisionNumberArrayRule.java


示例10: getBackgroundColor

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
protected static Color getBackgroundColor(@Nullable Object value) {
  if (value instanceof PsiElement || value instanceof DataProvider) {
    final PsiElement psiElement = value instanceof PsiElement
                                  ? (PsiElement)value
                                  : CommonDataKeys.PSI_ELEMENT.getData((DataProvider) value);
    if (psiElement != null && psiElement.isValid()) {
      final FileColorManager fileColorManager = FileColorManager.getInstance(psiElement.getProject());
      final Color fileColor = fileColorManager.getRendererBackground(psiElement.getContainingFile());
      if (fileColor != null) {
        return fileColor;
      }
    }
  }

  return UIUtil.getListBackground();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NavigationItemListCellRenderer.java


示例11: getData

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
  final Navigatable navigatable = CommonDataKeys.NAVIGATABLE.getData(dataProvider);
  if (navigatable != null && navigatable instanceof OpenFileDescriptor) {
    final OpenFileDescriptor openFileDescriptor = (OpenFileDescriptor)navigatable;

    if (openFileDescriptor.getFile().isValid()) {
      return openFileDescriptor;
    }
  }
  final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataProvider);
  if (element instanceof Navigatable) {
    return element;
  }
  if (element != null) {
    return EditSourceUtil.getDescriptor(element);
  }

  final Object selection = PlatformDataKeys.SELECTED_ITEM.getData(dataProvider);
  if (selection instanceof Navigatable) {
    return selection;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NavigatableRule.java


示例12: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PsiElementFromSelectionsRule.java


示例13: search

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
protected List<PsiElement> search(VirtualFile file) throws IOException {
  final MapDataContext context = createDataContext(file);
  UsageTarget[] targets = UsageTargetUtil.findUsageTargets(new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      return context.getData(dataId);
    }
  });
  PsiElement target = ((PsiElement2UsageTargetAdapter)targets[0]).getElement();
  List<PsiReference> result = new ArrayList<PsiReference>(ReferencesSearch.search(target).findAll());
  return ContainerUtil.map(result, new Function<PsiReference, PsiElement>() {
    @Override
    public PsiElement fun(PsiReference psiReference) {
      return psiReference.getElement();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenDomTestCase.java


示例14: setUp

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  myNestedFormLoader = new MyNestedFormLoader();

  final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);

  java.util.List<URL> cp = new ArrayList<URL>();
  appendPath(cp, JBTabbedPane.class);
  appendPath(cp, TIntObjectHashMap.class);
  appendPath(cp, UIUtil.class);
  appendPath(cp, SystemInfoRt.class);
  appendPath(cp, ApplicationManager.class);
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
  appendPath(cp, GridLayoutManager.class); // forms_rt
  appendPath(cp, DataProvider.class);
  myClassFinder = new MyClassFinder(
    new URL[] {new File(swingPath).toURI().toURL()},
    cp.toArray(new URL[cp.size()])
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AsmCodeGeneratorTest.java


示例15: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:AnalysisScopeRule.java


示例16: getData

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public final Object getData(String dataId){
  if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
    return getSelectedEditor();
  }
  else if(PlatformDataKeys.VIRTUAL_FILE.is(dataId)){
    return myFile.isValid() ? myFile : null;
  }
  else if(PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)){
    return myFile.isValid() ? new VirtualFile[] {myFile} : null;
  }
  else{
    JComponent component = getPreferredFocusedComponent();
    if(component instanceof DataProvider && component != this){
      return ((DataProvider)component).getData(dataId);
    }
    else{
      return null;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:EditorComposite.java


示例17: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ContentManagerImpl.java


示例18: 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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:FileTextRule.java


示例19: RunContentDescriptor

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public RunContentDescriptor(final ExecutionConsole executionConsole,
                            final ProcessHandler processHandler, final JComponent component, final String displayName, final Icon icon) {
  myExecutionConsole = executionConsole;
  myProcessHandler = processHandler;
  myComponent = component;
  myDisplayName = displayName;
  myIcon = icon;
  myHelpId = myExecutionConsole instanceof HelpIdProvider ? ((HelpIdProvider)myExecutionConsole).getHelpId() : null;
  DataManager.registerDataProvider(myComponent, new DataProvider() {

    @Override
    public Object getData(@NonNls final String dataId) {
      if (RunContentManager.RUN_CONTENT_DESCRIPTOR.is(dataId)) {
        return RunContentDescriptor.this;
      }
      return null;
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:RunContentDescriptor.java


示例20: DirDiffFrame

import com.intellij.openapi.actionSystem.DataProvider; //导入依赖的package包/类
public DirDiffFrame(Project project, DirDiffTableModel model) {
  super(project, "DirDiffDialog");
  setSize(new Dimension(800, 600));
  setTitle(model.getTitle());
  myPanel = new DirDiffPanel(model, new DirDiffWindow(this));
  Disposer.register(this, myPanel);
  setComponent(myPanel.getPanel());
  if (project != null) {
    setProject(project);
  }
  closeOnEsc();
  DataManager.registerDataProvider(myPanel.getPanel(), new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      if (PlatformDataKeys.HELP_ID.is(dataId)) {
        return "reference.dialogs.diff.folder";
      }
      return null;
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:DirDiffFrame.java



注:本文中的com.intellij.openapi.actionSystem.DataProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConstructorAccessor类代码示例发布时间:2022-05-21
下一篇:
Java AtmosphereServlet类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap