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

Java EditorWithProviderComposite类代码示例

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

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



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

示例1: getEditorTabColor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
@Nullable
@Override
public Color getEditorTabColor(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    final FileEditorManagerEx fileEditorManagerEx = FileEditorManagerEx.getInstanceEx(project);
    FileColorManager fileColorManager = FileColorManager.getInstance(project);
    HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);

    EditorWindow activeWindow = fileEditorManagerEx.getCurrentWindow();
    if (activeWindow != null) {
        final EditorWithProviderComposite selectedEditor = activeWindow.getSelectedEditor();

        if (selectedEditor != null && selectedEditor.getFile() != null && selectedEditor.getFile().equals(virtualFile)) {
            return highlighterSettingsConfig.buildHighlightColor();
        }
    }

    return fileColorManager.getFileColor(virtualFile);
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:19,代码来源:CustomEditorTabColorProvider.java


示例2: RequestFocusInEditorComponentCmd

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
public RequestFocusInEditorComponentCmd(@NotNull final EditorsSplitters splitters, IdeFocusManager
                                        focusManager, final Runnable finishCallBack, boolean forced){
  super(finishCallBack);

  boolean shouldLogFocuses = Registry.is("ide.log.focuses");
  if (shouldLogFocuses) {
    LOG.info(new Exception());
  }
  myComponent = null;
  final EditorWindow window = splitters.getCurrentWindow();
  if (window != null) {
    final EditorWithProviderComposite editor = window.getSelectedEditor();
    if (editor != null) {
      myComponent = editor.getPreferredFocusedComponent();
    }
  }

  myForced = forced;
  myFocusManager = focusManager;

  myDoneCallback = new ActionCallback();

  myTimestamp = myFocusManager.getTimestamp(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RequestFocusInEditorComponentCmd.java


示例3: getCurrentFileEditor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
/**
 * Finds the current file editor.
 */
@Nullable
public static FileEditor getCurrentFileEditor(@NotNull Project project, @Nullable StatusBar statusBar) {
  if (statusBar == null) {
    return null;
  }

  DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
  EditorsSplitters splitters = null;
  if (c instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)c).getSplitters();
  }

  if (splitters != null && splitters.getCurrentWindow() != null) {
    EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
    if (editor != null) {
      return editor.getSelectedEditorWithProvider().getFirst();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:StatusBarUtil.java


示例4: findEditorWindow

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
@Nullable
private EditorWindow findEditorWindow(Project project) {
  final Document document = myEditor.getDocument();
  final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file != null) {
    final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
    final EditorWindow[] windows = fileEditorManager.getWindows();
    for (EditorWindow window : windows) {
      final EditorWithProviderComposite composite = window.findFileComposite(file);
      if (composite == null) {
        continue;
      }
      for (FileEditor editor : composite.getEditors()) {
        if (editor instanceof TextEditor && ((TextEditor)editor).getEditor() == myEditor) {
          return window;
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FileDropHandler.java


示例5: isActionEnabled

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
@Override
protected boolean isActionEnabled(final Project project, final AnActionEvent event) {
  final ArrayList<Pair<EditorComposite,EditorWindow>> filesToClose = getFilesToClose(event);
  if (filesToClose.isEmpty()) return false;
  Set<EditorWindow> checked = new HashSet<EditorWindow>();
  boolean hasPinned = false;
  boolean hasUnpinned = false;
  for (Pair<EditorComposite, EditorWindow> pair : filesToClose) {
    final EditorWindow window = pair.second;
    if (checked.add(window)) {
      for (EditorWithProviderComposite e : window.getEditors()) {
        if (e.isPinned()) {
          hasPinned = true;
        }
        else {
          hasUnpinned = true;
        }
      }
      if (/*hasPinned && */hasUnpinned) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CloseAllUnpinnedEditorsAction.java


示例6: RequestFocusInEditorComponentCmd

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
public RequestFocusInEditorComponentCmd(@NotNull final EditorsSplitters splitters, IdeFocusManager
                                        focusManager, final Runnable finishCallBack, boolean forced){
  super(finishCallBack);

  myComponent = null;
  final EditorWindow window = splitters.getCurrentWindow();
  if (window != null) {
    final EditorWithProviderComposite editor = window.getSelectedEditor();
    if (editor != null) {
      myComponent = editor.getPreferredFocusedComponent();
    }
  }

  myForced = forced;
  myFocusManager = focusManager;

  myDoneCallback = new ActionCallback();

  myTimestamp = myFocusManager.getTimestamp(true);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:RequestFocusInEditorComponentCmd.java


示例7: RequestFocusInEditorComponentCmd

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
public RequestFocusInEditorComponentCmd(@Nonnull final EditorSplitters splitters, IdeFocusManager
        focusManager, final Runnable finishCallBack, boolean forced){
  super(finishCallBack);

  boolean shouldLogFocuses = Registry.is("ide.log.focuses");
  if (shouldLogFocuses) {
    LOG.info(new Exception());
  }
  myComponent = null;
  final EditorWindow window = splitters.getCurrentWindow();
  if (window != null) {
    final EditorWithProviderComposite editor = window.getSelectedEditor();
    if (editor != null) {
      myComponent = editor.getPreferredFocusedComponent();
    }
  }

  myForced = forced;
  myFocusManager = focusManager;

  myDoneCallback = new ActionCallback();

}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:RequestFocusInEditorComponentCmd.java


示例8: getCurrentFileEditor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
/**
 * Finds the current file editor.
 */
@Nullable
public static FileEditor getCurrentFileEditor(@Nonnull Project project, @Nullable StatusBar statusBar) {
  if (statusBar == null) {
    return null;
  }

  DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
  DesktopEditorsSplitters splitters = null;
  if (c instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)c).getSplitters();
  }

  if (splitters != null && splitters.getCurrentWindow() != null) {
    EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
    if (editor != null) {
      return editor.getSelectedEditorWithProvider().getFirst();
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:StatusBarUtil.java


示例9: focusDefaultElementInSelectedEditor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private void focusDefaultElementInSelectedEditor() {
  JComponent defaultFocusedComponentInEditor = null;
  EditorSplitters splittersToFocus = getSplittersToFocus();
  if (splittersToFocus != null) {
    final EditorWindow window = splittersToFocus.getCurrentWindow();
    if (window != null) {
      final EditorWithProviderComposite editor = window.getSelectedEditor();
      if (editor != null) {
        defaultFocusedComponentInEditor = editor.getPreferredFocusedComponent();
        if (defaultFocusedComponentInEditor != null) {
          defaultFocusedComponentInEditor.requestFocus();
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:DesktopToolWindowManagerImpl.java


示例10: setTabColor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private void setTabColor(Color color, @NotNull VirtualFile file, @NotNull EditorWindow editorWindow) {
    final EditorWithProviderComposite fileComposite = editorWindow.findFileComposite(file);

    final int index = getEditorIndex(editorWindow, fileComposite);
    if (index >= 0) {
        if (editorWindow.getTabbedPane() != null) { //Distraction free mode // Presentation mode
            editorWindow.getTabbedPane().getTabs().getTabAt(index).setTabColor(color);
        }
    }
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:11,代码来源:TabHighlighterFileEditorListener.java


示例11: getEditorIndex

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private int getEditorIndex(@NotNull EditorWindow editorWindow, EditorWithProviderComposite fileComposite) {
    int index = -1;
    for (EditorWithProviderComposite editorWithProviderComposite : editorWindow.getEditors()) {
        index++;
        if (editorWithProviderComposite.equals(fileComposite)) {
            break;
        }
    }

    return index;
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:12,代码来源:TabHighlighterFileEditorListener.java


示例12: assertOpenFiles

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private void assertOpenFiles(String... fileNames) {
  EditorWithProviderComposite[] files = myManager.getSplitters().getEditorsComposites();
  List<String> names = ContainerUtil.map(files, new Function<EditorWithProviderComposite, String>() {
    @Override
    public String fun(EditorWithProviderComposite composite) {
      return composite.getFile().getName();
    }
  });
  assertEquals(Arrays.asList(fileNames), names);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FileEditorManagerTest.java


示例13: closeEditor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private void closeEditor() {
  boolean unsplit = false;
  if (mySplittedWindow != null && !mySplittedWindow.isDisposed()) {
    final EditorWithProviderComposite[] editors = mySplittedWindow.getEditors();
    if (editors.length == 1 && Comparing.equal(editors[0].getFile(), myNewVirtualFile)) {
      unsplit = true;
    }
  }
  FileEditorManager.getInstance(myProject).closeFile(myNewVirtualFile);
  if (unsplit) {
    for (EditorWindow editorWindow : mySplittedWindow.findSiblings()) {
      editorWindow.unsplit(true);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:QuickEditHandler.java


示例14: setTabColor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
/**
 * Set current tab's background and foreground color
 * <p>
 * TODO file status color
 *
 * @param bgColor      the background color
 * @param file         the file
 * @param editorWindow the editor window
 * @param status       the file status
 */
private void setTabColor(final Color bgColor,
                         @NotNull final VirtualFile file,
                         @NotNull final EditorWindow editorWindow,
                         final FileStatus status) {
  final EditorWithProviderComposite fileComposite = editorWindow.findFileComposite(file);

  // Find the tab of the selected file
  final int editorIndex = getEditorIndex(editorWindow, fileComposite);

  if (editorIndex >= 0) {
    final EditorTabbedContainer tabbedPane = editorWindow.getTabbedPane();

    if (tabbedPane != null) {
      tabbedPane.getTabs()
                .getPresentation()
                .setActiveTabFillIn(bgColor);

      //        try {
      //          if (statusColor != null) {
      //            tabbedPane.getTabs()
      //                .getTabAt(editorIndex)
      //                .setDefaultForeground(statusColor);
      //          }
      //        }
      //        catch (IndexOutOfBoundsException ignored) {
      //
      //        }
    }
  }
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:41,代码来源:MTTabsEditorAdapter.java


示例15: getEditorIndex

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
/**
 * Get index of given fileComposite
 *
 * @param editorWindow  the editor window
 * @param fileComposite the edited file
 * @return
 */
private int getEditorIndex(@NotNull final EditorWindow editorWindow, final EditorWithProviderComposite fileComposite) {
  int index = 0;
  for (final EditorWithProviderComposite editorWithProviderComposite : editorWindow.getEditors()) {
    if (editorWithProviderComposite.equals(fileComposite)) {
      break;
    }
    index++;
  }

  return index;
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:19,代码来源:MTTabsEditorAdapter.java


示例16: hasPinned

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private static boolean hasPinned(final EditorWindow window) {
  for (EditorWithProviderComposite e : window.getEditors()) {
    if (e.isPinned()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:CloseAllUnpinnedEditorsAction.java


示例17: closeEditor

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
private void closeEditor() {
  boolean unsplit = false;
  if (mySplittedWindow != null && !mySplittedWindow.isDisposed()) {
    final EditorWithProviderComposite[] editors = mySplittedWindow.getEditors();
    if (editors.length == 1 && Comparing.equal(editors[0].getFile(), myNewVirtualFile)) {
      unsplit = true;
    }
  }
  FileEditorManager.getInstance(myProject).closeFile(myNewVirtualFile);
  if (unsplit) {
    for (consulo.fileEditor.impl.EditorWindow editorWindow : mySplittedWindow.findSiblings()) {
      editorWindow.unsplit(true);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:QuickEditHandler.java


示例18: getFileToSwapTo

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
@Override
public Pair<VirtualFile, Integer> getFileToSwapTo(Project project, EditorWithProviderComposite editor) {
  VirtualFile file = editor.getFile();
  VirtualFile sourceFile = findSourceFile(project, file);
  if (sourceFile == null) return null;

  Integer position = null;

  TextEditorImpl oldEditor = findSinglePsiAwareEditor(editor.getEditors());
  if (oldEditor != null) {
    PsiCompiledFile clsFile = (PsiCompiledFile)PsiManager.getInstance(project).findFile(file);
    assert clsFile != null;

    int offset = oldEditor.getEditor().getCaretModel().getOffset();

    PsiElement elementAt = clsFile.findElementAt(offset);
    PsiMember member = PsiTreeUtil.getParentOfType(elementAt, PsiMember.class, false);

    if (member instanceof PsiClass) {
      boolean isFirstMember = true;

      for (PsiElement e = member.getFirstChild(); e != null; e = e.getNextSibling()) {
        if (e instanceof PsiMember) {
          if (offset < e.getTextRange().getEndOffset()) {
            if (!isFirstMember) {
              member = (PsiMember)e;
            }

            break;
          }

          isFirstMember = false;
        }
      }
    }

    if (member != null) {
      PsiElement navigationElement = member.getNavigationElement();
      if (Comparing.equal(navigationElement.getContainingFile().getVirtualFile(), sourceFile)) {
        position = navigationElement.getTextOffset();
      }
    }
  }

  return Pair.create(sourceFile, position);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:JavaEditorFileSwapper.java


示例19: getFileToSwapTo

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
public Pair<VirtualFile, Integer> getFileToSwapTo(Project project, EditorWithProviderComposite editorWithProviderComposite) {
  VirtualFile file = editorWithProviderComposite.getFile();
  VirtualFile sourceFile = findSourceFile(project, file);
  if (sourceFile == null) return null;

  Integer position = null;

  TextEditorImpl oldEditor = findSinglePsiAwareEditor(editorWithProviderComposite.getEditors());
  if (oldEditor != null) {
    PsiCompiledFile clsFile = (PsiCompiledFile)PsiManager.getInstance(project).findFile(file);
    assert clsFile != null;

    int offset = oldEditor.getEditor().getCaretModel().getOffset();

    PsiElement elementAt = clsFile.findElementAt(offset);
    PsiMember member = PsiTreeUtil.getParentOfType(elementAt, PsiMember.class, false);

    if (member instanceof PsiClass) {
      boolean isFirstMember = true;

      for (PsiElement e = member.getFirstChild(); e != null; e = e.getNextSibling()) {
        if (e instanceof PsiMember) {
          if (offset < e.getTextRange().getEndOffset()) {
            if (!isFirstMember) {
              member = (PsiMember)e;
            }

            break;
          }

          isFirstMember = false;
        }
      }
    }

    if (member != null) {
      PsiElement navigationElement = member.getNavigationElement();
      if (Comparing.equal(navigationElement.getContainingFile().getVirtualFile(), sourceFile)) {
        position = navigationElement.getTextOffset();
      }
    }
  }

  return Pair.create(sourceFile, position);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:46,代码来源:JavaEditorFileSwapper.java


示例20: actionPerformed

import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite; //导入依赖的package包/类
public void actionPerformed(AnActionEvent event) {
    final Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
    final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
    final EditorWindow activeWindowPane = EditorWindow.DATA_KEY.getData(event.getDataContext());

    if (activeWindowPane == null) return; // Action invoked when no files are open; do nothing

    final EditorWindow nextWindowPane = fileEditorManager.getNextWindow(activeWindowPane);

    if (nextWindowPane == activeWindowPane) return; // Action invoked with one pane open; do nothing

    final EditorWithProviderComposite activeEditorTab = activeWindowPane.getSelectedEditor();
    final VirtualFile activeFile = activeEditorTab.getFile();

    nextWindowPane.getManager().openFileImpl2(nextWindowPane, activeFile, true);

    activeWindowPane.closeFile(activeFile, true, false);
}
 
开发者ID:jacksingleton,项目名称:tab-to-next-splitter,代码行数:19,代码来源:TabToNextSplitter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java JavaSysMon类代码示例发布时间:2022-05-23
下一篇:
Java LayoutStyle类代码示例发布时间: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