1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

159683 update modes

This commit is contained in:
Ted Williams 2007-07-06 05:32:54 +00:00
parent ac373103f4
commit 9a1a5ad41c
9 changed files with 99 additions and 31 deletions

View file

@ -21,12 +21,13 @@ Require-Bundle: org.eclipse.ui,
Eclipse-LazyStart: true
Export-Package:
org.eclipse.dd.dsf.debug.ui,
org.eclipse.dd.dsf.debug.ui.actions,
org.eclipse.dd.dsf.debug.ui.sourcelookup,
org.eclipse.dd.dsf.debug.ui.viewmodel,
org.eclipse.dd.dsf.debug.ui.viewmodel.dm,
org.eclipse.dd.dsf.debug.ui.viewmodel.expression,
org.eclipse.dd.dsf.debug.ui.viewmodel.formatsupport,
org.eclipse.dd.dsf.debug.ui.viewmodel.launch,
org.eclipse.dd.dsf.debug.ui.viewmodel.register,
org.eclipse.dd.dsf.debug.ui.viewmodel.variable,
org.eclipse.dd.dsf.debug.ui.sourcelookup,
org.eclipse.dd.dsf.debug.ui.actions
org.eclipse.dd.dsf.debug.ui.viewmodel.variable
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View file

@ -0,0 +1,43 @@
/*******************************************************************************
* 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:
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.ui.viewmodel.dm;
import org.eclipse.dd.dsf.debug.ui.viewmodel.update.VMCacheRefreshAlways;
import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProviderWithCache;
import org.eclipse.dd.dsf.ui.viewmodel.update.VMCacheManager;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
/*
* The purpose of this class is to satisfy package structure requirements while enabling VM update modes.
* The non-debug centric VMCacheManager and VMCache live under org.eclipse.dd.dsf.*. The debug data view
* caches (VMCacheRefreshAlways/Manual/OnBreak) live under org.eclipse.dd.dsf.debug.* because of their
* awareness of debug specific events. There is a need to instantiate a default (always) cache on view
* startup. AbstractDMVMProviderWithCache would be a good place to accomplish this task, but like the
* VMCacheManager, this class cannot access the *dsf.debug* VMCacheRefreshAlways. AbstractDebugDMVMProviderWithCache
* is meant to solve this problem.
*/
public class AbstractDebugDMVMProviderWithCache extends
AbstractDMVMProviderWithCache
{
@SuppressWarnings("restriction")
public AbstractDebugDMVMProviderWithCache(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
super(adapter, presentationContext, session);
VMCacheManager.getVMCacheManager().registerCache(presentationContext, new VMCacheRefreshAlways());
}
}

View file

