mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-17 14:05:23 +02:00
Added expression service (bug# 159696)
Fixed updating the launch state upon startup and shutdown.
This commit is contained in:
parent
6c6f7978db
commit
750c30a128
3 changed files with 93 additions and 30 deletions
|
@ -38,6 +38,17 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
||||||
public class StandardLaunchRootLayoutNode extends AbstractVMRootLayoutNode
|
public class StandardLaunchRootLayoutNode extends AbstractVMRootLayoutNode
|
||||||
implements IVMRootLayoutNode
|
implements IVMRootLayoutNode
|
||||||
{
|
{
|
||||||
|
public static class LaunchesEvent {
|
||||||
|
public enum Type { ADDED, REMOVED, CHANGED, TERMINATED };
|
||||||
|
public final ILaunch[] fLaunches;
|
||||||
|
public final Type fType;
|
||||||
|
|
||||||
|
public LaunchesEvent(ILaunch[] launches, Type type) {
|
||||||
|
fLaunches = launches;
|
||||||
|
fType = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final private ILaunch fLaunch;
|
final private ILaunch fLaunch;
|
||||||
|
|
||||||
public StandardLaunchRootLayoutNode(AbstractVMProvider provider, ILaunch launch) {
|
public StandardLaunchRootLayoutNode(AbstractVMProvider provider, ILaunch launch) {
|
||||||
|
@ -60,7 +71,21 @@ public class StandardLaunchRootLayoutNode extends AbstractVMRootLayoutNode
|
||||||
return IModelDelta.NO_CHANGE;
|
return IModelDelta.NO_CHANGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getDeltaFlags(e);
|
int flags = 0;
|
||||||
|
if (e instanceof LaunchesEvent) {
|
||||||
|
LaunchesEvent le = (LaunchesEvent)e;
|
||||||
|
for (ILaunch launch : le.fLaunches) {
|
||||||
|
if (fLaunch == launch) {
|
||||||
|
if (le.fType == LaunchesEvent.Type.CHANGED) {
|
||||||
|
flags = IModelDelta.STATE | IModelDelta.CONTENT;
|
||||||
|
} else if (le.fType == LaunchesEvent.Type.TERMINATED) {
|
||||||
|
flags = IModelDelta.STATE | IModelDelta.CONTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags | super.getDeltaFlags(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createDelta(Object event, final GetDataDone<IModelDelta> done) {
|
public void createDelta(Object event, final GetDataDone<IModelDelta> done) {
|
||||||
|
@ -74,19 +99,37 @@ public class StandardLaunchRootLayoutNode extends AbstractVMRootLayoutNode
|
||||||
final VMDelta viewRootDelta = new VMDelta(manager, 0, IModelDelta.NO_CHANGE, launchList.size());
|
final VMDelta viewRootDelta = new VMDelta(manager, 0, IModelDelta.NO_CHANGE, launchList.size());
|
||||||
final VMDelta rootDelta = viewRootDelta.addNode(getRootObject(), launchList.indexOf(fLaunch), IModelDelta.NO_CHANGE);
|
final VMDelta rootDelta = viewRootDelta.addNode(getRootObject(), launchList.indexOf(fLaunch), IModelDelta.NO_CHANGE);
|
||||||
|
|
||||||
final Map<IVMLayoutNode,Integer> childNodeDeltas = getChildNodesWithDeltas(event);
|
// Generate delta for launch node.
|
||||||
assert childNodeDeltas.size() != 0 : "Caller should make sure that there are deltas for given event."; //$NON-NLS-1$
|
if (event instanceof LaunchesEvent) {
|
||||||
|
LaunchesEvent le = (LaunchesEvent)event;
|
||||||
callChildNodesToBuildDelta(
|
for (ILaunch launch : le.fLaunches) {
|
||||||
childNodeDeltas, rootDelta, event,
|
if (fLaunch == launch) {
|
||||||
new Done() {
|
if (le.fType == LaunchesEvent.Type.CHANGED) {
|
||||||
public void run() {
|
rootDelta.addFlags(IModelDelta.STATE | IModelDelta.CONTENT);
|
||||||
if (isDisposed()) return;
|
} else if (le.fType == LaunchesEvent.Type.TERMINATED) {
|
||||||
if (propagateError(getExecutor(), done, "Failed to create delta.")); //$NON-NLS-1$
|
rootDelta.addFlags(IModelDelta.STATE | IModelDelta.CONTENT);
|
||||||
done.setData(viewRootDelta);
|
}
|
||||||
getExecutor().execute(done);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the child nodes to generate their delta.
|
||||||
|
final Map<IVMLayoutNode,Integer> childNodeDeltas = getChildNodesWithDeltas(event);
|
||||||
|
if (childNodeDeltas.size() != 0) {
|
||||||
|
callChildNodesToBuildDelta(
|
||||||
|
childNodeDeltas, rootDelta, event,
|
||||||
|
new Done() {
|
||||||
|
public void run() {
|
||||||
|
if (isDisposed()) return;
|
||||||
|
if (propagateError(getExecutor(), done, "Failed to create delta.")); //$NON-NLS-1$
|
||||||
|
done.setData(viewRootDelta);
|
||||||
|
getExecutor().execute(done);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
done.setData(viewRootDelta);
|
||||||
|
getExecutor().execute(done);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getRootObject() {
|
public Object getRootObject() {
|
||||||
|
|
|
@ -53,6 +53,10 @@ public class StandardProcessLayoutNode extends AbstractVMLayoutNode {
|
||||||
|
|
||||||
public IVMLayoutNode getLayoutNode() { return StandardProcessLayoutNode.this; }
|
public IVMLayoutNode getLayoutNode() { return StandardProcessLayoutNode.this; }
|
||||||
@SuppressWarnings("unchecked") public Object getAdapter(Class adapter) {
|
@SuppressWarnings("unchecked") public Object getAdapter(Class adapter) {
|
||||||
|
Object vmcAdapter = super.getAdapter(adapter);
|
||||||
|
if (vmcAdapter != null) {
|
||||||
|
return vmcAdapter;
|
||||||
|
}
|
||||||
return fProcess.getAdapter(adapter);
|
return fProcess.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
public String toString() { return "IProcess " + fProcess.toString(); } //$NON-NLS-1$
|
public String toString() { return "IProcess " + fProcess.toString(); } //$NON-NLS-1$
|
||||||
|
@ -67,7 +71,9 @@ public class StandardProcessLayoutNode extends AbstractVMLayoutNode {
|
||||||
public boolean isTerminated() { return fProcess.isTerminated(); }
|
public boolean isTerminated() { return fProcess.isTerminated(); }
|
||||||
public void terminate() throws DebugException { fProcess.terminate(); }
|
public void terminate() throws DebugException { fProcess.terminate(); }
|
||||||
|
|
||||||
public boolean equals(Object other) { return fProcess.equals(other); }
|
public boolean equals(Object other) {
|
||||||
|
return other instanceof VMC && fProcess.equals(((VMC)other).fProcess);
|
||||||
|
}
|
||||||
public int hashCode() { return fProcess.hashCode(); }
|
public int hashCode() { return fProcess.hashCode(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,10 +175,16 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateHasElements(final IHasChildrenUpdate[] updates) {
|
public void updateHasElements(final IHasChildrenUpdate[] updates) {
|
||||||
getSession().getExecutor().execute(new DsfRunnable() {
|
try {
|
||||||
public void run() {
|
getSession().getExecutor().execute(new DsfRunnable() {
|
||||||
updateHasElementsInSessionThread(updates);
|
public void run() {
|
||||||
}});
|
updateHasElementsInSessionThread(updates);
|
||||||
|
}});
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
for (IHasChildrenUpdate update : updates) {
|
||||||
|
handleFailedUpdate(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateHasElementsInSessionThread(IHasChildrenUpdate[] updates) {
|
protected void updateHasElementsInSessionThread(IHasChildrenUpdate[] updates) {
|
||||||
|
@ -206,12 +212,16 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
|
||||||
public void updateElementCount(final IChildrenCountUpdate update) {
|
public void updateElementCount(final IChildrenCountUpdate update) {
|
||||||
if (!checkUpdate(update)) return;
|
if (!checkUpdate(update)) return;
|
||||||
|
|
||||||
getSession().getExecutor().execute(new DsfRunnable() {
|
try {
|
||||||
public void run() {
|
getSession().getExecutor().execute(new DsfRunnable() {
|
||||||
// After every dispatch, must check if update still valid.
|
public void run() {
|
||||||
if (!checkUpdate(update)) return;
|
// After every dispatch, must check if update still valid.
|
||||||
updateElementCountInSessionThread(update);
|
if (!checkUpdate(update)) return;
|
||||||
}});
|
updateElementCountInSessionThread(update);
|
||||||
|
}});
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
handleFailedUpdate(update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateElementCountInSessionThread(final IChildrenCountUpdate update) {
|
protected void updateElementCountInSessionThread(final IChildrenCountUpdate update) {
|
||||||
|
@ -235,12 +245,16 @@ abstract public class AbstractDMVMLayoutNode<V extends IDMData> extends Abstract
|
||||||
public void updateElements(final IChildrenUpdate update) {
|
public void updateElements(final IChildrenUpdate update) {
|
||||||
if (!checkUpdate(update)) return;
|
if (!checkUpdate(update)) return;
|
||||||
|
|
||||||
getSession().getExecutor().execute(new DsfRunnable() {
|
try {
|
||||||
public void run() {
|
getSession().getExecutor().execute(new DsfRunnable() {
|
||||||
// After every dispatch, must check if update still valid.
|
public void run() {
|
||||||
if (!checkUpdate(update)) return;
|
// After every dispatch, must check if update still valid.
|
||||||
updateElementsInSessionThread(update);
|
if (!checkUpdate(update)) return;
|
||||||
}});
|
updateElementsInSessionThread(update);
|
||||||
|
}});
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
handleFailedUpdate(update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void updateElementsInSessionThread(IChildrenUpdate update);
|
abstract protected void updateElementsInSessionThread(IChildrenUpdate update);
|
||||||
|
|
Loading…
Add table
Reference in a new issue