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


Java FileEditorManager.setSelectedEditor方法代码示例

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


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

示例1: actionPerformed

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
    final Project project = event.getProject();
    if (project == null) {
        return;
    }
    VirtualFile virtualFile = event.getData(PlatformDataKeys.VIRTUAL_FILE);
    if (virtualFile != null && virtualFile.isValid() && !virtualFile.isDirectory()) {
        DeltaHexVirtualFile deltaHexVirtualFile = new DeltaHexVirtualFile(virtualFile);
        OpenFileDescriptor descriptor = new OpenFileDescriptor(project, deltaHexVirtualFile, 0);
        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
        List<FileEditor> editors = fileEditorManager.openEditor(descriptor, true);
        fileEditorManager.setSelectedEditor(virtualFile, DeltaHexWindowProvider.DELTAHEX_EDITOR_TYPE_ID);
        for (FileEditor fileEditor : editors) {
            if (fileEditor instanceof DeltaHexFileEditor) {
                ((DeltaHexFileEditor) fileEditor).openFile(deltaHexVirtualFile);
            }
        }
    }
}
 
开发者ID:hajdam,项目名称:deltahex-intellij-plugin,代码行数:21,代码来源:OpenAsHexAction.java

示例2: actionPerformed

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
    final Project project = event.getProject();
    if (project == null) {
        return;
    }

    FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(true, false, true, false, false, false);
    VirtualFile virtualFile = FileChooser.chooseFile(chooserDescriptor, project, null);
    if (virtualFile != null && virtualFile.isValid() && !virtualFile.isDirectory()) {
        DeltaHexVirtualFile deltaHexVirtualFile = new DeltaHexVirtualFile(virtualFile);
        OpenFileDescriptor descriptor = new OpenFileDescriptor(project, deltaHexVirtualFile, 0);
        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
        List<FileEditor> editors = fileEditorManager.openEditor(descriptor, true);
        fileEditorManager.setSelectedEditor(virtualFile, DeltaHexWindowProvider.DELTAHEX_EDITOR_TYPE_ID);
        for (FileEditor fileEditor : editors) {
            if (fileEditor instanceof DeltaHexFileEditor) {
                ((DeltaHexFileEditor) fileEditor).openFile(deltaHexVirtualFile);
            }
        }
    }
}
 
开发者ID:hajdam,项目名称:deltahex-intellij-plugin,代码行数:23,代码来源:FileOpenAsHexAction.java

示例3: showNavigationEditor

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
public void showNavigationEditor(@Nullable Project project, @Nullable Module module, final String dir, final String file) {
  if (project == null) {
    return;
  }
  if (module == null) {
    return;
  }
  VirtualFile baseDir = project.getBaseDir();
  if (baseDir == null) { // this happens when we have the 'default' project; can't launch nav editor from here
    return;
  }
  VirtualFile navFile = NavigationEditorUtils.getNavigationFile(baseDir, module.getName(), dir, file);
  OpenFileDescriptor descriptor = new OpenFileDescriptor(project, navFile, 0);
  FileEditorManager manager = FileEditorManager.getInstance(project);
  manager.openEditor(descriptor, true);
  manager.setSelectedEditor(navFile, NavigationEditorProvider.ID);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidShowNavigationEditor.java

示例4: launchEditor

import com.intellij.openapi.fileEditor.FileEditorManager; //导入方法依赖的package包/类
public static void launchEditor(RenderingParameters renderingParameters, @Nullable PsiFile file, boolean layoutFile) {
  if (file != null) {
    Project project = renderingParameters.project;
    VirtualFile virtualFile = file.getVirtualFile();
    OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, 0);
    FileEditorManager manager = FileEditorManager.getInstance(project);
    manager.openEditor(descriptor, true);
    if (layoutFile) {
      manager.setSelectedEditor(virtualFile, AndroidDesignerEditorProvider.ANDROID_DESIGNER_ID);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidRootComponent.java


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