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
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
label="Always"
@ -159,7 +158,6 @@
</action>
<action
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
label="Always"
@ -201,7 +199,6 @@
</action>
<action
class="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.RefreshAlwaysActionDelegate"
definitionId="org.eclipse.debug.ui.RegisterView"
icon="icons/refreshalways.gif"
id="org.eclipse.dd.dsf.debug.ui.update.registers.RefreshAlways"
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
// construct below and suppress warnings.
@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);
if (dmc == null) {
request.setEnabled(false);

View file

@ -89,13 +89,13 @@ public class MISourceDisplayAdapter implements ISourceDisplay
*/
class LookupJob extends Job {
private IDMContext<?> fDmc;
private IDMContext fDmc;
private IWorkbenchPage fPage;
/**
* 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$
setPriority(Job.INTERACTIVE);
setSystem(true);
@ -103,7 +103,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
fPage = page;
}
IDMContext<?> getDmc() { return fDmc; }
IDMContext getDmc() { return fDmc; }
/* (non-Javadoc)
* @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 IWorkbenchPage fPage;
IDMContext<?> getDmc() { return fResult.getDmc(); }
IDMContext getDmc() { return fResult.getDmc(); }
/**
* Constructs a new source display job
@ -257,7 +257,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
/**
* 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;
final IFrameDMContext frameDmc = (IFrameDMContext)dmc;
@ -387,7 +387,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
private DsfSession fSession;
private DsfExecutor fExecutor;
private DsfServicesTracker fServicesTracker;
private IDMContext<?> fPrevModelContext;
private IDMContext fPrevModelContext;
private SourceLookupResult fPrevResult;
private ISourceLookupDirector fSourceLookup;
private DsfMISourceLookupParticipant fSourceLookupParticipant;
@ -430,7 +430,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
if (!(context instanceof DMVMContext)) return;
// Correct cast: (AbstractDMVMLayoutNode<?>.DMVMContext) breaks the javac compiler
@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
// 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 (fRunningLookupJob != null) {
fRunningLookupJob.cancel();

View file

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

View file

@ -321,7 +321,7 @@ public class DetailPane implements IDetailPane, IAdaptable, IPropertyChangeListe
*/
if ( element instanceof DMVMContext) {
IFormattedValues service = null;
IFormattedDataDMContext<?> dmc = null ;
IFormattedDataDMContext dmc = null ;
/*
* 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
* preference where they can select what formats they want to show.
*/
final IFormattedDataDMContext<?> finalDmc = dmc;
final IFormattedDataDMContext finalDmc = dmc;
final IFormattedValues finalService = service;
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.RequestMonitor;
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.service.DsfSession;
import org.eclipse.dd.dsf.service.IDsfService;
@ -39,11 +38,11 @@ import org.eclipse.jface.viewers.TreePath;
*
*/
@SuppressWarnings("restriction")
public abstract class AbstractExpressionLayoutNode<V extends IDMData> extends AbstractDMVMLayoutNode<V>
public abstract class AbstractExpressionLayoutNode extends AbstractDMVMLayoutNode
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);
}

View file

@ -60,8 +60,8 @@ public class ExpressionVMProvider extends AbstractDebugDMVMProviderWithCache imp
/*
* Allocate the synchronous data providers.
*/
SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess();
SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess() ;
SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess(getSession());
SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess(getSession()) ;
/*
* 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.RequestMonitor;
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.debug.service.IRunControl;
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.IFrameDMData;
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.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
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.IHasChildrenUpdate;
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;
@SuppressWarnings("restriction")
public class StackFramesLayoutNode extends AbstractDMVMLayoutNode<IStack.IFrameDMData> {
public class StackFramesLayoutNode extends AbstractDMVMLayoutNode {
public IVMContext[] fCachedOldFrameVMCs;
@ -143,8 +144,49 @@ public class StackFramesLayoutNode extends AbstractDMVMLayoutNode<IStack.IFrameD
}
@Override
protected void fillColumnLabel(IDMContext<IFrameDMData> dmContext, IFrameDMData dmData, String columnId, int idx,
ILabelUpdate update)
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
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;

View file

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

View file

@ -56,14 +56,14 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction")
public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode<IRegisterGroupDMData>
public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode
implements IElementEditor
{
protected class RegisterGroupVMC extends DMVMContext implements IVariable
{
private IExpression fExpression;
public RegisterGroupVMC(IDMContext<?> dmc) {
public RegisterGroupVMC(IDMContext dmc) {
super(dmc);
}
@ -173,13 +173,55 @@ public class RegisterGroupLayoutNode extends AbstractExpressionLayoutNode<IRegis
}
@Override
protected IVMContext createVMContext(IDMContext<IRegisterGroupDMData> dmc) {
protected IVMContext createVMContext(IDMContext dmc) {
return new RegisterGroupVMC(dmc);
}
@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)
{
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.IDMContext;
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.IRegisters;
import org.eclipse.dd.dsf.debug.service.IRunControl;
@ -63,14 +62,14 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction")
public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDMData>
public class RegisterLayoutNode extends AbstractExpressionLayoutNode
implements IElementEditor
{
protected class RegisterVMC extends DMVMContext
implements IVariable, IFormattedValueVMContext
{
private IExpression fExpression;
public RegisterVMC(IDMContext<?> dmc) {
public RegisterVMC(IDMContext dmc) {
super(dmc);
}
@ -282,10 +281,10 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
for (final ILabelUpdate update : updates) {
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())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()),
.getModelData(getServicesTracker().getService(IRegisters.class),
dmc,
new DataRequestMonitor<IRegisterDMData>(getSession().getExecutor(), null) {
@Override
@ -296,7 +295,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
* service changed during the request, but the view model
* has not been updated yet.
*/
if (!getStatus().isOK() || !getData().isValid()) {
if (!getStatus().isOK()) {
assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED;
@ -394,7 +393,7 @@ public class RegisterLayoutNode extends AbstractExpressionLayoutNode<IRegisterDM
}
@Override
protected IVMContext createVMContext(IDMContext<IRegisterDMData> dmc) {
protected IVMContext createVMContext(IDMContext dmc) {
return new RegisterVMC(dmc);
}

View file

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

View file

@ -35,7 +35,7 @@ public class RegisterVMProvider extends AbstractDebugDMVMProviderWithCache
/*
* 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.

View file

@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
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.datamodel.DMContexts;
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.util.tracker.ServiceTracker;
@ThreadSafeAndProhibitedFromDsfExecutor("")
@ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
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),
* because we're accessing it in non-dispatch thread. DsfServiceTracker is
* not thread-safe.
*/
@ThreadSafe
private ServiceTracker fServiceTracker;
private synchronized IRegisters getService(String filter) {
public SyncRegisterDataAccess(DsfSession session) {
fSession = session;
}
@ThreadSafe
private synchronized IRegisters getService() {
if (fServiceTracker == null) {
try {
fServiceTracker = new ServiceTracker(DsfDebugUIPlugin
.getBundleContext(), DsfDebugUIPlugin.getBundleContext()
.createFilter(filter), null);
fServiceTracker = new ServiceTracker(
DsfDebugUIPlugin.getBundleContext(),
DsfDebugUIPlugin.getBundleContext().createFilter(getServiceFilter()), null);
fServiceTracker.open();
} catch (InvalidSyntaxException e) {
assert false : "Invalid filter in DMC: " + filter; //$NON-NLS-1$
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();
}
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 ) {
fServiceTracker.close();
}
@ -105,7 +120,7 @@ public class SyncRegisterDataAccess {
return;
}
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done();
@ -140,7 +155,7 @@ public class SyncRegisterDataAccess {
public IBitFieldDMContext getBitFieldDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IBitFieldDMContext.class);
}
return null;
@ -207,7 +222,7 @@ public class SyncRegisterDataAccess {
/*
* Guard against a disposed service
*/
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -315,7 +330,7 @@ public class SyncRegisterDataAccess {
/*
* Guard against a disposed service
*/
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -396,7 +411,7 @@ public class SyncRegisterDataAccess {
public IRegisterGroupDMContext getRegisterGroupDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IRegisterGroupDMContext.class);
}
return null;
@ -404,15 +419,15 @@ public class SyncRegisterDataAccess {
public IRegisterDMContext getRegisterDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
return DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class);
}
return null;
}
public IFormattedDataDMContext<?> getFormattedDMC(Object element) {
public IFormattedDataDMContext getFormattedDMC(Object element) {
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext dmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(dmc, IRegisterDMContext.class);
return DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class);
}
@ -442,7 +457,7 @@ public class SyncRegisterDataAccess {
return;
}
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done();
@ -531,7 +546,7 @@ public class SyncRegisterDataAccess {
return;
}
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done();
@ -625,7 +640,7 @@ public class SyncRegisterDataAccess {
/*
* Guard against a disposed service
*/
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -712,9 +727,9 @@ public class SyncRegisterDataAccess {
public class GetSupportFormatsValueQuery extends Query<Object> {
IFormattedDataDMContext<?> fDmc;
IFormattedDataDMContext fDmc;
public GetSupportFormatsValueQuery(IFormattedDataDMContext<?> dmc) {
public GetSupportFormatsValueQuery(IFormattedDataDMContext dmc) {
super();
fDmc = dmc;
}
@ -734,7 +749,7 @@ public class SyncRegisterDataAccess {
/*
* Guard against a disposed service
*/
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -779,9 +794,9 @@ public class SyncRegisterDataAccess {
* Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out.
*/
IFormattedDataDMContext<?> dmc = null;
IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.class);
dmc = DMContexts.getAncestorOfType(regdmc, IFormattedDataDMContext.class);
}
@ -815,10 +830,10 @@ public class SyncRegisterDataAccess {
public class GetFormattedValueValueQuery extends Query<Object> {
private IFormattedDataDMContext<?> fDmc;
private IFormattedDataDMContext fDmc;
private String fFormatId;
public GetFormattedValueValueQuery(IFormattedDataDMContext<?> dmc, String formatId) {
public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) {
super();
fDmc = dmc;
fFormatId = formatId;
@ -839,7 +854,7 @@ public class SyncRegisterDataAccess {
/*
* Guard against a disposed service
*/
IRegisters service = getService(fDmc.getServiceFilter());
IRegisters service = getService();
if (service == null) {
rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -883,9 +898,9 @@ public class SyncRegisterDataAccess {
* Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out.
*/
IFormattedDataDMContext<?> dmc = null;
IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IRegisterDMContext regdmc = DMContexts.getAncestorOfType(vmcdmc, IRegisterDMContext.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
* session is stale, then bail out.
*/
IFormattedDataDMContext<?> dmc = null;
IFormattedDataDMContext dmc = null;
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
IDMContext<?> vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IDMContext vmcdmc = ((AbstractDMVMLayoutNode.DMVMContext)element).getDMC();
IBitFieldDMContext bitfielddmc = DMContexts.getAncestorOfType(vmcdmc, IBitFieldDMContext.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.dd.dsf.concurrent.DataRequestMonitor;
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.debug.service.IExpressions;
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.util.tracker.ServiceTracker;
@ThreadSafeAndProhibitedFromDsfExecutor("")
@ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
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),
* because we're accessing it in non-dispatch thread. DsfServiceTracker is
* not thread-safe.
*/
@ThreadSafe
private ServiceTracker fServiceTracker;
private synchronized IExpressions getService(String filter) {
public SyncVariableDataAccess(DsfSession session) {
fSession = session;
}
@ThreadSafe
private synchronized IExpressions getService() {
if (fServiceTracker == null) {
try {
fServiceTracker = new ServiceTracker(DsfDebugUIPlugin
.getBundleContext(), DsfDebugUIPlugin.getBundleContext()
.createFilter(filter), null);
fServiceTracker = new ServiceTracker(
DsfDebugUIPlugin.getBundleContext(),
DsfDebugUIPlugin.getBundleContext().createFilter(getServiceFilter()), null);
fServiceTracker.open();
} catch (InvalidSyntaxException e) {
assert false : "Invalid filter in DMC: " + filter; //$NON-NLS-1$
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();
}
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) {
fServiceTracker.close();
}
@ -101,7 +117,7 @@ public class SyncVariableDataAccess {
return;
}
IExpressions service = getService(fDmc.getServiceFilter());
IExpressions service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service not available", null)); //$NON-NLS-1$
rm.done();
@ -202,7 +218,7 @@ public class SyncVariableDataAccess {
/*
* Guard against a disposed service
*/
IExpressions service = getService(fDmc.getServiceFilter());
IExpressions service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -282,18 +298,18 @@ public class SyncVariableDataAccess {
}
}
public IFormattedDataDMContext<?> getFormattedDMC(Object element) {
public IFormattedDataDMContext getFormattedDMC(Object element) {
if (element instanceof IAdaptable) {
return (IFormattedDataDMContext<?>) ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class);
return (IFormattedDataDMContext) ((IAdaptable) element).getAdapter(IFormattedDataDMContext.class);
}
return null;
}
public class GetSupportFormatsValueQuery extends Query<Object> {
IFormattedDataDMContext<?> fDmc;
IFormattedDataDMContext fDmc;
public GetSupportFormatsValueQuery(IFormattedDataDMContext<?> dmc) {
public GetSupportFormatsValueQuery(IFormattedDataDMContext dmc) {
super();
fDmc = dmc;
}
@ -313,7 +329,7 @@ public class SyncVariableDataAccess {
/*
* Guard against a disposed service
*/
IExpressions service = getService(fDmc.getServiceFilter());
IExpressions service = getService();
if (service == null) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -358,7 +374,7 @@ public class SyncVariableDataAccess {
* Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out.
*/
IFormattedDataDMContext<?> dmc = getFormattedDMC(element);
IFormattedDataDMContext dmc = getFormattedDMC(element);
if (dmc == null) return null;
DsfSession session = DsfSession.getSession(dmc.getSessionId());
if (session == null) return null;
@ -388,10 +404,10 @@ public class SyncVariableDataAccess {
public class GetFormattedValueValueQuery extends Query<Object> {
private IFormattedDataDMContext<?> fDmc;
private IFormattedDataDMContext fDmc;
private String fFormatId;
public GetFormattedValueValueQuery(IFormattedDataDMContext<?> dmc, String formatId) {
public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) {
super();
fDmc = dmc;
fFormatId = formatId;
@ -412,7 +428,7 @@ public class SyncVariableDataAccess {
/*
* Guard against a disposed service
*/
IExpressions service = getService(fDmc.getServiceFilter());
IExpressions service = getService();
if (service == null) {
rm .setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Service unavailable", null)); //$NON-NLS-1$
rm.done();
@ -456,7 +472,7 @@ public class SyncVariableDataAccess {
* Get the DMC and the session. If element is not an register DMC, or
* session is stale, then bail out.
*/
IFormattedDataDMContext<?> dmc = getFormattedDMC(element);
IFormattedDataDMContext dmc = getFormattedDMC(element);
if (dmc == null) return null;
DsfSession session = DsfSession.getSession(dmc.getSessionId());
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.datamodel.DMContexts;
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.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IRunControl;
@ -63,7 +62,7 @@ import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.Composite;
@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
@ -126,7 +125,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
private IExpression fExpression;
public VariableExpressionVMC(IDMContext<?> dmc) {
public VariableExpressionVMC(IDMContext dmc) {
super(dmc);
}
@ -208,7 +207,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
}
@Override
protected IVMContext createVMContext(IDMContext<IExpressionDMData> dmc) {
protected IVMContext createVMContext(IDMContext dmc) {
return new VariableExpressionVMC(dmc);
}
@ -225,7 +224,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode<IExpression
final IExpressionDMContext dmc = findDmcInPath(update.getElementPath(), IExpressions.IExpressionDMContext.class);
VMCacheManager.getVMCacheManager().getCache(update.getPresentationContext())
.getModelData((IDMService)getServicesTracker().getService(null, dmc.getServiceFilter()),
.getModelData(getServicesTracker().getService(IExpressions.class, null),
dmc,
new DataRequestMonitor<IExpressionDMData>(getSession().getExecutor(), null) {
@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
// has not been updated yet.
if (!getStatus().isOK() || !getData().isValid()) {
if (!getStatus().isOK()) {
assert getStatus().isOK() ||
getStatus().getCode() != IDsfService.INTERNAL_ERROR ||
getStatus().getCode() != IDsfService.NOT_SUPPORTED;

View file

@ -28,7 +28,7 @@ public class VariableVMProvider extends AbstractDebugDMVMProviderWithCache imple
/*
* 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.

View file

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

View file

@ -28,7 +28,7 @@ public interface IBreakpoints extends IDMService {
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 {
IBreakpoint getPlatformBreakpoint();
@ -43,7 +43,7 @@ public interface IBreakpoints extends IDMService {
public interface IBreakpointHitEvent extends IBreakpointDMEvent {}
public void getAllBreakpoints(IDMContext<?> execDmc, DataRequestMonitor<IBreakpointDMContext[]> rm);
public void getBreakpoints(IDMContext<?> execDmc, IBreakpoint platformBp, DataRequestMonitor<IBreakpointDMContext[]> rm);
public void getAllBreakpoints(IDMContext ctx, 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
* 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
* 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
* 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,
@ -208,5 +208,5 @@ public interface IExpressions extends IDMService, IFormattedValues {
*
* @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 {
/** 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
@ -43,7 +43,7 @@ public interface IFormattedValues extends IDMService {
* @param dmc Context for which to retrieve available formats.
* @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.
@ -51,24 +51,24 @@ public interface IFormattedValues extends IDMService {
* @param dmc Parent context for the context that is being created
* @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
* persisted and used for comparison.
*/
public static class FormattedValueDMContext extends AbstractDMContext<FormattedValueDMData>
public static class FormattedValueDMContext extends AbstractDMContext
{
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 });
fFormatID = formatId;
}
public FormattedValueDMContext(String sessionId, String filter, IDMContext<?> parent, String formatId) {
super(sessionId, filter, new IDMContext[] { parent });
public FormattedValueDMContext(String sessionId, IDMContext parent, String formatId) {
super(sessionId, new IDMContext[] { parent });
fFormatID = formatId;
}
@ -103,10 +103,5 @@ public interface IFormattedValues extends IDMService {
public String getFormattedValue() {
return fValue;
}
public boolean isValid() {
return true;
}
}
}

View file

@ -50,14 +50,14 @@ public interface IMemory extends IDsfService {
*/
public class MemoryChangedEvent {
IAddress[] fAddresses;
IDMContext<?> fContext;
IDMContext fContext;
public MemoryChangedEvent(IDMContext<?> context, IAddress[] addresses) {
public MemoryChangedEvent(IDMContext context, IAddress[] addresses) {
fContext = context;
fAddresses = addresses;
}
public IDMContext<?> getContext() {
public IDMContext getContext() {
return fContext;
}
@ -86,7 +86,7 @@ public interface IMemory extends IDsfService {
* @param count the number of data elements to read
* @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);
/**
@ -107,7 +107,7 @@ public interface IMemory extends IDsfService {
* @param buffer the source buffer
* @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);
/**
@ -123,7 +123,7 @@ public interface IMemory extends IDsfService {
* @param pattern the source buffer
* @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);
}

View file

@ -30,12 +30,12 @@ public interface IModules extends IDMService {
* types of debugging, like kernel or no-OS debugging, it's useful to
* 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.
*/
public interface IModuleDMContext extends IDMContext<IModuleDMData> {}
public interface IModuleDMContext extends IDMContext {}
/**
* Event indicating a change in the symbol information for given context.
@ -101,7 +101,7 @@ public interface IModules extends IDMService {
}
/** Module information. */
public interface IModuleDMData extends IDMData {
public interface IModuleDMData {
String getName();
String getFile();
long getTimeStamp();
@ -134,16 +134,16 @@ public interface IModules extends IDMService {
/**
* 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.
*/
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.
*/
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 IThreadDMContext extends IDMContext<IThreadDMData> {}
public interface IProcessDMContext extends IDMContext<IProcessDMData> {}
public interface IThreadDMContext extends IDMContext {}
public interface IProcessDMContext extends IDMContext {}
/**
* Interface for thread and process object data.
@ -36,7 +36,7 @@ public interface INativeProcesses extends IDMService {
String getName();
String getId();
boolean isDebuggerAttached();
IDMContext<?> getDebugContext();
IDMContext getDebugContext();
}
/**
@ -46,7 +46,7 @@ public interface INativeProcesses extends IDMService {
String getName();
String getId();
boolean isDebuggerAttached();
IDMContext<?> getDebugContext();
IDMContext getDebugContext();
}
/**
@ -55,11 +55,11 @@ public interface INativeProcesses extends IDMService {
public interface IProcessChangedDMEvent extends IDMEvent<IProcessDMContext> {}
public interface IProcessStartedEvent extends IDMEvent<IDMContext<INativeProcesses>> {
public interface IProcessStartedEvent extends IDMEvent<IDMContext> {
IProcessDMContext getProcess();
}
public interface IProcessExitedEvent extends IDMEvent<IDMContext<INativeProcesses>> {
public interface IProcessExitedEvent extends IDMEvent<IDMContext> {
IProcessDMContext getProcess();
}
@ -69,13 +69,13 @@ public interface INativeProcesses extends IDMService {
* @param execCtx
* @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
* corresponding process exists.
*/
public IProcessDMContext getProcessForDebugContext(IDMContext<?> execCtx);
public IProcessDMContext getProcessForDebugContext(IDMContext execCtx);
/**
* 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 rm Return token.
*/
void canTerminate(IDMContext<?> ctx, DataRequestMonitor<Boolean> rm);
void canTerminate(IDMContext ctx, DataRequestMonitor<Boolean> rm);
/**
* Terminates the selected process or thread.
* @param thread Thread or process to terminate.
* @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;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
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.IDMData;
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
* debugging multiple targets/cores simultaneously.
*/
public interface IOSDMContext extends IDMContext<IOSDMData> {}
public interface IOSDMContext extends IDMContext {}
/**
* 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.
*/
public interface IObjectTypeDMContext extends IDMContext<IObjectTypeDMData> {}
public interface IObjectTypeDMContext extends IDMContext {}
/**
* Description data for a OS object type.
@ -59,7 +59,7 @@ public interface IOS extends IDMService {
/**
* OS object context.
*/
public interface IObjectDMContext extends IDMContext<IObjectDMData> {}
public interface IObjectDMContext extends IDMContext {}
/**
* Description data for an OS object.
@ -69,7 +69,7 @@ public interface IOS extends IDMService {
String getID();
boolean canAttachDebugger();
boolean isDebuggerAttached();
IDMContext<?> getDebuggingContext();
IDMContext getDebuggingContext();
}
/**

View file

@ -25,7 +25,7 @@ public interface IRegisters extends IFormattedValues {
public interface IGroupsChangedDMEvent extends IDMEvent<IRunControl.IExecutionDMContext> {}
/** Register group context */
public interface IRegisterGroupDMContext extends IFormattedDataDMContext<IRegisterGroupDMData> {
public interface IRegisterGroupDMContext extends IFormattedDataDMContext {
public String getName();
}
@ -45,7 +45,7 @@ public interface IRegisters extends IFormattedValues {
}
/** Register context */
public interface IRegisterDMContext extends IFormattedDataDMContext<IRegisterDMData> {
public interface IRegisterDMContext extends IFormattedDataDMContext {
public String getName();
}
@ -66,7 +66,7 @@ public interface IRegisters extends IFormattedValues {
}
/** Bit field context */
public interface IBitFieldDMContext extends IFormattedDataDMContext<IBitFieldDMData> {
public interface IBitFieldDMContext extends IFormattedDataDMContext {
public String getName();
}
@ -109,28 +109,28 @@ public interface IRegisters extends IFormattedValues {
* @param ctx Context for the returned data.
* @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.
* @param ctx Context for the returned data.
* @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.
* @param ctx Context for the returned data.
* @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
* @param ctx Context for the returned data.
* @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
@ -139,7 +139,7 @@ public interface IRegisters extends IFormattedValues {
* @param formatId Format of the value to be written.
* @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
@ -148,7 +148,7 @@ public interface IRegisters extends IFormattedValues {
* @param formatId Format of the value to be written.
* @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
@ -156,5 +156,5 @@ public interface IRegisters extends IFormattedValues {
* @param mnemonic Mnemonic which represents the value to be written.
* @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
* 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
@ -95,15 +95,15 @@ public interface IRunControl extends IDMService
* Run control commands. They all require the IExecutionContext object on
* which they perform the operations.
*/
boolean canResume(IDMContext<?> context);
boolean canSuspend(IDMContext<?> context);
boolean isSuspended(IDMContext<?> context);
void resume(IDMContext<?> context, RequestMonitor requestMonitor);
void suspend(IDMContext<?> context, RequestMonitor requestMonitor);
boolean canResume(IDMContext context);
boolean canSuspend(IDMContext context);
boolean isSuspended(IDMContext context);
void resume(IDMContext context, RequestMonitor requestMonitor);
void suspend(IDMContext context, RequestMonitor requestMonitor);
public enum StepType { STEP_OVER, STEP_INTO, STEP_RETURN };
boolean isStepping(IDMContext<?> context);
boolean canStep(IDMContext<?> context);
void step(IDMContext<?> context, StepType stepType, RequestMonitor requestMonitor);
boolean canInstructionStep(IDMContext<?> context);
void instructionStep(IDMContext<?> context, StepType stepType, RequestMonitor requestMonitor);
boolean isStepping(IDMContext context);
boolean canStep(IDMContext context);
void step(IDMContext context, StepType stepType, RequestMonitor requestMonitor);
boolean canInstructionStep(IDMContext context);
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.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.dd.dsf.datamodel.IDMEvent;
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 ISourceLookupDMContext extends IDMContext<IDMData> {}
public interface ISourceLookupDMContext extends IDMContext {}
public interface ISourceLookupChangedDMEvent extends IDMEvent<ISourceLookupDMContext> {}
/**
* 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.
*/
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 for evaluation.
*/
public interface IFrameDMContext extends IDMContext<IFrameDMData> {}
public interface IFrameDMContext extends IDMContext {}
/**
* Stack frame information.
@ -46,7 +46,7 @@ public interface IStack extends IDMService {
* expression information. For displaying complete information,
* Expressions service should be used.
*/
public interface IVariableDMContext extends IDMContext<IVariableDMData> {}
public interface IVariableDMContext extends IDMContext {}
/**
* Stack frame variable information.
@ -59,13 +59,13 @@ public interface IStack extends IDMService {
/**
* 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
* 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.
@ -76,17 +76,17 @@ public interface IStack extends IDMService {
* @param execContext
* @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.
*/
void getArguments(IDMContext<?> frameCtx, DataRequestMonitor<IVariableDMContext[]> rm);
void getArguments(IDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm);
/**
* 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.

View file

@ -46,21 +46,21 @@ public interface IStepQueueManager extends IDsfService {
* Returns the number of step commands that are queued for given execution
* context.
*/
int getPendingStepCount(IDMContext<?> ctx);
int getPendingStepCount(IDMContext ctx);
/**
* 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.
* @param execCtx Execution context that should perform the step.
* @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
@ -68,7 +68,7 @@ public interface IStepQueueManager extends IDsfService {
* @param execCtx Execution context that should perform the step.
* @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
*/
public interface ISymbols extends IDMService {
public interface ISymbolObjectDMContext extends IDMContext<ISymbolObjectDMData> {}
public interface ISymbolObjectDMContext extends IDMContext {}
/**
* 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 ITargetDMContext extends IDMContext<ITargetDMData> {}
public interface ITargetDMContext extends IDMContext {}
public interface ITargetDMData extends IDMData {
String getName();
@ -31,7 +31,7 @@ public interface ITargets extends IDMService {
public interface ITargetStateChanged extends IDMEvent<ITargetDMContext> {}
public interface ICoreDMContext extends IDMContext<ICoreDMData> {}
public interface ICoreDMContext extends IDMContext {}
public interface ICoreDMData extends IDMData {
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
* 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)
*/
public String getSourceName(Object object) throws CoreException {
if ( !(object instanceof IDMContext<?>) ||
!((IDMContext<?>)object).getSessionId().equals(fSessionId) )
if ( !(object instanceof IDMContext) ||
!((IDMContext)object).getSessionId().equals(fSessionId) )
{
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>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
@ -202,7 +202,7 @@ public class DsfMISourceLookupParticipant implements ISourceLookupParticipant {
}
@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)) {
rm.setStatus(new Status(IStatus.ERROR, DsfDebugPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "No source for this object", null)); //$NON-NLS-1$
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.datamodel.DMContexts;
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.IDMService;
import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession;
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.IVMLayoutNode;
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.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.IHasChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
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.
*/
@SuppressWarnings("restriction")
abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends AbstractVMLayoutNode
abstract public class AbstractDMVMLayoutNode extends AbstractVMLayoutNode
implements IElementLabelProvider
{
@ -67,14 +60,14 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
*/
@Immutable
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);
fDmc = dmc;
}
public IDMContext<?> getDMC() { return fDmc; }
public IDMContext getDMC() { return fDmc; }
/**
* 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
* 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.
@ -131,7 +124,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
* @param dmcClassType
* @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);
fSession = session;
fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
@ -161,7 +154,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
Object element = update.getElement();
if (element instanceof AbstractDMVMLayoutNode.DMVMContext) {
// 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())) {
handleFailedUpdate(update);
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.
* @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) {
update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfService.INVALID_STATE,
"No valid context found.", null)); //$NON-NLS-1$
@ -306,77 +299,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
}
}
/**
* 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$
}
abstract protected void updateLabelInSessionThread(ILabelUpdate[] updates);
@Override
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.
*/
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) {
// 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.
* @return Array of IVMContext objects.
*/
protected IVMContext[] dmcs2vmcs(IDMContext<V>[] dmcs) {
protected IVMContext[] dmcs2vmcs(IDMContext[] dmcs) {
IVMContext[] vmContexts = new IVMContext[dmcs.length];
for (int i = 0; i < dmcs.length; i++) {
vmContexts[i] = new DMVMContext(dmcs[i]);
@ -501,7 +424,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
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 endIdx = update.getLength() != -1 ? startIdx + update.getLength() : 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);
}
@ -528,7 +451,7 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
T retVal = null;
for (int i = path.getSegmentCount() - 1; i >= 0; i--) {
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()) ) {
retVal = DMContexts.getAncestorOfType(dmc, dmcType);
if (retVal != null) break;

View file

@ -61,14 +61,14 @@ public class DMVMRootLayoutNode extends VMRootLayoutNode
*/
@Override
public int getDeltaFlags(Object event) {
IDMContext<?> inputDmc = getSelectedDMC();
IDMContext inputDmc = getSelectedDMC();
if (event instanceof IDMEvent && inputDmc != null) {
boolean potentialMatchFound = false;
boolean matchFound = false;
IDMContext<?> eventDmc = ((IDMEvent<?>)event).getDMContext();
for (IDMContext<?> eventDmcAncestor : DMContexts.toList(eventDmc)) {
IDMContext<?> inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass());
IDMContext eventDmc = ((IDMEvent<?>)event).getDMContext();
for (IDMContext eventDmcAncestor : DMContexts.toList(eventDmc)) {
IDMContext inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass());
if (inputDmcAncestor != null) {
potentialMatchFound = true;
if (inputDmcAncestor.equals(eventDmcAncestor)) {
@ -84,7 +84,7 @@ public class DMVMRootLayoutNode extends VMRootLayoutNode
return super.getDeltaFlags(event);
}
private IDMContext<?> getSelectedDMC() {
private IDMContext getSelectedDMC() {
Object rootObject = getVMProvider().getRootElement();
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<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()
{
@ -69,8 +69,8 @@ public abstract class VMCache
fHasChildren = (HashMap<Object, Boolean>)oldCacheData[0];
fChildrenCounts = (HashMap<Object, Integer>)oldCacheData[1];
fChildren = (HashMap<Object, HashMap<Integer,Object>>)oldCacheData[2];
fData = (HashMap<IDMContext<?>, IDMData>)oldCacheData[3];
fDataArchive = (HashMap<IDMContext<?>, IDMData>)oldCacheData[4];
fData = (HashMap<IDMContext, IDMData>)oldCacheData[3];
fDataArchive = (HashMap<IDMContext, IDMData>)oldCacheData[4];
}
}
@ -78,7 +78,7 @@ public abstract class VMCache
{
if(archive)
fDataArchive = fData;
fData = new HashMap<IDMContext<?>, IDMData>();
fData = new HashMap<IDMContext, IDMData>();
fChildrenCounts.clear();
fChildren.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.
*/
@Immutable
abstract public class AbstractDMContext<V extends IDMData> extends PlatformObject
implements IDMContext<V>
abstract public class AbstractDMContext extends PlatformObject
implements IDMContext
{
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
* interface.
*/
public AbstractDMContext(String sessionId, String filter, IDMContext<?>[] parents) {
public AbstractDMContext(String sessionId, IDMContext[] parents) {
fSessionId = sessionId;
fServiceFilter = filter;
fParents = parents;
}
/** Convenience constructor */
public AbstractDMContext(IDMService service, IDMContext<?>[] parents) {
this(service.getSession().getId(), service.getServiceFilter(), parents);
public AbstractDMContext(IDMService service, IDMContext[] parents) {
this(service.getSession().getId(), parents);
}
/**
@ -60,13 +58,12 @@ abstract public class AbstractDMContext<V extends IDMData> extends PlatformObjec
protected boolean baseEquals(Object other) {
if (other == null) return false;
if ( !(other.getClass().equals(getClass()))) return false;
IDMContext<?> otherCtx = (IDMContext<?>)other;
IDMContext otherCtx = (IDMContext)other;
return getSessionId().equals(otherCtx.getSessionId()) &&
getServiceFilter().equals(otherCtx.getServiceFilter()) &&
areParentsEqual(otherCtx.getParents());
}
private boolean areParentsEqual(IDMContext<?>[] otherParents) {
private boolean areParentsEqual(IDMContext[] otherParents) {
if ( !(fParents.length == otherParents.length) ) return false;
for (int i = 0; i < fParents.length; i++) {
if (!fParents[i].equals(otherParents[i])) {
@ -81,20 +78,19 @@ abstract public class AbstractDMContext<V extends IDMData> extends PlatformObjec
for (Object parent : getParents()) {
parentsHash += parent.hashCode();
}
return getSessionId().hashCode() + getServiceFilter().hashCode() + parentsHash;
return getSessionId().hashCode() + parentsHash;
}
protected String baseToString() {
StringBuffer retVal = new StringBuffer();
for (IDMContext<?> parent : fParents) {
for (IDMContext parent : fParents) {
retVal.append(parent);
}
return retVal.toString();
}
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

View file

@ -17,7 +17,7 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
* required DM-Context reference.
*/
@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;
public AbstractDMEvent(V context) {

View file

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

View file

@ -44,7 +44,7 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
* @see IDMData
*/
@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
@ -55,17 +55,6 @@ public interface IDMContext<V extends IDMData> extends IAdaptable
*/
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
* 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.
* @return parent context of this context.
*/
public IDMContext<?>[] getParents();
public IDMContext[] getParents();
}

View file

@ -10,23 +10,13 @@
*******************************************************************************/
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
* DM Context object, this object does have to be accessed on the dispatch thread,
* unless other-wise noted. And it does not need to be immutable or free of
* 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).
* Marker interface for data corresponding to IDMContext, retrieved from a
* service. These data objects are meant to be processed by clients on
* different threads, therefore they should be immutable.
*/
@ConfinedToDsfExecutor("")
@Immutable
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.
* @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();
}

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
* 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
* usually used in events to indicate that lists of contexts in this
* 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 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
* 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;
public ServiceDMContext(IDMService service, String serviceDMID) {
super(service, new IDMContext<?>[0]);
super(service, new IDMContext[0]);
fServiceDMID = serviceDMID;
}
@ -29,7 +29,7 @@ public class ServiceDMContext<V extends IDMService> extends AbstractDMContext<V>
@Override
public boolean equals(Object obj) {
return obj instanceof ServiceDMContext<?> && fServiceDMID.equals(((ServiceDMContext<?>)obj).fServiceDMID);
return obj instanceof ServiceDMContext && fServiceDMID.equals(((ServiceDMContext)obj).fServiceDMID);
}
@Override