當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。