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


Java FileEditorManager.getEditors方法代码示例

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


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

示例1: getFileLevelHighlights

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
@Override
@NotNull
@TestOnly
public List<HighlightInfo> getFileLevelHighlights(@NotNull Project project, @NotNull PsiFile file) {
  VirtualFile vFile = file.getViewProvider().getVirtualFile();
  final FileEditorManager manager = FileEditorManager.getInstance(project);
  List<HighlightInfo> result = new ArrayList<HighlightInfo>();
  for (FileEditor fileEditor : manager.getEditors(vFile)) {
    final List<HighlightInfo> infos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS);
    if (infos == null) continue;
    for (HighlightInfo info : infos) {
        result.add(info);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DaemonCodeAnalyzerImpl.java

示例2: cleanFileLevelHighlights

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
@Override
public void cleanFileLevelHighlights(@NotNull Project project, final int group, PsiFile psiFile) {
  if (psiFile == null) return;
  FileViewProvider provider = psiFile.getViewProvider();
  VirtualFile vFile = provider.getVirtualFile();
  final FileEditorManager manager = FileEditorManager.getInstance(project);
  for (FileEditor fileEditor : manager.getEditors(vFile)) {
    final List<HighlightInfo> infos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS);
    if (infos == null) continue;
    List<HighlightInfo> infosToRemove = new ArrayList<HighlightInfo>();
    for (HighlightInfo info : infos) {
      if (info.getGroup() == group) {
        manager.removeTopComponent(fileEditor, info.fileLevelComponent);
        infosToRemove.add(info);
      }
    }
    infos.removeAll(infosToRemove);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DaemonCodeAnalyzerImpl.java

示例3: addFileLevelHighlight

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
@Override
public void addFileLevelHighlight(@NotNull final Project project,
                                  final int group,
                                  @NotNull final HighlightInfo info,
                                  @NotNull final PsiFile psiFile) {
  VirtualFile vFile = psiFile.getViewProvider().getVirtualFile();
  final FileEditorManager manager = FileEditorManager.getInstance(project);
  for (FileEditor fileEditor : manager.getEditors(vFile)) {
    if (fileEditor instanceof TextEditor) {
      FileLevelIntentionComponent component = new FileLevelIntentionComponent(info.getDescription(), info.getSeverity(),
                                                                              info.getGutterIconRenderer(), info.quickFixActionRanges,
                                                                              project, psiFile, ((TextEditor)fileEditor).getEditor());
      manager.addTopComponent(fileEditor, component);
      List<HighlightInfo> fileLevelInfos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS);
      if (fileLevelInfos == null) {
        fileLevelInfos = new ArrayList<HighlightInfo>();
        fileEditor.putUserData(FILE_LEVEL_HIGHLIGHTS, fileLevelInfos);
      }
      info.fileLevelComponent = component;
      info.setGroup(group);
      fileLevelInfos.add(info);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DaemonCodeAnalyzerImpl.java

示例4: fileOpened

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
  if (myCache.getCachedIncomingChanges() == null) {
    requestLoadIncomingChanges();
  }
  else {
    final Pair<CommittedChangeList, Change> pair = myCache.getIncomingChangeList(file);
    if (pair != null) {
      final FileEditor[] fileEditors = source.getEditors(file);
      for(FileEditor editor: fileEditors) {
        initPanel(pair.first, pair.second, editor);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:OutdatedVersionNotifier.java

示例5: activatePsiElementIfOpen

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
private static boolean activatePsiElementIfOpen(@NotNull PsiElement elt, boolean searchForOpen, boolean requestFocus) {
  if (!elt.isValid()) return false;
  elt = elt.getNavigationElement();
  final PsiFile file = elt.getContainingFile();
  if (file == null || !file.isValid()) return false;

  VirtualFile vFile = file.getVirtualFile();
  if (vFile == null) return false;

  if (!EditorHistoryManager.getInstance(elt.getProject()).hasBeenOpen(vFile)) return false;

  final FileEditorManager fem = FileEditorManager.getInstance(elt.getProject());
  if (!fem.isFileOpen(vFile)) {
    fem.openFile(vFile, requestFocus, searchForOpen);
  }

  final TextRange range = elt.getTextRange();
  if (range == null) return false;

  final FileEditor[] editors = fem.getEditors(vFile);
  for (FileEditor editor : editors) {
    if (editor instanceof TextEditor) {
      final Editor text = ((TextEditor)editor).getEditor();
      final int offset = text.getCaretModel().getOffset();

      if (range.containsOffset(offset)) {
        // select the file
        fem.openFile(vFile, requestFocus, searchForOpen);
        return true;
      }
    }
  }

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

示例6: configureConsole

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
public static void configureConsole(@NotNull VirtualFile file, @NotNull FileEditorManager source) {
  MyRunAction runAction = new MyRunAction();
  for (FileEditor fileEditor : source.getEditors(file)) {
    if (!(fileEditor instanceof TextEditor)) continue;
    Editor editor = ((TextEditor)fileEditor).getEditor();
    runAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, editor.getComponent());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RunIdeConsoleAction.java


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