mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-177216 Add count of items for intermediate states
This commit is contained in:
@@ -51,6 +51,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
|
||||
private final Project myProject;
|
||||
private final Map<TraceElement, TreePath> myValue2Path = new HashMap<>();
|
||||
private final Map<TreePath, TraceElement> myPath2Value = new HashMap<>();
|
||||
private final int myItemsCount;
|
||||
private Set<TreePath> myHighlighted = Collections.emptySet();
|
||||
private final EventDispatcher<ValuesSelectionListener> mySelectionDispatcher = EventDispatcher.create(ValuesSelectionListener.class);
|
||||
private final EventDispatcher<PaintingListener> myPaintingDispatcher = EventDispatcher.create(PaintingListener.class);
|
||||
@@ -65,6 +66,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
|
||||
|
||||
myProject = evaluationContext.getProject();
|
||||
myNodeManager = new MyNodeManager(myProject);
|
||||
myItemsCount = values.size();
|
||||
final XValueNodeImpl root = new XValueNodeImpl(this, null, "root", new MyRootValue(values, evaluationContext));
|
||||
setRoot(root, false);
|
||||
root.setLeaf(false);
|
||||
@@ -196,6 +198,10 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
|
||||
return !isSelectionEmpty() || !myHighlighted.isEmpty();
|
||||
}
|
||||
|
||||
public int getItemsCount() {
|
||||
return myItemsCount;
|
||||
}
|
||||
|
||||
public void addPaintingListener(@NotNull PaintingListener listener) {
|
||||
myPaintingDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
+17
-2
@@ -5,8 +5,10 @@ import com.intellij.debugger.streams.trace.TraceElement;
|
||||
import com.intellij.debugger.streams.ui.TraceContainer;
|
||||
import com.intellij.debugger.streams.ui.ValuesSelectionListener;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -19,10 +21,10 @@ import java.util.List;
|
||||
public class CollectionView extends JPanel implements TraceContainer {
|
||||
private final CollectionTree myInstancesTree;
|
||||
|
||||
CollectionView(@NotNull String header,
|
||||
CollectionView(@NotNull JLabel header,
|
||||
@NotNull CollectionTree collectionTree) {
|
||||
super(new BorderLayout());
|
||||
add(new JBLabel(header), BorderLayout.NORTH);
|
||||
add(header, BorderLayout.NORTH);
|
||||
|
||||
myInstancesTree = collectionTree;
|
||||
|
||||
@@ -32,6 +34,19 @@ public class CollectionView extends JPanel implements TraceContainer {
|
||||
Disposer.register(this, myInstancesTree);
|
||||
}
|
||||
|
||||
CollectionView(@NotNull CollectionTree tree) {
|
||||
this(createDefaultLabel(tree), tree);
|
||||
}
|
||||
|
||||
private static JLabel createDefaultLabel(@NotNull CollectionTree tree) {
|
||||
final JLabel label = new JBLabel(String.valueOf(tree.getItemsCount()), SwingConstants.CENTER);
|
||||
label.setForeground(JBColor.GRAY);
|
||||
final Font oldFont = label.getFont();
|
||||
label.setFont(oldFont.deriveFont(oldFont.getSize() - JBUI.scale(1.f)));
|
||||
label.setBorder(JBUI.Borders.empty(3, 0));
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper {
|
||||
if (controllers.isEmpty()) return;
|
||||
final List<TraceElement> trace = controllers.get(0).getTrace();
|
||||
final CollectionTree tree = new CollectionTree(trace, context);
|
||||
final CollectionView sourceView = new SourceView(tree);
|
||||
final CollectionView sourceView = new CollectionView(tree);
|
||||
controllers.get(0).register(sourceView);
|
||||
myTabContents.get(0).setContent(sourceView, BorderLayout.CENTER);
|
||||
|
||||
|
||||
@@ -4,13 +4,14 @@ package com.intellij.debugger.streams.ui.impl
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl
|
||||
import com.intellij.debugger.streams.trace.TraceElement
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ui.components.JBLabel
|
||||
import javax.swing.JTree
|
||||
|
||||
/**
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
class ExceptionView(context: EvaluationContextImpl, ex: TraceElement)
|
||||
: CollectionView("Cause", SingleElementTree(ex.value!!, listOf(ex), context)) {
|
||||
: CollectionView(JBLabel("Cause"), SingleElementTree(ex.value!!, listOf(ex), context)) {
|
||||
init {
|
||||
instancesTree.cellRenderer = object : TraceTreeCellRenderer() {
|
||||
override fun customizeCellRenderer(tree: JTree,
|
||||
|
||||
@@ -30,7 +30,7 @@ open class FlatView(controllers: List<TraceController>, evaluationContext: Evalu
|
||||
val mappingPane = MappingPane(nextCall.name, TraceUtil.formatWithArguments(nextCall), valuesBefore, mapping, controller)
|
||||
|
||||
val tree = CollectionTree(controller.values, valuesBefore.map { it.traceElement }, evaluationContext)
|
||||
val view = PositionsAwareCollectionView(" ", tree, valuesBefore)
|
||||
val view = PositionsAwareCollectionView(tree, valuesBefore)
|
||||
controller.register(view)
|
||||
view.addValuesPositionsListener(object : ValuesPositionsListener {
|
||||
override fun valuesPositionsChanged() {
|
||||
@@ -70,7 +70,7 @@ open class FlatView(controllers: List<TraceController>, evaluationContext: Evalu
|
||||
else {
|
||||
CollectionTree(lastController.values, it.map { it.traceElement }, evaluationContext)
|
||||
}
|
||||
val view = PositionsAwareCollectionView(" ", tree, it)
|
||||
val view = PositionsAwareCollectionView(tree, it)
|
||||
lastController.register(view)
|
||||
view.addValuesPositionsListener(object : ValuesPositionsListener {
|
||||
override fun valuesPositionsChanged() {
|
||||
@@ -86,7 +86,7 @@ open class FlatView(controllers: List<TraceController>, evaluationContext: Evalu
|
||||
if (controllers.size == 1) {
|
||||
val controller = controllers[0]
|
||||
val tree = CollectionTree(controller.values, controller.trace, evaluationContext)
|
||||
val view = CollectionView("", tree)
|
||||
val view = CollectionView(tree)
|
||||
add(view)
|
||||
controller.register(view)
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class MappingPane(name: String,
|
||||
init {
|
||||
val label = JBLabel(name, SwingConstants.CENTER)
|
||||
label.toolTipText = fullCallExpression
|
||||
label.border = JBUI.Borders.empty(2, 0, 3, 0)
|
||||
add(label, BorderLayout.NORTH)
|
||||
add(MyDrawPane(), BorderLayout.CENTER)
|
||||
}
|
||||
|
||||
+2
-6
@@ -10,10 +10,9 @@ import com.intellij.util.EventDispatcher
|
||||
/**
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
open class PositionsAwareCollectionView(header: String,
|
||||
tree: CollectionTree,
|
||||
open class PositionsAwareCollectionView(tree: CollectionTree,
|
||||
private val values: List<ValueWithPositionImpl>)
|
||||
: CollectionView(header, tree) {
|
||||
: CollectionView(tree) {
|
||||
private val myDispatcher: EventDispatcher<ValuesPositionsListener> = EventDispatcher.create(ValuesPositionsListener::class.java)
|
||||
|
||||
init {
|
||||
@@ -66,6 +65,3 @@ open class PositionsAwareCollectionView(header: String,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SourceView(tree: CollectionTree)
|
||||
: CollectionView("Source", tree)
|
||||
|
||||
Reference in New Issue
Block a user