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

Java TextEditorProvider类代码示例

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

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



TextEditorProvider类属于com.intellij.openapi.fileEditor.impl.text包,在下文中一共展示了TextEditorProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCurrentTaskFilePath

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Nullable
private String getCurrentTaskFilePath() {
  String textFile = null;
  for (Map.Entry<String, TaskFile> entry : myTask.getTaskFiles().entrySet()) {
    String path = getTaskFilePath(entry.getKey());
    if (!entry.getValue().getActivePlaceholders().isEmpty()) {
      return path;
    }
    VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
    if (virtualFile == null) {
      continue;
    }
    if (TextEditorProvider.isTextFile(virtualFile)) {
      textFile = path;
    }
  }
  return textFile;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:PyCCCommandLineState.java


示例2: instantiateAndRun

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@NotNull
public static List<HighlightInfo> instantiateAndRun(@NotNull PsiFile file,
                                                    @NotNull Editor editor,
                                                    @NotNull int[] toIgnore,
                                                    boolean canChangeDocument) {
  Project project = file.getProject();
  ensureIndexesUpToDate(project);
  DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(project);
  TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  ProcessCanceledException exception = null;
  for (int i = 0; i < 1000; i++) {
    try {
      List<HighlightInfo> infos = codeAnalyzer.runPasses(file, editor.getDocument(), textEditor, toIgnore, canChangeDocument, null);
      infos.addAll(DaemonCodeAnalyzerEx.getInstanceEx(project).getFileLevelHighlights(project, file));
      return infos;
    }
    catch (ProcessCanceledException e) {
      PsiDocumentManager.getInstance(project).commitAllDocuments();
      UIUtil.dispatchAllInvocationEvents();
      exception = e;
    }
  }
  // unable to highlight after 100 retries
  throw exception;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CodeInsightTestFixtureImpl.java


示例3: getDocumentReferences

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@NotNull
static Set<DocumentReference> getDocumentReferences(@NotNull FileEditor editor) {
  Set<DocumentReference> result = new THashSet<DocumentReference>();

  if (editor instanceof DocumentReferenceProvider) {
    result.addAll(((DocumentReferenceProvider)editor).getDocumentReferences());
    return result;
  }

  Document[] documents = TextEditorProvider.getDocuments(editor);
  if (documents != null) {
    for (Document each : documents) {
      Document original = getOriginal(each);
      // KirillK : in AnAction.update we may have an editor with an invalid file
      VirtualFile f = FileDocumentManager.getInstance().getFile(each);
      if (f != null && !f.isValid()) continue;
      result.add(DocumentReferenceManager.getInstance().create(original));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:UndoManagerImpl.java


示例4: updateEditorText

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的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


示例5: openFileWithProviders

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Override
@NotNull
public Pair<FileEditor[], FileEditorProvider[]> openFileWithProviders(@NotNull VirtualFile file,
                                                                      boolean focusEditor,
                                                                      boolean searchForSplitter) {
  // for non-text editors. uml, etc
  final FileEditorProvider provider = file.getUserData(FileEditorProvider.KEY);
  if (provider != null && provider.accept(getProject(), file)) {
    return Pair.create(new FileEditor[]{provider.createEditor(getProject(), file)}, new FileEditorProvider[]{provider});
  }

  //text editor
  Editor editor = openTextEditor(new OpenFileDescriptor(myProject, file), focusEditor);
  final FileEditor fileEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  return Pair.create (new FileEditor[] {fileEditor}, new FileEditorProvider[] {getProvider (fileEditor)});
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:TestEditorManagerImpl.java


示例6: instantiateAndRun

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Nonnull
public static List<HighlightInfo> instantiateAndRun(@Nonnull PsiFile file, @Nonnull Editor editor, @Nonnull int[] toIgnore, boolean canChangeDocument) {
  Project project = file.getProject();
  ensureIndexesUpToDate(project);
  DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(project);
  TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  ProcessCanceledException exception = null;
  for (int i = 0; i < 100; i++) {
    try {
      List<HighlightInfo> infos = codeAnalyzer.runPasses(file, editor.getDocument(), Arrays.asList(textEditor), toIgnore, canChangeDocument, null);
      infos.addAll(DaemonCodeAnalyzerEx.getInstanceEx(project).getFileLevelHighlights(project, file));
      return infos;
    }
    catch (ProcessCanceledException e) {
      exception = e;
    }
  }
  // unable to highlight after 100 retries
  throw exception;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:CodeInsightTestFixtureImpl.java


示例7: getDocumentReferences

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Nonnull
static Set<DocumentReference> getDocumentReferences(@Nonnull FileEditor editor) {
  Set<DocumentReference> result = new THashSet<>();

  if (editor instanceof DocumentReferenceProvider) {
    result.addAll(((DocumentReferenceProvider)editor).getDocumentReferences());
    return result;
  }

  Document[] documents = TextEditorProvider.getDocuments(editor);
  if (documents != null) {
    for (Document each : documents) {
      Document original = getOriginal(each);
      // KirillK : in AnAction.update we may have an editor with an invalid file
      VirtualFile f = FileDocumentManager.getInstance().getFile(each);
      if (f != null && !f.isValid()) continue;
      result.add(DocumentReferenceManager.getInstance().create(original));
    }
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:UndoManagerImpl.java


示例8: collectDescriptorsForEditor

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
public static void collectDescriptorsForEditor(@Nonnull Editor editor, @Nonnull List<HighlightInfo.IntentionActionDescriptor> descriptors) {
  Project project = editor.getProject();
  if (project == null) return;
  FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
  if (!(fileEditorManager instanceof FileEditorManagerImpl)) return;
  TextEditor fileEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  List<JComponent> components = ((FileEditorManagerImpl)fileEditorManager).getTopComponents(fileEditor);
  for (JComponent component : components) {
    if (component instanceof IntentionActionProvider) {
      IntentionActionWithOptions action = ((IntentionActionProvider)component).getIntentionAction();
      if (action != null) {
        descriptors.add(new HighlightInfo.IntentionActionDescriptor(action, action.getOptions(), null));
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:EditorNotificationActions.java


示例9: closeFile

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Override
public void closeFile(@Nonnull final VirtualFile file) {
  Editor editor = myVirtualFile2Editor.remove(file);
  if (editor != null){
    TextEditorProvider editorProvider = TextEditorProvider.getInstance();
    editorProvider.disposeEditor(editorProvider.getTextEditor(editor));
    EditorFactory.getInstance().releaseEditor(editor);
  }
  if (Comparing.equal(file, myActiveFile)) {
    myActiveFile = null;
  }

  modifyTabWell(new Runnable() {
    @Override
    public void run() {
      myTestEditorSplitter.closeFile(file);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:TestEditorManagerImpl.java


示例10: switchEditor

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
private void switchEditor() {
  LOG.debug("Switching editor...");
  AppUIUtil.invokeOnEdt(new Runnable() {
    @Override
    public void run() {
      TextEditor textEditor = (TextEditor)TextEditorProvider.getInstance().createEditor(myProject, myVirtualFile);
      textEditor.addPropertyChangeListener(myPropertyChangeListener);
      myEditorPanel.removeAll();
      myEditorPanel.add(textEditor.getComponent(), BorderLayout.CENTER);
      myFileEditor = textEditor;
      showCard(EDITOR_CARD);
      LOG.debug("Editor for downloaded file opened.");
    }
  }, myProject.getDisposed());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RemoteFilePanel.java


示例11: openTextEditor

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Override
@Nullable
public Editor openTextEditor(@NotNull final OpenFileDescriptor descriptor, final boolean focusEditor) {
  final Collection<FileEditor> fileEditors = openEditor(descriptor, focusEditor);
  for (FileEditor fileEditor : fileEditors) {
    if (fileEditor instanceof TextEditor) {
      setSelectedEditor(descriptor.getFile(), TextEditorProvider.getInstance().getEditorTypeId());
      Editor editor = ((TextEditor)fileEditor).getEditor();
      return getOpenedEditor(editor, focusEditor);
    }
  }

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


示例12: getData

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FileEditorRule.java


示例13: updateEditorText

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的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


示例14: closeFile

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Override
public void closeFile(@NotNull VirtualFile file) {
  Editor editor = myVirtualFile2Editor.remove(file);
  if (editor != null){
    TextEditorProvider editorProvider = TextEditorProvider.getInstance();
    editorProvider.disposeEditor(editorProvider.getTextEditor(editor));
    EditorFactory.getInstance().releaseEditor(editor);
  }
  if (Comparing.equal(file, myActiveFile)) {
    myActiveFile = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TestEditorManagerImpl.java


示例15: getAllEditors

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Override
@NotNull
public FileEditor[] getAllEditors() {
  FileEditor[] result = new FileEditor[myVirtualFile2Editor.size()];
  int i = 0;
  for (Map.Entry<VirtualFile, Editor> entry : myVirtualFile2Editor.entrySet()) {
    TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(entry.getValue());
    result[i++] = textEditor;
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TestEditorManagerImpl.java


示例16: doHighlighting

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@NotNull
public List<HighlightInfo> doHighlighting(@NotNull PsiFile file, @NotNull Editor editor) {
  final DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myProject);
  final TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  final List<HighlightInfo> infos = codeAnalyzer.runPasses(file, editor.getDocument(), Lists.newArrayList(textEditor), new int[0], false, null);
  infos.addAll(DaemonCodeAnalyzerEx.getInstanceEx(myProject).getFileLevelHighlights(myProject, file));
  return infos;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:9,代码来源:PantsHighlightingIntegrationTest.java


示例17: instantiateAndRun

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@NotNull
public static List<HighlightInfo> instantiateAndRun(@NotNull PsiFile file,
                                                    @NotNull Editor editor,
                                                    @NotNull int[] toIgnore,
                                                    boolean canChangeDocument) {
  Project project = file.getProject();
  ensureIndexesUpToDate(project);
  DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(project);
  TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor);
  List<HighlightInfo> infos = codeAnalyzer.runPasses(file, editor.getDocument(), textEditor, toIgnore, canChangeDocument, null);
  infos.addAll(DaemonCodeAnalyzerImpl.getFileLevelHighlights(project, file));
  return infos;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:CodeInsightTestFixtureImpl.java


示例18: switchEditor

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
private void switchEditor() {
  LOG.debug("Switching editor...");
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      final TextEditor textEditor = (TextEditor)TextEditorProvider.getInstance().createEditor(myProject, myVirtualFile);
      textEditor.addPropertyChangeListener(RemoteFilePanel.this);
      myEditorPanel.removeAll();
      myEditorPanel.add(textEditor.getComponent(), BorderLayout.CENTER);
      myFileEditor = textEditor;
      showCard(EDITOR_CARD);
      LOG.debug("Editor for downloaded file opened.");
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:RemoteFilePanel.java


示例19: getProviders

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的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


示例20: openTextEditor

import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; //导入依赖的package包/类
@Nullable
public Editor openTextEditor(@NotNull final OpenFileDescriptor descriptor, final boolean focusEditor) {
  final Collection<FileEditor> fileEditors = openEditor(descriptor, focusEditor);
  for (FileEditor fileEditor : fileEditors) {
    if (fileEditor instanceof TextEditor) {
      setSelectedEditor(descriptor.getFile(), TextEditorProvider.getInstance().getEditorTypeId());
      Editor editor = ((TextEditor)fileEditor).getEditor();
      return getOpenedEditor(editor, focusEditor);
    }
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:FileEditorManagerImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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