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

Java EditorWindow类代码示例

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

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



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

示例1: selectionChanged

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent fileEditorManagerEvent) {
    final Project project = fileEditorManagerEvent.getManager().getProject();
    final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
    final FileColorManager fileColorManager = FileColorManager.getInstance(project);
    final HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);

    final VirtualFile oldFile = fileEditorManagerEvent.getOldFile();
    final VirtualFile newFile = fileEditorManagerEvent.getNewFile();

    for (EditorWindow editorWindow : manager.getWindows()) {
        setUnfocusedTabWithColorManagerDefaultColor(fileColorManager, oldFile, editorWindow);

        setFocusedTabHighlighterColor(highlighterSettingsConfig, newFile, editorWindow);
    }
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:17,代码来源:TabHighlighterFileEditorListener.java


示例2: getEditorTabColor

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


示例3: RequestFocusInEditorComponentCmd

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


示例4: openFiles

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
private void openFiles(final Project project, final List<File> fileList, EditorWindow editorWindow) {
  if (editorWindow == null && myEditor != null) {
    editorWindow = findEditorWindow(project);
  }
  final LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  for (File file : fileList) {
    final VirtualFile vFile = fileSystem.refreshAndFindFileByIoFile(file);
    final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
    if (vFile != null) {
      if (editorWindow != null) {
        fileEditorManager.openFileWithProviders(vFile, true, editorWindow);
      }
      else {
        new OpenFileDescriptor(project, vFile).navigate(true);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FileDropHandler.java


示例5: findEditorWindow

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


示例6: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  DataContext dataContext = event.getDataContext();
  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  presentation.setEnabled(false);
  if (project == null) {
    return;
  }
  final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  if (windowManager.isEditorComponentActive()) {
    final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
    EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext);
    if (currentWindow == null){
      editorManager.getCurrentWindow ();
    }
    if (currentWindow != null) {
      final VirtualFile[] files = currentWindow.getFiles();
      presentation.setEnabled(files.length > 1);
    }
    return;
  }

  ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
  presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TabNavigationActionBase.java


示例7: isActionEnabled

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


示例8: actionPerformed

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  FileEditorManagerEx fileEditorManager=FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
  if (window != null){
    window.closeAllExcept(e.getData(CommonDataKeys.VIRTUAL_FILE));
    return;
  }
  selectedFile = fileEditorManager.getSelectedFiles()[0];
  final VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  for (final VirtualFile sibling : siblings) {
    if (!Comparing.equal(selectedFile, sibling)) {
      fileEditorManager.closeFile(sibling);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CloseAllEditorsButActiveAction.java


示例9: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
  if (window != null){
    presentation.setEnabled(window.getFiles().length > 1);
    return;
  } else {
    if (fileEditorManager.getSelectedFiles().length == 0) {
      presentation.setEnabled(false);
      return;
    }
    selectedFile = fileEditorManager.getSelectedFiles()[0];
  }
  VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  presentation.setEnabled(siblings.length > 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CloseAllEditorsButActiveAction.java


示例10: actionPerformed

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);

  FileEditorManagerEx editorManager = getEditorManager(project);
  EditorWindow window = e.getData(EditorWindow.DATA_KEY);
  VirtualFile file = null;
  if (window == null) {
    window = editorManager.getActiveWindow().getResult();
    if (window != null) {
      file = window.getSelectedFile();
    }
  }
  else {
    file = e.getData(CommonDataKeys.VIRTUAL_FILE);
  }
  if (file != null) {
    editorManager.closeFile(file, window);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CloseEditorAction.java


示例11: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
@Override
public void update(final AnActionEvent event){
  final Presentation presentation = event.getPresentation();
  final Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  if (ActionPlaces.EDITOR_POPUP.equals(event.getPlace()) || ActionPlaces.EDITOR_TAB_POPUP.equals(event.getPlace())) {
    presentation.setText(IdeBundle.message("action.close"));
  }
  EditorWindow window = event.getData(EditorWindow.DATA_KEY);
  if (window == null) {
    window = getEditorManager(project).getActiveWindow().getResult();
  }
  presentation.setEnabled(window != null && window.getTabCount() > 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CloseEditorAction.java


示例12: actionPerformed

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(
    project, new Runnable(){
      public void run() {
        final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
        if (window != null){
          final VirtualFile[] files = window.getFiles();
          for (final VirtualFile file : files) {
            window.closeFile(file);
          }
          return;
        }
        FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
        VirtualFile selectedFile = fileEditorManager.getSelectedFiles()[0];
        VirtualFile[] openFiles = fileEditorManager.getSiblings(selectedFile);
        for (final VirtualFile openFile : openFiles) {
          fileEditorManager.closeFile(openFile);
        }
      }
    }, IdeBundle.message("command.close.all.editors"), null
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CloseAllEditorsAction.java


示例13: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  final EditorWindow editorWindow = event.getData(EditorWindow.DATA_KEY);
  if (editorWindow != null && editorWindow.inSplitter()) {
    presentation.setText(IdeBundle.message("action.close.all.editors.in.tab.group"));
  }
  else {
    presentation.setText(IdeBundle.message("action.close.all.editors"));
  }
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  presentation.setEnabled(FileEditorManager.getInstance(project).getSelectedFiles().length > 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CloseAllEditorsAction.java


示例14: isSelected

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
@Override
public boolean isSelected(AnActionEvent e) {
  DataContext context = e.getDataContext();
  VirtualFile file = getFile(context);
  if(file != null){
    // 1. Check editor
    EditorWindow editorWindow = getEditorWindow(context);
    if (editorWindow != null) {
      if (!editorWindow.isFileOpen(file)) {
        file = editorWindow.getSelectedFile();
        if (file == null) return false;
      }

      return editorWindow.isFilePinned(file);
    }
  }
  // 2. Check content
  final Content content = getContent(context);
  if(content != null){
    return content.isPinned();
  }
  else{
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PinActiveTabAction.java


示例15: setOpenOrClosedIcon

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
/**
 * Try to mimic the "open or closed"  folder feature
 */
private void setOpenOrClosedIcon(final PresentationData data, final VirtualFile file, final Project project) {
  if (!file.isDirectory()) {
    return;
  }

  final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
  for (final EditorWindow editorWindow : manager.getWindows()) {
    final VirtualFile[] files = editorWindow.getFiles();
    for (final VirtualFile leaf : files) {
      if (leaf.getPath().contains(file.getPath())) {
        setDirectoryIcon(data, file, project);
        colorOpenDirectories(data);
      }
    }
  }
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:20,代码来源:MTProjectViewNodeDecorator.java


示例16: RequestFocusInEditorComponentCmd

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


示例17: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  DataContext dataContext = event.getDataContext();
  Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  presentation.setEnabled(false);
  if (project == null) {
    return;
  }
  final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  if (windowManager.isEditorComponentActive()) {
    final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
    EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext);
    if (currentWindow == null){
      editorManager.getCurrentWindow ();
    }
    if (currentWindow != null) {
      final VirtualFile[] files = currentWindow.getFiles();
      presentation.setEnabled(files.length > 1);
    }
    return;
  }

  ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
  presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:TabNavigationActionBase.java


示例18: isActionEnabled

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的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>();
  for (Pair<EditorComposite, EditorWindow> pair : filesToClose) {
    final EditorWindow window = pair.second;
    if (!checked.contains(window)) {
      checked.add(window);
      if (hasPinned(window)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:CloseAllUnpinnedEditorsAction.java


示例19: actionPerformed

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  Project project = e.getData(PlatformDataKeys.PROJECT);
  FileEditorManagerEx fileEditorManager=FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
  if (window != null){
    window.closeAllExcept(e.getData(PlatformDataKeys.VIRTUAL_FILE));
    return;
  }
  selectedFile = fileEditorManager.getSelectedFiles()[0];
  final VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  for (final VirtualFile sibling : siblings) {
    if (!Comparing.equal(selectedFile, sibling)) {
      fileEditorManager.closeFile(sibling);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:CloseAllEditorsButActiveAction.java


示例20: update

import com.intellij.openapi.fileEditor.impl.EditorWindow; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Project project = event.getData(PlatformDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
  if (window != null){
    presentation.setEnabled(window.getFiles().length > 1);
    return;
  } else {
    if (fileEditorManager.getSelectedFiles().length == 0) {
      presentation.setEnabled(false);
      return;
    }
    selectedFile = fileEditorManager.getSelectedFiles()[0];
  }
  VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  presentation.setEnabled(siblings.length > 1);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:CloseAllEditorsButActiveAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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