1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[205132] First step in refactoring IDMContext:

- Removed the type parameter from IDMContext
- Got rid of the IDMContext.getServiceFilter() method.
This commit is contained in:
Pawel Piech 2007-10-19 22:15:57 +00:00
parent 4e553d3250
commit 7286137a7e
46 changed files with 387 additions and 389 deletions

View file

@ -117,7 +117,6 @@
</action> </action>
<action <action
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate" class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif" icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways" id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
label="Always" label="Always"
@ -159,7 +158,6 @@
</action> </action>
<action <action
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate" class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif" icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways" id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
label="Always" label="Always"
@ -201,7 +199,6 @@
</action> </action>
<action <action
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate" class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif" icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways" id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
label="Always" label="Always"

View file

@ -52,7 +52,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
// Javac doesn't like the cast to "(AbstractDMVMLayoutNode<?>.DMVMContext)" need to use the // Javac doesn't like the cast to "(AbstractDMVMLayoutNode<?>.DMVMContext)" need to use the
// construct below and suppress warnings. // construct below and suppress warnings.
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
AbstractDMVMLayoutNode<?>.DMVMContext vmc = (AbstractDMVMLayoutNode.DMVMContext)request.getElements()[0]; AbstractDMVMLayoutNode.DMVMContext vmc = (AbstractDMVMLayoutNode.DMVMContext)request.getElements()[0];
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(vmc.getDMC(), IExecutionDMContext.class); final IExecutionDMContext dmc = DMContexts.getAncestorOfType(vmc.getDMC(), IExecutionDMContext.class);
if (dmc == null) { if (dmc == null) {
request.setEnabled(false); request.setEnabled(false);

View file

@ -89,13 +89,13 @@ public class MISourceDisplayAdapter implements ISourceDisplay
*/ */
class LookupJob extends Job { class LookupJob extends Job {
private IDMContext<?> fDmc; private IDMContext fDmc;
private IWorkbenchPage fPage; private IWorkbenchPage fPage;
/** /**
* Constructs a new source lookup job. * Constructs a new source lookup job.
*/ */
public LookupJob(IDMContext<?> dmc, IWorkbenchPage page) { public LookupJob(IDMContext dmc, IWorkbenchPage page) {
super("DSF Source Lookup"); //$NON-NLS-1$ super("DSF Source Lookup"); //$NON-NLS-1$
setPriority(Job.INTERACTIVE); setPriority(Job.INTERACTIVE);
setSystem(true); setSystem(true);
@ -103,7 +103,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
fPage = page; fPage = page;
} }
IDMContext<?> getDmc() { return fDmc; } IDMContext getDmc() { return fDmc; }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
@ -164,7 +164,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
private SourceLookupResult fResult; private SourceLookupResult fResult;
private IWorkbenchPage fPage; private IWorkbenchPage fPage;
IDMContext<?> getDmc() { return fResult.getDmc(); } IDMContext getDmc() { return fResult.getDmc(); }
/** /**
* Constructs a new source display job * Constructs a new source display job
@ -257,7 +257,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
/** /**
* Positions the text editor for the given stack frame * Positions the text editor for the given stack frame
*/ */
private void positionEditor(ITextEditor editor, final IDMContext<?> dmc) { private void positionEditor(ITextEditor editor, final IDMContext dmc) {
if (!(dmc instanceof IFrameDMContext)) return; if (!(dmc instanceof IFrameDMContext)) return;
final IFrameDMContext frameDmc = (IFrameDMContext)dmc; final IFrameDMContext frameDmc = (IFrameDMContext)dmc;
@ -387,7 +387,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
private DsfSession fSession; private DsfSession fSession;
private DsfExecutor fExecutor; private DsfExecutor fExecutor;
private DsfServicesTracker fServicesTracker; private DsfServicesTracker fServicesTracker;
private IDMContext<?> fPrevModelContext; private IDMContext fPrevModelContext;
private SourceLookupResult fPrevResult; private SourceLookupResult fPrevResult;
private ISourceLookupDirector fSourceLookup; private ISourceLookupDirector fSourceLookup;
private DsfMISourceLookupParticipant fSourceLookupParticipant; private DsfMISourceLookupParticipant fSourceLookupParticipant;
@ -430,7 +430,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
if (!(context instanceof DMVMContext)) return; if (!(context instanceof DMVMContext)) return;
// Correct cast: (AbstractDMVMLayoutNode<?>.DMVMContext) breaks the javac compiler // Correct cast: (AbstractDMVMLayoutNode<?>.DMVMContext) breaks the javac compiler
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final IDMContext<?> dmc = ((DMVMContext)context).getDMC(); final IDMContext dmc = ((DMVMContext)context).getDMC();
// Quick test. DMC is checked again in source lookup participant, but // Quick test. DMC is checked again in source lookup participant, but
// it's much quicker to test here. // it's much quicker to test here.
@ -455,7 +455,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
} }
} }
private void startLookupJob(final IDMContext<?> dmc, final IWorkbenchPage page) { private void startLookupJob(final IDMContext dmc, final IWorkbenchPage page) {
// If there is a previous lookup job running, cancel it. // If there is a previous lookup job running, cancel it.
if (fRunningLookupJob != null) { if (fRunningLookupJob != null) {
fRunningLookupJob.cancel(); fRunningLookupJob.cancel();

View file

@ -24,7 +24,7 @@ class SourceLookupResult {
/** /**
* Element that source was resolved for. * Element that source was resolved for.
*/ */
private IDMContext<?> fDmc; private IDMContext fDmc;
/** /**
* Corresponding source element, or <code>null</code> * Corresponding source element, or <code>null</code>
* if unknown. * if unknown.
@ -45,7 +45,7 @@ class SourceLookupResult {
* Creates a source lookup result on the given artifact, source element, * Creates a source lookup result on the given artifact, source element,
* editor id, and editor input. * editor id, and editor input.
*/ */
public SourceLookupResult(IDMContext<?> dmc, Object sourceElement, String editorId, IEditorInput editorInput) { public SourceLookupResult(IDMContext dmc, Object sourceElement, String editorId, IEditorInput editorInput) {
fDmc = dmc; fDmc = dmc;
setSourceElement(sourceElement); setSourceElement(sourceElement);
setEditorId(editorId); setEditorId(editorId);
@ -55,7 +55,7 @@ class SourceLookupResult {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.ui.sourcelookup.ISourceLookupResult#getArtifact() * @see org.eclipse.debug.ui.sourcelookup.ISourceLookupResult#getArtifact()
*/ */
public IDMContext<?> getDmc() { public IDMContext getDmc() {
return fDmc; return fDmc;
} }
@ -121,7 +121,7 @@ class SourceLookupResult {
* *
* @param artifact new artifact state * @param artifact new artifact state
*/ */
public void updateArtifact(IDMContext<?> dmc) { public void updateArtifact(IDMContext dmc) {
if (fDmc.equals(dmc)) { if (fDmc.equals(dmc)) {
fDmc = dmc; fDmc = dmc;
} }

View file

@ -321,7 +321,7 @@ public class DetailPane implements IDetailPane, IAdaptable, IPropertyChangeListe
*/ */
if ( element instanceof DMVMContext) { if ( element instanceof DMVMContext) {
IFormattedValues service = null; IFormattedValues service = null;
IFormattedDataDMContext<?> dmc = null ; IFormattedDataDMContext dmc = null ;
/* /*
* We are specifically looking to support the following Data Model Contexts * We are specifically looking to support the following Data Model Contexts
@ -384,7 +384,7 @@ public class DetailPane implements IDetailPane, IAdaptable, IPropertyChangeListe
* typically be a burden. We should probably consider perhaps doing a * typically be a burden. We should probably consider perhaps doing a
* preference where they can select what formats they want to show. * preference where they can select what formats they want to show.
*/ */
final IFormattedDataDMContext<?> finalDmc = dmc; final IFormattedDataDMContext finalDmc = dmc;
final IFormattedValues finalService = service; final IFormattedValues finalService = service;
final DataRequestMonitor<String[]> getAvailableFormatsDone = final DataRequestMonitor<String[]> getAvailableFormatsDone =

View file

@ -21,7 +21,6 @@ import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor; import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.dd.dsf.debug.ui.DsfDebugUIPlugin; import org.eclipse.dd.dsf.debug.ui.DsfDebugUIPlugin;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.service.IDsfService; import org.eclipse.dd.dsf.service.IDsfService;
@ -39,11 +38,11 @@ import org.eclipse.jface.viewers.TreePath;
* *
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public abstract class AbstractExpressionLayoutNode<V extends IDMData> extends AbstractDMVMLayoutNode<V> public abstract class AbstractExpressionLayoutNode extends AbstractDMVMLayoutNode
implements IExpressionLayoutNode implements IExpressionLayoutNode
{ {
public AbstractExpressionLayoutNode(AbstractVMProvider provider, DsfSession session, Class<? extends IDMContext<V>> dmcClassType) { public AbstractExpressionLayoutNode(AbstractVMProvider provider, DsfSession session, Class<? extends IDMContext> dmcClassType) {
super(provider, session, dmcClassType); super(provider, session, dmcClassType);
} }

View file

@ -60,8 +60,8 @@ public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache imp
/* /*
* Allocate the synchronous data providers. * Allocate the synchronous data providers.
*/ */
SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess(); SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess(getSession());
SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess() ; SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess(getSession()) ;
/* /*
* Create the top level node which provides the anchor starting point. * Create the top level node which provides the anchor starting point.

View file

@ -15,7 +15,6 @@ import java.util.List;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.datamodel.IDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRunControl;
import org.eclipse.dd.dsf.debug.service.IStack; import org.eclipse.dd.dsf.debug.service.IStack;
@ -28,10 +27,12 @@ import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMData; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMData;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.service.IDsfService;
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext; import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.update.VMCacheManager;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; 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.ILabelUpdate;
@ -41,7 +42,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class StackFramesLayoutNode extends AbstractDMVMLayoutNode<IStack.IFrameDMData> { public class StackFramesLayoutNode extends AbstractDMVMLayoutNode {
public IVMContext[] fCachedOldFrameVMCs; public IVMContext[] fCachedOldFrameVMCs;
@ -143,8 +144,49 @@ public class StackFramesLayoutNode extends AbstractDMVMLayoutNode<IStack.IFrameD
} }
@Override @Override
protected void fillColumnLabel(IDMContext<IFrameDMData> dmContext, IFrameDMData dmData, String columnId, int idx, protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
ILabelUpdate update) for (final ILabelUpdate update : updates) {
final IFrameDMContext dmc = findDmcInPath(update.getElementPath(), IFrameDMContext.class);
if (!checkDmc(dmc, update) || !checkService(IStack.class, null, update)) continue;
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData(getServicesTracker().getService(IStack.class, null),
dmc,
new DataRequestMonitor<IFrameDMData>(getSession().getExecutor(), null) {
@Override
protected void handleCompleted() {
/*
* Check that the request was evaluated and data is still
* valid. The request could fail if the state of the
* service changed during the request, but the view model
* has not been updated yet.
*/
if (!getStatus().isOK()) {
assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED;
handleFailedUpdate(update);
return;
}
/*
* If columns are configured, call the protected methods to
* fill in column values.
*/
String[] localColumns = update.getPresentationContext().getColumns();
if (localColumns == null) localColumns = new String[] { null };
for (int i = 0; i < localColumns.length; i++) {
fillColumnLabel(dmc, getData(), localColumns[i], i, update);
}
update.done();
}
},
getExecutor());
}
}
protected void fillColumnLabel(IFrameDMContext dmContext, IFrameDMData dmData, String columnId, int idx, ILabelUpdate update)
{ {
if (idx != 0) return; if (idx != 0) return;

View file

@ -41,7 +41,7 @@ public class RegisterBitFieldLayoutCellModifier extends WatchExpressionCellModif
*/ */
private IBitFieldDMContext getBitFieldDMC(Object element) { private IBitFieldDMContext getBitFieldDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IBitFieldDMContext.class); return DMContexts.getAncestorOfType(dmc, IBitFieldDMContext.class);
} }
return null; return null;

View file

@ -18,7 +18,6 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.datamodel.IDMEvent;
import org.eclipse.dd.dsf.datamodel.IDMService;
import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRegisters;
import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRunControl;
@ -64,13 +63,13 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode<IBitFieldDMData> implements IElementEditor { public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode implements IElementEditor {
protected class BitFieldVMC extends DMVMContext protected class BitFieldVMC extends DMVMContext
implements IVariable, IFormattedValueVMContext implements IVariable, IFormattedValueVMContext
{ {
private IExpression fExpression; private IExpression fExpression;
public BitFieldVMC(IDMContext<?> dmc) { public BitFieldVMC(IDMContext dmc) {
super(dmc); super(dmc);
} }
@ -285,7 +284,7 @@ public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode<IBi
final IBitFieldDMContext dmc = findDmcInPath(update.getElementPath(), IRegisters.IBitFieldDMContext.class); final IBitFieldDMContext dmc = findDmcInPath(update.getElementPath(), IRegisters.IBitFieldDMContext.class);
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext()) VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()), .getModelData(getServicesTracker().getService(IRegisters.class),
dmc, dmc,
new DataRequestMonitor<IBitFieldDMData>(getSession().getExecutor(), null) { new DataRequestMonitor<IBitFieldDMData>(getSession().getExecutor(), null) {
@Override @Override
@ -296,7 +295,7 @@ public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode<IBi
* service changed during the request, but the view model * service changed during the request, but the view model
* has not been updated yet. * has not been updated yet.
*/ */
if (!getStatus().isOK() || !getData().isValid()) { if (!getStatus().isOK()) {
assert getStatus().isOK() || assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR || getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED; getStatus().getCode() != IDsfService.NOT_SUPPORTED;
@ -392,7 +391,7 @@ public class RegisterBitFieldLayoutNode extends AbstractExpressionLayoutNode<IBi
} }
@Override @Override
protected IVMContext createVMContext(IDMContext<IBitFieldDMData> dmc) { protected IVMContext createVMContext(IDMContext dmc) {
return new BitFieldVMC(dmc); return new BitFieldVMC(dmc);
} }

View file

@ -56,14 +56,14 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode<IRegisterGroupDMData> public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode
implements IElementEditor implements IElementEditor
{ {
protected class RegisterGroupVMC extends DMVMContext implements IVariable protected class RegisterGroupVMC extends DMVMContext implements IVariable
{ {
private IExpression fExpression; private IExpression fExpression;
public RegisterGroupVMC(IDMContext<?> dmc) { public RegisterGroupVMC(IDMContext dmc) {
super(dmc); super(dmc);
} }
@ -173,13 +173,55 @@ public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode<IRegis
} }
@Override @Override
protected IVMContext createVMContext(IDMContext<IRegisterGroupDMData> dmc) { protected IVMContext createVMContext(IDMContext dmc) {
return new RegisterGroupVMC(dmc); return new RegisterGroupVMC(dmc);
} }
@Override @Override
protected void fillColumnLabel(IDMContext<IRegisterGroupDMData> dmContext, IRegisterGroupDMData dmData, protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
for (final ILabelUpdate update : updates) {
final IRegisterGroupDMContext dmc = findDmcInPath(update.getElementPath(), IRegisterGroupDMContext.class);
if (!checkDmc(dmc, update) || !checkService(IRegisters.class, null, update)) continue;
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData(getServicesTracker().getService(IRegisters.class, null),
dmc,
new DataRequestMonitor<IRegisterGroupDMData>(getSession().getExecutor(), null) {
@Override
protected void handleCompleted() {
/*
* Check that the request was evaluated and data is still
* valid. The request could fail if the state of the
* service changed during the request, but the view model
* has not been updated yet.
*/
if (!getStatus().isOK()) {
assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED;
handleFailedUpdate(update);
return;
}
/*
* If columns are configured, call the protected methods to
* fill in column values.
*/
String[] localColumns = update.getPresentationContext().getColumns();
if (localColumns == null) localColumns = new String[] { null };
for (int i = 0; i < localColumns.length; i++) {
fillColumnLabel(dmc, getData(), localColumns[i], i, update);
}
update.done();
}
},
getExecutor());
}
}
protected void fillColumnLabel(IRegisterGroupDMContext dmContext, IRegisterGroupDMData dmData,
String columnId, int idx, ILabelUpdate update) String columnId, int idx, ILabelUpdate update)
{ {
if (IDebugVMConstants.COLUMN_ID__NAME.equals(columnId)) { if (IDebugVMConstants.COLUMN_ID__NAME.equals(columnId)) {

View file

@ -18,7 +18,6 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.datamodel.IDMEvent;
import org.eclipse.dd.dsf.datamodel.IDMService;
import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRegisters;
import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRunControl;
@ -63,14 +62,14 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDMData> public class RegisterLayoutNode extends AbstractExpressionLayoutNode
implements IElementEditor implements IElementEditor
{ {
protected class RegisterVMC extends DMVMContext protected class RegisterVMC extends DMVMContext
implements IVariable, IFormattedValueVMContext implements IVariable, IFormattedValueVMContext
{ {
private IExpression fExpression; private IExpression fExpression;
public RegisterVMC(IDMContext<?> dmc) { public RegisterVMC(IDMContext dmc) {
super(dmc); super(dmc);
} }
@ -282,10 +281,10 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
protected void updateLabelInSessionThread(ILabelUpdate[] updates) { protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
for (final ILabelUpdate update : updates) { for (final ILabelUpdate update : updates) {
final IRegisterDMContext dmc = findDmcInPath(update.getElementPath(), IRegisters.IRegisterDMContext.class); final IRegisterDMContext dmc = findDmcInPath(update.getElementPath(), IRegisters.IRegisterDMContext.class);
if (!checkDmc(dmc, update) || !checkService(null, dmc.getServiceFilter(), update)) continue; if (!checkDmc(dmc, update) || !checkService(IRegisters.class, null, update)) continue;
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext()) VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()), .getModelData(getServicesTracker().getService(IRegisters.class),
dmc, dmc,
new DataRequestMonitor<IRegisterDMData>(getSession().getExecutor(), null) { new DataRequestMonitor<IRegisterDMData>(getSession().getExecutor(), null) {
@Override @Override
@ -296,7 +295,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
* service changed during the request, but the view model * service changed during the request, but the view model
* has not been updated yet. * has not been updated yet.
*/ */
if (!getStatus().isOK() || !getData().isValid()) { if (!getStatus().isOK()) {
assert getStatus().isOK() || assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR || getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED; getStatus().getCode() != IDsfService.NOT_SUPPORTED;
@ -394,7 +393,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
} }
@Override @Override
protected IVMContext createVMContext(IDMContext<IRegisterDMData> dmc) { protected IVMContext createVMContext(IDMContext dmc) {
return new RegisterVMC(dmc); return new RegisterVMC(dmc);
} }

View file

@ -45,7 +45,7 @@ public class RegisterLayoutValueCellModifier extends WatchExpressionCellModifier
*/ */
protected IRegisterDMContext getRegisterDMC(Object element) { protected IRegisterDMContext getRegisterDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class); return DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class);
} }
return null; return null;

View file

@ -35,7 +35,7 @@ public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache
/* /*
* Create the register data access routines. * Create the register data access routines.
*/ */
SyncRegisterDataAccess regAccess = new SyncRegisterDataAccess() ; SyncRegisterDataAccess regAccess = new SyncRegisterDataAccess(session) ;
/* /*
* Create the top level node to deal with the root selection. * Create the top level node to deal with the root selection.

View file

@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.Query; import org.eclipse.dd.dsf.concurrent.Query;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
@ -38,45 +39,59 @@ import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode;
import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.InvalidSyntaxException;
import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTracker;
@ThreadSafeAndProhibitedFromDsfExecutor("") @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
public class SyncRegisterDataAccess { public class SyncRegisterDataAccess {
/**
* The session that this data access operates in.
*/
private final DsfSession fSession;
/** /**
* Need to use the OSGi service tracker here (instead of DsfServiceTracker), * Need to use the OSGi service tracker here (instead of DsfServiceTracker),
* because we're accessing it in non-dispatch thread. DsfServiceTracker is * because we're accessing it in non-dispatch thread. DsfServiceTracker is
* not thread-safe. * not thread-safe.
*/ */
@ThreadSafe
private ServiceTracker fServiceTracker; private ServiceTracker fServiceTracker;
private synchronized IRegisters getService(String filter) { public SyncRegisterDataAccess(DsfSession session) {
fSession = session;
}
@ThreadSafe
private synchronized IRegisters getService() {
if (fServiceTracker == null) { if (fServiceTracker == null) {
try { try {
fServiceTracker = new ServiceTracker(DsfDebugUIPlugin fServiceTracker = new ServiceTracker(
.getBundleContext(), DsfDebugUIPlugin.getBundleContext() DsfDebugUIPlugin.getBundleContext(),
.createFilter(filter), null); DsfDebugUIPlugin.getBundleContext().createFilter(getServiceFilter()), null);
fServiceTracker.open(); fServiceTracker.open();
} catch (InvalidSyntaxException e) { } catch (InvalidSyntaxException e) {
assert false : "Invalid filter in DMC: " + filter; //$NON-NLS-1$
return null; return null;
} }
} else {
/*
* All of the DMCs that this cell modifier is invoked for should
* originate from the same service. This assertion checks this
* assumption by comparing the service reference in the tracker to
* the filter string in the DMC.
*/
try {
assert DsfDebugUIPlugin.getBundleContext().createFilter(filter)
.match(fServiceTracker.getServiceReference());
} catch (InvalidSyntaxException e) {
}
} }
return (IRegisters) fServiceTracker.getService(); return (IRegisters) fServiceTracker.getService();
} }
public void dispose() { private String getServiceFilter() {
StringBuffer filter = new StringBuffer();
filter.append("(&"); //$NON-NLS-1$
filter.append("(OBJECTCLASS="); //$NON-NLS-1$
filter.append(IRegisters.class.getName());
filter.append(')');
filter.append('(');
filter.append(IDsfService.PROP_SESSION_ID);
filter.append('=');
filter.append(fSession.getId());
filter.append(')');
filter.append(')');
return filter.toString();
}
@ThreadSafe
public synchronized void dispose() {
if ( fServiceTracker != null ) { if ( fServiceTracker != null ) {
fServiceTracker.close(); fServiceTracker.close();
} }
@ -105,7 +120,7 @@ public class SyncRegisterDataAccess {
return; return;
} }
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -140,7 +155,7 @@ public class SyncRegisterDataAccess {
public IBitFieldDMContext getBitFieldDMC(Object element) { public IBitFieldDMContext getBitFieldDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IBitFieldDMContext.class); return DMContexts.getAncestorOfType(dmc, IBitFieldDMContext.class);
} }
return null; return null;
@ -207,7 +222,7 @@ public class SyncRegisterDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -315,7 +330,7 @@ public class SyncRegisterDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -396,7 +411,7 @@ public class SyncRegisterDataAccess {
public IRegisterGroupDMContext getRegisterGroupDMC(Object element) { public IRegisterGroupDMContext getRegisterGroupDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IRegisterGroupDMContext.class); return DMContexts.getAncestorOfType(dmc, IRegisterGroupDMContext.class);
} }
return null; return null;
@ -404,15 +419,15 @@ public class SyncRegisterDataAccess {
public IRegisterDMContext getRegisterDMC(Object element) { public IRegisterDMContext getRegisterDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class); return DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class);
} }
return null; return null;
} }
public IFormattedDataDMContext<?> getFormattedDMC(Object element) { public IFormattedDataDMContext getFormattedDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class); IRegisterDMContext regdmc = DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class);
return DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class); return DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class);
} }
@ -442,7 +457,7 @@ public class SyncRegisterDataAccess {
return; return;
} }
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -531,7 +546,7 @@ public class SyncRegisterDataAccess {
return; return;
} }
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -625,7 +640,7 @@ public class SyncRegisterDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -712,9 +727,9 @@ public class SyncRegisterDataAccess {
public class GetSupportFormatsValueQuery extends Query<Object> { public class GetSupportFormatsValueQuery extends Query<Object> {
IFormattedDataDMContext<?> fDmc; IFormattedDataDMContext fDmc;
public GetSupportFormatsValueQuery(IFormattedDataDMContext<?> dmc) { public GetSupportFormatsValueQuery(IFormattedDataDMContext dmc) {
super(); super();
fDmc = dmc; fDmc = dmc;
} }
@ -734,7 +749,7 @@ public class SyncRegisterDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -779,9 +794,9 @@ public class SyncRegisterDataAccess {
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out. * session is stale, then bail out.
*/ */
IFormattedDataDMContext<?> dmc = null; IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.class); IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.class);
dmc = DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class); dmc = DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class);
} }
@ -815,10 +830,10 @@ public class SyncRegisterDataAccess {
public class GetFormattedValueValueQuery extends Query<Object> { public class GetFormattedValueValueQuery extends Query<Object> {
private IFormattedDataDMContext<?> fDmc; private IFormattedDataDMContext fDmc;
private String fFormatId; private String fFormatId;
public GetFormattedValueValueQuery(IFormattedDataDMContext<?> dmc, String formatId) { public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) {
super(); super();
fDmc = dmc; fDmc = dmc;
fFormatId = formatId; fFormatId = formatId;
@ -839,7 +854,7 @@ public class SyncRegisterDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IRegisters service = getService(fDmc.getServiceFilter()); IRegisters service = getService();
if (service == null) { if (service == null) {
rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -883,9 +898,9 @@ public class SyncRegisterDataAccess {
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out. * session is stale, then bail out.
*/ */
IFormattedDataDMContext<?> dmc = null; IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.class); IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.class);
dmc = DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class); dmc = DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class);
} }
@ -923,9 +938,9 @@ public class SyncRegisterDataAccess {
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out. * session is stale, then bail out.
*/ */
IFormattedDataDMContext<?> dmc = null; IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC(); IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IBitFieldDMContext bitfielddmc = DMContexts.getAncestorOfType(vmcdmc, IBitFieldDMContext.class); IBitFieldDMContext bitfielddmc = DMContexts.getAncestorOfType(vmcdmc, IBitFieldDMContext.class);
dmc = DMContexts.getAncestorOfType(bitfielddmc, IFormattedDataDMContext.class); dmc = DMContexts.getAncestorOfType(bitfielddmc, IFormattedDataDMContext.class);
} }

View file

@ -13,6 +13,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.Query; import org.eclipse.dd.dsf.concurrent.Query;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IExpressions;
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext; import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
@ -26,45 +27,60 @@ import org.eclipse.dd.dsf.service.IDsfService;
import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.InvalidSyntaxException;
import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTracker;
@ThreadSafeAndProhibitedFromDsfExecutor("") @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
public class SyncVariableDataAccess { public class SyncVariableDataAccess {
/**
* The session that this data access operates in.
*/
private final DsfSession fSession;
/** /**
* Need to use the OSGi service tracker here (instead of DsfServiceTracker), * Need to use the OSGi service tracker here (instead of DsfServiceTracker),
* because we're accessing it in non-dispatch thread. DsfServiceTracker is * because we're accessing it in non-dispatch thread. DsfServiceTracker is
* not thread-safe. * not thread-safe.
*/ */
@ThreadSafe
private ServiceTracker fServiceTracker; private ServiceTracker fServiceTracker;
private synchronized IExpressions getService(String filter) {
public SyncVariableDataAccess(DsfSession session) {
fSession = session;
}
@ThreadSafe
private synchronized IExpressions getService() {
if (fServiceTracker == null) { if (fServiceTracker == null) {
try { try {
fServiceTracker = new ServiceTracker(DsfDebugUIPlugin fServiceTracker = new ServiceTracker(
.getBundleContext(), DsfDebugUIPlugin.getBundleContext() DsfDebugUIPlugin.getBundleContext(),
.createFilter(filter), null); DsfDebugUIPlugin.getBundleContext().createFilter(getServiceFilter()), null);
fServiceTracker.open(); fServiceTracker.open();
} catch (InvalidSyntaxException e) { } catch (InvalidSyntaxException e) {
assert false : "Invalid filter in DMC: " + filter; //$NON-NLS-1$
return null; return null;
} }
} else { }
/*
* All of the DMCs that this cell modifier is invoked for should
* originate from the same service. This assertion checks this
* assumption by comparing the service reference in the tracker to
* the filter string in the DMC.
*/
try {
assert DsfDebugUIPlugin.getBundleContext().createFilter(filter)
.match(fServiceTracker.getServiceReference());
} catch (InvalidSyntaxException e) {
}
}
return (IExpressions) fServiceTracker.getService(); return (IExpressions) fServiceTracker.getService();
} }
public void dispose() { private String getServiceFilter() {
StringBuffer filter = new StringBuffer();
filter.append("(&"); //$NON-NLS-1$
filter.append("(OBJECTCLASS="); //$NON-NLS-1$
filter.append(IExpressions.class.getName());
filter.append(')');
filter.append('(');
filter.append(IDsfService.PROP_SESSION_ID);
filter.append('=');
filter.append(fSession.getId());
filter.append(')');
filter.append(')');
return filter.toString();
}
@ThreadSafe
public synchronized void dispose() {
if (fServiceTracker != null) { if (fServiceTracker != null) {
fServiceTracker.close(); fServiceTracker.close();
} }
@ -101,7 +117,7 @@ public class SyncVariableDataAccess {
return; return;
} }
IExpressions service = getService(fDmc.getServiceFilter()); IExpressions service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -202,7 +218,7 @@ public class SyncVariableDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IExpressions service = getService(fDmc.getServiceFilter()); IExpressions service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -282,18 +298,18 @@ public class SyncVariableDataAccess {
} }
} }
public IFormattedDataDMContext<?> getFormattedDMC(Object element) { public IFormattedDataDMContext getFormattedDMC(Object element) {
if (element instanceof IAdaptable) { if (element instanceof IAdaptable) {
return (IFormattedDataDMContext<?>) ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class); return (IFormattedDataDMContext) ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class);
} }
return null; return null;
} }
public class GetSupportFormatsValueQuery extends Query<Object> { public class GetSupportFormatsValueQuery extends Query<Object> {
IFormattedDataDMContext<?> fDmc; IFormattedDataDMContext fDmc;
public GetSupportFormatsValueQuery(IFormattedDataDMContext<?> dmc) { public GetSupportFormatsValueQuery(IFormattedDataDMContext dmc) {
super(); super();
fDmc = dmc; fDmc = dmc;
} }
@ -313,7 +329,7 @@ public class SyncVariableDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IExpressions service = getService(fDmc.getServiceFilter()); IExpressions service = getService();
if (service == null) { if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -358,7 +374,7 @@ public class SyncVariableDataAccess {
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out. * session is stale, then bail out.
*/ */
IFormattedDataDMContext<?> dmc = getFormattedDMC(element); IFormattedDataDMContext dmc = getFormattedDMC(element);
if (dmc == null) return null; if (dmc == null) return null;
DsfSession session = DsfSession.getSession(dmc.getSessionId()); DsfSession session = DsfSession.getSession(dmc.getSessionId());
if (session == null) return null; if (session == null) return null;
@ -388,10 +404,10 @@ public class SyncVariableDataAccess {
public class GetFormattedValueValueQuery extends Query<Object> { public class GetFormattedValueValueQuery extends Query<Object> {
private IFormattedDataDMContext<?> fDmc; private IFormattedDataDMContext fDmc;
private String fFormatId; private String fFormatId;
public GetFormattedValueValueQuery(IFormattedDataDMContext<?> dmc, String formatId) { public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) {
super(); super();
fDmc = dmc; fDmc = dmc;
fFormatId = formatId; fFormatId = formatId;
@ -412,7 +428,7 @@ public class SyncVariableDataAccess {
/* /*
* Guard against a disposed service * Guard against a disposed service
*/ */
IExpressions service = getService(fDmc.getServiceFilter()); IExpressions service = getService();
if (service == null) { if (service == null) {
rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$ rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done(); rm.done();
@ -456,7 +472,7 @@ public class SyncVariableDataAccess {
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out. * session is stale, then bail out.
*/ */
IFormattedDataDMContext<?> dmc = getFormattedDMC(element); IFormattedDataDMContext dmc = getFormattedDMC(element);
if (dmc == null) return null; if (dmc == null) return null;
DsfSession session = DsfSession.getSession(dmc.getSessionId()); DsfSession session = DsfSession.getSession(dmc.getSessionId());
if (session == null) return null; if (session == null) return null;

View file

@ -19,7 +19,6 @@ import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMService;
import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IExpressions;
import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRunControl;
@ -63,7 +62,7 @@ import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@SuppressWarnings({"restriction", "nls"}) @SuppressWarnings({"restriction", "nls"})
public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpressionDMData> implements IElementEditor { public class VariableLayoutNode extends AbstractExpressionLayoutNode implements IElementEditor {
/** /**
* List of child nodes containing only a reference to this. This is what enables the view model * List of child nodes containing only a reference to this. This is what enables the view model
@ -126,7 +125,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
private IExpression fExpression; private IExpression fExpression;
public VariableExpressionVMC(IDMContext<?> dmc) { public VariableExpressionVMC(IDMContext dmc) {
super(dmc); super(dmc);
} }
@ -208,7 +207,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
} }
@Override @Override
protected IVMContext createVMContext(IDMContext<IExpressionDMData> dmc) { protected IVMContext createVMContext(IDMContext dmc) {
return new VariableExpressionVMC(dmc); return new VariableExpressionVMC(dmc);
} }
@ -225,7 +224,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
final IExpressionDMContext dmc = findDmcInPath(update.getElementPath(), IExpressions.IExpressionDMContext.class); final IExpressionDMContext dmc = findDmcInPath(update.getElementPath(), IExpressions.IExpressionDMContext.class);
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext()) VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()), .getModelData(getServicesTracker().getService(IExpressions.class, null),
dmc, dmc,
new DataRequestMonitor<IExpressionDMData>(getSession().getExecutor(), null) { new DataRequestMonitor<IExpressionDMData>(getSession().getExecutor(), null) {
@Override @Override
@ -234,7 +233,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
// fail if the state of the service changed during the request, but the view model // fail if the state of the service changed during the request, but the view model
// has not been updated yet. // has not been updated yet.
if (!getStatus().isOK() || !getData().isValid()) { if (!getStatus().isOK()) {
assert getStatus().isOK() || assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR || getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED; getStatus().getCode() != IDsfService.NOT_SUPPORTED;

View file

@ -28,7 +28,7 @@ public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache imple
/* /*
* Create the variable data access routines. * Create the variable data access routines.
*/ */
SyncVariableDataAccess varAccess = new SyncVariableDataAccess() ; SyncVariableDataAccess varAccess = new SyncVariableDataAccess(session) ;
/* /*
* Create the top level node to deal with the root selection. * Create the top level node to deal with the root selection.

View file

@ -66,7 +66,7 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
private final String fModelId; private final String fModelId;
private final DsfSession fSession; private final DsfSession fSession;
private final DsfExecutor fExecutor; private final DsfExecutor fExecutor;
private IDMContext<?> fContext; private IDMContext fContext;
private final ServiceTracker fMemoryServiceTracker; private final ServiceTracker fMemoryServiceTracker;
private final ServiceTracker fExpressionServiceTracker; private final ServiceTracker fExpressionServiceTracker;
@ -77,7 +77,7 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
* @param dmc * @param dmc
* @throws DebugException * @throws DebugException
*/ */
public DsfMemoryBlockRetrieval(String modelId, IDMContext<?> dmc) throws DebugException { public DsfMemoryBlockRetrieval(String modelId, IDMContext dmc) throws DebugException {
fModelId = modelId; fModelId = modelId;
fContext = dmc; fContext = dmc;
@ -143,7 +143,7 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
return fExecutor; return fExecutor;
} }
public IDMContext<?> getContext() { public IDMContext getContext() {
return fContext; return fContext;
} }
@ -254,9 +254,9 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
// In case of failure, simply return 'null' // In case of failure, simply return 'null'
// Drill for the actual DMC // Drill for the actual DMC
IDMContext<?> dmc = null; IDMContext dmc = null;
if (context instanceof IAdaptable) { if (context instanceof IAdaptable) {
dmc = (IDMContext<?>)((IAdaptable)context).getAdapter(IDMContext.class); dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class);
} }
if (dmc == null) { if (dmc == null) {
@ -293,7 +293,7 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
// Helper functions // Helper functions
// //////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////
private BigInteger resolveMemoryAddress(final IDMContext<?> idmContext, final String expression) throws DebugException { private BigInteger resolveMemoryAddress(final IDMContext idmContext, final String expression) throws DebugException {
// Use a Query to "synchronise" the downstream calls // Use a Query to "synchronise" the downstream calls
Query<BigInteger> query = new Query<BigInteger>() { Query<BigInteger> query = new Query<BigInteger>() {
@ -312,15 +312,13 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
FormattedValueDMContext valueDmc = expressionService.getFormattedValueContext(expressionDMC, formatId); FormattedValueDMContext valueDmc = expressionService.getFormattedValueContext(expressionDMC, formatId);
expressionService.getModelData( expressionService.getModelData(
valueDmc, valueDmc,
new DataRequestMonitor<FormattedValueDMData>(getExecutor(), null) { new DataRequestMonitor<FormattedValueDMData>(getExecutor(), drm) {
@Override @Override
protected void handleOK() { protected void handleOK() {
// Store the result // Store the result
FormattedValueDMData data = getData(); FormattedValueDMData data = getData();
if (data.isValid()) { String value = data.getFormattedValue().substring(2); // Strip the "0x"
String value = data.getFormattedValue().substring(2); // Strip the "0x" drm.setData(new BigInteger(value, 16));
drm.setData(new BigInteger(value, 16));
}
drm.done(); drm.done();
} }
} }

View file

@ -28,7 +28,7 @@ public interface IBreakpoints extends IDMService {
public enum BreakpointStatus { INSTALLED, FAILED_TO_INSTALL, FILTERED_OUT } public enum BreakpointStatus { INSTALLED, FAILED_TO_INSTALL, FILTERED_OUT }
public interface IBreakpointDMContext extends IDMContext<IBreakpointDMData> {} public interface IBreakpointDMContext extends IDMContext {}
public interface IBreakpointDMData extends IDMData { public interface IBreakpointDMData extends IDMData {
IBreakpoint getPlatformBreakpoint(); IBreakpoint getPlatformBreakpoint();
@ -43,7 +43,7 @@ public interface IBreakpoints extends IDMService {
public interface IBreakpointHitEvent extends IBreakpointDMEvent {} public interface IBreakpointHitEvent extends IBreakpointDMEvent {}
public void getAllBreakpoints(IDMContext<?> execDmc, DataRequestMonitor<IBreakpointDMContext[]> rm); public void getAllBreakpoints(IDMContext ctx, DataRequestMonitor<IBreakpointDMContext[]> rm);
public void getBreakpoints(IDMContext<?> execDmc, IBreakpoint platformBp, DataRequestMonitor<IBreakpointDMContext[]> rm); public void getBreakpoints(IDMContext ctx, IBreakpoint platformBp, DataRequestMonitor<IBreakpointDMContext[]> rm);
} }

View file

@ -32,7 +32,7 @@ public interface IExpressions extends IDMService, IFormattedValues {
* Expression context. Since some expressions have children, expression contexts can have an * Expression context. Since some expressions have children, expression contexts can have an
* arbitrary number of parents of type IExpressionDMContext. * arbitrary number of parents of type IExpressionDMContext.
*/ */
public interface IExpressionDMContext extends IFormattedDataDMContext<IExpressionDMData> { public interface IExpressionDMContext extends IFormattedDataDMContext {
/** /**
* Returns a fully qualified expression string represented by this context. This * Returns a fully qualified expression string represented by this context. This
* expression string is the same as the string that is sent to the debug engine to be * expression string is the same as the string that is sent to the debug engine to be
@ -149,7 +149,7 @@ public interface IExpressions extends IDMService, IFormattedValues {
* @return An expression data model context object that must be passed to getModelData() to obtain the * @return An expression data model context object that must be passed to getModelData() to obtain the
* value of the expression. * value of the expression.
*/ */
IExpressionDMContext createExpression(IDMContext<?> ctx, String expression); IExpressionDMContext createExpression(IDMContext ctx, String expression);
/** /**
* Retrieves the sub-expressions of the given expression. Sub-expressions are fields of a struct, union, * Retrieves the sub-expressions of the given expression. Sub-expressions are fields of a struct, union,
@ -208,5 +208,5 @@ public interface IExpressions extends IDMService, IFormattedValues {
* *
* @param rm: Request completion monitor. * @param rm: Request completion monitor.
*/ */
void writeExpression(IDMContext<?> expressionContext, String exressionValue, String formatId, RequestMonitor rm); void writeExpression(IDMContext expressionContext, String exressionValue, String formatId, RequestMonitor rm);
} }

View file

@ -20,7 +20,7 @@ import org.eclipse.dd.dsf.datamodel.IDMService;
public interface IFormattedValues extends IDMService { public interface IFormattedValues extends IDMService {
/** Marker interface for a DMC that has a formatted value. */ /** Marker interface for a DMC that has a formatted value. */
public interface IFormattedDataDMContext<V extends IDMData> extends IDMContext<V> {} public interface IFormattedDataDMContext extends IDMContext {}
/** /**
* These strings represent the standard known formats for any bit stream * These strings represent the standard known formats for any bit stream
@ -43,7 +43,7 @@ public interface IFormattedValues extends IDMService {
* @param dmc Context for which to retrieve available formats. * @param dmc Context for which to retrieve available formats.
* @param rm Completion monitor returns an array of support formatIds. * @param rm Completion monitor returns an array of support formatIds.
*/ */
public void getAvailableFormats(IFormattedDataDMContext<?> dmc, DataRequestMonitor<String[]> rm); public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm);
/** /**
* Creates a FormattedValueDMContext representing the given formatId. * Creates a FormattedValueDMContext representing the given formatId.
@ -51,24 +51,24 @@ public interface IFormattedValues extends IDMService {
* @param dmc Parent context for the context that is being created * @param dmc Parent context for the context that is being created
* @param formatId Defines format to be used for the returned context. * @param formatId Defines format to be used for the returned context.
*/ */
public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext<?> dmc, String formatId); public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String formatId);
/** /**
* DMC that represents a value with specific format. The format ID can be * DMC that represents a value with specific format. The format ID can be
* persisted and used for comparison. * persisted and used for comparison.
*/ */
public static class FormattedValueDMContext extends AbstractDMContext<FormattedValueDMData> public static class FormattedValueDMContext extends AbstractDMContext
{ {
private final String fFormatID; private final String fFormatID;
public FormattedValueDMContext(IDMService service, IDMContext<?> parent, String formatId) { public FormattedValueDMContext(IDMService service, IDMContext parent, String formatId) {
super(service, new IDMContext[] { parent }); super(service, new IDMContext[] { parent });
fFormatID = formatId; fFormatID = formatId;
} }
public FormattedValueDMContext(String sessionId, String filter, IDMContext<?> parent, String formatId) { public FormattedValueDMContext(String sessionId, IDMContext parent, String formatId) {
super(sessionId, filter, new IDMContext[] { parent }); super(sessionId, new IDMContext[] { parent });
fFormatID = formatId; fFormatID = formatId;
} }
@ -103,10 +103,5 @@ public interface IFormattedValues extends IDMService {
public String getFormattedValue() { public String getFormattedValue() {
return fValue; return fValue;
} }
public boolean isValid() {
return true;
}
} }
} }

View file

@ -50,14 +50,14 @@ public interface IMemory extends IDsfService {
*/ */
public class MemoryChangedEvent { public class MemoryChangedEvent {
IAddress[] fAddresses; IAddress[] fAddresses;
IDMContext<?> fContext; IDMContext fContext;
public MemoryChangedEvent(IDMContext<?> context, IAddress[] addresses) { public MemoryChangedEvent(IDMContext context, IAddress[] addresses) {
fContext = context; fContext = context;
fAddresses = addresses; fAddresses = addresses;
} }
public IDMContext<?> getContext() { public IDMContext getContext() {
return fContext; return fContext;
} }
@ -86,7 +86,7 @@ public interface IMemory extends IDsfService {
* @param count the number of data elements to read * @param count the number of data elements to read
* @param drm the asynchronous data request monitor * @param drm the asynchronous data request monitor
*/ */
public void getMemory(IDMContext<?> context, IAddress address, long offset, public void getMemory(IDMContext context, IAddress address, long offset,
int word_size, int count, DataRequestMonitor<MemoryByte[]> drm); int word_size, int count, DataRequestMonitor<MemoryByte[]> drm);
/** /**
@ -107,7 +107,7 @@ public interface IMemory extends IDsfService {
* @param buffer the source buffer * @param buffer the source buffer
* @param rm the asynchronous data request monitor * @param rm the asynchronous data request monitor
*/ */
public void setMemory(IDMContext<?> context, IAddress address, long offset, public void setMemory(IDMContext context, IAddress address, long offset,
int word_size, int count, byte[] buffer, RequestMonitor rm); int word_size, int count, byte[] buffer, RequestMonitor rm);
/** /**
@ -123,7 +123,7 @@ public interface IMemory extends IDsfService {
* @param pattern the source buffer * @param pattern the source buffer
* @param rm the asynchronous data request monitor * @param rm the asynchronous data request monitor
*/ */
public void fillMemory(IDMContext<?> context, IAddress address, long offset, public void fillMemory(IDMContext context, IAddress address, long offset,
int word_size, int count, byte[] pattern, RequestMonitor rm); int word_size, int count, byte[] pattern, RequestMonitor rm);
} }

View file

@ -30,12 +30,12 @@ public interface IModules extends IDMService {
* types of debugging, like kernel or no-OS debugging, it's useful to * types of debugging, like kernel or no-OS debugging, it's useful to
* separate the concept of a symbol context from a process. * separate the concept of a symbol context from a process.
*/ */
public interface ISymbolDMContext extends IDMContext<ISymbolDMData>{} public interface ISymbolDMContext extends IDMContext {}
/** /**
* Module context represents a single module that is loaded. * Module context represents a single module that is loaded.
*/ */
public interface IModuleDMContext extends IDMContext<IModuleDMData> {} public interface IModuleDMContext extends IDMContext {}
/** /**
* Event indicating a change in the symbol information for given context. * Event indicating a change in the symbol information for given context.
@ -101,7 +101,7 @@ public interface IModules extends IDMService {
} }
/** Module information. */ /** Module information. */
public interface IModuleDMData extends IDMData { public interface IModuleDMData {
String getName(); String getName();
String getFile(); String getFile();
long getTimeStamp(); long getTimeStamp();
@ -134,16 +134,16 @@ public interface IModules extends IDMService {
/** /**
* Retreives the list of modules loaded in given symbol context. * Retreives the list of modules loaded in given symbol context.
*/ */
void getModules(IDMContext<?> symCtx, DataRequestMonitor<IModuleDMContext[]> rm); void getModules(IDMContext symCtx, DataRequestMonitor<IModuleDMContext[]> rm);
/** /**
* Calculates the line numbers corresponding to the given address. * Calculates the line numbers corresponding to the given address.
*/ */
void calcLineInfo(IDMContext<?> symCtx, IAddress address, DataRequestMonitor<LineInfo[]> rm); void calcLineInfo(IDMContext symCtx, IAddress address, DataRequestMonitor<LineInfo[]> rm);
/** /**
* Calculates the addresses corresponding to the given source file location. * Calculates the addresses corresponding to the given source file location.
*/ */
void calcAddressInfo(IDMContext<?> symCtx, String file, int line, int col, DataRequestMonitor<AddressRange[]> rm); void calcAddressInfo(IDMContext symCtx, String file, int line, int col, DataRequestMonitor<AddressRange[]> rm);
} }

View file

@ -26,8 +26,8 @@ import org.eclipse.dd.dsf.datamodel.IDMService;
*/ */
public interface INativeProcesses extends IDMService { public interface INativeProcesses extends IDMService {
public interface IThreadDMContext extends IDMContext<IThreadDMData> {} public interface IThreadDMContext extends IDMContext {}
public interface IProcessDMContext extends IDMContext<IProcessDMData> {} public interface IProcessDMContext extends IDMContext {}
/** /**
* Interface for thread and process object data. * Interface for thread and process object data.
@ -36,7 +36,7 @@ public interface INativeProcesses extends IDMService {
String getName(); String getName();
String getId(); String getId();
boolean isDebuggerAttached(); boolean isDebuggerAttached();
IDMContext<?> getDebugContext(); IDMContext getDebugContext();
} }
/** /**
@ -46,7 +46,7 @@ public interface INativeProcesses extends IDMService {
String getName(); String getName();
String getId(); String getId();
boolean isDebuggerAttached(); boolean isDebuggerAttached();
IDMContext<?> getDebugContext(); IDMContext getDebugContext();
} }
/** /**
@ -55,11 +55,11 @@ public interface INativeProcesses extends IDMService {
public interface IProcessChangedDMEvent extends IDMEvent<IProcessDMContext> {} public interface IProcessChangedDMEvent extends IDMEvent<IProcessDMContext> {}
public interface IProcessStartedEvent extends IDMEvent<IDMContext<INativeProcesses>> { public interface IProcessStartedEvent extends IDMEvent<IDMContext> {
IProcessDMContext getProcess(); IProcessDMContext getProcess();
} }
public interface IProcessExitedEvent extends IDMEvent<IDMContext<INativeProcesses>> { public interface IProcessExitedEvent extends IDMEvent<IDMContext> {
IProcessDMContext getProcess(); IProcessDMContext getProcess();
} }
@ -69,13 +69,13 @@ public interface INativeProcesses extends IDMService {
* @param execCtx * @param execCtx
* @return * @return
*/ */
public IThreadDMContext getThreadForDebugContext(IDMContext<?> execCtx); public IThreadDMContext getThreadForDebugContext(IDMContext execCtx);
/** /**
* Returns a process context corresponding to the given context. <code>null</code> if no * Returns a process context corresponding to the given context. <code>null</code> if no
* corresponding process exists. * corresponding process exists.
*/ */
public IProcessDMContext getProcessForDebugContext(IDMContext<?> execCtx); public IProcessDMContext getProcessForDebugContext(IDMContext execCtx);
/** /**
* Retrieves the current list of processes running on target. * Retrieves the current list of processes running on target.
@ -114,13 +114,13 @@ public interface INativeProcesses extends IDMService {
* @param thread Thread or process to terminate. * @param thread Thread or process to terminate.
* @param rm Return token. * @param rm Return token.
*/ */
void canTerminate(IDMContext<?> ctx, DataRequestMonitor<Boolean> rm); void canTerminate(IDMContext ctx, DataRequestMonitor<Boolean> rm);
/** /**
* Terminates the selected process or thread. * Terminates the selected process or thread.
* @param thread Thread or process to terminate. * @param thread Thread or process to terminate.
* @param rm Request completion monitor, indicates success or failure. * @param rm Request completion monitor, indicates success or failure.
*/ */
void terminate(IDMContext<?> ctx, RequestMonitor requestMonitor); void terminate(IDMContext ctx, RequestMonitor requestMonitor);
} }

View file

@ -10,8 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dd.dsf.debug.service; package org.eclipse.dd.dsf.debug.service;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData; import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.dd.dsf.datamodel.IDMService; import org.eclipse.dd.dsf.datamodel.IDMService;
@ -30,7 +30,7 @@ public interface IOS extends IDMService {
* Context object for the whole OS, for debuggers that support * Context object for the whole OS, for debuggers that support
* debugging multiple targets/cores simultaneously. * debugging multiple targets/cores simultaneously.
*/ */
public interface IOSDMContext extends IDMContext<IOSDMData> {} public interface IOSDMContext extends IDMContext {}
/** /**
* Data object describing OS info * Data object describing OS info
@ -44,7 +44,7 @@ public interface IOS extends IDMService {
/** /**
* Context for a OS object type, such as process, kernel task, semaphore, etc. * Context for a OS object type, such as process, kernel task, semaphore, etc.
*/ */
public interface IObjectTypeDMContext extends IDMContext<IObjectTypeDMData> {} public interface IObjectTypeDMContext extends IDMContext {}
/** /**
* Description data for a OS object type. * Description data for a OS object type.
@ -59,7 +59,7 @@ public interface IOS extends IDMService {
/** /**
* OS object context. * OS object context.
*/ */
public interface IObjectDMContext extends IDMContext<IObjectDMData> {} public interface IObjectDMContext extends IDMContext {}
/** /**
* Description data for an OS object. * Description data for an OS object.
@ -69,7 +69,7 @@ public interface IOS extends IDMService {
String getID(); String getID();
boolean canAttachDebugger(); boolean canAttachDebugger();
boolean isDebuggerAttached(); boolean isDebuggerAttached();
IDMContext<?> getDebuggingContext(); IDMContext getDebuggingContext();
} }
/** /**

View file

@ -25,7 +25,7 @@ public interface IRegisters extends IFormattedValues {
public interface IGroupsChangedDMEvent extends IDMEvent<IRunControl.IExecutionDMContext> {} public interface IGroupsChangedDMEvent extends IDMEvent<IRunControl.IExecutionDMContext> {}
/** Register group context */ /** Register group context */
public interface IRegisterGroupDMContext extends IFormattedDataDMContext<IRegisterGroupDMData> { public interface IRegisterGroupDMContext extends IFormattedDataDMContext {
public String getName(); public String getName();
} }
@ -45,7 +45,7 @@ public interface IRegisters extends IFormattedValues {
} }
/** Register context */ /** Register context */
public interface IRegisterDMContext extends IFormattedDataDMContext<IRegisterDMData> { public interface IRegisterDMContext extends IFormattedDataDMContext {
public String getName(); public String getName();
} }
@ -66,7 +66,7 @@ public interface IRegisters extends IFormattedValues {
} }
/** Bit field context */ /** Bit field context */
public interface IBitFieldDMContext extends IFormattedDataDMContext<IBitFieldDMData> { public interface IBitFieldDMContext extends IFormattedDataDMContext {
public String getName(); public String getName();
} }
@ -109,28 +109,28 @@ public interface IRegisters extends IFormattedValues {
* @param ctx Context for the returned data. * @param ctx Context for the returned data.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void getRegisterGroups(IDMContext<?> ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm); void getRegisterGroups(IDMContext ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm);
/** /**
* Retrieves list of sub-groups of given register group. * Retrieves list of sub-groups of given register group.
* @param ctx Context for the returned data. * @param ctx Context for the returned data.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void getRegisterSubGroups(IDMContext<?> ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm); void getRegisterSubGroups(IDMContext ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm);
/** /**
* Retrieves registers in given register group. * Retrieves registers in given register group.
* @param ctx Context for the returned data. * @param ctx Context for the returned data.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void getRegisters(IDMContext<?> ctx, DataRequestMonitor<IRegisterDMContext[]> rm); void getRegisters(IDMContext ctx, DataRequestMonitor<IRegisterDMContext[]> rm);
/** /**
* Retrieves bit fields for given register * Retrieves bit fields for given register
* @param ctx Context for the returned data. * @param ctx Context for the returned data.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void getBitFields(IDMContext<?> ctx, DataRequestMonitor<IBitFieldDMContext[]> rm); void getBitFields(IDMContext ctx, DataRequestMonitor<IBitFieldDMContext[]> rm);
/** /**
* Writes a register value for a given register to the target * Writes a register value for a given register to the target
@ -139,7 +139,7 @@ public interface IRegisters extends IFormattedValues {
* @param formatId Format of the value to be written. * @param formatId Format of the value to be written.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void writeRegister(IDMContext<?> regCtx, String regValue, String formatId, RequestMonitor rm); void writeRegister(IDMContext regCtx, String regValue, String formatId, RequestMonitor rm);
/** /**
* Writes a bit field value for a given bit field to the target * Writes a bit field value for a given bit field to the target
@ -148,7 +148,7 @@ public interface IRegisters extends IFormattedValues {
* @param formatId Format of the value to be written. * @param formatId Format of the value to be written.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void writeBitField(IDMContext<?> bitFieldCtx, String bitFieldValue, String formatId, RequestMonitor rm); void writeBitField(IDMContext bitFieldCtx, String bitFieldValue, String formatId, RequestMonitor rm);
/** /**
* Writes a bit field value for a given bit field to the target * Writes a bit field value for a given bit field to the target
@ -156,5 +156,5 @@ public interface IRegisters extends IFormattedValues {
* @param mnemonic Mnemonic which represents the value to be written. * @param mnemonic Mnemonic which represents the value to be written.
* @param rm Request completion monitor. * @param rm Request completion monitor.
*/ */
void writeBitField(IDMContext<?> bitFieldCtx, IMnemonic mnemonic, RequestMonitor rm); void writeBitField(IDMContext bitFieldCtx, IMnemonic mnemonic, RequestMonitor rm);
} }

View file

@ -33,7 +33,7 @@ public interface IRunControl extends IDMService
* performed. A lot of higher-level services reference this context to build * performed. A lot of higher-level services reference this context to build
* functionality on top of it, e.g. stack, expression evaluation, registers, etc. * functionality on top of it, e.g. stack, expression evaluation, registers, etc.
*/ */
public interface IExecutionDMContext extends IDMContext<IExecutionDMData> {} public interface IExecutionDMContext extends IDMContext {}
/** /**
* Context representing a process, kernel, or some other logical container * Context representing a process, kernel, or some other logical container
@ -95,15 +95,15 @@ public interface IRunControl extends IDMService
* Run control commands. They all require the IExecutionContext object on * Run control commands. They all require the IExecutionContext object on
* which they perform the operations. * which they perform the operations.
*/ */
boolean canResume(IDMContext<?> context); boolean canResume(IDMContext context);
boolean canSuspend(IDMContext<?> context); boolean canSuspend(IDMContext context);
boolean isSuspended(IDMContext<?> context); boolean isSuspended(IDMContext context);
void resume(IDMContext<?> context, RequestMonitor requestMonitor); void resume(IDMContext context, RequestMonitor requestMonitor);
void suspend(IDMContext<?> context, RequestMonitor requestMonitor); void suspend(IDMContext context, RequestMonitor requestMonitor);
public enum StepType { STEP_OVER, STEP_INTO, STEP_RETURN }; public enum StepType { STEP_OVER, STEP_INTO, STEP_RETURN };
boolean isStepping(IDMContext<?> context); boolean isStepping(IDMContext context);
boolean canStep(IDMContext<?> context); boolean canStep(IDMContext context);
void step(IDMContext<?> context, StepType stepType, RequestMonitor requestMonitor); void step(IDMContext context, StepType stepType, RequestMonitor requestMonitor);
boolean canInstructionStep(IDMContext<?> context); boolean canInstructionStep(IDMContext context);
void instructionStep(IDMContext<?> context, StepType stepType, RequestMonitor requestMonitor); void instructionStep(IDMContext context, StepType stepType, RequestMonitor requestMonitor);
} }

View file

@ -12,7 +12,6 @@ package org.eclipse.dd.dsf.debug.service;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.datamodel.IDMEvent;
import org.eclipse.dd.dsf.service.IDsfService; import org.eclipse.dd.dsf.service.IDsfService;
@ -24,17 +23,17 @@ import org.eclipse.dd.dsf.service.IDsfService;
*/ */
public interface ISourceLookup extends IDsfService { public interface ISourceLookup extends IDsfService {
public interface ISourceLookupDMContext extends IDMContext<IDMData> {} public interface ISourceLookupDMContext extends IDMContext {}
public interface ISourceLookupChangedDMEvent extends IDMEvent<ISourceLookupDMContext> {} public interface ISourceLookupChangedDMEvent extends IDMEvent<ISourceLookupDMContext> {}
/** /**
* Retrieves the host source object for given debugger path string. * Retrieves the host source object for given debugger path string.
*/ */
void getSource(IDMContext<?> ctx, String debuggerPath, DataRequestMonitor<Object> rm); void getSource(IDMContext ctx, String debuggerPath, DataRequestMonitor<Object> rm);
/** /**
* Retrieves the debugger path string for given host source object. * Retrieves the debugger path string for given host source object.
*/ */
void getDebuggerPath(IDMContext<?> ctx, Object source, DataRequestMonitor<String> rm); void getDebuggerPath(IDMContext ctx, Object source, DataRequestMonitor<String> rm);
} }

View file

@ -27,7 +27,7 @@ public interface IStack extends IDMService {
* frame data, this context is used by other services that require a stack * frame data, this context is used by other services that require a stack
* frame for evaluation. * frame for evaluation.
*/ */
public interface IFrameDMContext extends IDMContext<IFrameDMData> {} public interface IFrameDMContext extends IDMContext {}
/** /**
* Stack frame information. * Stack frame information.
@ -46,7 +46,7 @@ public interface IStack extends IDMService {
* expression information. For displaying complete information, * expression information. For displaying complete information,
* Expressions service should be used. * Expressions service should be used.
*/ */
public interface IVariableDMContext extends IDMContext<IVariableDMData> {} public interface IVariableDMContext extends IDMContext {}
/** /**
* Stack frame variable information. * Stack frame variable information.
@ -59,13 +59,13 @@ public interface IStack extends IDMService {
/** /**
* Returns whether the stack frames can be retrieved for given thread. * Returns whether the stack frames can be retrieved for given thread.
*/ */
boolean isStackAvailable(IDMContext<?> execContext); boolean isStackAvailable(IDMContext execContext);
/** /**
* Retrieves list of stack frames for the given execution context. Request * Retrieves list of stack frames for the given execution context. Request
* will fail if the stack frame data is not available. * will fail if the stack frame data is not available.
*/ */
void getFrames(IDMContext<?> execContext, DataRequestMonitor<IFrameDMContext[]> rm); void getFrames(IDMContext execContext, DataRequestMonitor<IFrameDMContext[]> rm);
/** /**
* Retrieves the top stack frame for the given execution context. * Retrieves the top stack frame for the given execution context.
@ -76,17 +76,17 @@ public interface IStack extends IDMService {
* @param execContext * @param execContext
* @param rm * @param rm
*/ */
void getTopFrame(IDMContext<?> execContext, DataRequestMonitor<IFrameDMContext> rm); void getTopFrame(IDMContext execContext, DataRequestMonitor<IFrameDMContext> rm);
/** /**
* Retrieves variables which were arguments to the stack frame's function. * Retrieves variables which were arguments to the stack frame's function.
*/ */
void getArguments(IDMContext<?> frameCtx, DataRequestMonitor<IVariableDMContext[]> rm); void getArguments(IDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm);
/** /**
* Retrieves variables local to the stack frame. * Retrieves variables local to the stack frame.
*/ */
void getLocals(IDMContext<?> frameCtx, DataRequestMonitor<IVariableDMContext[]> rm); void getLocals(IDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm);
/** /**
* Retrieves the stack depth of the specified stack frame. * Retrieves the stack depth of the specified stack frame.

View file

@ -46,21 +46,21 @@ public interface IStepQueueManager extends IDsfService {
* Returns the number of step commands that are queued for given execution * Returns the number of step commands that are queued for given execution
* context. * context.
*/ */
int getPendingStepCount(IDMContext<?> ctx); int getPendingStepCount(IDMContext ctx);
/** /**
* Checks whether a step command can be queued up for given context. * Checks whether a step command can be queued up for given context.
*/ */
boolean canEnqueueStep(IDMContext<?> execCtx); boolean canEnqueueStep(IDMContext execCtx);
boolean canEnqueueInstructionStep(IDMContext<?> ctx); boolean canEnqueueInstructionStep(IDMContext ctx);
/** /**
* Adds a step command to the execution queue for given context. * Adds a step command to the execution queue for given context.
* @param execCtx Execution context that should perform the step. * @param execCtx Execution context that should perform the step.
* @param stepType Type of step to execute. * @param stepType Type of step to execute.
*/ */
void enqueueStep(IDMContext<?> ctx, IRunControl.StepType stepType); void enqueueStep(IDMContext ctx, IRunControl.StepType stepType);
/** /**
* Adds an instruction step command to the execution queue for given * Adds an instruction step command to the execution queue for given
@ -68,7 +68,7 @@ public interface IStepQueueManager extends IDsfService {
* @param execCtx Execution context that should perform the step. * @param execCtx Execution context that should perform the step.
* @param stepType Type of step to execute. * @param stepType Type of step to execute.
*/ */
void enqueueInstructionStep(IDMContext<?> ctx, IRunControl.StepType stepType); void enqueueInstructionStep(IDMContext ctx, IRunControl.StepType stepType);
boolean isSteppingTimedOut(IDMContext<?> context); boolean isSteppingTimedOut(IDMContext context);
} }

View file

@ -23,7 +23,7 @@ import org.eclipse.dd.dsf.datamodel.IDMService;
* @see IModules * @see IModules
*/ */
public interface ISymbols extends IDMService { public interface ISymbols extends IDMService {
public interface ISymbolObjectDMContext extends IDMContext<ISymbolObjectDMData> {} public interface ISymbolObjectDMContext extends IDMContext {}
/** /**
* Data about a debug symbol. * Data about a debug symbol.

View file

@ -22,7 +22,7 @@ import org.eclipse.dd.dsf.datamodel.IDMService;
*/ */
public interface ITargets extends IDMService { public interface ITargets extends IDMService {
public interface ITargetDMContext extends IDMContext<ITargetDMData> {} public interface ITargetDMContext extends IDMContext {}
public interface ITargetDMData extends IDMData { public interface ITargetDMData extends IDMData {
String getName(); String getName();
@ -31,7 +31,7 @@ public interface ITargets extends IDMService {
public interface ITargetStateChanged extends IDMEvent<ITargetDMContext> {} public interface ITargetStateChanged extends IDMEvent<ITargetDMContext> {}
public interface ICoreDMContext extends IDMContext<ICoreDMData> {} public interface ICoreDMContext extends IDMContext {}
public interface ICoreDMData extends IDMData { public interface ICoreDMData extends IDMData {
String getName(); String getName();

View file

@ -39,7 +39,7 @@ public interface ICommand<V extends ICommandResult> {
* Returns the context that this command is to be evaluated in. May be null * Returns the context that this command is to be evaluated in. May be null
* if the command does not need to be evaluated in a specific context. * if the command does not need to be evaluated in a specific context.
*/ */
public IDMContext<?> getContext(); public IDMContext getContext();
} }

View file

@ -176,13 +176,13 @@ public class DsfMISourceLookupParticipant implements ISourceLookupParticipant {
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object) * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object)
*/ */
public String getSourceName(Object object) throws CoreException { public String getSourceName(Object object) throws CoreException {
if ( !(object instanceof IDMContext<?>) || if ( !(object instanceof IDMContext) ||
!((IDMContext<?>)object).getSessionId().equals(fSessionId) ) !((IDMContext)object).getSessionId().equals(fSessionId) )
{ {
throw new CoreException(new Status(IStatus.ERROR, DsfDebugPlugin.PLUGIN_ID, -1, "Invalid object", null)); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, DsfDebugPlugin.PLUGIN_ID, -1, "Invalid object", null)); //$NON-NLS-1$
} }
final IDMContext<?> dmc = (IDMContext<?>)object; final IDMContext dmc = (IDMContext)object;
Query<String> query = new Query<String>() { Query<String> query = new Query<String>() {
@Override @Override
protected void execute(final DataRequestMonitor<String> rm) { protected void execute(final DataRequestMonitor<String> rm) {
@ -202,7 +202,7 @@ public class DsfMISourceLookupParticipant implements ISourceLookupParticipant {
} }
@ConfinedToDsfExecutor("fExecutor") @ConfinedToDsfExecutor("fExecutor")
private void getSourceNameOnDispatchThread(IDMContext<?> dmc, final DataRequestMonitor<String> rm) { private void getSourceNameOnDispatchThread(IDMContext dmc, final DataRequestMonitor<String> rm) {
if (!(dmc instanceof IStack.IFrameDMContext)) { if (!(dmc instanceof IStack.IFrameDMContext)) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "No source for this object", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, DsfDebugPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "No source for this object", null)); //$NON-NLS-1$
rm.done(); rm.done();

View file

@ -22,9 +22,7 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.datamodel.IDMEvent;
import org.eclipse.dd.dsf.datamodel.IDMService;
import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.service.IDsfService; import org.eclipse.dd.dsf.service.IDsfService;
@ -34,21 +32,16 @@ import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext; import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode; import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode;
import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
import org.eclipse.dd.dsf.ui.viewmodel.update.VMCacheManager;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; 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.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; 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.IHasChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; 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.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection; import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;
/** /**
@ -58,7 +51,7 @@ import org.eclipse.swt.graphics.RGB;
* are of the same class type. * are of the same class type.
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends AbstractVMLayoutNode abstract public class AbstractDMVMLayoutNode extends AbstractVMLayoutNode
implements IElementLabelProvider implements IElementLabelProvider
{ {
@ -67,14 +60,14 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
*/ */
@Immutable @Immutable
public class DMVMContext extends AbstractVMContext { public class DMVMContext extends AbstractVMContext {
private final IDMContext<?> fDmc; private final IDMContext fDmc;
public DMVMContext(IDMContext<?> dmc) { public DMVMContext(IDMContext dmc) {
super(getVMProvider().getVMAdapter(), AbstractDMVMLayoutNode.this); super(getVMProvider().getVMAdapter(), AbstractDMVMLayoutNode.this);
fDmc = dmc; fDmc = dmc;
} }
public IDMContext<?> getDMC() { return fDmc; } public IDMContext getDMC() { return fDmc; }
/** /**
* The IAdaptable implementation. If the adapter is the DM context, * The IAdaptable implementation. If the adapter is the DM context,
@ -122,7 +115,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* this type is erased at runtime, so a concrete class typs of the DMC * this type is erased at runtime, so a concrete class typs of the DMC
* is needed for instanceof chacks. * is needed for instanceof chacks.
*/ */
private Class<? extends IDMContext<V>> fDMCClassType; private Class<? extends IDMContext> fDMCClassType;
/** /**
* Constructor initializes instance data, except for the child nodes. * Constructor initializes instance data, except for the child nodes.
@ -131,7 +124,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* @param dmcClassType * @param dmcClassType
* @see #setChildNodes(IVMLayoutNode[]) * @see #setChildNodes(IVMLayoutNode[])
*/ */
public AbstractDMVMLayoutNode(AbstractVMProvider provider, DsfSession session, Class<? extends IDMContext<V>> dmcClassType) { public AbstractDMVMLayoutNode(AbstractVMProvider provider, DsfSession session, Class<? extends IDMContext> dmcClassType) {
super(provider); super(provider);
fSession = session; fSession = session;
fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId()); fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
@ -161,7 +154,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
Object element = update.getElement(); Object element = update.getElement();
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) { if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
// If update element is a DMC, check if session is still alive. // If update element is a DMC, check if session is still alive.
IDMContext<?> dmc = ((DMVMContext)element).getDMC(); IDMContext dmc = ((DMVMContext)element).getDMC();
if (dmc.getSessionId() != getSession().getId() || !DsfSession.isSessionActive(dmc.getSessionId())) { if (dmc.getSessionId() != getSession().getId() || !DsfSession.isSessionActive(dmc.getSessionId())) {
handleFailedUpdate(update); handleFailedUpdate(update);
return false; return false;
@ -177,7 +170,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* @param update Update to handle in case the DMC is null. * @param update Update to handle in case the DMC is null.
* @return true if the DMC is NOT null, indicating that it's OK to proceed. * @return true if the DMC is NOT null, indicating that it's OK to proceed.
*/ */
protected boolean checkDmc(IDMContext<?> dmc, IViewerUpdate update) { protected boolean checkDmc(IDMContext dmc, IViewerUpdate update) {
if (dmc == null) { if (dmc == null) {
update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE,
"No valid context found.", null)); //$NON-NLS-1$ "No valid context found.", null)); //$NON-NLS-1$
@ -306,77 +299,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
} }
} }
/** abstract protected void updateLabelInSessionThread(ILabelUpdate[] updates);
* The default implementation of the retrieve label method. It acquires
* the service, using parameters in the DMC, then it fetches the model
* data from the service, and then it calls the protected method
* fillColumnLabel() for each column. The deriving classes should override
* this method if a different method of computing the label is needed.
*
* @see #fillColumnLabel(IDMData, String, int, String[], ImageDescriptor[], FontData[], RGB[], RGB[])
*/
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
for (final ILabelUpdate update : updates) {
final IDMContext<V> dmc = findDmcInPath(update.getElementPath(), fDMCClassType);
if (!checkDmc(dmc, update) || !checkService(null, dmc.getServiceFilter(), update)) continue;
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()),
dmc,
new DataRequestMonitor<V>(getSession().getExecutor(), null) {
@Override
protected void handleCompleted() {
/*
* Check that the request was evaluated and data is still
* valid. The request could fail if the state of the
* service changed during the request, but the view model
* has not been updated yet.
*/
if (!getStatus().isOK() || !getData().isValid()) {
assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED;
handleFailedUpdate(update);
return;
}
/*
* If columns are configured, call the protected methods to
* fill in column values.
*/
String[] localColumns = update.getPresentationContext().getColumns();
if (localColumns == null) localColumns = new String[] { null };
for (int i = 0; i < localColumns.length; i++) {
fillColumnLabel(dmc, getData(), localColumns[i], i, update);
}
update.done();
}
},
getExecutor());
}
}
/**
* Fills in label information for given column. This method is intended to
* be overriden by deriving classes, to supply label information specific
* to the node. <br>
* The implementation should fill in the correct value in each array at the
* given index.
* @param dmContext Data Model Context object for which the label is generated.
* @param dmData Data Model Data object retrieved from the model service.
* for the DM Context supplied to the retrieveLabel() call.
* @param columnId Name of the column to fill in, null if no columns specified.
* @param idx Index to fill in in the label arrays.
* @param update Update object to fill information to
*
* @see IElementLabelProvider
* @see IColumnPresentationFactory
*/
protected void fillColumnLabel(@SuppressWarnings("unused") IDMContext<V> dmContext, @SuppressWarnings("unused") V dmData,
@SuppressWarnings("unused") String columnId, int idx, ILabelUpdate update) {
update.setLabel("", idx); //$NON-NLS-1$
}
@Override @Override
public int getDeltaFlags(Object e) { public int getDeltaFlags(Object e) {
@ -417,7 +340,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* will only create a delta node for this one element. * will only create a delta node for this one element.
*/ */
protected void buildDeltaForDMEvent(final IDMEvent<?> event, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { protected void buildDeltaForDMEvent(final IDMEvent<?> event, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
IDMContext<V> dmc = DMContexts.getAncestorOfType(event.getDMContext(), fDMCClassType); IDMContext dmc = DMContexts.getAncestorOfType(event.getDMContext(), fDMCClassType);
if (dmc != null) { if (dmc != null) {
// Create the VM context based on the DM context from the DM event. // Create the VM context based on the DM context from the DM event.
@ -493,7 +416,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* @param dmcs Array of DMC objects to build return array on. * @param dmcs Array of DMC objects to build return array on.
* @return Array of IVMContext objects. * @return Array of IVMContext objects.
*/ */
protected IVMContext[] dmcs2vmcs(IDMContext<V>[] dmcs) { protected IVMContext[] dmcs2vmcs(IDMContext[] dmcs) {
IVMContext[] vmContexts = new IVMContext[dmcs.length]; IVMContext[] vmContexts = new IVMContext[dmcs.length];
for (int i = 0; i < dmcs.length; i++) { for (int i = 0; i < dmcs.length; i++) {
vmContexts[i] = new DMVMContext(dmcs[i]); vmContexts[i] = new DMVMContext(dmcs[i]);
@ -501,7 +424,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
return vmContexts; return vmContexts;
} }
protected void fillUpdateWithVMCs(IChildrenUpdate update, IDMContext<V>[] dmcs) { protected void fillUpdateWithVMCs(IChildrenUpdate update, IDMContext[] dmcs) {
int startIdx = update.getOffset() != -1 ? update.getOffset() : 0; int startIdx = update.getOffset() != -1 ? update.getOffset() : 0;
int endIdx = update.getLength() != -1 ? startIdx + update.getLength() : dmcs.length; int endIdx = update.getLength() != -1 ? startIdx + update.getLength() : dmcs.length;
// Ted: added bounds limitation of dmcs.length // Ted: added bounds limitation of dmcs.length
@ -511,7 +434,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
} }
} }
protected IVMContext createVMContext(IDMContext<V> dmc) { protected IVMContext createVMContext(IDMContext dmc) {
return new DMVMContext(dmc); return new DMVMContext(dmc);
} }
@ -528,7 +451,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
T retVal = null; T retVal = null;
for (int i = path.getSegmentCount() - 1; i >= 0; i--) { for (int i = path.getSegmentCount() - 1; i >= 0; i--) {
if (path.getSegment(i) instanceof AbstractDMVMLayoutNode.DMVMContext) { if (path.getSegment(i) instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((DMVMContext)path.getSegment(i)).getDMC(); IDMContext dmc = ((DMVMContext)path.getSegment(i)).getDMC();
if ( dmc.getSessionId().equals(getSession().getId()) ) { if ( dmc.getSessionId().equals(getSession().getId()) ) {
retVal = DMContexts.getAncestorOfType(dmc, dmcType); retVal = DMContexts.getAncestorOfType(dmc, dmcType);
if (retVal != null) break; if (retVal != null) break;

View file

@ -61,14 +61,14 @@ public class DMVMRootLayoutNode extends VMRootLayoutNode
*/ */
@Override @Override
public int getDeltaFlags(Object event) { public int getDeltaFlags(Object event) {
IDMContext<?> inputDmc = getSelectedDMC(); IDMContext inputDmc = getSelectedDMC();
if (event instanceof IDMEvent && inputDmc != null) { if (event instanceof IDMEvent && inputDmc != null) {
boolean potentialMatchFound = false; boolean potentialMatchFound = false;
boolean matchFound = false; boolean matchFound = false;
IDMContext<?> eventDmc = ((IDMEvent<?>)event).getDMContext(); IDMContext eventDmc = ((IDMEvent<?>)event).getDMContext();
for (IDMContext<?> eventDmcAncestor : DMContexts.toList(eventDmc)) { for (IDMContext eventDmcAncestor : DMContexts.toList(eventDmc)) {
IDMContext<?> inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass()); IDMContext inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass());
if (inputDmcAncestor != null) { if (inputDmcAncestor != null) {
potentialMatchFound = true; potentialMatchFound = true;
if (inputDmcAncestor.equals(eventDmcAncestor)) { if (inputDmcAncestor.equals(eventDmcAncestor)) {
@ -84,7 +84,7 @@ public class DMVMRootLayoutNode extends VMRootLayoutNode
return super.getDeltaFlags(event); return super.getDeltaFlags(event);
} }
private IDMContext<?> getSelectedDMC() { private IDMContext getSelectedDMC() {
Object rootObject = getVMProvider().getRootElement(); Object rootObject = getVMProvider().getRootElement();
if (rootObject instanceof DMVMContext) if (rootObject instanceof DMVMContext)
{ {

View file

@ -44,9 +44,9 @@ public abstract class VMCache
protected HashMap<Object, Boolean> fHasChildren = new HashMap<Object, Boolean>(); protected HashMap<Object, Boolean> fHasChildren = new HashMap<Object, Boolean>();
protected HashMap<IDMContext<?>, IDMData> fData = new HashMap<IDMContext<?>, IDMData>(); protected HashMap<IDMContext, IDMData> fData = new HashMap<IDMContext, IDMData>();
protected HashMap<IDMContext<?>, IDMData> fDataArchive = fData; protected HashMap<IDMContext, IDMData> fDataArchive = fData;
public HashMap<?,?>[] getCacheData() public HashMap<?,?>[] getCacheData()
{ {
@ -69,8 +69,8 @@ public abstract class VMCache
fHasChildren = (HashMap<Object, Boolean>)oldCacheData[0]; fHasChildren = (HashMap<Object, Boolean>)oldCacheData[0];
fChildrenCounts = (HashMap<Object, Integer>)oldCacheData[1]; fChildrenCounts = (HashMap<Object, Integer>)oldCacheData[1];
fChildren = (HashMap<Object, HashMap<Integer,Object>>)oldCacheData[2]; fChildren = (HashMap<Object, HashMap<Integer,Object>>)oldCacheData[2];
fData = (HashMap<IDMContext<?>, IDMData>)oldCacheData[3]; fData = (HashMap<IDMContext, IDMData>)oldCacheData[3];
fDataArchive = (HashMap<IDMContext<?>, IDMData>)oldCacheData[4]; fDataArchive = (HashMap<IDMContext, IDMData>)oldCacheData[4];
} }
} }
@ -78,7 +78,7 @@ public abstract class VMCache
{ {
if(archive) if(archive)
fDataArchive = fData; fDataArchive = fData;
fData = new HashMap<IDMContext<?>, IDMData>(); fData = new HashMap<IDMContext, IDMData>();
fChildrenCounts.clear(); fChildrenCounts.clear();
fChildren.clear(); fChildren.clear();
fHasChildren.clear(); fHasChildren.clear();

View file

@ -29,26 +29,24 @@ import org.eclipse.dd.dsf.service.DsfSession;
* @param <V> Data Model data type that this context is for. * @param <V> Data Model data type that this context is for.
*/ */
@Immutable @Immutable
abstract public class AbstractDMContext<V extends IDMData> extends PlatformObject abstract public class AbstractDMContext extends PlatformObject
implements IDMContext<V> implements IDMContext
{ {
private final String fSessionId; private final String fSessionId;
private final String fServiceFilter; private final IDMContext[] fParents;
private final IDMContext<?>[] fParents;
/** /**
* Main constructor provides all data needed to implement the IModelContext * Main constructor provides all data needed to implement the IModelContext
* interface. * interface.
*/ */
public AbstractDMContext(String sessionId, String filter, IDMContext<?>[] parents) { public AbstractDMContext(String sessionId, IDMContext[] parents) {
fSessionId = sessionId; fSessionId = sessionId;
fServiceFilter = filter;
fParents = parents; fParents = parents;
} }
/** Convenience constructor */ /** Convenience constructor */
public AbstractDMContext(IDMService service, IDMContext<?>[] parents) { public AbstractDMContext(IDMService service, IDMContext[] parents) {
this(service.getSession().getId(), service.getServiceFilter(), parents); this(service.getSession().getId(), parents);
} }
/** /**
@ -60,13 +58,12 @@ abstract public class AbstractDMContext<V extends IDMData> extends PlatformObjec
protected boolean baseEquals(Object other) { protected boolean baseEquals(Object other) {
if (other == null) return false; if (other == null) return false;
if ( !(other.getClass().equals(getClass()))) return false; if ( !(other.getClass().equals(getClass()))) return false;
IDMContext<?> otherCtx = (IDMContext<?>)other; IDMContext otherCtx = (IDMContext)other;
return getSessionId().equals(otherCtx.getSessionId()) && return getSessionId().equals(otherCtx.getSessionId()) &&
getServiceFilter().equals(otherCtx.getServiceFilter()) &&
areParentsEqual(otherCtx.getParents()); areParentsEqual(otherCtx.getParents());
} }
private boolean areParentsEqual(IDMContext<?>[] otherParents) { private boolean areParentsEqual(IDMContext[] otherParents) {
if ( !(fParents.length == otherParents.length) ) return false; if ( !(fParents.length == otherParents.length) ) return false;
for (int i = 0; i < fParents.length; i++) { for (int i = 0; i < fParents.length; i++) {
if (!fParents[i].equals(otherParents[i])) { if (!fParents[i].equals(otherParents[i])) {
@ -81,20 +78,19 @@ abstract public class AbstractDMContext<V extends IDMData> extends PlatformObjec
for (Object parent : getParents()) { for (Object parent : getParents()) {
parentsHash += parent.hashCode(); parentsHash += parent.hashCode();
} }
return getSessionId().hashCode() + getServiceFilter().hashCode() + parentsHash; return getSessionId().hashCode() + parentsHash;
} }
protected String baseToString() { protected String baseToString() {
StringBuffer retVal = new StringBuffer(); StringBuffer retVal = new StringBuffer();
for (IDMContext<?> parent : fParents) { for (IDMContext parent : fParents) {
retVal.append(parent); retVal.append(parent);
} }
return retVal.toString(); return retVal.toString();
} }
public String getSessionId() { return fSessionId; } public String getSessionId() { return fSessionId; }
public String getServiceFilter() { return fServiceFilter; } public IDMContext[] getParents() { return fParents; }
public IDMContext<?>[] getParents() { return fParents; }
/** /**
* Overrides the standard platform getAdapter to provide session-specific * Overrides the standard platform getAdapter to provide session-specific

View file

@ -17,7 +17,7 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
* required DM-Context reference. * required DM-Context reference.
*/ */
@Immutable @Immutable
abstract public class AbstractDMEvent<V extends IDMContext<?>> implements IDMEvent<V> { abstract public class AbstractDMEvent<V extends IDMContext> implements IDMEvent<V> {
private final V fModelContext; private final V fModelContext;
public AbstractDMEvent(V context) { public AbstractDMEvent(V context) {

View file

@ -59,16 +59,16 @@ public class DMContexts {
* @return true if a match is found. * @return true if a match is found.
*/ */
@ThreadSafe @ThreadSafe
public static boolean isAncestorOf(IDMContext<?> dmc, IDMContext<?> potentialAncestor) { public static boolean isAncestorOf(IDMContext dmc, IDMContext potentialAncestor) {
// Check the direct parents for a match. // Check the direct parents for a match.
for (IDMContext<?> parentDmc : dmc.getParents()) { for (IDMContext parentDmc : dmc.getParents()) {
if (potentialAncestor.equals(parentDmc)) { if (potentialAncestor.equals(parentDmc)) {
return true; return true;
} }
} }
// Recursively check the parents' parents for a match. // Recursively check the parents' parents for a match.
for (IDMContext<?> parentDmc : dmc.getParents()) { for (IDMContext parentDmc : dmc.getParents()) {
if (isAncestorOf(parentDmc, potentialAncestor)) { if (isAncestorOf(parentDmc, potentialAncestor)) {
return true; return true;
} }
@ -83,15 +83,15 @@ public class DMContexts {
* into a list. * into a list.
*/ */
@ThreadSafe @ThreadSafe
public static List<IDMContext<?>> toList(IDMContext<?> dmc) { public static List<IDMContext> toList(IDMContext dmc) {
/* /*
* This method is implemented recursively, which is not necessarily * This method is implemented recursively, which is not necessarily
* the most efficient way to do this. * the most efficient way to do this.
*/ */
List<IDMContext<?>> list = new ArrayList<IDMContext<?>>(); List<IDMContext> list = new ArrayList<IDMContext>();
list.add(dmc); list.add(dmc);
for (IDMContext<?> parentDmc : dmc.getParents()) { for (IDMContext parentDmc : dmc.getParents()) {
list.addAll(toList(parentDmc)); list.addAll(toList(parentDmc));
} }
return list; return list;

View file

@ -44,7 +44,7 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
* @see IDMData * @see IDMData
*/ */
@Immutable @Immutable
public interface IDMContext<V extends IDMData> extends IAdaptable public interface IDMContext extends IAdaptable
{ {
/** /**
* Each model context object needs to track the session from which it * Each model context object needs to track the session from which it
@ -55,17 +55,6 @@ public interface IDMContext<V extends IDMData> extends IAdaptable
*/ */
public String getSessionId(); public String getSessionId();
/**
* Returns the service filter object which can be used to uniquely identify
* a service. For most services, it's sufficient to know the service class
* and the session-id to find the service, but some services may have
* multiple instances running in the same session. For those services, this
* filter string can be used to find the correct service instance.
* @see org.osgi.framework.BundleContext#getServiceReferences
* @return
*/
public String getServiceFilter();
/** /**
* Returns the parent context of this context. ModelContext objects can be * Returns the parent context of this context. ModelContext objects can be
* chained this way to allow methods that require context from multiple * chained this way to allow methods that require context from multiple
@ -73,5 +62,5 @@ public interface IDMContext<V extends IDMData> extends IAdaptable
* the client. * the client.
* @return parent context of this context. * @return parent context of this context.
*/ */
public IDMContext<?>[] getParents(); public IDMContext[] getParents();
} }

View file

@ -10,23 +10,13 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dd.dsf.datamodel; package org.eclipse.dd.dsf.datamodel;
import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.dd.dsf.concurrent.Immutable;
/** /**
* Data object containing information regarding a model context. Unlike the * Marker interface for data corresponding to IDMContext, retrieved from a
* DM Context object, this object does have to be accessed on the dispatch thread, * service. These data objects are meant to be processed by clients on
* unless other-wise noted. And it does not need to be immutable or free of * different threads, therefore they should be immutable.
* references to the service. In fact, to avoid unnecessary duplication of data
* it is most practical for the DM Data object to simply retrieve data directly
* from the service internals (caches, queues, etc).
*/ */
@ConfinedToDsfExecutor("") @Immutable
public interface IDMData { public interface IDMData {
/**
* Returns true if the data represented by this object is still valid.
* Data may become invalid if, for example the cache object backing this
* data was cleared.
*/
public boolean isValid();
} }

View file

@ -16,6 +16,6 @@ package org.eclipse.dd.dsf.datamodel;
* this base class only identifies the DM Context that is affected. * this base class only identifies the DM Context that is affected.
* @param <V> Data Model context type that is affected by this event. * @param <V> Data Model context type that is affected by this event.
*/ */
public interface IDMEvent <V extends IDMContext<?>> { public interface IDMEvent <V extends IDMContext> {
V getDMContext(); V getDMContext();
} }

View file

@ -20,13 +20,13 @@ import org.eclipse.dd.dsf.service.IDsfService;
* and has a method which allows clients to retrieve the DM Context that * and has a method which allows clients to retrieve the DM Context that
* represents the service data. * represents the service data.
*/ */
public interface IDMService extends IDsfService, IDMData { public interface IDMService extends IDsfService {
/** /**
* Returns the context representing the service in the data model. It is * Returns the context representing the service in the data model. It is
* usually used in events to indicate that lists of contexts in this * usually used in events to indicate that lists of contexts in this
* service are changed. * service are changed.
*/ */
IDMContext<?> getServiceContext(); IDMContext getServiceContext();
/** /**
/** /**
@ -38,5 +38,5 @@ public interface IDMService extends IDsfService, IDMData {
* @param dmc Data Model Context for the data model data object to be retrieved. * @param dmc Data Model Context for the data model data object to be retrieved.
* @param rm Request completion monitor to be filled in with the Data Model Data. * @param rm Request completion monitor to be filled in with the Data Model Data.
*/ */
<V extends IDMData> void getModelData(IDMContext<V> dmc, DataRequestMonitor<V> rm); void getModelData(IDMContext dmc, DataRequestMonitor<?> rm);
} }

View file

@ -16,11 +16,11 @@ package org.eclipse.dd.dsf.datamodel;
* {@link IDMService#getServiceContext()} methods. The service DM Context * {@link IDMService#getServiceContext()} methods. The service DM Context
* should be the parent of all contexts originating from the given service. * should be the parent of all contexts originating from the given service.
*/ */
public class ServiceDMContext<V extends IDMService> extends AbstractDMContext<V> { public class ServiceDMContext extends AbstractDMContext {
String fServiceDMID; String fServiceDMID;
public ServiceDMContext(IDMService service, String serviceDMID) { public ServiceDMContext(IDMService service, String serviceDMID) {
super(service, new IDMContext<?>[0]); super(service, new IDMContext[0]);
fServiceDMID = serviceDMID; fServiceDMID = serviceDMID;
} }
@ -29,7 +29,7 @@ public class ServiceDMContext<V extends IDMService> extends AbstractDMContext<V>
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof ServiceDMContext<?> && fServiceDMID.equals(((ServiceDMContext<?>)obj).fServiceDMID); return obj instanceof ServiceDMContext && fServiceDMID.equals(((ServiceDMContext)obj).fServiceDMID);
} }
@Override @Override