use of com.redhat.devtools.intellij.common.CommonConstants.PROJECT in project intellij-tekton by redhat-developer.
the class VirtualFileHelper method innerOpenVirtualFileInEditor.
public static void innerOpenVirtualFileInEditor(Project project, String namespace, String name, String content, String kind, boolean edit, boolean readOnly, boolean clean) throws IOException {
Optional<FileEditor> editor = Arrays.stream(FileEditorManager.getInstance(project).getAllEditors()).filter(fileEditor -> fileEditor.getFile().getName().startsWith(name)).findFirst();
if (!clean) {
clean = SettingsState.getInstance().displayCleanedYAMLInEditor;
}
if (!editor.isPresent()) {
createAndOpenVirtualFile(project, namespace, name, content, kind, null, readOnly, clean);
} else {
Editor openedEditor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, editor.get().getFile()), true);
if (edit) {
content = cleanContent(content);
openedEditor.getDocument().setText(content);
}
}
}
Aggregations