当前位置: 首页>>代码示例>>Java>>正文


Java FileEditorProvider.accept方法代码示例

本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorProvider.accept方法的典型用法代码示例。如果您正苦于以下问题:Java FileEditorProvider.accept方法的具体用法?Java FileEditorProvider.accept怎么用?Java FileEditorProvider.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.fileEditor.FileEditorProvider的用法示例。


在下文中一共展示了FileEditorProvider.accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateEditorText

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
private void updateEditorText() {
  disposeNonTextEditor();

  final PsiElement elt = myElements[myIndex].getNavigationElement();
  Project project = elt.getProject();
  PsiFile psiFile = getContainingFile(elt);
  final VirtualFile vFile = psiFile.getVirtualFile();
  if (vFile == null) return;
  final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile);
  for (FileEditorProvider provider : providers) {
    if (provider instanceof TextEditorProvider) {
      updateTextElement(elt);
      myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
      break;
    }
    else if (provider.accept(project, vFile)) {
      myCurrentNonTextEditorProvider = provider;
      myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
      myBinaryPanel.removeAll();
      myBinaryPanel.add(myNonTextEditor.getComponent());
      myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
      break;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:ImplementationViewComponent.java

示例2: updateEditorText

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
private void updateEditorText() {
  disposeNonTextEditor();

  final PsiElement foundElement = myElements[myIndex];
  final PsiElement elt = foundElement.getNavigationElement();
  LOG.assertTrue(elt != null, foundElement);
  final Project project = foundElement.getProject();
  final PsiFile psiFile = getContainingFile(elt);
  final VirtualFile vFile = psiFile != null ? psiFile.getVirtualFile() : null;
  if (vFile == null) return;
  final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile);
  for (FileEditorProvider provider : providers) {
    if (provider instanceof TextEditorProvider) {
      updateTextElement(elt);
      myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
      break;
    }
    else if (provider.accept(project, vFile)) {
      myCurrentNonTextEditorProvider = provider;
      myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
      myBinaryPanel.removeAll();
      myBinaryPanel.add(myNonTextEditor.getComponent());
      myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
      break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ImplementationViewComponent.java

示例3: getProviders

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
@NotNull
public synchronized FileEditorProvider[] getProviders(@NotNull Project project, @NotNull VirtualFile file){
  // Collect all possible editors
  mySharedProviderList.clear();
  boolean doNotShowTextEditor = false;
  final boolean dumb = DumbService.getInstance(project).isDumb();
  for(int i = myProviders.size() -1 ; i >= 0; i--){
    FileEditorProvider provider=myProviders.get(i);
    if((!dumb || DumbService.isDumbAware(provider)) && provider.accept(project, file)){
      mySharedProviderList.add(provider);
      doNotShowTextEditor |= provider.getPolicy() == FileEditorPolicy.HIDE_DEFAULT_EDITOR;
    }
  }

  // Throw out default editors provider if necessary
  if(doNotShowTextEditor){
    for(int i = mySharedProviderList.size() - 1; i >= 0; i--){
      if(mySharedProviderList.get(i) instanceof TextEditorProvider){
        mySharedProviderList.remove(i);
      }
    }
  }

  // Sort editors according policies
  Collections.sort(mySharedProviderList, MyComparator.ourInstance);

  if(!mySharedProviderList.isEmpty()){
    return mySharedProviderList.toArray(new FileEditorProvider[mySharedProviderList.size()]);
  }
  else{
    return EMPTY_ARRAY;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:FileEditorProviderManagerImpl.java


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