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


Java FileEditorManagerEx.getSelectedFiles方法代码示例

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


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

示例1: actionPerformed

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的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

示例2: update

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的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

示例3: actionPerformed

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的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

示例4: update

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的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

示例5: actionPerformed

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public void actionPerformed(@Nonnull 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(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:consulo,项目名称:consulo,代码行数:20,代码来源:CloseAllEditorsButActiveAction.java

示例6: update

import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public void update(@Nonnull 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:consulo,项目名称:consulo,代码行数:27,代码来源:CloseAllEditorsButActiveAction.java


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