Update preview with the current source file when navigating to EditorConfig

GitOrigin-RevId: f68d63aa66ba44c8e9c5f4ba9595e14c9c683137
This commit is contained in:
Rustam Vishnyakov
2019-06-05 11:10:41 +03:00
committed by intellij-monorepo-bot
parent 6d9a6a6bfa
commit 48fd5c0153
@@ -1,10 +1,10 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.editorconfig.configmanagement;
import com.intellij.ide.actions.OpenFileAction;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -47,8 +47,12 @@ public class EditorConfigNavigationActionsFactory {
}
private static void openEditorConfig(@NotNull Project project, @NotNull VirtualFile sourceFile, @NotNull VirtualFile editorConfigFile) {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
if (fileEditorManager.isFileOpen(editorConfigFile)) {
fileEditorManager.closeFile(editorConfigFile);
}
EditorConfigPreviewManager.getInstance(project).associateWithPreviewFile(editorConfigFile, sourceFile);
OpenFileAction.openFile(editorConfigFile, project);
fileEditorManager.openFile(editorConfigFile, true);
}
public void updateEditorConfigFilePaths(@NotNull List<String> editorConfigFilePaths) {