mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
[218847] Create a DataModelInitialized event, to properly initialize selection in Debug view
This commit is contained in:
parent
ed7fb8c287
commit
795dbe40e0
5 changed files with 63 additions and 8 deletions
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
|
import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
|
||||||
|
@ -509,6 +510,17 @@ public class FinalLaunchSequence extends Sequence {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
|
* Indicate that the Data Model has been filled. This will trigger the Debug view to expand.
|
||||||
|
*/
|
||||||
|
new Step() {
|
||||||
|
@Override
|
||||||
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
|
fLaunch.getSession().dispatchEvent(new DataModelInitializedEvent(fCommandControl.getContext()),
|
||||||
|
fCommandControl.getProperties());
|
||||||
|
requestMonitor.done();
|
||||||
|
}
|
||||||
|
},
|
||||||
/*
|
/*
|
||||||
* Cleanup
|
* Cleanup
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
|
@ -243,7 +244,7 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
|
||||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
return;
|
return;
|
||||||
} else if (e instanceof ModelProxyInstalledEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
getThreadVMCForModelProxyInstallEvent(
|
getThreadVMCForModelProxyInstallEvent(
|
||||||
parentDelta,
|
parentDelta,
|
||||||
new DataRequestMonitor<VMContextInfo>(getExecutor(), rm) {
|
new DataRequestMonitor<VMContextInfo>(getExecutor(), rm) {
|
||||||
|
@ -339,7 +340,7 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
|
||||||
return IModelDelta.CONTENT;
|
return IModelDelta.CONTENT;
|
||||||
} else if (e instanceof SteppingTimedOutEvent) {
|
} else if (e instanceof SteppingTimedOutEvent) {
|
||||||
return IModelDelta.CONTENT;
|
return IModelDelta.CONTENT;
|
||||||
} else if (e instanceof ModelProxyInstalledEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
||||||
}
|
}
|
||||||
return IModelDelta.NO_CHANGE;
|
return IModelDelta.NO_CHANGE;
|
||||||
|
@ -382,7 +383,7 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
|
||||||
// the user that the program is running.
|
// the user that the program is running.
|
||||||
parentDelta.addNode(createVMContext(dmc), IModelDelta.CONTENT);
|
parentDelta.addNode(createVMContext(dmc), IModelDelta.CONTENT);
|
||||||
rm.done();
|
rm.done();
|
||||||
} else if (e instanceof ModelProxyInstalledEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
// Model Proxy install event is generated when the model is first
|
// Model Proxy install event is generated when the model is first
|
||||||
// populated into the view. This happens when a new debug session
|
// populated into the view. This happens when a new debug session
|
||||||
// is started or when the view is first opened.
|
// is started or when the view is first opened.
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
|
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.IRootVMNode;
|
import org.eclipse.cdt.dsf.ui.viewmodel.IRootVMNode;
|
||||||
|
@ -73,7 +74,10 @@ public class LaunchRootVMNode extends RootVMNode
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (e instanceof DataModelInitializedEvent) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.isDeltaEvent(rootObject, e);
|
return super.isDeltaEvent(rootObject, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +89,8 @@ public class LaunchRootVMNode extends RootVMNode
|
||||||
if (le.fType == LaunchesEvent.Type.CHANGED || le.fType == LaunchesEvent.Type.TERMINATED) {
|
if (le.fType == LaunchesEvent.Type.CHANGED || le.fType == LaunchesEvent.Type.TERMINATED) {
|
||||||
flags = IModelDelta.STATE | IModelDelta.CONTENT;
|
flags = IModelDelta.STATE | IModelDelta.CONTENT;
|
||||||
}
|
}
|
||||||
|
} else if (e instanceof DataModelInitializedEvent) {
|
||||||
|
flags = IModelDelta.EXPAND | IModelDelta.CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
|
@ -121,8 +127,9 @@ public class LaunchRootVMNode extends RootVMNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (event instanceof DataModelInitializedEvent) {
|
||||||
|
rootDelta.setFlags(rootDelta.getFlags() | IModelDelta.EXPAND | IModelDelta.CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
rm.setData(rootDelta);
|
rm.setData(rootDelta);
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack;
|
import org.eclipse.cdt.dsf.debug.service.IStack;
|
||||||
|
@ -509,7 +510,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getContextsForEvent(final VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) {
|
public void getContextsForEvent(final VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) {
|
||||||
if (e instanceof ModelProxyInstalledEvent) {
|
if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
// Retrieve the list of stack frames, and mark the top frame to be selected.
|
// Retrieve the list of stack frames, and mark the top frame to be selected.
|
||||||
getVMProvider().updateNode(
|
getVMProvider().updateNode(
|
||||||
this,
|
this,
|
||||||
|
@ -546,7 +547,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
||||||
return IModelDelta.CONTENT | IModelDelta.EXPAND;
|
return IModelDelta.CONTENT | IModelDelta.EXPAND;
|
||||||
} else if (e instanceof SteppingTimedOutEvent) {
|
} else if (e instanceof SteppingTimedOutEvent) {
|
||||||
return IModelDelta.CONTENT;
|
return IModelDelta.CONTENT;
|
||||||
} else if (e instanceof ModelProxyInstalledEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
||||||
} else if (e instanceof ExpandStackEvent) {
|
} else if (e instanceof ExpandStackEvent) {
|
||||||
return IModelDelta.CONTENT;
|
return IModelDelta.CONTENT;
|
||||||
|
@ -598,7 +599,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
||||||
buildDeltaForSuspendedEvent(execDmc, execDmc, parent, nodeOffset, rm);
|
buildDeltaForSuspendedEvent(execDmc, execDmc, parent, nodeOffset, rm);
|
||||||
} else if (e instanceof SteppingTimedOutEvent) {
|
} else if (e instanceof SteppingTimedOutEvent) {
|
||||||
buildDeltaForSteppingTimedOutEvent((SteppingTimedOutEvent)e, parent, nodeOffset, rm);
|
buildDeltaForSteppingTimedOutEvent((SteppingTimedOutEvent)e, parent, nodeOffset, rm);
|
||||||
} else if (e instanceof ModelProxyInstalledEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
buildDeltaForModelProxyInstalledEvent(parent, nodeOffset, rm);
|
buildDeltaForModelProxyInstalledEvent(parent, nodeOffset, rm);
|
||||||
} else if (e instanceof ExpandStackEvent) {
|
} else if (e instanceof ExpandStackEvent) {
|
||||||
IExecutionDMContext execDmc = ((ExpandStackEvent)e).getDMContext();
|
IExecutionDMContext execDmc = ((ExpandStackEvent)e).getDMContext();
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Wind River Systems - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.datamodel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event to signal the initial availability of the data model.
|
||||||
|
*
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
public class DataModelInitializedEvent extends AbstractDMEvent<IDMContext> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an event for the given data model context.
|
||||||
|
* The context should represent the root of the data model hierarchy.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Clients may instantiate and subclass.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param context the data model context
|
||||||
|
*/
|
||||||
|
public DataModelInitializedEvent(IDMContext context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue