diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties index 75d65467351..a505ceb758f 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties +++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties @@ -36,6 +36,14 @@ action.breakpointHitUpdatePolicy.label = Breakpoint Hit action.manualUpdatePolicy.label = Manual action.automaticUpdatePolicy.label = Automatic +menu.updatePolicyAtomic = Updates Atomic +action.updatePolicyAtomic.label = Delay run control until updates are complete +action.updatePolicyNotAtomic.label = Do NOT Delay run control until updates are complete + +menu.updateScope = Update Scope +action.visibleUpdateScope.label = Visible +action.allUpdateScope.label = Expanded + menu.numberFormat = Number Format action.setDefaultNumberFormatHex.label = Hex action.setDefaultNumberFormatDecimal.label = Decimal @@ -43,6 +51,6 @@ action.setDefaultNumberFormatOctal.label = Octal action.setDefaultNumberFormatBinary.label = Binary action.setDefaultNumberFormatNatural.label = Natural -preferencePage.name = DSF Debugging +preferencePage.name = DSF Performance action.expandStack.label = E&xpand Stack diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml index a168f3456b2..e65f4a8826b 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml +++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml @@ -114,6 +114,26 @@ style="radio"> + + + + + + @@ -142,6 +162,9 @@ state="true" style="radio"> + + + @@ -201,6 +224,25 @@ style="radio"> + + + + + + @@ -289,6 +331,26 @@ style="radio"> + + + + + + @@ -351,7 +413,29 @@ menubarPath="updatePolicy/additions" state="true" style="radio"> - + + + + + + + + + + diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java index 75a5fea790c..411420ea772 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java @@ -36,8 +36,8 @@ public class AbstractDebugVMAdapter extends AbstractDMVMAdapter } private SteppingController fController; - - @Override + + @Override protected IVMProvider createViewModelProvider(IPresentationContext context) { return null; } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/expression/ExpressionVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/expression/ExpressionVMProvider.java index bb310cb6df0..4d645756da7 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/expression/ExpressionVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/expression/ExpressionVMProvider.java @@ -31,6 +31,8 @@ import org.eclipse.dd.dsf.debug.service.ICachingService; import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent; +import org.eclipse.dd.dsf.debug.ui.DsfDebugUITools; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; @@ -51,6 +53,7 @@ import org.eclipse.debug.internal.core.IExpressionsListener2; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.TreePath; @@ -95,6 +98,15 @@ public class ExpressionVMProvider extends AbstractDMVMProvider DebugPlugin.getDefault().getExpressionManager().addExpressionListener(this); configureLayout(); + + final IPreferenceStore store = DsfDebugUITools.getPreferenceStore(); + store.addPropertyChangeListener(new IPropertyChangeListener() + { + public void propertyChange(PropertyChangeEvent event) { + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); + } + }); + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); } @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMProvider.java index 873cdb850d7..c3237f89b68 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMProvider.java @@ -22,6 +22,8 @@ import org.eclipse.dd.dsf.debug.service.ICachingService; import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent; +import org.eclipse.dd.dsf.debug.ui.DsfDebugUITools; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; @@ -36,6 +38,7 @@ import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; @@ -86,6 +89,15 @@ public class RegisterVMProvider extends AbstractDMVMProvider * Now set this schema set as the layout set. */ setRootNode(rootNode); + + final IPreferenceStore store = DsfDebugUITools.getPreferenceStore(); + store.addPropertyChangeListener(new IPropertyChangeListener() + { + public void propertyChange(PropertyChangeEvent event) { + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); + } + }); + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); } /* diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java new file mode 100644 index 00000000000..975ab009107 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AllUpdateScopeAction.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions; + +import org.eclipse.dd.dsf.ui.viewmodel.update.AllUpdateScope; + +/** + * + */ +public class AllUpdateScopeAction extends SelectUpdateScopeAction { + + public AllUpdateScopeAction() { + super(AllUpdateScope.ALL_UPDATE_SCOPE_ID); + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AtomicUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AtomicUpdatePolicyAction.java new file mode 100644 index 00000000000..00417c8e6ed --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/AtomicUpdatePolicyAction.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ + +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions; + +import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate; +import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; + +public class AtomicUpdatePolicyAction extends AbstractVMProviderActionDelegate { + + private final static String ATOMIC_UPDATE = "ATOMIC_UPDATE"; + + public void run(IAction action) { + DsfDebugUIPlugin.getDefault().getPreferenceStore().setValue(ATOMIC_UPDATE, "true"); + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + super.selectionChanged(action, selection); + + this.getAction().setChecked(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(ATOMIC_UPDATE)); + + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/NonAtomicUpdatePolicyAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/NonAtomicUpdatePolicyAction.java new file mode 100644 index 00000000000..b247e880f3a --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/NonAtomicUpdatePolicyAction.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ + +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions; + +import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate; +import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; + +public class NonAtomicUpdatePolicyAction extends AbstractVMProviderActionDelegate { + +private final static String ATOMIC_UPDATE = "ATOMIC_UPDATE"; + + public void run(IAction action) { + DsfDebugUIPlugin.getDefault().getPreferenceStore().setValue(ATOMIC_UPDATE, "false"); + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + super.selectionChanged(action, selection); + + getAction().setChecked(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(ATOMIC_UPDATE)); + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java new file mode 100644 index 00000000000..92be7f9238b --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/SelectUpdateScopeAction.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2007, 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions; + +import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate; +import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope; +import org.eclipse.debug.ui.contexts.DebugContextEvent; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewPart; + +/** + * + */ +public class SelectUpdateScopeAction extends AbstractVMProviderActionDelegate { + + private final String fUpdateScopeId; + + public SelectUpdateScopeAction(String policyId) { + fUpdateScopeId = policyId; + } + + protected String getUpdateScopeId() { + return fUpdateScopeId; + } + + @Override + public void init(IViewPart view) { + super.init(view); + update(); + } + + public void run(IAction action) { + if(action.isChecked()) + { + IVMProvider provider = getVMProvider(); + if (provider instanceof ICachingVMProvider) { + ICachingVMProvider cachingProvider = (ICachingVMProvider)provider; + IVMUpdateScope policy = getScopeFromProvider(cachingProvider, getUpdateScopeId()); + if (policy != null) { + cachingProvider.setActiveUpdateScope(policy); + } + } + } + } + + private IVMUpdateScope getScopeFromProvider(ICachingVMProvider provider, String id) { + for (IVMUpdateScope policy : provider.getAvailableUpdateScopes()) { + if (policy.getID().equals(id)) { + return policy; + } + } + return null; + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + super.selectionChanged(action, selection); + update(); + } + + @Override + public void debugContextChanged(DebugContextEvent event) { + super.debugContextChanged(event); + update(); + } + + protected void update() { + IVMProvider provider = getVMProvider(); + if (provider instanceof ICachingVMProvider) { + getAction().setEnabled(true); + IVMUpdateScope activeScope = ((ICachingVMProvider)provider).getActiveUpdateScope(); + getAction().setChecked( activeScope != null && getUpdateScopeId().equals(activeScope.getID()) ); + } else { + getAction().setEnabled(false); + } + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java new file mode 100644 index 00000000000..e916c52142a --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/actions/VisibleUpdateScopeAction.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions; + +import org.eclipse.dd.dsf.ui.viewmodel.update.VisibleUpdateScope; + +/** + * + */ +public class VisibleUpdateScopeAction extends SelectUpdateScopeAction { + + public VisibleUpdateScopeAction() { + super(VisibleUpdateScope.VISIBLE_UPDATE_SCOPE_ID); + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMProvider.java index f6e97995be9..cacc95a7188 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMProvider.java @@ -19,6 +19,8 @@ import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; import org.eclipse.dd.dsf.debug.service.ICachingService; import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent; +import org.eclipse.dd.dsf.debug.ui.DsfDebugUITools; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; @@ -32,6 +34,7 @@ import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; @@ -65,6 +68,15 @@ public class VariableVMProvider extends AbstractDMVMProvider // Configure the sub-expression node to be a child of itself. This way the content // provider will recursively drill-down the variable hierarchy. addChildNodes(subExpressioNode, new IVMNode[] { subExpressioNode }); + + final IPreferenceStore store = DsfDebugUITools.getPreferenceStore(); + store.addPropertyChangeListener(new IPropertyChangeListener() + { + public void propertyChange(PropertyChangeEvent event) { + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); + } + }); + setAtomicUpdate(store.getBoolean(IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE)); } @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java index 4adfb0ca938..d17f1930425 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java @@ -94,6 +94,15 @@ public class DsfDebugPreferencePage extends FieldEditorPreferencePage implements minIntervalEditor.setValidRange(0, 10000); minIntervalEditor.fillIntoGrid(performanceGroup, 3); addField(minIntervalEditor); + + // atomic update + BooleanFieldEditor atomicUpdateEditor = new BooleanFieldEditor( + IDsfDebugUIConstants.PREF_ATOMIC_UPDATE_ENABLE, + MessagesForPreferences.DsfDebugPreferencePage_atomicUpdate_label, + performanceGroup); + + atomicUpdateEditor.fillIntoGrid(performanceGroup, 3); + addField(atomicUpdateEditor); // need to set layout again performanceGroup.setLayout(groupLayout); diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/MessagesForPreferences.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/MessagesForPreferences.java index bd38bb58f43..4a84f9d573b 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/MessagesForPreferences.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/MessagesForPreferences.java @@ -25,6 +25,8 @@ class MessagesForPreferences extends NLS { public static String DsfDebugPreferencePage_performanceGroup_label; public static String DsfDebugPreferencePage_syncStepping_label; + + public static String DsfDebugPreferencePage_atomicUpdate_label; static { // initialize resource bundle diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/messages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/messages.properties index 225e6b1fe2d..627e0b9d3cd 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/messages.properties +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/preferences/messages.properties @@ -14,3 +14,4 @@ DsfDebugPreferencePage_limitStackFrames_label=Limit number of stack frames to DsfDebugPreferencePage_minStepInterval_label=Minimum interval between steps (in milliseconds) DsfDebugPreferencePage_performanceGroup_label=Performance DsfDebugPreferencePage_syncStepping_label=Synchronize stepping speed with UI updates +DsfDebugPreferencePage_atomicUpdate_label=Atomic Update \ No newline at end of file diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/DsfDebugUITools.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/DsfDebugUITools.java new file mode 100644 index 00000000000..6d44924a626 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/DsfDebugUITools.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ + +package org.eclipse.dd.dsf.debug.ui; + +import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.jface.preference.IPreferenceStore; + +public class DsfDebugUITools { + + public static IPreferenceStore getPreferenceStore() + { + return DsfDebugUIPlugin.getDefault().getPreferenceStore(); + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/IDsfDebugUIConstants.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/IDsfDebugUIConstants.java index 57df777d292..823507feea2 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/IDsfDebugUIConstants.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/IDsfDebugUIConstants.java @@ -88,6 +88,13 @@ public interface IDsfDebugUIConstants { * @since 1.1 */ public static final String PREF_MIN_STEP_INTERVAL= "minStepInterval"; //$NON-NLS-1$ + + /** + * Boolean preference whether to wait for view update before continuing run control requests + * + * @since 1.1 + */ + public static final String PREF_ATOMIC_UPDATE_ENABLE = "atomicUpdateEnable"; //$NON-NLS-1$ /** * Help prefixes. diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMAdapter.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMAdapter.java index 0e07e4d4a20..c11105f0dc6 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMAdapter.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMAdapter.java @@ -333,7 +333,7 @@ abstract public class AbstractVMAdapter implements IVMAdapter */ @ThreadSafe abstract protected IVMProvider createViewModelProvider(IPresentationContext context); - + /** * Dispatch given event to VM providers interested in events. * diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java index 47acd1beb6d..8acb4ae10b9 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java @@ -52,7 +52,7 @@ import org.eclipse.jface.viewers.Viewer; */ @ConfinedToDsfExecutor("#getProvider()#getExecutor()") @SuppressWarnings("restriction") -public class DefaultVMModelProxyStrategy implements IVMModelProxy { +public class DefaultVMModelProxyStrategy implements IVMModelProxy, IVMModelProxyExtension { private final AbstractVMProvider fProvider; private final Object fRootElement; @@ -103,6 +103,14 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy { return fRootElement; } + public Object getViewerInput() { + return fRootElement; + } + + public TreePath getRootPath() { + return TreePath.EMPTY; + } + /** * Notifies registered listeners of the given delta. * @@ -230,7 +238,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy { * * @return viewer or null if not installed */ - protected Viewer getViewer() { + public Viewer getViewer() { return fViewer; } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxyExtension.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxyExtension.java new file mode 100644 index 00000000000..ab4ada03766 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxyExtension.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2007, 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.ui.viewmodel; + +import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.Viewer; + +/** + * View Model extension to IVMModelProxy interface. This extension + * allows access to the viewer. + */ +public interface IVMModelProxyExtension extends IVMModelProxy { + + /** + * Returns the viewer. + */ + public Viewer getViewer(); + + /** + * Returns the viewer input that was set to the viewer when this proxy + * was created. + */ + public Object getViewerInput(); + + /** + * Returns the full path for the root element. If the path is empty, it + * means that the root element is the viewer input. + * @return + */ + public TreePath getRootPath(); +} diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java index 50fff44089b..faf3cd68a92 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.Executor; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.dd.dsf.concurrent.CountingRequestMonitor; @@ -34,6 +35,7 @@ import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; import org.eclipse.dd.dsf.ui.viewmodel.IVMModelProxy; +import org.eclipse.dd.dsf.ui.viewmodel.IVMModelProxyExtension; import org.eclipse.dd.dsf.ui.viewmodel.IVMNode; import org.eclipse.dd.dsf.ui.viewmodel.VMChildrenCountUpdate; import org.eclipse.dd.dsf.ui.viewmodel.VMChildrenUpdate; @@ -41,20 +43,30 @@ import org.eclipse.dd.dsf.ui.viewmodel.VMHasChildrenUpdate; import org.eclipse.dd.dsf.ui.viewmodel.properties.IElementPropertiesProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; /** * Base implementation of a caching view model provider. */ @SuppressWarnings("restriction") -public class AbstractCachingVMProvider extends AbstractVMProvider implements ICachingVMProvider { +public class AbstractCachingVMProvider extends AbstractVMProvider implements ICachingVMProvider, ICachingVMProviderExtension { + private boolean fIsAtomicUpdate = false; + // debug flags public static boolean DEBUG_CACHE = false; @@ -293,8 +305,10 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa } protected static String SELECTED_UPDATE_MODE = "org.eclipse.dd.dsf.ui.viewmodel.update.selectedUpdateMode"; //$NON-NLS-1$ + protected static String SELECTED_UPDATE_SCOPE = "org.eclipse.dd.dsf.ui.viewmodel.update.selectedUpdateScope"; //$NON-NLS-1$ private IVMUpdatePolicy[] fAvailableUpdatePolicies; + private IVMUpdateScope[] fAvailableUpdateScopes; public Map fRootMarkers = new HashMap(); @@ -328,12 +342,19 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa fCacheListHead.fPrevious = fCacheListHead; fAvailableUpdatePolicies = createUpdateModes(); + + fAvailableUpdateScopes = createUpdateScopes(); + setActiveUpdateScope(new VisibleUpdateScope()); } protected IVMUpdatePolicy[] createUpdateModes() { return new IVMUpdatePolicy[] { new AutomaticUpdatePolicy() }; } + protected IVMUpdateScope[] createUpdateScopes() { + return new IVMUpdateScope[] { new VisibleUpdateScope(), new AllUpdateScope() }; + } + public IVMUpdatePolicy[] getAvailableUpdatePolicies() { return fAvailableUpdatePolicies; } @@ -697,12 +718,239 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa } @Override - protected void handleEvent(final IVMModelProxy proxyStrategy, final Object event, RequestMonitor rm) { + protected void handleEvent(final IVMModelProxy proxyStrategy, final Object event, final RequestMonitor rm) { IElementUpdateTester elementTester = getActiveUpdatePolicy().getElementUpdateTester(event); - + flush(new FlushMarkerKey(proxyStrategy.getRootElement(), elementTester)); - super.handleEvent(proxyStrategy, event, rm); + if (proxyStrategy instanceof IVMModelProxyExtension) { + IVMModelProxyExtension proxyStrategyExtension = (IVMModelProxyExtension)proxyStrategy; + if(fIsAtomicUpdate) { + if(this.getActiveUpdateScope().getID().equals(AllUpdateScope.ALL_UPDATE_SCOPE_ID)) { + updateExpanded( + proxyStrategyExtension, + proxyStrategyExtension.getViewerInput(), proxyStrategyExtension.getRootPath(), + new RequestMonitor(getExecutor(), null) { + @Override + protected void handleCompleted() { + AbstractCachingVMProvider.super.handleEvent(proxyStrategy, event, rm); + } + }); + } else { + // block updating only the viewport + + TreeViewer viewer = (TreeViewer) proxyStrategyExtension.getViewer(); + Tree tree = viewer.getTree(); + int count[] = { tree.getSize().y / tree.getItemHeight() }; + + final CountingRequestMonitor multiRm = new CountingRequestMonitor(getExecutor(), rm); + multiRm.setDoneCount(count[0] + 1); + + ArrayList childrenUpdateVector = new ArrayList(); + + updateVisibleExpanded(tree, new TreeItem[] { tree.getTopItem() }, count, viewer, proxyStrategyExtension, + multiRm, childrenUpdateVector); + update(childrenUpdateVector.toArray(new IChildrenUpdate[childrenUpdateVector.size()])); + + super.handleEvent(proxyStrategy, event, multiRm); + } + } else { + if(this.getActiveUpdateScope().getID().equals(AllUpdateScope.ALL_UPDATE_SCOPE_ID)) + { + final CountingRequestMonitor multiRm = new CountingRequestMonitor(getExecutor(), rm); + multiRm.setDoneCount(2); + + updateExpanded( + proxyStrategyExtension, + proxyStrategyExtension.getViewerInput(), proxyStrategyExtension.getRootPath(), + multiRm); + super.handleEvent(proxyStrategy, event, multiRm); + } else { + super.handleEvent(proxyStrategy, event, rm); + } + } + } else { + super.handleEvent(proxyStrategy, event, rm); + } + } + + private void updateVisibleExpanded(final Object parent, TreeItem startItem[], final int count[], final TreeViewer viewer, + final IVMModelProxy proxyStrategy, final RequestMonitor rm, List childrenUpdatesVector) + { + if(parent instanceof Tree) + { + for(int i = 0; i < ((Tree) parent).getItemCount() && count[0] > 0; i++) + { + TreeItem item = ((Tree) parent).getItem(i); + if(item.equals(startItem[0])) + startItem[0] = null; + + if(startItem[0] == null) + { + childrenUpdatesVector.add(createChildrenUpdate(item, proxyStrategy, viewer.getInput(), rm)); + count[0]--; + } + + if(item.getData() != null && viewer.getExpandedState(item.getData())) + updateVisibleExpanded(item, startItem, count, viewer, proxyStrategy, rm, + childrenUpdatesVector); + } + } + else + { + for(int i = 0; i < ((TreeItem) parent).getItemCount() && count[0] > 0; i++) + { + TreeItem item = ((TreeItem) parent).getItem(i); + if(item.equals(startItem[0])) + startItem[0] = null; + + if(startItem[0] == null) + { + childrenUpdatesVector.add(createChildrenUpdate(item, proxyStrategy, viewer.getInput(), rm)); + count[0]--; + } + + if(item.getData() != null && viewer.getExpandedState(item.getData())) + updateVisibleExpanded(item, startItem, count, viewer, proxyStrategy, rm, + childrenUpdatesVector); + } + } + } + + private IChildrenUpdate createChildrenUpdate(TreeItem child, final IVMModelProxy proxyStrategy, final Object viewerInput, final RequestMonitor rm) + { + List pathList = new LinkedList(); + TreeItem item = child.getParentItem(); + Tree tree = null; + while (item != null) { + pathList.add(0, item.getData()); + item = item.getParentItem(); + } + final TreePath path = new TreePath(pathList.toArray()); + int index = 0; + if(child.getParentItem() != null) + index = child.getParentItem().indexOf(child); + else + index = child.getParent().indexOf(child); + + final IPresentationContext presentationContext = getPresentationContext(); + + final String columns[] = presentationContext.getColumns(); + + return new VMChildrenUpdate( + path, viewerInput, + getPresentationContext(), index, 1, new DataRequestMonitor>(getExecutor(), null) { + @Override + protected void handleCompleted() { + for(final Object o : getData()) + { + if(o instanceof IAdaptable) + { + IElementLabelProvider labelProvider = (IElementLabelProvider) ((IAdaptable) o).getAdapter(IElementLabelProvider.class); + + labelProvider.update(new ILabelUpdate[] { + new ILabelUpdate() + { + public Object getElement() { + return o; + } + + public TreePath getElementPath() { + return path; + } + + public IPresentationContext getPresentationContext() { + return presentationContext; + } + + public Object getViewerInput() { + return viewerInput; + } + + public void cancel() { + + } + + public IStatus getStatus() { + return null; + } + + public boolean isCanceled() { + return false; + } + + public void setStatus(IStatus status) { + + } + + public String[] getColumnIds() { + return columns; + } + + public void setBackground(RGB arg0, int arg1) { + + } + + public void setFontData(FontData arg0, int arg1) { + + } + + public void setForeground(RGB arg0, int arg1) { + + } + + public void setImageDescriptor(ImageDescriptor arg0, int arg1) { + + } + + public void setLabel(String arg0, int arg1) { + } + + public void done() { + + rm.done(); + } + } + }); + } + } + } + }); + } + + private void updateExpanded(final IVMModelProxyExtension proxyStrategy, final Object viewerInput, final TreePath path, final RequestMonitor rm) + { + this.update(new IChildrenUpdate[] { new VMChildrenUpdate( + path, viewerInput, + getPresentationContext(), -1, -1, new DataRequestMonitor>(getExecutor(), null) { + @Override + protected void handleCompleted() { + if (getData() != null) { + TreeViewer viewer = (TreeViewer) proxyStrategy.getViewer(); + + int expandedCount = 0; + + final CountingRequestMonitor multiRm = new CountingRequestMonitor(getExecutor(), rm); + + for(Object data : getData()) + { + if(viewer.getExpandedState(data)) + { + Object[] childPathSegments = new Object[path.getSegmentCount() + 1]; + int i = 0; + for (i = 0; i < path.getSegmentCount(); i++) { + childPathSegments[i] = path.getSegment(i); + } + childPathSegments[i] = data; + updateExpanded(proxyStrategy, viewerInput, new TreePath(childPathSegments), multiRm); + expandedCount++; + } + } + + multiRm.setDoneCount(expandedCount); + } + } + })}); } /** @@ -906,4 +1154,34 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa return null; } + public IVMUpdateScope[] getAvailableUpdateScopes() { + return fAvailableUpdateScopes; + } + + public IVMUpdateScope getActiveUpdateScope() { + String updateScopeId = (String)getPresentationContext().getProperty(SELECTED_UPDATE_SCOPE); + if (updateScopeId != null) { + for (IVMUpdateScope updateScope : getAvailableUpdateScopes()) { + if (updateScope.getID().equals(updateScopeId)) { + return updateScope; + } + } + } + + // Default to the first one. + return getAvailableUpdateScopes()[0]; + } + + public void setActiveUpdateScope(IVMUpdateScope updateScope) { + getPresentationContext().setProperty(SELECTED_UPDATE_SCOPE, updateScope.getID()); + } + + public boolean isAtomicUpdate() { + return fIsAtomicUpdate; + } + + public void setAtomicUpdate(boolean enable) { + fIsAtomicUpdate = enable; + } + } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AllUpdateScope.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AllUpdateScope.java new file mode 100644 index 00000000000..5a7fe7ad1f5 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AllUpdateScope.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2007, 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.ui.viewmodel.update; + +import org.eclipse.jface.viewers.TreePath; + +/** + * An "automatic" update policy which causes the view model provider cache to + * be flushed whenever an event causes a delta to be generated in the given + * model. + */ +public class AllUpdateScope implements IVMUpdateScope { + + public static String ALL_UPDATE_SCOPE_ID = "org.eclipse.dd.dsf.ui.viewmodel.update.allUpdateScope"; //$NON-NLS-1$ + + public static IElementUpdateTester fgUpdateTester = new IElementUpdateTester() { + public int getUpdateFlags(Object viewerInput, TreePath path) { + return 0; + } + + public boolean includes(IElementUpdateTester tester) { + return tester.equals(this); + } + + @Override + public String toString() { + return ViewModelUpdateMessages.AllUpdateScope_name; + } + }; + + public String getID() { + return ALL_UPDATE_SCOPE_ID; + } + + public String getName() { + return ViewModelUpdateMessages.AllUpdateScope_name; + } +} diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProvider.java index cdda9a2bdaf..182128c3f60 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProvider.java @@ -34,6 +34,32 @@ public interface ICachingVMProvider extends IVMProvider { * policies supported by the provider. */ public void setActiveUpdatePolicy(IVMUpdatePolicy mode); + + /** + * Returns the update policies that the given provider supports. + */ + public IVMUpdateScope[] getAvailableUpdateScopes(); + + /** + * Returns the active update policy. + */ + public IVMUpdateScope getActiveUpdateScope(); + + /** + * Sets the active update policy. This has to be one of the update + * policies supported by the provider. + */ + public void setActiveUpdateScope(IVMUpdateScope mode); + + /** + * Is update atomic? + */ + public boolean isAtomicUpdate(); + + /** + * Sets atomic update. + */ + public void setAtomicUpdate(boolean enable); /** * Forces the view to flush its cache and re-fetch data from the view diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProviderExtension.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProviderExtension.java new file mode 100644 index 00000000000..71622aba22e --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ICachingVMProviderExtension.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.ui.viewmodel.update; + + +/** + * + */ +public interface ICachingVMProviderExtension extends ICachingVMProvider { + + + public boolean isAtomicUpdate(); + + public void setAtomicUpdate(boolean enable); + +} diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/IVMUpdateScope.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/IVMUpdateScope.java new file mode 100644 index 00000000000..3a5a6f233a3 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/IVMUpdateScope.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2007, 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.ui.viewmodel.update; + + +/** + * + */ +public interface IVMUpdateScope { + + /** + * Returns unique ID of this update policy. + */ + public String getID(); + + /** + * Returns the user-presentable name of this update policy. + */ + public String getName(); +} diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.java index 975de1173bd..f7d98d2d99b 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.java @@ -18,6 +18,8 @@ public class ViewModelUpdateMessages extends NLS { public static String AutomaticUpdatePolicy_name; public static String ManualUpdatePolicy_name; + public static String AllUpdateScope_name; + public static String VisibleUpdateScope_name; static { // load message values from bundle file diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.properties b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.properties index 41dae99e2c6..002d04b01d6 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.properties +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ViewModelUpdateMessages.properties @@ -9,4 +9,6 @@ # Wind River Systems - initial API and implementation ############################################################################### AutomaticUpdatePolicy_name = Automatic -ManualUpdatePolicy_name = Manual \ No newline at end of file +ManualUpdatePolicy_name = Manual +AllUpdateScope_name = All Elements +VisibleUpdateScope_name== Visible Elements \ No newline at end of file diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VisibleUpdateScope.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VisibleUpdateScope.java new file mode 100644 index 00000000000..fae123f0d8a --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VisibleUpdateScope.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2007, 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.ui.viewmodel.update; + +import org.eclipse.jface.viewers.TreePath; + +/** + * An "automatic" update policy which causes the view model provider cache to + * be flushed whenever an event causes a delta to be generated in the given + * model. + */ +public class VisibleUpdateScope implements IVMUpdateScope { + + public static String VISIBLE_UPDATE_SCOPE_ID = "org.eclipse.dd.dsf.ui.viewmodel.update.visibleUpdateScope"; //$NON-NLS-1$ + + public static IElementUpdateTester fgUpdateTester = new IElementUpdateTester() { + public int getUpdateFlags(Object viewerInput, TreePath path) { + return 0; + } + + public boolean includes(IElementUpdateTester tester) { + return tester.equals(this); + } + + @Override + public String toString() { + return ViewModelUpdateMessages.VisibleUpdateScope_name; + } + }; + + public String getID() { + return VISIBLE_UPDATE_SCOPE_ID; + } + + public String getName() { + return ViewModelUpdateMessages.VisibleUpdateScope_name; + } +} diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java new file mode 100644 index 00000000000..f571192ffe5 --- /dev/null +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2008 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.dd.gdb.internal.ui.viewmodel.launch; + +import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.DefaultVMModelProxyStrategy; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.jface.viewers.TreePath; + +/** + * + */ +public class LaunchVMModelProxyStrategy extends DefaultVMModelProxyStrategy { + + final private TreePath fRootPath; + + public LaunchVMModelProxyStrategy(AbstractVMProvider provider, Object rootElement) { + super(provider, rootElement); + fRootPath = new TreePath( new Object[] { rootElement }); + } + + @Override + public Object getViewerInput() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + @Override + public TreePath getRootPath() { + return fRootPath; + } +} diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java index e89b3b7878f..65d942d79f7 100644 --- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java @@ -61,7 +61,6 @@ public class LaunchVMProvider extends AbstractLaunchVMProvider DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); } - @Override public void dispose() { DebugPlugin.getDefault().removeDebugEventListener(this); @@ -69,7 +68,6 @@ public class LaunchVMProvider extends AbstractLaunchVMProvider super.dispose(); } - @Override protected boolean canSkipHandlingEvent(Object newEvent, Object eventToSkip) { // Never skip the process lifecycle events.