Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2011-03-24 15:32:51 +0000
committerPawel Piech2011-03-24 15:32:51 +0000
commit94a5ff3494011025dd85fc9ee48c52b355a9dce1 (patch)
tree9e566c1b6f1d2a050fec1ad6ad6ff46ef55d4bcb
parent592fdd18d91360ed92e26249dc3b0223831bcb48 (diff)
downloadeclipse.platform.debug-94a5ff3494011025dd85fc9ee48c52b355a9dce1.tar.gz
eclipse.platform.debug-94a5ff3494011025dd85fc9ee48c52b355a9dce1.tar.xz
eclipse.platform.debug-94a5ff3494011025dd85fc9ee48c52b355a9dce1.zip
Bug 296018 - Added ability to rename "Add New Expression" element.
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
index b132aba27..fbe8a3439 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
@@ -41,7 +41,8 @@ public class EditWatchExpressinInPlaceAction extends Action implements ISelectio
}
public void selectionChanged(SelectionChangedEvent event) {
- fEditActionDelegate.selectionChanged(this, event.getSelection());
+ IStructuredSelection selelection = fEditActionDelegate.getCurrentSelection();
+ setEnabled(selelection.size() == 1);
}
public void dispose() {
@@ -55,25 +56,30 @@ public class EditWatchExpressinInPlaceAction extends Action implements ISelectio
return;
}
+
// Always edit multi-line expressions in dialog. Otherwise try to find the expression
// column and activate cell editor there.
- IWatchExpression[] expressions = fEditActionDelegate.getSelectedExpressions();
- int expressionColumn = -1;
- if (expressions[0].getExpressionText().indexOf('\n') == -1) {
- Object[] columnProperties = fViewer.getColumnProperties();
- for (int i = 0; i < columnProperties.length; i++) {
- if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(columnProperties[i])) {
- expressionColumn = i;
- break;
- }
- }
- }
- if (expressionColumn != -1) {
+ int expressionColumn = getExpressionColumnIndex();
+ if (expressionColumn != -1 || isWatchExpressionWithNewLine()) {
fViewer.editElement(selelection.getFirstElement(), expressionColumn);
} else {
fEditActionDelegate.run(this);
}
}
+ private boolean isWatchExpressionWithNewLine() {
+ IWatchExpression[] expressions = fEditActionDelegate.getSelectedExpressions();
+ return expressions.length == 1 &&
+ expressions[0].getExpressionText().indexOf('\n') == -1;
+ }
+ private int getExpressionColumnIndex() {
+ Object[] columnProperties = fViewer.getColumnProperties();
+ for (int i = 0; i < columnProperties.length; i++) {
+ if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(columnProperties[i])) {
+ return i;
+ }
+ }
+ return -1;
+ }
}

Back to the top