@ -11,6 +11,7 @@
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.register.RegisterGroupLayoutNode;
import org.eclipse.dd.dsf.debug.ui.viewmodel.register.RegisterLayoutNode;
@ -23,7 +24,6 @@ import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.IVMRootLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProviderWithCache;
import org.eclipse.dd.dsf.ui.viewmodel.dm.DMVMRootLayoutNode;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionsListener;
@ -35,7 +35,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
*
*/
@SuppressWarnings("restriction")
public class ExpressionVMProvider extends AbstractDMVMProviderWithCache
public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache
implements IExpressionsListener, IFormattedValuePreferenceStore
{
private String fDefaultFormatId = IFormattedValues.HEX_FORMAT;

View file

@ -11,12 +11,12 @@
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.service.DsfSession;
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.IVMRootLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProviderWithCache;
import org.eclipse.dd.dsf.ui.viewmodel.dm.DMVMRootLayoutNode;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
@ -25,7 +25,7 @@ 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 AbstractDMVMProviderWithCache implements IFormattedValuePreferenceStore
public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache implements IFormattedValuePreferenceStore
{
/*
* Current default for register formatting.

View file

@ -25,12 +25,4 @@ public class VMCacheRefreshAlways extends VMCache
flush(true);
}
@Override
protected boolean useCache() {
return false;
}
}

View file

@ -9,19 +9,19 @@
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.service.DsfSession;
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.IVMRootLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProviderWithCache;
import org.eclipse.dd.dsf.ui.viewmodel.dm.DMVMRootLayoutNode;
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;
@SuppressWarnings("restriction")
public class VariableVMProvider extends AbstractDMVMProviderWithCache implements
public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache implements
IColumnPresentationFactory, IFormattedValuePreferenceStore {
private String defaultFormatId = IFormattedValues.NATURAL_FORMAT;

View file

@ -27,11 +27,13 @@ public abstract class AbstractDMVMProviderWithCache extends AbstractDMVMProvider
implements VMCacheManager.CacheListener
{
@DsfServiceEventHandler
@Override
public void eventDispatched(IDMEvent<?> event) {
VMCacheManager.getVMCacheManager().getCache(getPresentationContext()).handleEvent(event);
super.eventDispatched(event);
}
@SuppressWarnings("restriction")
public void cacheFlushed(Object context) {
if(getPresentationContext().equals(context))
getModelProxy().fireModelChanged(new ModelDelta(getRootElement(),IModelDelta.CONTENT));
@ -43,18 +45,22 @@ public abstract class AbstractDMVMProviderWithCache extends AbstractDMVMProvider
VMCacheManager.getVMCacheManager().addCacheListener(getPresentationContext(), this);
}
@Override
public void update(IHasChildrenUpdate[] updates) {
super.update(VMCacheManager.getVMCacheManager().getCache(getPresentationContext()).update(updates));
}
@Override
public void update(IChildrenCountUpdate[] updates) {
super.update(VMCacheManager.getVMCacheManager().getCache(getPresentationContext()).update(updates));
}
@Override
public void update(final IChildrenUpdate[] updates) {
super.update(VMCacheManager.getVMCacheManager().getCache(getPresentationContext()).update(updates));
}
@Override
public void dispose()
{
VMCacheManager.getVMCacheManager().removeCacheListener(getPresentationContext(), this);

View file

@ -56,17 +56,25 @@ public abstract class VMCache
fHasChildren.clear();
}
protected boolean useCache()
protected boolean isCacheReadEnabled()
{
return true;
}
protected boolean isCacheWriteEnabled()
{
return true;
}
@SuppressWarnings("restriction")
public IHasChildrenUpdate[] update(IHasChildrenUpdate[] updates) {
if(!isCacheReadEnabled())
return updates;
Vector<IHasChildrenUpdate> missVector = new Vector<IHasChildrenUpdate>();
for(IHasChildrenUpdate update : updates)
{
if(fHasChildren.containsKey(update.getElement()) && useCache())
if(fHasChildren.containsKey(update.getElement()) && isCacheReadEnabled())
{
update.setHasChilren(fHasChildren.get(update.getElement()).booleanValue());
update.done();
@ -86,7 +94,8 @@ public abstract class VMCache
@Override
protected void handleCompleted()
{
fHasChildren.put(update.getElement(), this.getData());
if(isCacheWriteEnabled())
fHasChildren.put(update.getElement(), this.getData());
update.setHasChilren(getData());
update.done();
}
@ -99,10 +108,13 @@ public abstract class VMCache
@SuppressWarnings("restriction")
public IChildrenCountUpdate[] update(IChildrenCountUpdate[] updates)
{
if(!isCacheReadEnabled())
return updates;
Vector<IChildrenCountUpdate> missVector = new Vector<IChildrenCountUpdate>();
for(IChildrenCountUpdate update : updates)
{
if(fChildrenCounts.containsKey(update.getElement()) && useCache())
if(fChildrenCounts.containsKey(update.getElement()) && isCacheReadEnabled())
{
update.setChildCount(fChildrenCounts.get(update.getElement()));
update.done();
@ -122,7 +134,8 @@ public abstract class VMCache
@Override
protected void handleOK()
{
fChildrenCounts.put(update.getElement(), this.getData());
if(isCacheWriteEnabled())
fChildrenCounts.put(update.getElement(), this.getData());
update.setChildCount(this.getData());
update.done();
}
@ -134,10 +147,13 @@ public abstract class VMCache
@SuppressWarnings("restriction")
public IChildrenUpdate[] update(IChildrenUpdate[] updates) {
if(!isCacheReadEnabled())
return updates;
Vector<IChildrenUpdate> updatesEntirelyMissingFromCache = new Vector<IChildrenUpdate>();
for(final IChildrenUpdate update : updates)
{
if(fChildren.containsKey(update.getElement()) && useCache())
if(fChildren.containsKey(update.getElement()) && isCacheReadEnabled())
{
Vector<Integer> childrenMissingFromCache = new Vector<Integer>();
for(int i = update.getOffset(); i < update.getOffset() + update.getLength(); i++)
@ -227,10 +243,13 @@ public abstract class VMCache
{
for(int j = 0; j < update.getLength(); j++)
{
if(!fChildren.containsKey(update.getElement()))
fChildren.put(update.getElement(), new HashMap<Integer,Object>());
if(isCacheWriteEnabled())
{
if(!fChildren.containsKey(update.getElement()))
fChildren.put(update.getElement(), new HashMap<Integer,Object>());
fChildren.get(update.getElement()).put(update.getOffset() + j, getData().get(j));
fChildren.get(update.getElement()).put(update.getOffset() + j, getData().get(j));
}
update.setChild(getData().get(j), update.getOffset() + j);
}
@ -246,7 +265,7 @@ public abstract class VMCache
@ConfinedToDsfExecutor("DsfSession.getSession(dmc.getSessionId()).getExecutor()")
public void getModelData(IDMService service, final IDMContext dmc, final DataRequestMonitor rm, DsfExecutor executor)
{
if(fData.containsKey(dmc) && useCache())
if(fData.containsKey(dmc) && isCacheReadEnabled())
{
rm.setData( fData.get(dmc));
rm.done();
@ -257,7 +276,8 @@ public abstract class VMCache
new DataRequestMonitor<IDMData>(executor, null) {
@Override
public void handleOK() {
fData.put(dmc, getData());
if(isCacheWriteEnabled())
fData.put(dmc, getData());
rm.setData(getData());
rm.done();
}

View file

@ -49,10 +49,16 @@ public class VMCacheManager
{
@Override
public void handleEvent(IDMEvent event) {
flush(true);
}
public boolean readFromCache()
@Override
public boolean isCacheReadEnabled()
{
return false;
}
@Override
public boolean isCacheWriteEnabled()
{
return false;
}