Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-04-10 21:02:03 +0000
committerPawel Piech2012-04-10 21:02:33 +0000
commit595db0a239d44fe1f1590c846fb4edcd1e4f0609 (patch)
tree60b55d987f680e63417392324041de3b4c2eae53
parent468b44d75d55a954d381e55a7b98f6c3b150f8f6 (diff)
downloadorg.eclipse.cdt-595db0a239d44fe1f1590c846fb4edcd1e4f0609.tar.gz
org.eclipse.cdt-595db0a239d44fe1f1590c846fb4edcd1e4f0609.tar.xz
org.eclipse.cdt-595db0a239d44fe1f1590c846fb4edcd1e4f0609.zip
Bug 376443 - [expressions] Adding multiple expressions to view can leave the "Add New Expression" at top
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java7
2 files changed, 7 insertions, 2 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java
index 0be570cf919..ba3b733c1f1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java
@@ -360,7 +360,7 @@ public class ExpressionVMProvider extends AbstractDMVMProvider
@Override
public void expressionsAdded(IExpression[] expressions) {
- expressionsListChanged(ExpressionsChangedEvent.Type.ADDED, expressions, -1);
+ expressionsListChanged(ExpressionsChangedEvent.Type.ADDED, expressions, DebugPlugin.getDefault().getExpressionManager().getExpressions().length - expressions.length);
}
@Override
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java
index c2ce5d9338e..a3ce8674645 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java
@@ -157,8 +157,13 @@ public class ExpressionVMProviderModelProxyStrategy extends DefaultVMModelProxyS
case ADDED:
// New expressions are always added one element before last.
// Last element is the "Add new expression" element.
+ // Note: Index should be calculated when the IExpressionListener.expressionsAdded
+ // is called. If it's not, try to calculate it here based on parent count.
int parentCount = parentDelta.getChildCount();
- parentDelta.addNode(element, parentCount > 1 ? parentCount - 2 : -1, IModelDelta.ADDED);
+ if (elementIdx == -1 && parentCount > 1) {
+ elementIdx = parentCount - 2;
+ }
+ parentDelta.addNode(element, elementIdx, IModelDelta.ADDED);
break;
case CHANGED:
parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);

Back to the top