From 39cf259bbdb51a41aafcf1535c4b94db357d4801 Mon Sep 17 00:00:00 2001
From: Pawel Piech
Date: Mon, 6 Oct 2008 21:51:07 +0000
Subject: [PATCH] [233407] - [update policy][menu] The update modes menu is
enabled when no DSF debug session is active.
---
.../META-INF/MANIFEST.MF | 1 -
.../plugin.properties | 11 -
.../org.eclipse.dd.dsf.debug.ui/plugin.xml | 589 +++++++++---------
.../ui/viewmodel/actions/VMCommandUtils.java | 115 ++++
.../numberformat/AbstractSetFormatStyle.java | 197 ------
.../numberformat/MessagesForNumberFormat.java | 35 ++
.../NumberFormatsContribution.java | 126 ++++
.../NumberFormatsPropertyTester.java | 88 +++
.../actions/SetDefaultFormatBinary.java | 22 -
.../actions/SetDefaultFormatDecimal.java | 22 -
.../actions/SetDefaultFormatHex.java | 22 -
.../actions/SetDefaultFormatNatural.java | 22 -
.../actions/SetDefaultFormatOctal.java | 23 -
.../numberformat/messages.properties | 19 +
.../update/actions/AllUpdateScopeAction.java | 23 -
.../actions/AutomaticUpdatePolicyAction.java | 23 -
.../BreakpointHitUpdatePolicyAction.java | 23 -
.../actions/ManualUpdatePolicyAction.java | 23 -
.../actions/MessagesForVMUpdateActions.java | 29 +
.../actions/SelectUpdatePolicyAction.java | 85 ---
.../actions/SelectUpdateScopeAction.java | 89 ---
.../actions/UpdatePoliciesContribution.java | 110 ++++
.../actions/UpdatePoliciesPropertyTester.java | 78 +++
.../actions/UpdateScopesContribution.java | 110 ++++
.../actions/UpdateScopesPropertyTester.java | 78 +++
.../actions/VisibleUpdateScopeAction.java | 23 -
.../update/actions/messages.properties | 13 +
27 files changed, 1083 insertions(+), 916 deletions(-)
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/actions/VMCommandUtils.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/AbstractSetFormatStyle.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/MessagesForNumberFormat.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/NumberFormatsContribution.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/NumberFormatsPropertyTester.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/messages.properties
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AutomaticUpdatePolicyAction.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/BreakpointHitUpdatePolicyAction.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/ManualUpdatePolicyAction.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/MessagesForVMUpdateActions.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdatePolicyAction.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesContribution.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesPropertyTester.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesContribution.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesPropertyTester.java
delete mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/messages.properties
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.dd.dsf.debug.ui/META-INF/MANIFEST.MF
index 19d7c82f462..75fd46891b1 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/META-INF/MANIFEST.MF
@@ -35,7 +35,6 @@ Export-Package:
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;x-internal:=true,
- org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;x-internal:=true,
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
index a9c7a58d668..28d20409a8c 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
@@ -32,20 +32,9 @@ action.refresh.label = Refresh
menu.updatePolicy = Update Policy
menu.threadsUpdatePolicy = Threads Update Policy
-action.breakpointHitUpdatePolicy.label = Breakpoint Hit
-action.manualUpdatePolicy.label = Manual
-action.automaticUpdatePolicy.label = Automatic
-
menu.updateScope = Update Scope
-action.visibleUpdateScope.label = Visible
-action.allUpdateScope.label = Expanded
menu.numberFormat = Number Format
-action.setDefaultNumberFormatHex.label = Hex
-action.setDefaultNumberFormatDecimal.label = Decimal
-action.setDefaultNumberFormatOctal.label = Octal
-action.setDefaultNumberFormatBinary.label = Binary
-action.setDefaultNumberFormatNatural.label = Natural
preferencePage.name = DSF
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
index 7e8b591cacd..d1b586a2b76 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
@@ -68,103 +68,6 @@
label="%action.refresh.label"
toolbarPath="additions">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -178,100 +81,6 @@
label="%action.refresh.label"
toolbarPath="additions">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -285,101 +94,6 @@
label="%action.refresh.label"
toolbarPath="additions">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -393,29 +107,290 @@
label="%action.refresh.label"
toolbarPath="additions">
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
FORMATS = new LinkedHashMap();
+ static {
+ FORMATS.put(IFormattedValues.NATURAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Natural_label);
+ FORMATS.put(IFormattedValues.HEX_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Hex_label);
+ FORMATS.put(IFormattedValues.DECIMAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Decimal_label);
+ FORMATS.put(IFormattedValues.OCTAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Octal_label);
+ FORMATS.put(IFormattedValues.BINARY_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Binary_label);
+ FORMATS.put(IFormattedValues.STRING_FORMAT, MessagesForNumberFormat.NumberFormatContribution_String_label);
+ }
+
+ private class SelectNumberFormatAction extends Action {
+ private final IPresentationContext fContext;
+ private final String fFormatId;
+ SelectNumberFormatAction(IPresentationContext context, String formatId) {
+ super(FORMATS.get(formatId), AS_RADIO_BUTTON);
+ fContext = context;
+ fFormatId = formatId;
+ }
+
+ @Override
+ public void run() {
+ if (isChecked()) {
+ fContext.setProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE, fFormatId);
+ }
+ }
+ }
+
+ private IServiceLocator fServiceLocator;
+
+ private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setEnabled(false);
+ item.setText(MessagesForNumberFormat.NumberFormatContribution_EmptyFormatsList_label);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+ }
+ };
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
+
+ // If no part or selection, disable all.
+ if (provider == null) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ IPresentationContext context = provider.getPresentationContext();
+ Object activeId = context.getProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE);
+ if (activeId == null) {
+ activeId = IFormattedValues.NATURAL_FORMAT;
+ }
+
+ List actions = new ArrayList(FORMATS.size());
+ for (String formatId : FORMATS.keySet()) {
+ Action action = new SelectNumberFormatAction(context, formatId);
+ if (formatId.equals(activeId)) {
+ action.setChecked(true);
+ }
+ actions.add(action);
+ }
+
+ if ( actions.isEmpty() ) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ IContributionItem[] items = new IContributionItem[actions.size()];
+ for (int i = 0; i < actions.size(); i++) {
+ items[i] = new ActionContributionItem(actions.get(i));
+ }
+ return items;
+ }
+
+ public void initialize(IServiceLocator serviceLocator) {
+ fServiceLocator = serviceLocator;
+ }
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/NumberFormatsPropertyTester.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/NumberFormatsPropertyTester.java
new file mode 100644
index 00000000000..8245b9335df
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/NumberFormatsPropertyTester.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.IDebugVMConstants;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
+import org.eclipse.dd.dsf.debug.service.IFormattedValues;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Property tester for number format information available through the given
+ * object. The object being tested should be either an {@link IVMContext},
+ * through which an instance of {@link IVMProvider} could be obtained.
+ * Or it could be an {@link IWorkbenchPart}, which is tested to see if it
+ * is a debug view through which a caching VM provider can be obtained.
+ * The view's presentation context is used to test the given property.
+ *
+ * Three properties are supported:
+ *
+ * - "areNumberFormatsSupported" - Checks whether number formats are
+ * available at all given the receiver.
+ * - "isNumberFormatAvailable" - Checks whether the number format ID in the
+ * expected value is available for the given receiver.
+ * - "isNumberFormatActive" - Checks whether the number format ID in the expected
+ * value is the currently active number format for the given receiver.
+ *
+ *
+ */
+@SuppressWarnings("restriction")
+public class NumberFormatsPropertyTester extends PropertyTester {
+
+ private static final String SUPPORTED = "areNumberFormatsSupported"; //$NON-NLS-1$
+ private static final String AVAILABLE = "isNumberFormatAvailable"; //$NON-NLS-1$
+ private static final String ACTIVE = "isNumberFormatActive"; //$NON-NLS-1$
+
+ private static final List AVAILABLE_FORMATS = new ArrayList();
+ static {
+ AVAILABLE_FORMATS.add(IFormattedValues.NATURAL_FORMAT);
+ AVAILABLE_FORMATS.add(IFormattedValues.HEX_FORMAT);
+ AVAILABLE_FORMATS.add(IFormattedValues.DECIMAL_FORMAT);
+ AVAILABLE_FORMATS.add(IFormattedValues.OCTAL_FORMAT);
+ AVAILABLE_FORMATS.add(IFormattedValues.BINARY_FORMAT);
+ AVAILABLE_FORMATS.add(IFormattedValues.STRING_FORMAT);
+ };
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof IVMContext) {
+ IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
+ if (provider != null) {
+ return testProvider(provider, property, expectedValue);
+ }
+ } else if (receiver instanceof IDebugView) {
+ IVMProvider provider = VMCommandUtils.getVMProviderForPart((IDebugView)receiver);
+ if (provider != null) {
+ return testProvider(provider, property, expectedValue);
+ }
+ }
+ return false;
+ }
+
+ private boolean testProvider(IVMProvider provider, String property, Object expectedValue) {
+ if (SUPPORTED.equals(property)) {
+ return true;
+ } else if (AVAILABLE.equals(property)) {
+ return AVAILABLE_FORMATS.contains(expectedValue);
+ } else if (ACTIVE.equals(property)) {
+ Object activeId = provider.getPresentationContext().getProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE);
+ return expectedValue != null && expectedValue.equals(activeId);
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java
deleted file mode 100644
index 20984a04141..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
-import org.eclipse.dd.dsf.debug.service.IFormattedValues;
-
-public class SetDefaultFormatBinary extends AbstractSetFormatStyle {
-
- @Override
- protected String getFormatStyle() {
- return IFormattedValues.BINARY_FORMAT;
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java
deleted file mode 100644
index 1442339069d..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
-import org.eclipse.dd.dsf.debug.service.IFormattedValues;
-
-public class SetDefaultFormatDecimal extends AbstractSetFormatStyle {
-
- @Override
- protected String getFormatStyle() {
- return IFormattedValues.DECIMAL_FORMAT;
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java
deleted file mode 100644
index f0c21803b6b..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
-import org.eclipse.dd.dsf.debug.service.IFormattedValues;
-
-public class SetDefaultFormatHex extends AbstractSetFormatStyle {
-
- @Override
- protected String getFormatStyle() {
- return IFormattedValues.HEX_FORMAT;
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java
deleted file mode 100644
index 4e138a403ff..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
-import org.eclipse.dd.dsf.debug.service.IFormattedValues;
-
-public class SetDefaultFormatNatural extends AbstractSetFormatStyle {
-
- @Override
- protected String getFormatStyle() {
- return IFormattedValues.NATURAL_FORMAT;
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java
deleted file mode 100644
index b39f336509a..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
-import org.eclipse.dd.dsf.debug.service.IFormattedValues;
-
-public class SetDefaultFormatOctal extends AbstractSetFormatStyle {
-
- @Override
- protected String getFormatStyle() {
- return IFormattedValues.OCTAL_FORMAT;
- }
-}
-
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/messages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/messages.properties
new file mode 100644
index 00000000000..fbebfa748d8
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/messages.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2006, 2008 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Wind River Systems Inc - copied for non-restricted version for DSDP/DD/DSF
+###############################################################################
+
+NumberFormatContribution_Natural_label=Natural
+NumberFormatContribution_Decimal_label=Decimal
+NumberFormatContribution_Hex_label=Hex
+NumberFormatContribution_Octal_label=Octal
+NumberFormatContribution_Binary_label=Binary
+NumberFormatContribution_String_label=String
+
+NumberFormatContribution_EmptyFormatsList_label=Number formats not available
\ No newline at end of file
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java
deleted file mode 100644
index 532627bf6d8..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.ui.viewmodel.update.AllUpdateScope;
-
-/**
- * @since 1.1
- */
-public class AllUpdateScopeAction extends SelectUpdateScopeAction {
-
- public AllUpdateScopeAction() {
- super(AllUpdateScope.ALL_UPDATE_SCOPE_ID);
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AutomaticUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AutomaticUpdatePolicyAction.java
deleted file mode 100644
index f3b58174c69..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AutomaticUpdatePolicyAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.ui.viewmodel.update.AutomaticUpdatePolicy;
-
-/**
- *
- */
-public class AutomaticUpdatePolicyAction extends SelectUpdatePolicyAction {
-
- public AutomaticUpdatePolicyAction() {
- super(AutomaticUpdatePolicy.AUTOMATIC_UPDATE_POLICY_ID);
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/BreakpointHitUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/BreakpointHitUpdatePolicyAction.java
deleted file mode 100644
index 2fc61e621ed..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/BreakpointHitUpdatePolicyAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.BreakpointHitUpdatePolicy;
-
-/**
- *
- */
-public class BreakpointHitUpdatePolicyAction extends SelectUpdatePolicyAction {
-
- public BreakpointHitUpdatePolicyAction() {
- super(BreakpointHitUpdatePolicy.BREAKPOINT_HIT_UPDATE_POLICY_ID);
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/ManualUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/ManualUpdatePolicyAction.java
deleted file mode 100644
index ee6dd54fa6e..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/ManualUpdatePolicyAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy;
-
-/**
- *
- */
-public class ManualUpdatePolicyAction extends SelectUpdatePolicyAction {
-
- public ManualUpdatePolicyAction() {
- super(ManualUpdatePolicy.MANUAL_UPDATE_POLICY_ID);
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/MessagesForVMUpdateActions.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/MessagesForVMUpdateActions.java
new file mode 100644
index 00000000000..bb20f1bd25c
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/MessagesForVMUpdateActions.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems, Inc. - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class MessagesForVMUpdateActions extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.messages"; //$NON-NLS-1$
+
+ public static String UpdatePoliciesContribution_EmptyPoliciesList_label;
+ public static String UpdateScopesContribution_EmptyScopesList_label;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, MessagesForVMUpdateActions.class);
+ }
+
+ private MessagesForVMUpdateActions() {}
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdatePolicyAction.java
deleted file mode 100644
index 9df6951684b..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdatePolicyAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
-import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
-import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
-import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewPart;
-
-/**
- *
- */
-public class SelectUpdatePolicyAction extends AbstractVMProviderActionDelegate {
-
- private final String fUpdatePolicyId;
-
- public SelectUpdatePolicyAction(String policyId) {
- fUpdatePolicyId = policyId;
- }
-
- protected String getUpdatePolicyId() {
- return fUpdatePolicyId;
- }
-
- @Override
- public void init(IViewPart view) {
- super.init(view);
- update();
- }
-
- public void run(IAction action) {
- IVMProvider provider = getVMProvider();
- if (provider instanceof ICachingVMProvider) {
- ICachingVMProvider cachingProvider = (ICachingVMProvider)provider;
- IVMUpdatePolicy policy = getPolicyFromProvider(cachingProvider, getUpdatePolicyId());
- if (policy != null) {
- cachingProvider.setActiveUpdatePolicy(policy);
- }
- }
- }
-
- private IVMUpdatePolicy getPolicyFromProvider(ICachingVMProvider provider, String id) {
- for (IVMUpdatePolicy policy : provider.getAvailableUpdatePolicies()) {
- if (policy.getID().equals(id)) {
- return policy;
- }
- }
- return null;
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
- update();
- }
-
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- super.debugContextChanged(event);
- update();
- }
-
- protected void update() {
- IVMProvider provider = getVMProvider();
- if (provider instanceof ICachingVMProvider) {
- getAction().setEnabled(true);
- IVMUpdatePolicy activePolicy = ((ICachingVMProvider)provider).getActiveUpdatePolicy();
- getAction().setChecked( activePolicy != null && getUpdatePolicyId().equals(activePolicy.getID()) );
- } else {
- getAction().setEnabled(false);
- }
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java
deleted file mode 100644
index 4a1ca887fd3..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
-import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
-import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
-import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
-import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @since 1.1
- */
-public class SelectUpdateScopeAction extends AbstractVMProviderActionDelegate {
-
- private final String fUpdateScopeId;
-
- public SelectUpdateScopeAction(String policyId) {
- fUpdateScopeId = policyId;
- }
-
- protected String getUpdateScopeId() {
- return fUpdateScopeId;
- }
-
- @Override
- public void init(IViewPart view) {
- super.init(view);
- update();
- }
-
- public void run(IAction action) {
- if(action.isChecked())
- {
- IVMProvider provider = getVMProvider();
- if (provider instanceof ICachingVMProvider) {
- ICachingVMProviderExtension cachingProvider = (ICachingVMProviderExtension)provider;
- IVMUpdateScope policy = getScopeFromProvider(cachingProvider, getUpdateScopeId());
- if (policy != null) {
- cachingProvider.setActiveUpdateScope(policy);
- }
- }
- }
- }
-
- private IVMUpdateScope getScopeFromProvider(ICachingVMProviderExtension provider, String id) {
- for (IVMUpdateScope policy : provider.getAvailableUpdateScopes()) {
- if (policy.getID().equals(id)) {
- return policy;
- }
- }
- return null;
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
- update();
- }
-
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- super.debugContextChanged(event);
- update();
- }
-
- protected void update() {
- IVMProvider provider = getVMProvider();
- if (provider instanceof ICachingVMProviderExtension) {
- getAction().setEnabled(true);
- IVMUpdateScope activeScope = ((ICachingVMProviderExtension)provider).getActiveUpdateScope();
- getAction().setChecked( activeScope != null && getUpdateScopeId().equals(activeScope.getID()) );
- } else {
- getAction().setEnabled(false);
- }
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesContribution.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesContribution.java
new file mode 100644
index 00000000000..801e1e7a7a1
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesContribution.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * Dynamic menu contribution that shows available update policies
+ * in the current view.
+ *
+ * @since 1.1
+ */
+public class UpdatePoliciesContribution extends CompoundContributionItem implements IWorkbenchContribution {
+
+ private class SelectUpdatePolicyAction extends Action {
+ private final ICachingVMProvider fProvider;
+ private final IVMUpdatePolicy fPolicy;
+ SelectUpdatePolicyAction(ICachingVMProvider provider, IVMUpdatePolicy policy) {
+ super(policy.getName(), AS_RADIO_BUTTON);
+ fProvider = provider;
+ fPolicy = policy;
+ }
+
+ @Override
+ public void run() {
+ if (isChecked()) {
+ fProvider.setActiveUpdatePolicy(fPolicy);
+ }
+ }
+ }
+
+ private IServiceLocator fServiceLocator;
+
+ private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setEnabled(false);
+ item.setText(MessagesForVMUpdateActions.UpdateScopesContribution_EmptyScopesList_label);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+ }
+ };
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
+
+ // If no part or selection, disable all.
+ if (provider == null || !(provider instanceof ICachingVMProvider)) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+ ICachingVMProvider cachingProvider = (ICachingVMProvider)provider;
+
+ IVMUpdatePolicy[] policies = cachingProvider.getAvailableUpdatePolicies();
+ IVMUpdatePolicy activePolicy = cachingProvider.getActiveUpdatePolicy();
+
+ List actions = new ArrayList(policies.length);
+ for (IVMUpdatePolicy policy : policies) {
+ Action action = new SelectUpdatePolicyAction(cachingProvider, policy);
+ if (policy.getID().equals(activePolicy.getID())) {
+ action.setChecked(true);
+ }
+ actions.add(action);
+ }
+
+ if ( actions.isEmpty() ) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ IContributionItem[] items = new IContributionItem[actions.size()];
+ for (int i = 0; i < actions.size(); i++) {
+ items[i] = new ActionContributionItem(actions.get(i));
+ }
+ return items;
+ }
+
+ public void initialize(IServiceLocator serviceLocator) {
+ fServiceLocator = serviceLocator;
+ }
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesPropertyTester.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesPropertyTester.java
new file mode 100644
index 00000000000..279833a1903
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdatePoliciesPropertyTester.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Property tester for update policy information available through the given
+ * object. The object being tested should be either an {@link IVMContext},
+ * through which an instance of {@link ICachingVMProvider} could be obtained.
+ * Or it could be an {@link IWorkbenchPart}, which is tested to see if it
+ * is a debug view through which a caching VM provider can be obtained.
+ * The Caching View Model provider is used to test the given property.
+ *
+ * Three properties are supported:
+ *
+ * - "areUpdatePoliciesSupported" - Checks whether update policies are
+ * available at all given the receiver.
+ * - "isUpdatePolicyAvailable" - Checks whether the update policy in the
+ * expected value is available for the given receiver.
+ * - "isUpdatePolicyActive" - Checks whether the policy given in the expected
+ * value is the currently active policy for the given receiver.
+ *
+ *
+ */
+public class UpdatePoliciesPropertyTester extends PropertyTester {
+
+ private static final String SUPPORTED = "areUpdatePoliciesSupported"; //$NON-NLS-1$
+ private static final String AVAILABLE = "isUpdatePolicyAvailable"; //$NON-NLS-1$
+ private static final String ACTIVE = "isUpdatePolicyActive"; //$NON-NLS-1$
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof IVMContext) {
+ IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
+ if (provider instanceof ICachingVMProvider) {
+ return testProvider((ICachingVMProvider)provider, property, expectedValue);
+ }
+ } else if (receiver instanceof IDebugView) {
+ IVMProvider provider = VMCommandUtils.getVMProviderForPart((IDebugView)receiver);
+ if (provider instanceof ICachingVMProvider) {
+ return testProvider((ICachingVMProvider)provider, property, expectedValue);
+ }
+ }
+ return false;
+ }
+
+ private boolean testProvider(ICachingVMProvider provider, String property, Object expectedValue) {
+ if (SUPPORTED.equals(property)) {
+ return true;
+ } else if (AVAILABLE.equals(property)) {
+ for (IVMUpdatePolicy policy : provider.getAvailableUpdatePolicies()) {
+ if (policy.getID().equals(expectedValue)) {
+ return true;
+ }
+ return false;
+ }
+ } else if (ACTIVE.equals(property)) {
+ return expectedValue != null && expectedValue.equals(provider.getActiveUpdatePolicy().getID());
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesContribution.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesContribution.java
new file mode 100644
index 00000000000..54ed7a5b568
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesContribution.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
+import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * Dynamic menu contribution that shows available update scopes
+ * in the current view.
+ *
+ * @since 1.1
+ */
+public class UpdateScopesContribution extends CompoundContributionItem implements IWorkbenchContribution {
+
+ private class SelectUpdateScopeAction extends Action {
+ private final ICachingVMProviderExtension fProvider;
+ private final IVMUpdateScope fScope;
+ SelectUpdateScopeAction(ICachingVMProviderExtension provider, IVMUpdateScope scope) {
+ super(scope.getName(), AS_RADIO_BUTTON);
+ fProvider = provider;
+ fScope = scope;
+ }
+
+ @Override
+ public void run() {
+ if (isChecked()) {
+ fProvider.setActiveUpdateScope(fScope);
+ }
+ }
+ }
+
+ private IServiceLocator fServiceLocator;
+
+ private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setEnabled(false);
+ item.setText(MessagesForVMUpdateActions.UpdateScopesContribution_EmptyScopesList_label);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+ }
+ };
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
+
+ // If no part or selection, disable all.
+ if (provider == null || !(provider instanceof ICachingVMProviderExtension)) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+ ICachingVMProviderExtension cachingProvider = (ICachingVMProviderExtension)provider;
+
+ IVMUpdateScope[] scopes = cachingProvider.getAvailableUpdateScopes();
+ IVMUpdateScope activeScope = cachingProvider.getActiveUpdateScope();
+
+ List actions = new ArrayList(scopes.length);
+ for (IVMUpdateScope scope : scopes) {
+ Action action = new SelectUpdateScopeAction(cachingProvider, scope);
+ if (scope.getID().equals(activeScope.getID())) {
+ action.setChecked(true);
+ }
+ actions.add(action);
+ }
+
+ if ( actions.isEmpty() ) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ IContributionItem[] items = new IContributionItem[actions.size()];
+ for (int i = 0; i < actions.size(); i++) {
+ items[i] = new ActionContributionItem(actions.get(i));
+ }
+ return items;
+ }
+
+ public void initialize(IServiceLocator serviceLocator) {
+ fServiceLocator = serviceLocator;
+ }
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesPropertyTester.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesPropertyTester.java
new file mode 100644
index 00000000000..95459fa56c2
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/UpdateScopesPropertyTester.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
+import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Property tester for update scope information available through the given
+ * object. The object being tested should be either an {@link IVMContext},
+ * through which an instance of {@link ICachingVMProviderExtension} could be obtained.
+ * Or it could be an {@link IWorkbenchPart}, which is tested to see if it
+ * is a debug view through which a caching VM provider can be obtained.
+ * The Caching View Model provider is used to test the given property.
+ *
+ * Three properties are supported:
+ *
+ * - "areUpdateScopesSupported" - Checks whether update scopes are
+ * available at all given the receiver.
+ * - "isUpdateScopeAvailable" - Checks whether the update scope in the
+ * expected value is available for the given receiver.
+ * - "isUpdateScopeActive" - Checks whether the scope given in the expected
+ * value is the currently active scope for the given receiver.
+ *
+ *
+ */
+public class UpdateScopesPropertyTester extends PropertyTester {
+
+ private static final String SUPPORTED = "areUpdateScopesSupported"; //$NON-NLS-1$
+ private static final String AVAILABLE = "isUpdateScopeAvailable"; //$NON-NLS-1$
+ private static final String ACTIVE = "isUpdateScopeActive"; //$NON-NLS-1$
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof IVMContext) {
+ IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
+ if (provider instanceof ICachingVMProviderExtension) {
+ return testProvider((ICachingVMProviderExtension)provider, property, expectedValue);
+ }
+ } else if (receiver instanceof IDebugView) {
+ IVMProvider provider = VMCommandUtils.getVMProviderForPart((IDebugView)receiver);
+ if (provider instanceof ICachingVMProviderExtension) {
+ return testProvider((ICachingVMProviderExtension)provider, property, expectedValue);
+ }
+ }
+ return false;
+ }
+
+ private boolean testProvider(ICachingVMProviderExtension provider, String property, Object expectedValue) {
+ if (SUPPORTED.equals(property)) {
+ return true;
+ } else if (AVAILABLE.equals(property)) {
+ for (IVMUpdateScope scope : provider.getAvailableUpdateScopes()) {
+ if (scope.getID().equals(expectedValue)) {
+ return true;
+ }
+ return false;
+ }
+ } else if (ACTIVE.equals(property)) {
+ return expectedValue != null && expectedValue.equals(provider.getActiveUpdateScope().getID());
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java
deleted file mode 100644
index 072224493a4..00000000000
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
-
-import org.eclipse.dd.dsf.ui.viewmodel.update.VisibleUpdateScope;
-
-/**
- * @since 1.1
- */
-public class VisibleUpdateScopeAction extends SelectUpdateScopeAction {
-
- public VisibleUpdateScopeAction() {
- super(VisibleUpdateScope.VISIBLE_UPDATE_SCOPE_ID);
- }
-}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/messages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/messages.properties
new file mode 100644
index 00000000000..eb7f8f49e85
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2006, 2008 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Wind River Systems Inc - copied for non-restricted version for DSDP/DD/DSF
+###############################################################################
+
+UpdatePoliciesContribution_EmptyPoliciesList_label=No update policies available
+UpdateScopesContribution_EmptyScopesList_label=No update scopes available