mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-19 14:15:50 +02:00
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.
This commit is contained in:
parent
651bb074fb
commit
ee7f2cd0f0
29 changed files with 544 additions and 264 deletions
|
@ -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$
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -185,7 +185,8 @@ public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode<IBi
|
|||
* page format is supported by the register service. If the format is not supported then
|
||||
* we will pick the first available format.
|
||||
*/
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getDefaultFormatId();
|
||||
final IPresentationContext context = update.getPresentationContext();
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getCurrentNumericFormat(context) ;
|
||||
|
||||
regService.getAvailableFormattedValues(
|
||||
dmc,
|
||||
|
|
|
@ -153,7 +153,6 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
|
|||
}
|
||||
}
|
||||
|
||||
// private WatchExpressionCellModifier fWatchExpressionCellModifier = new WatchExpressionCellModifier();
|
||||
final protected RegisterExpressionFactory fRegisterExpressionFactory = new RegisterExpressionFactory();
|
||||
final private SyncRegisterDataAccess fSyncRegisterDataAccess;
|
||||
private final IFormattedValuePreferenceStore fFormattedPrefStore;
|
||||
|
@ -184,8 +183,10 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
|
|||
* page format is supported by the register service. If the format is not supported then
|
||||
* we will pick the first available format.
|
||||
*/
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getDefaultFormatId();
|
||||
|
||||
final IPresentationContext context = update.getPresentationContext();
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getCurrentNumericFormat(context) ;
|
||||
|
||||
regService.getAvailableFormattedValues(
|
||||
dmc,
|
||||
new DataRequestMonitor<String[]>(getSession().getExecutor(), null) {
|
||||
|
@ -200,7 +201,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
|
|||
* See if the desired format is supported.
|
||||
*/
|
||||
String[] formatIds = getData();
|
||||
String finalFormatId = IFormattedValues.HEX_FORMAT;
|
||||
String finalFormatId = IFormattedValues.NATURAL_FORMAT;
|
||||
boolean requestedFormatIsSupported = false;
|
||||
|
||||
for ( String fId : formatIds ) {
|
||||
|
@ -236,36 +237,33 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
|
|||
*/
|
||||
final FormattedValueDMContext valueDmc = regService.getFormattedValue(dmc, finalFormatId);
|
||||
|
||||
VMCacheManager.getVMCacheManager().getCache(RegisterLayoutNode.this.getVMProvider().getPresentationContext())
|
||||
.getModelData(regService,
|
||||
valueDmc,
|
||||
new DataRequestMonitor<FormattedValueDMData>(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<FormattedValueDMData>(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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -297,8 +297,8 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
|
|||
* page format is supported by the register service. If the format is not supported then
|
||||
* we will pick the first available format.
|
||||
*/
|
||||
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getDefaultFormatId();
|
||||
final IPresentationContext context = update.getPresentationContext();
|
||||
final String preferencePageFormatId = fFormattedPrefStore.getCurrentNumericFormat(context) ;
|
||||
|
||||
expressionService.getAvailableFormattedValues(
|
||||
dmc,
|
||||
|
|
|
@ -7,19 +7,23 @@
|
|||
package org.eclipse.dd.dsf.debug.ui.viewmodel.variable;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
|
||||
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||
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.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class VariableLayoutValueCellModifier extends WatchExpressionCellModifier {
|
||||
|
||||
private SyncVariableDataAccess fDataAccess = null;
|
||||
private IFormattedValuePreferenceStore fFormattedValuePreferenceStore;
|
||||
private IFormattedValuePreferenceStore fPrefStore;
|
||||
|
||||
public VariableLayoutValueCellModifier(IFormattedValuePreferenceStore formattedValuePreferenceStore, SyncVariableDataAccess access) {
|
||||
fDataAccess = access;
|
||||
fFormattedValuePreferenceStore = formattedValuePreferenceStore;
|
||||
fPrefStore = formattedValuePreferenceStore;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -55,16 +59,29 @@ public class VariableLayoutValueCellModifier extends WatchExpressionCellModifier
|
|||
// the watch expression.
|
||||
|
||||
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 formatId;
|
||||
|
||||
// Write the value in the currently requested format. Since they could
|
||||
// have freeformed typed in any format this is just a guess and may not
|
||||
// really accomplish anything.
|
||||
|
||||
String value = fDataAccess.getFormattedValue(element, fFormattedValuePreferenceStore.getDefaultFormatId());
|
||||
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 = fPrefStore.getCurrentNumericFormat(presCtx);
|
||||
}
|
||||
else {
|
||||
formatId = IFormattedValues.NATURAL_FORMAT;
|
||||
}
|
||||
|
||||
if (value == null)
|
||||
String value = fDataAccess.getFormattedValue(element, formatId);
|
||||
|
||||
if (value == null) {
|
||||
return "..."; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -74,13 +91,31 @@ public class VariableLayoutValueCellModifier extends WatchExpressionCellModifier
|
|||
|
||||
@Override
|
||||
public void modify(Object element, String property, Object value) {
|
||||
// If we're in the column value, modify the register data. Otherwise, call the super-class to edit
|
||||
// the watch expression.
|
||||
|
||||
/*
|
||||
* If we're in the column value, modify the register data. Otherwise, call the super-class to edit
|
||||
* the watch expression.
|
||||
*/
|
||||
if (IDebugVMConstants.COLUMN_ID__VALUE.equals(property)) {
|
||||
if (value instanceof String) {
|
||||
// PREFPAGE : We are using a default format until the preference page is created.
|
||||
fDataAccess.writeVariable(element, (String) value, fFormattedValuePreferenceStore.getDefaultFormatId());
|
||||
/*
|
||||
* We let the Model provider supply the current 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 = fPrefStore.getCurrentNumericFormat(presCtx);
|
||||
}
|
||||
else {
|
||||
formatId = IFormattedValues.NATURAL_FORMAT;
|
||||
}
|
||||
|
||||
fDataAccess.writeVariable(element, (String) value, formatId);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
*/
|
||||
package org.eclipse.dd.dsf.debug.ui.viewmodel.variable;
|
||||
|
||||
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;
|
||||
|
@ -21,10 +20,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentati
|
|||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache implements
|
||||
IColumnPresentationFactory, IFormattedValuePreferenceStore {
|
||||
|
||||
private String defaultFormatId = IFormattedValues.NATURAL_FORMAT;
|
||||
public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache implements IColumnPresentationFactory {
|
||||
|
||||
public VariableVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) {
|
||||
super(adapter, context, session);
|
||||
|
@ -42,7 +38,7 @@ public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache imple
|
|||
/*
|
||||
* Create the next level which represents members of structs/unions/enums and elements of arrays.
|
||||
*/
|
||||
IVMLayoutNode subExpressioNode = new VariableLayoutNode(this, this, getSession(), varAccess);
|
||||
IVMLayoutNode subExpressioNode = new VariableLayoutNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), varAccess);
|
||||
debugViewSelection.setChildNodes(new IVMLayoutNode[] { subExpressioNode });
|
||||
|
||||
/*
|
||||
|
@ -60,20 +56,4 @@ public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache imple
|
|||
public String getColumnPresentationId(IPresentationContext context, Object element) {
|
||||
return VariableColumnPresentation.ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore#getDefaultFormatId()
|
||||
*/
|
||||
public String getDefaultFormatId() {
|
||||
return defaultFormatId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport.IFormattedValuePreferenceStore#setDefaultFormatId(java.lang.String)
|
||||
*/
|
||||
public void setDefaultFormatId(String id) {
|
||||
defaultFormatId = id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.dd.dsf.datamodel.IDMData;
|
|||
import org.eclipse.dd.dsf.datamodel.IDMService;
|
||||
|
||||
public interface IFormattedValues extends IDMService {
|
||||
|
||||
|
||||
/** Marker interface for a DMC that has a formatted value. */
|
||||
public interface IFormattedDataDMContext<V extends IDMData> extends IDMContext<V> {}
|
||||
|
||||
|
@ -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$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ abstract public class AbstractVMLayoutNode implements IVMLayoutNode {
|
|||
return fProvider.getExecutor();
|
||||
}
|
||||
|
||||
protected AbstractVMProvider getVMProvider() {
|
||||
public IVMProvider getVMProvider() {
|
||||
return fProvider;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. <br>
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue