IDEA-168508 ant console output collapsed optionally

This commit is contained in:
Martin Zdarsky
2017-05-16 14:57:15 +02:00
committed by Eugene Zhuravlev
parent 55c221d746
commit c8fbaa5ff1
5 changed files with 35 additions and 6 deletions
@@ -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;
@@ -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()));
}
}
}
@@ -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<TargetFilter> 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;
@@ -82,6 +82,14 @@
<text value="Colored output messages"/>
</properties>
</component>
<component id="dfc52" class="javax.swing.JCheckBox" binding="myCollapseFinishedTargets">
<constraints>
<grid row="3" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Collapse finished targets in message view"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -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);