From ee7f2cd0f01e952968df49cfe5ba1443cc229881 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Fri, 20 Jul 2007 23:24:38 +0000 Subject: [PATCH] Bugzilla 186010 & 196756 IFormattedValues.java Reorganized ordering of format ids. IDebugVMConstants.java Added location in Presentation context where the format id is stored. AbstractExpressionLAyoutNode.java cleanup warnings. AbstractSetFormatStyke.java New abstract implementation which deals with the format menu handling. FormattedValuePreferenceStore.java Default singleton preference storage implementation IFormattedValuePreferenceStore.java Changed interfaces to be presentation context id based. SetDefaultFormatBinary.java SetDefaultFormatOctal.java SetDefaultFormatHex.java SetDefaultFormatNatural.java Changed to use the new abstract implementation class All cell editors were changed to use the new preference storage interfaces. All VM providers were changed to use the default preference store. All Layout Nodes were changed to use the new prference store interfaces. RefreshActionDelegate.java RefreshAlwaysActionDelegate.java RefreshManualActionDelegate.java RefreshOnBreakActionDelegate.java Cleaned up warnings. VMCache.java VMCacheManager.java Cleaned up warnings. AbstractVMLayoutNode.java made getVMprovider method public IVMLayoutNode.java Added getVMProvider method AbstractVMProvider.java Added refresh() implementation IVMprovider.java Added refresh() method declaration Added getVMAdapter() method declaration AbstractDMVMproviderWithCache.java Cleanup warnings. FileLayoutNode.java Added getVMprovider implementation. --- .../debug/ui/viewmodel/IDebugVMConstants.java | 7 + .../expression/ExpressionVMProvider.java | 22 +- .../formatsupport/AbstractSetFormatStyle.java | 220 ++++++++++++++++++ .../FormattedValuePreferenceStore.java | 42 ++++ .../IFormattedValuePreferenceStore.java | 14 +- .../formatsupport/SetDefaultFormatBinary.java | 35 +-- .../formatsupport/SetDefaultFormatHex.java | 35 +-- .../SetDefaultFormatNatural.java | 35 +-- .../formatsupport/SetDefaultFormatOctal.java | 36 +-- .../RegisterBitFieldLayoutCellModifier.java | 37 ++- .../register/RegisterBitFieldLayoutNode.java | 3 +- .../register/RegisterLayoutNode.java | 62 +++-- .../RegisterLayoutValueCellModifier.java | 45 +++- .../register/RegisterVMProvider.java | 19 +- .../update/actions/RefreshActionDelegate.java | 8 +- .../actions/RefreshAlwaysActionDelegate.java | 12 +- .../actions/RefreshManualActionDelegate.java | 12 +- .../actions/RefreshOnBreakActionDelegate.java | 12 +- .../variable/VariableLayoutNode.java | 4 +- .../VariableLayoutValueCellModifier.java | 63 +++-- .../variable/VariableVMProvider.java | 26 +-- .../dsf/debug/service/IFormattedValues.java | 6 +- .../ui/viewmodel/AbstractVMLayoutNode.java | 2 +- .../dsf/ui/viewmodel/AbstractVMProvider.java | 27 +++ .../dd/dsf/ui/viewmodel/IVMLayoutNode.java | 5 +- .../dd/dsf/ui/viewmodel/IVMProvider.java | 11 + .../dm/AbstractDMVMProviderWithCache.java | 3 +- .../dd/dsf/ui/viewmodel/update/VMCache.java | 2 + .../ui/viewmodel/update/VMCacheManager.java | 3 +- 29 files changed, 544 insertions(+), 264 deletions(-) create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/AbstractSetFormatStyle.java create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/FormattedValuePreferenceStore.java diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/IDebugVMConstants.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/IDebugVMConstants.java index 3b0b9432139..e381f8d40b7 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/IDebugVMConstants.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/IDebugVMConstants.java @@ -3,6 +3,9 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel; import org.eclipse.dd.dsf.debug.ui.DsfDebugUIPlugin; public interface IDebugVMConstants { + /** + * Standard across the board column IDs. + */ public static final String ID = DsfDebugUIPlugin.PLUGIN_ID + ".VARIABLES_COLUMN_PRESENTATION_ID"; //$NON-NLS-1$ public static final String COLUMN_ID__NAME = DsfDebugUIPlugin.PLUGIN_ID + ".COLUMN_ID__NAME"; //$NON-NLS-1$ public static final String COLUMN_ID__TYPE = DsfDebugUIPlugin.PLUGIN_ID + ".COLUMN_ID__TYPE"; //$NON-NLS-1$ @@ -10,4 +13,8 @@ public interface IDebugVMConstants { public static final String COLUMN_ID__DESCRIPTION = DsfDebugUIPlugin.PLUGIN_ID + ".COLUMN_ID__DESCRIPTION"; //$NON-NLS-1$ public static final String COLUMN_ID__EXPRESSION = DsfDebugUIPlugin.PLUGIN_ID + ".COLUMN_ID__EXPRESSION"; //$NON-NLS-1$ + /** + * Location of the current format in the IPresentationContext data store. + */ + public final static String CURRENT_FORMAT_STORAGE = "CurrentNumericStyle" ; //$NON-NLS-1$ } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java index ae77ee808ae..b7e56356f52 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java @@ -10,9 +10,8 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.ui.viewmodel.expression; -import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.ui.viewmodel.dm.AbstractDebugDMVMProviderWithCache; -import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore; +import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.FormattedValuePreferenceStore; import org.eclipse.dd.dsf.debug.ui.viewmodel.register.RegisterGroupLayoutNode; import org.eclipse.dd.dsf.debug.ui.viewmodel.register.RegisterLayoutNode; import org.eclipse.dd.dsf.debug.ui.viewmodel.register.SyncRegisterDataAccess; @@ -34,11 +33,8 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont * */ @SuppressWarnings("restriction") -public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache - implements IExpressionsListener, IFormattedValuePreferenceStore +public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache implements IExpressionsListener { - private String fDefaultFormatId = IFormattedValues.HEX_FORMAT; - public static class ExpressionsChangedEvent { enum Type {ADDED, CHANGED, REMOVED} public final Type fType; @@ -82,7 +78,7 @@ public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache * The expression view wants to support fully all of the components of the register view. */ IExpressionLayoutNode registerGroupNode = new RegisterGroupLayoutNode(this, getSession(), syncRegDataAccess); - IVMLayoutNode registerNode = new RegisterLayoutNode(this, this, getSession(), syncRegDataAccess); + IVMLayoutNode registerNode = new RegisterLayoutNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), syncRegDataAccess); registerGroupNode.setChildNodes(new IVMLayoutNode[] { registerNode }); /* @@ -90,7 +86,9 @@ public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache * view comes in as a fully qualified expression so we go directly to the SubExpression layout * node. */ - IExpressionLayoutNode subExpressioNode = new VariableLayoutNode(this, this, getSession(), syncvarDataAccess); + IExpressionLayoutNode subExpressioNode = + + new VariableLayoutNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), syncvarDataAccess); /* * Tell the expression node which subnodes it will directly support. It is very important @@ -164,12 +162,4 @@ public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache public void expressionsRemoved(IExpression[] expressions) { handleEvent(new ExpressionsChangedEvent(ExpressionsChangedEvent.Type.REMOVED, expressions)); } - - public String getDefaultFormatId() { - return fDefaultFormatId; - } - - public void setDefaultFormatId(String id) { - fDefaultFormatId = id; - } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/AbstractSetFormatStyle.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/AbstractSetFormatStyle.java new file mode 100644 index 00000000000..6c481b6e325 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/AbstractSetFormatStyle.java @@ -0,0 +1,220 @@ +/******************************************************************************* + * Copyright (c) 2007 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.ui.viewmodel.formatsupport; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.dd.dsf.debug.service.IFormattedValues; +import org.eclipse.dd.dsf.debug.ui.viewmodel.IDebugVMConstants; +import org.eclipse.dd.dsf.ui.viewmodel.IVMAdapter; +import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode.DMVMContext; +import org.eclipse.debug.core.model.IDebugElement; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; +import org.eclipse.debug.ui.AbstractDebugView; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.contexts.DebugContextEvent; +import org.eclipse.debug.ui.contexts.IDebugContextListener; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewSite; + +@SuppressWarnings("restriction") +public class AbstractSetFormatStyle implements IViewActionDelegate, IDebugContextListener { + + /* + * Local private storage. + */ + private IViewPart fpart = null; + private Object fViewInput = null; + private IAction fAction = null; + + /* + * This routine is meant to be overidden so extenders of this class tell us what + * to use for the default. + */ + protected String getFormatStyle() { + return IFormattedValues.NATURAL_FORMAT; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) + */ + public void init(IViewPart view) { + /* + * Save the view information for later reference and data retrieval. + */ + fpart = view; + + /* + * Get the current selection from the DebugView so we can determine if we want this menu action to be live or not. + */ + IViewSite site = (IViewSite) view.getSite(); + String combinedViewId = site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$ + + DebugUITools.getDebugContextManager().getContextService(view.getSite().getWorkbenchWindow()).addPostDebugContextListener(this, combinedViewId); + ISelection sel = DebugUITools.getDebugContextManager().getContextService(view.getSite().getWorkbenchWindow()).getActiveContext(); + + if ( sel instanceof IStructuredSelection ) { + /* + * Save the view selection as well so we can later determine if we want our action to be valid or not. + */ + fViewInput = ( (IStructuredSelection) sel ).getFirstElement(); + } + } + + /* + * (non-Javadoc) + * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent) + */ + public void debugContextChanged(DebugContextEvent event) { + /* + * This handler is called whenever a selection in the debug view is changed. So here is + * where we will know when we need to reenable the menu actions. + */ + ISelection sel = event.getContext(); + + if (sel instanceof IStructuredSelection) { + fViewInput = ((IStructuredSelection)sel).getFirstElement(); + } + + /* + * Update the current state of affairs. + */ + update(); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + @SuppressWarnings("restriction") + public void run(IAction action) { + + /* + * Make sure we have a valid set of information. Otherwise we cannot go forward. + */ + if ( fpart instanceof AbstractDebugView && fViewInput != null ) + { + Viewer viewer = ( (AbstractDebugView) fpart).getViewer(); + + /* + * Now we need to make sure this is one of the Flexible Hierarchy viewws. + */ + if ( viewer instanceof TreeModelViewer ) { + /* + * Get the presentation context and see if there is a numeric property there. If so then this + * is a view implementation which supports changing the format. + */ + TreeModelViewer treeViewer = (TreeModelViewer) viewer; + IPresentationContext context = treeViewer.getPresentationContext(); + + /* + * Store the new style. So it will be picked up by the view when the view changes. + */ + context.setProperty( IDebugVMConstants.CURRENT_FORMAT_STORAGE, getFormatStyle() ); + + /* + * Now go tell the view to update. We do so by finding the VM provider for this view + * and telling it to redraw the entire view. + */ + if (fViewInput instanceof IAdaptable) { + IVMAdapter adapter = (IVMAdapter) ((IAdaptable)fViewInput).getAdapter(IVMAdapter.class); + + if ( adapter != null ) { + IVMProvider provider = adapter.getVMProvider(context); + + if ( provider != null ) { + /* + * "null" means redraw the entire view. + */ + provider.refresh( null ); + } + } + } + } + } + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + + /* + * Since we are creating a generic central handler ( "update" ). It needs to get the + * action information later. + */ + fAction = action; + + /* + * We need to what our input is. This will either be a selection from the debug view + * or something selected in our view. + */ + if (selection instanceof IStructuredSelection) { + + Object element = ( (IStructuredSelection) selection ).getFirstElement(); + + if ( element instanceof DMVMContext ) { fViewInput = element; } + else { + /* + * We deliberately do nothing here. A valid structured selection has already been + * selected. It comes from the Debug View and is a valid Debug Element. We do not + * want to overwrite it. + */ + } + + } else { + fViewInput = null; + } + update(); + } + + /* + * This is the common processing routine which is called from the various selection routines. + * Its job is to determine if we are valid for OCD and if so what is the proper execution dmc + * we should be operating on + */ + + private void update() { + + if ( fAction != null ) { + /* + * If the element is a debug view context selection then we want to be active since + * a possible OCD selection is there. We will let the connection type determine if + * we are active or not. + */ + if ( fViewInput instanceof IDebugElement ) + { + fAction.setEnabled(true); + } + else if ( fViewInput instanceof DMVMContext ) + { + fAction.setEnabled(true); + } + else { + /* + * It is not us and we will mark ourselves not available. Remember on reselection will + * will renable again. The Debug View change handler we have will deal with being moved + * back into the picture. + */ + fAction.setEnabled(false); + } + } + } +} + diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/FormattedValuePreferenceStore.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/FormattedValuePreferenceStore.java new file mode 100644 index 00000000000..0fb2f060a64 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/FormattedValuePreferenceStore.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2006 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.ui.viewmodel.formatsupport; + +import org.eclipse.dd.dsf.debug.service.IFormattedValues; +import org.eclipse.dd.dsf.debug.ui.viewmodel.IDebugVMConstants; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; + +/** + * Provides default implementation of preference storage. + */ +@SuppressWarnings("restriction") +public class FormattedValuePreferenceStore implements IFormattedValuePreferenceStore { + + private static IFormattedValuePreferenceStore fgSingletonReference; + + public static IFormattedValuePreferenceStore getDefault() { + if (fgSingletonReference == null) { + fgSingletonReference = new FormattedValuePreferenceStore(); + } + return fgSingletonReference; + } + + @SuppressWarnings("restriction") + public String getCurrentNumericFormat( IPresentationContext context ) { + + Object prop = context.getProperty( IDebugVMConstants.CURRENT_FORMAT_STORAGE ); + + if ( prop != null ) { + return (String) prop; + } + return IFormattedValues.NATURAL_FORMAT; + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/IFormattedValuePreferenceStore.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/IFormattedValuePreferenceStore.java index f7b14c4b33f..14af52bc5e7 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/IFormattedValuePreferenceStore.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/IFormattedValuePreferenceStore.java @@ -10,11 +10,19 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; + /** * */ + +@SuppressWarnings("restriction") public interface IFormattedValuePreferenceStore { - public String getDefaultFormatId(); - - public void setDefaultFormatId(String id); + /* + * Retrieves for the specified Presentation Context the configured format. + * + * @param context Specified Presentation Context + * @return Format ID. + */ + public String getCurrentNumericFormat( IPresentationContext context ); } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatBinary.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatBinary.java index f945ab4a8e0..d0af577d3f1 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatBinary.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatBinary.java @@ -11,37 +11,12 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -/** - * - */ -public class SetDefaultFormatBinary implements IViewActionDelegate { +@SuppressWarnings("restriction") +public class SetDefaultFormatBinary extends AbstractSetFormatStyle { - private IFormattedValueVMContext fFormattedValueVMC; - - public void init(IViewPart view) { + @Override + protected String getFormatStyle() { + return IFormattedValues.BINARY_FORMAT; } - - public void run(IAction action) { - if (fFormattedValueVMC != null) { - fFormattedValueVMC.getPreferenceStore().setDefaultFormatId(IFormattedValues.BINARY_FORMAT); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - fFormattedValueVMC = null; - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if (element instanceof IFormattedValueVMContext) { - fFormattedValueVMC = ((IFormattedValueVMContext)element); - } - } - action.setEnabled(fFormattedValueVMC != null); - } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatHex.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatHex.java index edfb9d85be9..3a34e7b9a92 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatHex.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatHex.java @@ -11,37 +11,12 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -/** - * - */ -public class SetDefaultFormatHex implements IViewActionDelegate { +@SuppressWarnings("restriction") +public class SetDefaultFormatHex extends AbstractSetFormatStyle { - private IFormattedValueVMContext fFormattedValueVMC; - - public void init(IViewPart view) { + @Override + protected String getFormatStyle() { + return IFormattedValues.HEX_FORMAT; } - - public void run(IAction action) { - if (fFormattedValueVMC != null) { - fFormattedValueVMC.getPreferenceStore().setDefaultFormatId(IFormattedValues.HEX_FORMAT); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - fFormattedValueVMC = null; - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if (element instanceof IFormattedValueVMContext) { - fFormattedValueVMC = ((IFormattedValueVMContext)element); - } - } - action.setEnabled(fFormattedValueVMC != null); - } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatNatural.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatNatural.java index 52498992215..6d42e9a7365 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatNatural.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatNatural.java @@ -11,37 +11,12 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -/** - * - */ -public class SetDefaultFormatNatural implements IViewActionDelegate { +@SuppressWarnings("restriction") +public class SetDefaultFormatNatural extends AbstractSetFormatStyle { - private IFormattedValueVMContext fFormattedValueVMC; - - public void init(IViewPart view) { + @Override + protected String getFormatStyle() { + return IFormattedValues.NATURAL_FORMAT; } - - public void run(IAction action) { - if (fFormattedValueVMC != null) { - fFormattedValueVMC.getPreferenceStore().setDefaultFormatId(IFormattedValues.NATURAL_FORMAT); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - fFormattedValueVMC = null; - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if (element instanceof IFormattedValueVMContext) { - fFormattedValueVMC = ((IFormattedValueVMContext)element); - } - } - action.setEnabled(fFormattedValueVMC != null); - } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatOctal.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatOctal.java index 67641c4d511..34f0f9b75f8 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatOctal.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/formatsupport/SetDefaultFormatOctal.java @@ -11,37 +11,13 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -/** - * - */ -public class SetDefaultFormatOctal implements IViewActionDelegate { +@SuppressWarnings("restriction") +public class SetDefaultFormatOctal extends AbstractSetFormatStyle { - private IFormattedValueVMContext fFormattedValueVMC; - - public void init(IViewPart view) { + @Override + protected String getFormatStyle() { + return IFormattedValues.OCTAL_FORMAT; } - - public void run(IAction action) { - if (fFormattedValueVMC != null) { - fFormattedValueVMC.getPreferenceStore().setDefaultFormatId(IFormattedValues.OCTAL_FORMAT); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - fFormattedValueVMC = null; - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if (element instanceof IFormattedValueVMContext) { - fFormattedValueVMC = ((IFormattedValueVMContext)element); - } - } - action.setEnabled(fFormattedValueVMC != null); - } - } + diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutCellModifier.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutCellModifier.java index 0fbe1911caa..ca6743d766a 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutCellModifier.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutCellModifier.java @@ -15,8 +15,11 @@ import org.eclipse.dd.dsf.debug.service.IRegisters.IMnemonic; import org.eclipse.dd.dsf.debug.ui.viewmodel.IDebugVMConstants; import org.eclipse.dd.dsf.debug.ui.viewmodel.expression.WatchExpressionCellModifier; import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore; +import org.eclipse.dd.dsf.ui.viewmodel.IVMContext; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +@SuppressWarnings("restriction") public class RegisterBitFieldLayoutCellModifier extends WatchExpressionCellModifier { public static enum BitFieldEditorStyle { NOTHING, BITFIELDCOMBO, BITFIELDTEXT } @@ -85,11 +88,25 @@ public class RegisterBitFieldLayoutCellModifier extends WatchExpressionCellModif if ( element != fElement ) return false; if ( fStyle == BitFieldEditorStyle.BITFIELDTEXT ) { - /* * We let the Model provider supply the current format. */ - String value = fDataAccess.getFormattedBitFieldValue(fElement, fFormatPrefStore.getDefaultFormatId()); + String formatId; + + if ( element instanceof IVMContext) { + /* + * Find the presentation context and then use it to get the current desired format. + */ + IVMContext ctx = (IVMContext) element; + IPresentationContext presCtx = ctx.getLayoutNode().getVMProvider().getPresentationContext(); + + formatId = fFormatPrefStore.getCurrentNumericFormat(presCtx); + } + else { + formatId = IFormattedValues.NATURAL_FORMAT; + } + + String value = fDataAccess.getFormattedBitFieldValue(fElement, formatId); if ( value == null ) { value = "..."; } //$NON-NLS-1$ @@ -132,7 +149,21 @@ public class RegisterBitFieldLayoutCellModifier extends WatchExpressionCellModif /* * We let the Model provider supply the current format. */ - fDataAccess.writeBitField(element, (String) value, IFormattedValues.HEX_FORMAT); + String formatId; + + if ( element instanceof IVMContext) { + /* + * Find the presentation context and then use it to get the current desired format. + */ + IVMContext ctx = (IVMContext) element; + IPresentationContext presCtx = ctx.getLayoutNode().getVMProvider().getPresentationContext(); + + formatId = fFormatPrefStore.getCurrentNumericFormat(presCtx); + } + else { + formatId = IFormattedValues.NATURAL_FORMAT; + } + fDataAccess.writeBitField(element, (String) value, formatId); } } else { diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutNode.java index ff4e6c98588..72ba3a00cdb 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterBitFieldLayoutNode.java @@ -185,7 +185,8 @@ public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode(getSession().getExecutor(), null) { @@ -200,7 +201,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode(getSession().getExecutor(), null) { - @Override - public void handleCompleted() { - if (!getStatus().isOK()) { - handleFailedUpdate(update); - return; - } - - /* - * Fill the label/column with the properly formatted data value. - */ - update.setLabel(getData().getFormattedValue(), labelIndex); - - // color based on change history - FormattedValueDMData oldData = (FormattedValueDMData) VMCacheManager.getVMCacheManager() - .getCache(RegisterLayoutNode.this.getVMProvider().getPresentationContext()) - .getArchivedModelData(valueDmc); - if(oldData != null && !oldData.getFormattedValue().equals(getData().getFormattedValue())) { - update.setBackground( - DebugUIPlugin.getPreferenceColor( - IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB(), - labelIndex); - } - update.done(); + VMCacheManager.getVMCacheManager().getCache( context ).getModelData(regService, + valueDmc, + new DataRequestMonitor(getSession().getExecutor(), null) { + @Override + public void handleCompleted() { + if (!getStatus().isOK()) { + handleFailedUpdate(update); + return; } - }, - getSession().getExecutor() + /* + * Fill the label/column with the properly formatted data value. + */ + update.setLabel(getData().getFormattedValue(), labelIndex); + + // color based on change history + FormattedValueDMData oldData = (FormattedValueDMData) VMCacheManager.getVMCacheManager() + .getCache(context).getArchivedModelData(valueDmc); + if(oldData != null && !oldData.getFormattedValue().equals(getData().getFormattedValue())) { + update.setBackground( + DebugUIPlugin.getPreferenceColor( + IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB(), + labelIndex); + } + update.done(); + } + }, + getSession().getExecutor() ); } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutValueCellModifier.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutValueCellModifier.java index f953b1f5124..d0e0f6a7d23 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutValueCellModifier.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutValueCellModifier.java @@ -10,16 +10,19 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.ui.viewmodel.register; - import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMContext; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMData; import org.eclipse.dd.dsf.debug.ui.viewmodel.IDebugVMConstants; import org.eclipse.dd.dsf.debug.ui.viewmodel.expression.WatchExpressionCellModifier; import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore; +import org.eclipse.dd.dsf.ui.viewmodel.IVMContext; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +@SuppressWarnings("restriction") public class RegisterLayoutValueCellModifier extends WatchExpressionCellModifier { private SyncRegisterDataAccess fDataAccess = null; @@ -83,9 +86,26 @@ public class RegisterLayoutValueCellModifier extends WatchExpressionCellModifier */ if ( IDebugVMConstants.COLUMN_ID__VALUE.equals(property) ) { /* - * Make sure we are working on the editable areas. + * We let the Model provider supply the current format. */ - String value = fDataAccess.getFormattedRegisterValue(element, fFormattedValuePreferenceStore.getDefaultFormatId()); + String formatId; + + if ( element instanceof IVMContext) { + /* + * Find the presentation context and then use it to get the current desired format. + */ + IVMContext ctx = (IVMContext) element; + IPresentationContext presCtx = ctx.getLayoutNode().getVMProvider().getPresentationContext(); + + formatId = fFormattedValuePreferenceStore.getCurrentNumericFormat(presCtx); + } + else { + formatId = IFormattedValues.NATURAL_FORMAT; + } + + String value = + + fDataAccess.getFormattedRegisterValue(element, formatId); if ( value == null ) { return "..."; } //$NON-NLS-1$ else { return value; } @@ -105,9 +125,24 @@ public class RegisterLayoutValueCellModifier extends WatchExpressionCellModifier if (value instanceof String) { /* - * PREFPAGE : We are using a default format until the preference page is created. + * We let the Model provider supply the current format. */ - fDataAccess.writeRegister(element, (String) value, fFormattedValuePreferenceStore.getDefaultFormatId()); + String formatId; + + if ( element instanceof IVMContext) { + /* + * Find the presentation context and then use it to get the current desired format. + */ + IVMContext ctx = (IVMContext) element; + IPresentationContext presCtx = ctx.getLayoutNode().getVMProvider().getPresentationContext(); + + formatId = fFormattedValuePreferenceStore.getCurrentNumericFormat(presCtx); + } + else { + formatId = IFormattedValues.NATURAL_FORMAT; + } + + fDataAccess.writeRegister(element, (String) value, formatId); } } else { super.modify(element, property, value); diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterVMProvider.java index 704ec332c13..f2b0b6bf103 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterVMProvider.java @@ -10,9 +10,8 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.ui.viewmodel.register; -import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.ui.viewmodel.dm.AbstractDebugDMVMProviderWithCache; -import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore; +import org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.FormattedValuePreferenceStore; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode; @@ -25,13 +24,11 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont * Provides the VIEW MODEL for the DEBUG MODEL REGISTER view. */ @SuppressWarnings("restriction") -public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache implements IFormattedValuePreferenceStore +public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache { /* * Current default for register formatting. */ - private String fDefaultFormatId = IFormattedValues.HEX_FORMAT; - public RegisterVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) { super(adapter, context, session); @@ -54,13 +51,13 @@ public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache imple /* * Create the next level which is the registers themselves. */ - IVMLayoutNode registerNode = new RegisterLayoutNode(this, this, getSession(), regAccess); + IVMLayoutNode registerNode = new RegisterLayoutNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), regAccess); registerGroupNode.setChildNodes(new IVMLayoutNode[] { registerNode }); /* * Create the next level which is the bitfield level. */ - IVMLayoutNode bitFieldNode = new RegisterBitFieldLayoutNode(this, this, getSession(), regAccess); + IVMLayoutNode bitFieldNode = new RegisterBitFieldLayoutNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), regAccess); registerNode.setChildNodes(new IVMLayoutNode[] { bitFieldNode }); /* @@ -78,12 +75,4 @@ public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache imple public String getColumnPresentationId(IPresentationContext context, Object element) { return RegisterColumnPresentation.ID; } - - public String getDefaultFormatId() { - return fDefaultFormatId; - } - - public void setDefaultFormatId(String id) { - fDefaultFormatId = id; - } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshActionDelegate.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshActionDelegate.java index f75643f824e..ac227900b5c 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshActionDelegate.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshActionDelegate.java @@ -19,6 +19,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; +@SuppressWarnings("restriction") public class RefreshActionDelegate implements IViewActionDelegate { protected IViewPart fView; @@ -32,13 +33,10 @@ protected IViewPart fView; } public void selectionChanged(IAction action, ISelection selection) { - } - private Object getContext() + private Object getContext() { - return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()) - .getPresentationContext(); + return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()).getPresentationContext(); } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshAlwaysActionDelegate.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshAlwaysActionDelegate.java index 8dfe0d5dd87..7ad9dbb6278 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshAlwaysActionDelegate.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshAlwaysActionDelegate.java @@ -17,18 +17,18 @@ import org.eclipse.dd.dsf.ui.viewmodel.update.actions.AbstractRefreshActionDeleg import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; import org.eclipse.debug.ui.AbstractDebugView; +@SuppressWarnings("restriction") public class RefreshAlwaysActionDelegate extends AbstractRefreshActionDelegate { - - public Object getContext() + @Override + public Object getContext() { - return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()) - .getPresentationContext(); + return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()).getPresentationContext(); } - public VMCache createCache() + @Override + public VMCache createCache() { return new VMCacheRefreshAlways(); } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshManualActionDelegate.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshManualActionDelegate.java index 0b442de2ae6..5a70cb5bac6 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshManualActionDelegate.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshManualActionDelegate.java @@ -17,18 +17,18 @@ import org.eclipse.dd.dsf.ui.viewmodel.update.actions.AbstractRefreshActionDeleg import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; import org.eclipse.debug.ui.AbstractDebugView; +@SuppressWarnings("restriction") public class RefreshManualActionDelegate extends AbstractRefreshActionDelegate { - - public Object getContext() + @Override + public Object getContext() { - return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()) - .getPresentationContext(); + return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()).getPresentationContext(); } - public VMCache createCache() + @Override + public VMCache createCache() { return new VMCacheRefreshManual(); } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshOnBreakActionDelegate.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshOnBreakActionDelegate.java index d4c4d9a0e2b..21addc0a634 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshOnBreakActionDelegate.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/update/actions/RefreshOnBreakActionDelegate.java @@ -17,18 +17,18 @@ import org.eclipse.dd.dsf.ui.viewmodel.update.actions.AbstractRefreshActionDeleg import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; import org.eclipse.debug.ui.AbstractDebugView; +@SuppressWarnings("restriction") public class RefreshOnBreakActionDelegate extends AbstractRefreshActionDelegate { - - public Object getContext() + @Override + public Object getContext() { - return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()) - .getPresentationContext(); + return ((TreeModelViewer) ((AbstractDebugView) fView).getViewer()).getPresentationContext(); } - public VMCache createCache() + @Override + public VMCache createCache() { return new VMCacheRefreshOnBreak(); } - } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java index cfb10c32299..89440bdd65e 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java @@ -297,8 +297,8 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode extends IDMContext {} @@ -30,8 +30,8 @@ public interface IFormattedValues extends IDMService { */ public final static String HEX_FORMAT = "HEX.Format" ; //$NON-NLS-1$ public final static String OCTAL_FORMAT = "OCTAL.Format" ; //$NON-NLS-1$ - public final static String BINARY_FORMAT = "BINARY.Format" ; //$NON-NLS-1$ public final static String NATURAL_FORMAT = "NATURAL.Format" ; //$NON-NLS-1$ + public final static String BINARY_FORMAT = "BINARY.Format" ; //$NON-NLS-1$ /** * Retrieves the available formats that the given data is available in. @@ -90,7 +90,7 @@ public interface IFormattedValues extends IDMService { @Override public String toString() { - return super.toString() + ".format(" + getFormatID() + ")"; + return super.toString() + ".format(" + getFormatID() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java index 37024d81c3a..0542927d929 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java @@ -60,7 +60,7 @@ abstract public class AbstractVMLayoutNode implements IVMLayoutNode { return fProvider.getExecutor(); } - protected AbstractVMProvider getVMProvider() { + public IVMProvider getVMProvider() { return fProvider; } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java index b9c33513651..8bdec75ce00 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java @@ -139,6 +139,33 @@ abstract public class AbstractVMProvider implements IVMProvider fRootLayoutNodeRef.get().dispose(); } } + + /** + * Allows other subsystems to force the layout mode associated with the specified + * VM context to refresh. If null is passed then the RootLayoutNode is told to refresh. + */ + public void refresh(final IVMContext element) { + try { + getExecutor().execute(new Runnable() { + public void run() { + if (isDisposed()) return; + + if ( element == null ) { + VMDelta rootDelta = new VMDelta(getRootElement(), IModelDelta.CONTENT); + getModelProxy().fireModelChangedNonDispatch(rootDelta); + } + else { + VMDelta elementDelta = new VMDelta(element, IModelDelta.CONTENT); + getModelProxy().fireModelChangedNonDispatch(elementDelta); + } + + }}); + } catch (RejectedExecutionException e) { + // Ignore. This exception could be thrown if the provider is being + // shut down. + } + return; + } protected boolean isDisposed() { return fDisposed; diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMLayoutNode.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMLayoutNode.java index d21487c7192..fc0ce2ae030 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMLayoutNode.java @@ -33,6 +33,10 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; @SuppressWarnings("restriction") public interface IVMLayoutNode { + /** + * Retrieves the associated VM Provider. + */ + public IVMProvider getVMProvider(); /** * Retrieves information whether for a given path in the viewer, @@ -56,7 +60,6 @@ public interface IVMLayoutNode */ public void updateElementCount(IChildrenCountUpdate update); - /** * Retrieves the element objects of this node for the given path in the * viewer, and for the given range of indexes.
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMProvider.java index 1e96b5b81ee..66fcaa216a0 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMProvider.java @@ -16,6 +16,11 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont public interface IVMProvider extends IElementContentProvider, IModelProxyFactory, IColumnPresentationFactory { + /** + * Returns the VM Adapter associated with the provider. + */ + public IVMAdapter getVMAdapter(); + /** * Returns the root layout node that is configured in this provider. * It may return null, if a root node is not yet configured. @@ -37,6 +42,12 @@ public interface IVMProvider */ public IPresentationContext getPresentationContext(); + /** + * Allows other subsystems to force the layout mode associated with the specified + * VM context to refresh. If null is passed then the RootLayoutNode is told to refresh. + */ + public void refresh(IVMContext element); + /** * Cleans up the resources associated with this provider. */ diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/dm/AbstractDMVMProviderWithCache.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/dm/AbstractDMVMProviderWithCache.java index e8348bbc935..be6e704df7e 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/dm/AbstractDMVMProviderWithCache.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/dm/AbstractDMVMProviderWithCache.java @@ -23,6 +23,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; +@SuppressWarnings("restriction") public abstract class AbstractDMVMProviderWithCache extends AbstractDMVMProvider implements VMCacheManager.CacheListener { @@ -39,7 +40,7 @@ public abstract class AbstractDMVMProviderWithCache extends AbstractDMVMProvider getModelProxy().fireModelChanged(new ModelDelta(getRootElement(),IModelDelta.CONTENT)); } - public AbstractDMVMProviderWithCache(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) { + public AbstractDMVMProviderWithCache(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) { super(adapter, presentationContext, session); VMCacheManager.getVMCacheManager().addCacheListener(getPresentationContext(), this); diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java index d6b7d60dc9e..2635efb6ba7 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java @@ -33,6 +33,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpd import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; +@SuppressWarnings("restriction") public abstract class VMCache { protected Executor fExecutor = new DefaultDsfExecutor(); @@ -323,6 +324,7 @@ public abstract class VMCache return fDataArchive.get(dmc); } + @SuppressWarnings("unchecked") public abstract void handleEvent(IDMEvent event); } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCacheManager.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCacheManager.java index 3b612df1ad9..ecbb5270141 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCacheManager.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCacheManager.java @@ -47,7 +47,8 @@ public class VMCacheManager if(!fAssociations.containsKey(context)) fAssociations.put(context, new VMCache() { - @Override + @SuppressWarnings("unchecked") + @Override public void handleEvent(IDMEvent event) { }