本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
}