mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CVS: handle cvs console creation and disposal in one place
This commit is contained in:
+2
-25
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,10 +24,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.cvsIntegration.CvsResult;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -230,19 +226,6 @@ public class CvsOperationExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull private static Editor createView(Project project) {
|
||||
EditorFactory editorFactory = EditorFactory.getInstance();
|
||||
Document document = editorFactory.createDocument("");
|
||||
Editor result = editorFactory.createViewer(document, project);
|
||||
|
||||
EditorSettings editorSettings = result.getSettings();
|
||||
editorSettings.setLineMarkerAreaShown(false);
|
||||
editorSettings.setLineNumbersShown(false);
|
||||
editorSettings.setIndentGuidesShown(false);
|
||||
editorSettings.setFoldingOutlineShown(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String getStatusMessage(final CvsHandler handler) {
|
||||
final String actionName = handler.getTitle();
|
||||
if (handler.getErrors().isEmpty()) {
|
||||
@@ -276,13 +259,7 @@ public class CvsOperationExecutor {
|
||||
}
|
||||
|
||||
private void connectToOutput(CvsHandler output) {
|
||||
CvsTabbedWindow tabbedWindow = CvsTabbedWindow.getInstance(myProject);
|
||||
Editor editor = tabbedWindow.getOutput();
|
||||
if (editor == null) {
|
||||
output.connectToOutputView(tabbedWindow.addOutput(createView(myProject)), myProject);
|
||||
} else {
|
||||
output.connectToOutputView(editor, myProject);
|
||||
}
|
||||
output.connectToOutputView(CvsTabbedWindow.getInstance(myProject).getOutput(), myProject);
|
||||
}
|
||||
|
||||
public VcsException getFirstError() {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
@@ -37,6 +38,7 @@ import com.intellij.ui.errorView.ContentManagerProvider;
|
||||
import com.intellij.ui.errorView.ErrorViewFactory;
|
||||
import com.intellij.util.ui.ErrorTreeView;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -166,15 +168,6 @@ public class CvsTabbedWindow implements Disposable {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Editor addOutput(Editor output) {
|
||||
LOG.assertTrue(myOutput == null);
|
||||
if (myOutput == null) {
|
||||
addTab(CvsBundle.message("tab.title.cvs.output"), output.getComponent(), false, false, false, true, null, "cvs.cvsOutput");
|
||||
myOutput = output;
|
||||
}
|
||||
return myOutput;
|
||||
}
|
||||
|
||||
public ErrorTreeView getErrorsTreeView() {
|
||||
if (myErrorsView == null) {
|
||||
myErrorsView = ErrorViewFactory.SERVICE.getInstance()
|
||||
@@ -213,9 +206,25 @@ public class CvsTabbedWindow implements Disposable {
|
||||
}
|
||||
|
||||
public Editor getOutput() {
|
||||
if (myOutput == null) {
|
||||
final Editor outputEditor = createOutputEditor(myProject);
|
||||
addTab(CvsBundle.message("tab.title.cvs.output"), outputEditor.getComponent(), false, false, false, true, null, "cvs.cvsOutput");
|
||||
myOutput = outputEditor;
|
||||
}
|
||||
return myOutput;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Editor createOutputEditor(Project project) {
|
||||
final Editor result = EditorFactory.getInstance().createViewer(EditorFactory.getInstance().createDocument(""), project);
|
||||
final EditorSettings editorSettings = result.getSettings();
|
||||
editorSettings.setLineMarkerAreaShown(false);
|
||||
editorSettings.setLineNumbersShown(false);
|
||||
editorSettings.setIndentGuidesShown(false);
|
||||
editorSettings.setFoldingOutlineShown(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class GlobalCvsSettingsAction extends AnAction {
|
||||
public GlobalCvsSettingsAction() {
|
||||
super(CvsBundle.message("configure.global.cvs.settings.action.name"), null, AllIcons.Nodes.Cvs_global);
|
||||
|
||||
Reference in New Issue
Block a user