Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java67
1 files changed, 39 insertions, 28 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
index f3aaae04f..602eba927 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,14 +16,18 @@ import org.eclipse.debug.core.ILogicalStructureType;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.PlatformUI;
/**
@@ -41,6 +45,7 @@ public class AvailableLogicalStructuresAction extends Action implements IMenuCre
setView(view);
setToolTipText(VariablesViewMessages.AvailableLogicalStructuresAction_0);
setText(VariablesViewMessages.AvailableLogicalStructuresAction_1);
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SHOW_LOGICAL_STRUCTURE));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.VARIABLES_SELECT_LOGICAL_STRUCTURE);
setEnabled(false);
setMenuCreator(this);
@@ -104,7 +109,7 @@ public class AvailableLogicalStructuresAction extends Action implements IMenuCre
for (int i = 0; i < types.length; i++) {
ILogicalStructureType type= types[i];
Action action = new SelectLogicalStructureAction(getView(), type, getValue(), types);
- action.setChecked(enabledType == type);
+ action.setChecked((enabledType == type) && getView().isShowLogicalStructure());
StringBuffer label= new StringBuffer();
//add the numerical accelerator
if (i < 9) {
@@ -113,10 +118,19 @@ public class AvailableLogicalStructuresAction extends Action implements IMenuCre
label.append(' ');
}
label.append(action.getText());
- action.setText(label.toString());
+ if (enabledType == type) {
+ action.setText(label.toString() + " " + VariablesViewMessages.AvailableLogicalStructuresAction_2); //$NON-NLS-1$
+ } else {
+ action.setText(label.toString());
+ }
addActionToMenu(fMenu, action);
}
}
+
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ EditVariableLogicalStructureAction editVariableLogicalStructureAction = new EditVariableLogicalStructureAction(getView());
+ editVariableLogicalStructureAction.setText(VariablesViewMessages.AvailableLogicalStructuresAction_3);
+ addActionToMenu(fMenu, editVariableLogicalStructureAction);
return fMenu;
}
@@ -126,36 +140,33 @@ public class AvailableLogicalStructuresAction extends Action implements IMenuCre
public void init() {
setValue(null);
setTypes(null);
- if (getView().isShowLogicalStructure()) {
- ISelection s = getView().getViewer().getSelection();
- if (s instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) s;
- if (selection.size() == 1) {
- Object obj = selection.getFirstElement();
- IValue value = null;
- if (obj instanceof IVariable) {
- IVariable var = (IVariable) obj;
- try {
- value = var.getValue();
- } catch (DebugException e) {
- }
- } else if (obj instanceof IExpression) {
- IExpression expression = (IExpression)obj;
- value = expression.getValue();
+ ISelection s = getView().getViewer().getSelection();
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) s;
+ if (selection.size() == 1) {
+ Object obj = selection.getFirstElement();
+ IValue value = null;
+ if (obj instanceof IVariable) {
+ IVariable var = (IVariable) obj;
+ try {
+ value = var.getValue();
+ } catch (DebugException e) {
}
- if (value != null) {
- ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
- if (types.length > 0) {
- setTypes(types);
- setValue(value);
- setEnabled(true);
- return;
- }
+ } else if (obj instanceof IExpression) {
+ IExpression expression = (IExpression) obj;
+ value = expression.getValue();
+ }
+ if (value != null) {
+ ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
+ if (types.length > 0) {
+ setTypes(types);
+ setValue(value);
+ setEnabled(true);
+ return;
}
}
}
}
- setEnabled(false);
}
protected ILogicalStructureType[] getTypes() {

Back to the top