From c8fbaa5ff1adcc36f5b1ee8c534a6999926d5ca9 Mon Sep 17 00:00:00 2001 From: Martin Zdarsky Date: Tue, 16 May 2017 14:53:30 +0200 Subject: [PATCH] IDEA-168508 ant console output collapsed optionally --- .../lang/ant/config/AntBuildFileBase.java | 4 ++++ .../lang/ant/config/execution/TreeView.java | 15 +++++++++------ .../lang/ant/config/impl/AntBuildFileImpl.java | 12 ++++++++++++ .../configuration/BuildFilePropertiesPanel.form | 8 ++++++++ .../configuration/BuildFilePropertiesPanel.java | 2 ++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/plugins/ant/src/com/intellij/lang/ant/config/AntBuildFileBase.java b/plugins/ant/src/com/intellij/lang/ant/config/AntBuildFileBase.java index 0921d4b8b238..b070a47a5800 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/AntBuildFileBase.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/AntBuildFileBase.java @@ -49,6 +49,10 @@ public interface AntBuildFileBase extends AntBuildFile { boolean isRunInBackground(); + boolean isColoredOutputMessages(); + + boolean isCollapseFinishedTargets(); + void readWorkspaceProperties(final Element element) throws InvalidDataException; void writeWorkspaceProperties(final Element element) throws WriteExternalException; diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/TreeView.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/TreeView.java index fa2c1ad1520b..415517ac5e2d 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/execution/TreeView.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/TreeView.java @@ -21,7 +21,6 @@ import com.intellij.ide.OccurenceNavigatorSupport; import com.intellij.ide.TextCopyProvider; import com.intellij.lang.ant.AntBundle; import com.intellij.lang.ant.config.*; -import com.intellij.lang.ant.config.impl.AntBuildFileImpl; import com.intellij.lang.ant.config.impl.BuildTask; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; @@ -64,6 +63,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator { private DefaultMutableTreeNode myStatusNode; private final AutoScrollToSourceHandler myAutoScrollToSourceHandler; private OccurenceNavigatorSupport myOccurenceNavigatorSupport; + private final boolean myAutoCollapseTargets; @NonNls public static final String ROOT_TREE_USER_OBJECT = "root"; @NonNls public static final String JUNIT_TASK_NAME = "junit"; @@ -80,6 +80,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator { } }; myPanel = createPanel(); + myAutoCollapseTargets = buildFile instanceof AntBuildFileBase && ((AntBuildFileBase)myBuildFile).isCollapseFinishedTargets(); } @Override @@ -151,7 +152,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator { final JScrollPane treePane = MessageTreeRenderer.install(myTree); if (myBuildFile instanceof AntBuildFileBase) { ((MessageTreeRenderer)myTree.getCellRenderer()).setUseAnsiColor( - AntBuildFileImpl.TREE_VIEW_ANSI_COLOR.value(((AntBuildFileBase)myBuildFile).getAllOptions()) + ((AntBuildFileBase)myBuildFile).isColoredOutputMessages() ); } @@ -348,10 +349,12 @@ public final class TreeView implements AntOutputView, OccurenceNavigator { } private void collapseTargets() { - DefaultMutableTreeNode root = (DefaultMutableTreeNode)myTreeModel.getRoot(); - for (int i = 0; i < root.getChildCount(); i++) { - DefaultMutableTreeNode node = (DefaultMutableTreeNode)root.getChildAt(i); - myTree.collapsePath(new TreePath(node.getPath())); + if (myAutoCollapseTargets) { + final DefaultMutableTreeNode root = (DefaultMutableTreeNode)myTreeModel.getRoot(); + for (int i = 0; i < root.getChildCount(); i++) { + final DefaultMutableTreeNode node = (DefaultMutableTreeNode)root.getChildAt(i); + myTree.collapsePath(new TreePath(node.getPath())); + } } } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntBuildFileImpl.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntBuildFileImpl.java index bca30ec1d5d4..5bcdf24b9c9d 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntBuildFileImpl.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntBuildFileImpl.java @@ -118,6 +118,7 @@ public class AntBuildFileImpl implements AntBuildFileBase { public static final BooleanProperty VERBOSE = new BooleanProperty("verbose", true); public static final BooleanProperty TREE_VIEW = new BooleanProperty("treeView", true); public static final BooleanProperty TREE_VIEW_ANSI_COLOR = new BooleanProperty("treeViewAnsiColor", false); + public static final BooleanProperty TREE_VIEW_COLLAPSE_TARGETS = new BooleanProperty("treeViewCollapseTarget", true); public static final BooleanProperty CLOSE_ON_NO_ERRORS = new BooleanProperty("viewClosedWhenNoErrors", false); public static final StringProperty CUSTOM_JDK_NAME = new StringProperty("customJdkName", ""); public static final ListProperty TARGET_FILTERS = ListProperty.create("targetFilters"); @@ -164,6 +165,7 @@ public class AntBuildFileImpl implements AntBuildFileBase { myWorkspaceOptions.registerProperty(CLOSE_ON_NO_ERRORS); myWorkspaceOptions.registerProperty(TREE_VIEW); myWorkspaceOptions.registerProperty(TREE_VIEW_ANSI_COLOR); + myWorkspaceOptions.registerProperty(TREE_VIEW_COLLAPSE_TARGETS); myWorkspaceOptions.registerProperty(VERBOSE); myWorkspaceOptions.registerProperty(TARGET_FILTERS, "filter", NewInstanceFactory.fromClass(TargetFilter.class)); @@ -222,6 +224,16 @@ public class AntBuildFileImpl implements AntBuildFileBase { return RUN_IN_BACKGROUND.value(myAllOptions); } + @Override + public boolean isColoredOutputMessages() { + return TREE_VIEW_ANSI_COLOR.value(myWorkspaceOptions); + } + + @Override + public boolean isCollapseFinishedTargets() { + return TREE_VIEW_COLLAPSE_TARGETS.value(myWorkspaceOptions); + } + @Nullable public XmlFile getAntFile() { final PsiFile psiFile = myVFile.isValid() ? PsiManager.getInstance(getProject()).findFile(myVFile) : null; diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.form b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.form index ddc5d9036ab7..ce7d7282b388 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.form +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.form @@ -82,6 +82,14 @@ + + + + + + + + diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.java index 08d36015c612..1aa1fe4f54e7 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.java @@ -132,6 +132,7 @@ public class BuildFilePropertiesPanel { private JPanel myWholePanel; private JLabel myHeapSizeLabel; private JCheckBox myColoredOutputMessages; + private JCheckBox myCollapseFinishedTargets; private final Tab[] myTabs; private final UIPropertyBinding.Composite myBinding = new UIPropertyBinding.Composite(); private final TabbedPaneWrapper myWrapper; @@ -152,6 +153,7 @@ public class BuildFilePropertiesPanel { myBinding.bindBoolean(myRunInBackground, AntBuildFileImpl.RUN_IN_BACKGROUND); myBinding.bindBoolean(myCloseOnNoError, AntBuildFileImpl.CLOSE_ON_NO_ERRORS); myBinding.bindBoolean(myColoredOutputMessages, AntBuildFileImpl.TREE_VIEW_ANSI_COLOR); + myBinding.bindBoolean(myCollapseFinishedTargets, AntBuildFileImpl.TREE_VIEW_COLLAPSE_TARGETS); myBinding.bindInt(myXmx, AntBuildFileImpl.MAX_HEAP_SIZE); myBinding.bindInt(myXss, AntBuildFileImpl.MAX_STACK_SIZE);