Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-05-02 20:44:46 -0400
committereutarass2008-05-02 20:44:46 -0400
commita9183acf706be3c4a0f41a5572382acf9d0f0e28 (patch)
tree4f457b5620074c3344cf18aedc1adb433849d8b8 /plugins/org.eclipse.tm.tcf.dsf.ui
parentfeb497a50df2b2edc4a139fb52e39b394fbf05e1 (diff)
downloadorg.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.tar.gz
org.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.tar.xz
org.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.zip
1. Bug 225555: [tcf] Migrate to DSF 1.0M6
2. Since DSF 1.0 requires it, migrated to Eclipse 3.4M6 and CDT 5.0M6 3. Since DSF is not fast enough to keep up with rapid target state changes when TCF diagnostic is running, reworked TCF flow control logic and added TCF API for client congestion monitoring, which is used to monitor DSF UI event queue.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.dsf.ui')
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/plugin.xml2
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/Activator.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/AdapterFactory.java49
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ContainerLayoutNode.java159
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchVMProvider.java162
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ThreadLayoutNode.java201
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/actions/TcfTerminateCommand.java27
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/launch/LaunchDialogTabGroup.java (renamed from plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchDialogTabGroup.java)2
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ExecutableContextLayoutNode.java164
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/LaunchVMProvider.java122
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/RegisterVMProvider.java108
-rw-r--r--plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ViewModelAdapter.java (renamed from plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ViewModelAdapter.java)17
12 files changed, 469 insertions, 546 deletions
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.dsf.ui/plugin.xml
index 1f4a3c7a1..d43055aba 100644
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/plugin.xml
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/plugin.xml
@@ -7,7 +7,7 @@
<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
type="org.eclipse.tm.tcf.dsf.LaunchConfigurationType"
- class="org.eclipse.tm.internal.tcf.dsf.ui.LaunchDialogTabGroup"
+ class="org.eclipse.tm.internal.tcf.dsf.ui.launch.LaunchDialogTabGroup"
id="org.eclipse.dd.dsf.mi.launch.localRunLaunchTabGroup">
</launchConfigurationTabGroup>
</extension>
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/Activator.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/Activator.java
index 03355c9de..9565d7ffe 100644
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/Activator.java
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/Activator.java
@@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
/**
* The constructor
*/
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/AdapterFactory.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/AdapterFactory.java
index 30f513bd3..b4407ab26 100644
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/AdapterFactory.java
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/AdapterFactory.java
@@ -21,9 +21,9 @@ import org.eclipse.dd.dsf.debug.ui.actions.DsfStepIntoCommand;
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepOverCommand;
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepReturnCommand;
import org.eclipse.dd.dsf.debug.ui.actions.DsfSuspendCommand;
-import org.eclipse.dd.dsf.debug.ui.actions.DsfTerminateCommand;
-import org.eclipse.dd.dsf.debug.ui.sourcelookup.MISourceDisplayAdapter;
+import org.eclipse.dd.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.dsf.ui.concurrent.DisplayDsfExecutor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchesListener2;
@@ -39,8 +39,12 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentati
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
import org.eclipse.tm.internal.tcf.dsf.launch.TCFDSFLaunch;
+import org.eclipse.tm.internal.tcf.dsf.ui.actions.TcfTerminateCommand;
+import org.eclipse.tm.internal.tcf.dsf.ui.viewmodel.ViewModelAdapter;
+import org.eclipse.tm.tcf.protocol.Protocol;
@SuppressWarnings("restriction")
@@ -51,13 +55,13 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL
private final DsfSession session;
final ViewModelAdapter view_model_adapter;
- final MISourceDisplayAdapter source_display_adapter;
+ final DsfSourceDisplayAdapter source_display_adapter;
final DsfStepIntoCommand step_into_command;
final DsfStepOverCommand step_over_command;
final DsfStepReturnCommand step_return_command;
final DsfSuspendCommand suspend_command;
final DsfResumeCommand resume_command;
- final DsfTerminateCommand terminate_command;
+ final TcfTerminateCommand terminate_command;
final IDebugModelProvider debug_model_provider;
final TCFDSFLaunch lunch;
//final BreakpointCommand breakpoint_command;
@@ -69,7 +73,8 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL
view_model_adapter = new ViewModelAdapter(session, launch);
if (launch.getSourceLocator() instanceof ISourceLookupDirector) {
- source_display_adapter = new MISourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator());
+ source_display_adapter = new DsfSourceDisplayAdapter(session,
+ (ISourceLookupDirector)launch.getSourceLocator());
}
else {
source_display_adapter = null;
@@ -81,7 +86,7 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL
step_return_command = new DsfStepReturnCommand(session);
suspend_command = new DsfSuspendCommand(session);
resume_command = new DsfResumeCommand(session);
- terminate_command = new DsfTerminateCommand(session);
+ terminate_command = new TcfTerminateCommand(session);
//breakpoint_command = new BreakpointCommand();
//memory_retrieval = new DsfMemoryBlockRetrieval(ITCFConstants.ID_TCF_DEBUG_MODEL, );
session.registerModelAdapter(IStepIntoHandler.class, step_into_command);
@@ -131,23 +136,40 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL
}
}
- @SuppressWarnings({ "unchecked", "restriction" })
- private final Class[] adapter_list = {
+ private static final Class<?>[] adapter_list = {
IElementContentProvider.class,
IColumnPresentationFactory.class,
IModelProxyFactory.class,
ITerminateHandler.class
};
- private Map<String,SessionAdapterSet> session_adapter_set_map =
+ private static final Map<String,SessionAdapterSet> session_adapter_set_map =
Collections.synchronizedMap(new HashMap<String,SessionAdapterSet>());
public AdapterFactory() {
+ assert session_adapter_set_map.isEmpty();
DsfSession.addSessionEndedListener(this);
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ final Display display = Display.getDefault();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ final DisplayDsfExecutor executer = DisplayDsfExecutor.getDisplayDsfExecutor(display);
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ Protocol.addCongestionMonitor(new Protocol.CongestionMonitor() {
+ public int getCongestionLevel() {
+ int level = executer.getQueue().size() / 4 - 100;
+ if (level > 100) level = 100;
+ return level;
+ }
+ });
+ }
+ });
+ }
+ });
}
- @SuppressWarnings({ "restriction", "unchecked" })
+ @SuppressWarnings("unchecked")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (!(adaptableObject instanceof TCFDSFLaunch)) return null;
@@ -197,11 +219,10 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL
// Dispose the set of adapters for a launch only after the launch is removed.
for (ILaunch launch : launches) {
if (launch instanceof TCFDSFLaunch) {
- DsfSession session = ((TCFDSFLaunch)launch).getSession();
+ String id = ((TCFDSFLaunch)launch).getSession().getId();
synchronized (session_adapter_set_map) {
- if (session_adapter_set_map.containsKey(session.getId())) {
- session_adapter_set_map.get(session.getId()).dispose();
- session_adapter_set_map.remove(session);
+ if (session_adapter_set_map.containsKey(id)) {
+ session_adapter_set_map.remove(id).dispose();
}
}
}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ContainerLayoutNode.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ContainerLayoutNode.java
deleted file mode 100644
index 42c7a45f6..000000000
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ContainerLayoutNode.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Ericsson 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:
- * Ericsson - Initial API and implementation
- * Wind River Systems - reused for TCF connection type
- *******************************************************************************/
-
-package org.eclipse.tm.internal.tcf.dsf.ui;
-
-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.IDMEvent;
-import org.eclipse.dd.dsf.debug.model.DsfMemoryBlockRetrieval;
-import org.eclipse.dd.dsf.debug.service.INativeProcesses;
-import org.eclipse.dd.dsf.debug.service.IRunControl;
-import org.eclipse.dd.dsf.debug.service.INativeProcesses.IProcessDMData;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent;
-import org.eclipse.dd.dsf.service.DsfSession;
-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.debug.core.DebugException;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
-import org.eclipse.tm.internal.tcf.dsf.services.TCFDSFRunControl;
-
-
-@SuppressWarnings("restriction")
-public class ContainerLayoutNode extends AbstractDMVMLayoutNode{
-
- class ContainerVMContext extends DMVMContext {
- DsfMemoryBlockRetrieval retrieval;
-
- public ContainerVMContext(IDMContext dmc) {
- super(dmc);
- try {
- retrieval = new DsfMemoryBlockRetrieval(ITCFConstants.ID_TCF_DEBUG_MODEL, dmc);
- }
- catch (DebugException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter.isInstance(retrieval)) {
- return retrieval;
- }
- return super.getAdapter(adapter);
- }
- }
-
- @Override
- protected IVMContext createVMContext(IDMContext dmc) {
- return new ContainerVMContext(dmc);
- }
-
- public ContainerLayoutNode(AbstractVMProvider provider, DsfSession session) {
- super(provider, session, IRunControl.IExecutionDMContext.class);
- }
-
- @Override
- protected void updateElementsInSessionThread(final IChildrenUpdate update) {
- if (!checkService(IRunControl.class, null, update)) return;
- final IContainerDMContext contDmc = findDmcInPath(
- update.getElementPath().getParentPath(), IContainerDMContext.class);
-
- getServicesTracker().getService(TCFDSFRunControl.class).getContainerContexts(contDmc,
- new DataRequestMonitor<IExecutionDMContext[]>(getSession().getExecutor(), null){
- @Override
- public void handleCompleted() {
- if (!getStatus().isOK()) {
- handleFailedUpdate(update);
- return;
- }
- fillUpdateWithVMCs(update, getData());
- update.done();
- }
- });
- }
-
- @Override
- // Labels are only updated for elements that are visible.
- protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
- for (final ILabelUpdate update : updates) {
- if (!checkService(IRunControl.class, null, update)) continue;
- if (!checkService(INativeProcesses.class, null, update)) continue;
-
- final IContainerDMContext dmc = findDmcInPath(update.getElementPath(), IContainerDMContext.class);
-
- INativeProcesses processes = getServicesTracker().getService(INativeProcesses.class);
-
- String imageKey = null;
-
- if (getServicesTracker().getService(IRunControl.class).isSuspended(dmc)) {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
- }
- else {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
- }
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- processes.getProcessData(
- processes.getProcessForDebugContext(dmc),
- new DataRequestMonitor<IProcessDMData>(getSession().getExecutor(), null) {
- @SuppressWarnings("restriction")
- @Override
- public void handleCompleted() {
- if (!getStatus().isOK()) {
- update.done();
- return;
- }
- update.setLabel(getData().getName(), 0);
- update.done();
- }
- });
- }
- }
-
- @Override
- protected int getNodeDeltaFlagsForDMEvent(IDMEvent<?> e) {
- if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) {
- return IModelDelta.CONTENT;
- }
- if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) {
- return IModelDelta.STATE;
- }
- return IModelDelta.NO_CHANGE;
- }
-
- @Override
- protected void buildDeltaForDMEvent(final IDMEvent<?> e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
-
- if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) {
- parentDelta.addNode(new DMVMContext(e.getDMContext()), IModelDelta.STATE);
- }
- if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) {
- parentDelta.addFlags(IModelDelta.CONTENT);
- //parentDelta.addNode(new DMVMContext(e.getDMContext()), IModelDelta.CONTENT);
- }
- super.buildDeltaForDMEvent(e, parentDelta, nodeOffset, requestMonitor);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchVMProvider.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchVMProvider.java
deleted file mode 100644
index b91a2c74c..000000000
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchVMProvider.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.tm.internal.tcf.dsf.ui;
-
-import java.util.concurrent.RejectedExecutionException;
-
-import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.dd.dsf.concurrent.ThreadSafe;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.launch.StackFramesLayoutNode;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.launch.StandardLaunchRootLayoutNode;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.launch.StandardProcessLayoutNode;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.launch.StandardLaunchRootLayoutNode.LaunchesEvent;
-import org.eclipse.dd.dsf.service.DsfSession;
-import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
-import org.eclipse.dd.dsf.ui.viewmodel.IVMLayoutNode;
-import org.eclipse.dd.dsf.ui.viewmodel.IVMRootLayoutNode;
-import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProvider;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-
-
-@SuppressWarnings("restriction")
-public class LaunchVMProvider extends AbstractDMVMProvider
-implements IDebugEventSetListener, ILaunchesListener2 {
-
- @ThreadSafe
- public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext,
- DsfSession session, ILaunch launch)
- {
- super(adapter, presentationContext, session);
-
- IVMRootLayoutNode launchNode = new StandardLaunchRootLayoutNode(this, launch);
- // Container node to contain all processes and threads
- IVMLayoutNode containerNode = new ContainerLayoutNode(this, getSession());
- IVMLayoutNode processesNode = new StandardProcessLayoutNode(this);
- launchNode.setChildNodes(new IVMLayoutNode[] { containerNode, processesNode});
-
- IVMLayoutNode threadsNode = new ThreadLayoutNode(this, getSession());
- containerNode.setChildNodes(new IVMLayoutNode[] { threadsNode });
-
- IVMLayoutNode stackFramesNode = new StackFramesLayoutNode(this, getSession());
- threadsNode.setChildNodes(new IVMLayoutNode[] { stackFramesNode });
-
- setRootLayoutNode(launchNode);
-
- DebugPlugin.getDefault().addDebugEventListener(this);
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- }
-
-
- public void handleDebugEvents(final DebugEvent[] events) {
- if (isDisposed()) return;
-
- // We're in session's executor thread. Re-dispach to VM Adapter
- // executor thread and then call root layout node.
- try {
- getExecutor().execute(new Runnable() {
- public void run() {
- if (isDisposed()) return;
-
- for (final DebugEvent event : events) {
- IVMRootLayoutNode rootLayoutNode = getRootLayoutNode();
- if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != 0) {
- rootLayoutNode.createDelta(
- event,
- new DataRequestMonitor<IModelDelta>(getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (getStatus().isOK()) {
- getModelProxy().fireModelChangedNonDispatch(getData());
- }
- }
- @Override
- public String toString() {
- return "Result of a delta for debug event: '" + event.toString() +
- "' in VMP: '" + LaunchVMProvider.this + "'" +
- "\n" + getData();
- }
- });
- }
- }
- }});
- }
- catch (RejectedExecutionException e) {
- // Ignore. This exception could be thrown if the provider is being
- // shut down.
- }
- }
-
- @Override
- public void dispose() {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
- super.dispose();
- }
-
- public void launchesAdded(ILaunch[] launches) {
- handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.ADDED));
- }
-
- public void launchesRemoved(ILaunch[] launches) {
- handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.REMOVED));
- }
-
- public void launchesChanged(ILaunch[] launches) {
- handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.CHANGED));
- }
-
- public void launchesTerminated(ILaunch[] launches) {
- handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.TERMINATED));
- }
-
- private void handleLaunchesEvent(final LaunchesEvent event) {
- if (isDisposed()) return;
-
- // We're in session's executor thread. Re-dispach to VM Adapter
- // executor thread and then call root layout node.
- try {
- getExecutor().execute(new Runnable() {
- public void run() {
- if (isDisposed()) return;
-
- IVMRootLayoutNode rootLayoutNode = getRootLayoutNode();
- if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != 0) {
- rootLayoutNode.createDelta(
- event,
- new DataRequestMonitor<IModelDelta>(getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (getStatus().isOK()) {
- getModelProxy().fireModelChangedNonDispatch(getData());
- }
- }
- @Override
- public String toString() {
- return "Result of a delta for launch event: '" + event.toString() +
- "' in VMP: '" + LaunchVMProvider.this + "'" +
- "\n" + getData();
- }
- });
- }
- }});
- }
- catch (RejectedExecutionException e) {
- // Ignore. This exception could be thrown if the provider is being
- // shut down.
- }
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ThreadLayoutNode.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ThreadLayoutNode.java
deleted file mode 100644
index 43d6e788e..000000000
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ThreadLayoutNode.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- * Ericsson - Modified for multi threaded functionality
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.dsf.ui;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.dd.dsf.concurrent.RequestMonitor;
-import org.eclipse.dd.dsf.datamodel.IDMEvent;
-import org.eclipse.dd.dsf.debug.service.INativeProcesses;
-import org.eclipse.dd.dsf.debug.service.IRunControl;
-import org.eclipse.dd.dsf.debug.service.INativeProcesses.IThreadDMData;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMData;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
-import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent;
-import org.eclipse.dd.dsf.service.DsfSession;
-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.dm.AbstractDMVMLayoutNode;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.tm.internal.tcf.dsf.services.TCFDSFExecutionDMC;
-
-
-@SuppressWarnings("restriction")
-public class ThreadLayoutNode extends AbstractDMVMLayoutNode {
-
- public ThreadLayoutNode(AbstractVMProvider provider, DsfSession session) {
- super(provider, session, IRunControl.IExecutionDMContext.class);
- }
-
- @Override
- protected void updateElementsInSessionThread(final IChildrenUpdate update) {
- if (!checkService(IRunControl.class, null, update)) return;
- final IContainerDMContext contDmc = findDmcInPath(update.getElementPath(), IContainerDMContext.class);
-
- if (contDmc == null) {
- handleFailedUpdate(update);
- return;
- }
-
- getServicesTracker().getService(IRunControl.class).getExecutionContexts(contDmc,
- new DataRequestMonitor<IExecutionDMContext[]>(getSession().getExecutor(), null){
- @Override
- public void handleCompleted() {
- if (!getStatus().isOK()) {
- handleFailedUpdate(update);
- return;
- }
- fillUpdateWithVMCs(update, getData());
- update.done();
- }
- });
- }
-
- @Override
- protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
- for (final ILabelUpdate update : updates) {
- if (!checkService(IRunControl.class, null, update)) continue;
- if (!checkService(INativeProcesses.class, null, update)) continue;
-
- final IExecutionDMContext dmc = findDmcInPath(update.getElementPath(), IExecutionDMContext.class);
-
- INativeProcesses processes = getServicesTracker().getService(INativeProcesses.class);
-
- String imageKey = null;
- if (getServicesTracker().getService(IRunControl.class).isSuspended(dmc)) {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
- }
- else {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
- }
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- // Find the Reason for the State
- final StringBuilder reason = new StringBuilder();
- getServicesTracker().getService(IRunControl.class).getExecutionData(dmc,
- new DataRequestMonitor<IExecutionDMData>(getSession().getExecutor(), null) {
- @Override
- public void handleCompleted(){
- if (!getStatus().isOK()) {
- update.done();
- return;
- }
- if(getData().getStateChangeReason() != null){
- reason.append(": " + getData().getStateChangeReason() ); //$NON-NLS-1$
- }
- }
- });
-
- getServicesTracker().getService(INativeProcesses.class).getThreadData(
- processes.getThreadForDebugContext(dmc),
- new DataRequestMonitor<IThreadDMData>(getSession().getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (!getStatus().isOK()) {
- update.done();
- return;
- }
- final StringBuilder builder = new StringBuilder("Thread["); //$NON-NLS-1$
- builder.append(((TCFDSFExecutionDMC)dmc).getTcfContextId());
- builder.append("] "); //$NON-NLS-1$
- builder.append(getData().getId());
- builder.append(getData().getName());
- if(getServicesTracker().getService(IRunControl.class).isSuspended(dmc))
- builder.append(" (Suspended"); //$NON-NLS-1$
- else
- builder.append(" (Running"); //$NON-NLS-1$
- // Reason will be null before ContainerSuspendEvent is fired
- if(reason.length() > 0 )
- builder.append(reason);
- builder.append(")"); //$NON-NLS-1$
- update.setLabel(builder.toString(), 0);
- update.done();
- }
- });
- }
- }
-
- @Override
- protected int getNodeDeltaFlagsForDMEvent(IDMEvent<?> e) {
- if (e instanceof IRunControl.IContainerResumedDMEvent ||
- e instanceof IRunControl.IContainerSuspendedDMEvent ||
- e instanceof IStartedDMEvent ||
- e instanceof IExitedDMEvent) {
- return IModelDelta.CONTENT;
- }
- if (e instanceof IRunControl.IResumedDMEvent ||
- e instanceof IRunControl.ISuspendedDMEvent) {
- return IModelDelta.STATE;
- }
- return IModelDelta.NO_CHANGE;
- }
-
- @Override
- protected void buildDeltaForDMEvent(final IDMEvent<?> e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
- if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) {
- // Since IContainerDMContext sub-classes IExecutionDMContext, container
- // events require special processing:
- // Retrieve all the thread elements and mark their state as changed.
- // Then pass these elements to the child layout nodes for processing
- final Map<IVMLayoutNode,Integer> childNodeDeltas = getChildNodesWithDeltaFlags(e);
- if (childNodeDeltas.size() == 0) {
- // There are no child nodes with deltas, just return to parent.
- requestMonitor.done();
- return;
- }
-
- // Calculate the index of this node by retrieving all the
- // elements and then finding the DMC that the event is for.
- updateElements(new ElementsUpdate(
- new DataRequestMonitor<List<Object>>(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isDisposed()) return;
-
- // Check for an empty list of elements. If it's empty then we
- // don't have to call the children nodes, so return here.
- // No need to propagate error, there's no means or need to display it.
- if (!getStatus().isOK() || getData().isEmpty()) {
- requestMonitor.done();
- return;
- }
-
- for (int i = 0; i < getData().size(); i++) {
- IVMContext vmc = (IVMContext)getData().get(i);
- VMDelta delta = parentDelta.addNode(vmc, nodeOffset + i, IModelDelta.STATE);
- callChildNodesToBuildDelta(childNodeDeltas, delta, e, requestMonitor);
- if (vmc.equals(getData().get(i))) break;
- }
- }
- },
- parentDelta));
- return;
- }
- else if (e instanceof IRunControl.IResumedDMEvent || e instanceof IRunControl.ISuspendedDMEvent) {
- parentDelta.addNode(new DMVMContext(e.getDMContext()), IModelDelta.STATE);
- super.buildDeltaForDMEvent(e, parentDelta, nodeOffset, requestMonitor);
- }
- else {
- super.buildDeltaForDMEvent(e, parentDelta, nodeOffset, requestMonitor);
- }
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/actions/TcfTerminateCommand.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/actions/TcfTerminateCommand.java
new file mode 100644
index 000000000..331352409
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/actions/TcfTerminateCommand.java
@@ -0,0 +1,27 @@
+package org.eclipse.tm.internal.tcf.dsf.ui.actions;
+
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.core.commands.IEnabledStateRequest;
+import org.eclipse.debug.core.commands.ITerminateHandler;
+
+public class TcfTerminateCommand implements ITerminateHandler {
+
+ public TcfTerminateCommand(DsfSession session) {
+
+ }
+
+ public void dispose() {
+
+ }
+
+ public void canExecute(IEnabledStateRequest request) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean execute(IDebugCommandRequest request) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchDialogTabGroup.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/launch/LaunchDialogTabGroup.java
index eb47de6b9..aad3b3e63 100644
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/LaunchDialogTabGroup.java
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/launch/LaunchDialogTabGroup.java
@@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tm.internal.tcf.dsf.ui;
+package org.eclipse.tm.internal.tcf.dsf.ui.launch;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ExecutableContextLayoutNode.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ExecutableContextLayoutNode.java
new file mode 100644
index 000000000..acae2eca1
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ExecutableContextLayoutNode.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Ericsson 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:
+ * Ericsson - Initial API and implementation
+ * Wind River Systems - reused for TCF connection type
+ *******************************************************************************/
+
+package org.eclipse.tm.internal.tcf.dsf.ui.viewmodel;
+
+import java.util.concurrent.RejectedExecutionException;
+
+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.dd.dsf.concurrent.DsfRunnable;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.IDMEvent;
+import org.eclipse.dd.dsf.debug.service.IRunControl;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
+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.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tm.internal.tcf.dsf.services.TCFDSFExecutionDMC;
+import org.eclipse.tm.internal.tcf.dsf.services.TCFDSFRunControl;
+import org.eclipse.tm.internal.tcf.dsf.services.TCFDSFRunControlState;
+import org.eclipse.tm.tcf.util.TCFDataCache;
+
+
+@SuppressWarnings("restriction")
+public class ExecutableContextLayoutNode extends AbstractDMVMNode implements IElementLabelProvider {
+
+ public ExecutableContextLayoutNode(AbstractDMVMProvider provider, DsfSession session) {
+ super(provider, session, IRunControl.IExecutionDMContext.class);
+ }
+
+ private void doneViewerUpdate(final IViewerUpdate req) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ req.done();
+ }
+ });
+ }
+
+ @Override
+ protected void updateElementsInSessionThread(final IChildrenUpdate update) {
+ if (!checkService(IRunControl.class, null, update)) return;
+
+ final TCFDSFExecutionDMC dmc = findDmcInPath(update.getViewerInput(),
+ update.getElementPath(), TCFDSFExecutionDMC.class);
+
+ getServicesTracker().getService(TCFDSFRunControl.class).getAllContexts(dmc,
+ new DataRequestMonitor<IExecutionDMContext[]>(getSession().getExecutor(), null) {
+ @Override
+ public void handleCompleted() {
+ if (!getStatus().isOK()) {
+ handleFailedUpdate(update);
+ }
+ else {
+ fillUpdateWithVMCs(update, getData());
+ doneViewerUpdate(update);
+ }
+ }
+ }
+ );
+ }
+
+ public void update(final ILabelUpdate[] updates) {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ public void run() {
+ updateLabelInSessionThread(updates);
+ }
+ });
+ }
+ catch (RejectedExecutionException e) {
+ for (ILabelUpdate update : updates) {
+ handleFailedUpdate(update);
+ }
+ }
+ }
+
+ private void updateLabelInSessionThread(final ILabelUpdate[] updates) {
+ TCFDataCache<?> pending = null;
+ for (final ILabelUpdate update : updates) {
+ if (!checkService(TCFDSFRunControl.class, null, update)) continue;
+ TCFDSFExecutionDMC dmc = (TCFDSFExecutionDMC)findDmcInPath(update.getViewerInput(),
+ update.getElementPath(), IContainerDMContext.class);
+ if (!dmc.run_control_context_cache.validate()) pending = dmc.run_control_context_cache;
+ else if (!dmc.run_control_state_cache.validate()) pending = dmc.run_control_state_cache;
+ }
+ if (pending != null) {
+ pending.wait(new Runnable() {
+ public void run() {
+ updateLabelInSessionThread(updates);
+ }
+ });
+ return;
+ }
+
+ for (final ILabelUpdate update : updates) {
+ if (!checkService(TCFDSFRunControl.class, null, update)) continue;
+ TCFDSFExecutionDMC dmc = (TCFDSFExecutionDMC)findDmcInPath(update.getViewerInput(),
+ update.getElementPath(), IContainerDMContext.class);
+
+ org.eclipse.tm.tcf.services.IRunControl.RunControlContext rc = dmc.run_control_context_cache.getData();
+ String image = null;
+ if (rc == null) {
+ image = IDebugUIConstants.IMG_ACT_DEBUG;
+ }
+ else if (!rc.hasState()) {
+ image = IDebugUIConstants.IMG_OBJS_DEBUG_TARGET;
+ }
+ else {
+ TCFDSFRunControlState state = dmc.run_control_state_cache.getData();
+ if (state != null && state.is_suspended) {
+ image = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
+ }
+ else {
+ image = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
+ }
+ }
+ update.setImageDescriptor(DebugUITools.getImageDescriptor(image), 0);
+
+ update.setLabel(dmc.getTcfContextId(), 0);
+ doneViewerUpdate(update);
+ }
+ }
+
+ public int getDeltaFlags(Object e) {
+ if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) {
+ return IModelDelta.CONTENT;
+ }
+ if (e instanceof IRunControl.IResumedDMEvent || e instanceof IRunControl.ISuspendedDMEvent) {
+ return IModelDelta.STATE;
+ }
+ return IModelDelta.NO_CHANGE;
+ }
+
+ public void buildDelta(Object e, VMDelta parentDelta, int nodeOffset, RequestMonitor requestMonitor) {
+ if (e instanceof IRunControl.IResumedDMEvent || e instanceof IRunControl.ISuspendedDMEvent) {
+ parentDelta.addNode(new DMVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.STATE);
+ }
+ else if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) {
+ parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
+ //parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT);
+ }
+ requestMonitor.done();
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/LaunchVMProvider.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/LaunchVMProvider.java
new file mode 100644
index 000000000..477e3376a
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/LaunchVMProvider.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.tm.internal.tcf.dsf.ui.viewmodel;
+
+import java.util.concurrent.RejectedExecutionException;
+
+import org.eclipse.dd.dsf.concurrent.ThreadSafe;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.LaunchRootVMNode;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.StackFramesVMNode;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.LaunchRootVMNode.LaunchesEvent;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
+import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+
+
+@SuppressWarnings("restriction")
+public class LaunchVMProvider extends AbstractDMVMProvider
+implements IDebugEventSetListener, ILaunchesListener2 {
+
+ @ThreadSafe
+ public LaunchVMProvider(AbstractVMAdapter adapter,
+ IPresentationContext presentationContext,
+ DsfSession session, ILaunch launch) {
+ super(adapter, presentationContext, session);
+
+ IRootVMNode launch_node = new LaunchRootVMNode(this);
+ setRootNode(launch_node);
+
+ IVMNode threads_node = new ExecutableContextLayoutNode(this, getSession());
+ addChildNodes(launch_node, new IVMNode[] { threads_node });
+
+ IVMNode stack_frames_node = new StackFramesVMNode(this, getSession());
+ addChildNodes(threads_node, new IVMNode[] { threads_node, stack_frames_node });
+
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+
+ public void handleDebugEvents(final DebugEvent[] events) {
+ if (isDisposed()) return;
+
+ // We're in session's executor thread. Re-dispatch to VM Adapter
+ // executor thread and then call root layout node.
+ try {
+ getExecutor().execute(new Runnable() {
+ public void run() {
+ if (isDisposed()) return;
+
+ for (final DebugEvent event : events) {
+ handleEvent(event);
+ }
+ }
+ });
+ }
+ catch (RejectedExecutionException e) {
+ // Ignore. This exception could be thrown if the provider is being
+ // shut down.
+ }
+ }
+
+ @Override
+ public void dispose() {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ super.dispose();
+ }
+
+ public void launchesAdded(ILaunch[] launches) {
+ handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.ADDED));
+ }
+
+ public void launchesRemoved(ILaunch[] launches) {
+ handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.REMOVED));
+ }
+
+ public void launchesChanged(ILaunch[] launches) {
+ handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.CHANGED));
+ }
+
+ public void launchesTerminated(ILaunch[] launches) {
+ handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.TERMINATED));
+ }
+
+ private void handleLaunchesEvent(final LaunchesEvent event) {
+ if (isDisposed()) return;
+
+ // We're in session's executor thread. Re-dispach to VM Adapter
+ // executor thread and then call root layout node.
+ try {
+ getExecutor().execute(new Runnable() {
+ public void run() {
+ if (isDisposed()) return;
+
+ IRootVMNode rootLayoutNode = getRootVMNode();
+ if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != 0) {
+ handleEvent(event);
+ }
+ }});
+ }
+ catch (RejectedExecutionException e) {
+ // Ignore. This exception could be thrown if the provider is being
+ // shut down.
+ }
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/RegisterVMProvider.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/RegisterVMProvider.java
new file mode 100644
index 000000000..8822dc419
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/RegisterVMProvider.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.dsf.ui.viewmodel;
+
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.FormattedValuePreferenceStore;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterBitFieldVMNode;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterColumnPresentation;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterGroupVMNode;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterVMNode;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.SyncRegisterDataAccess;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.BreakpointHitUpdatePolicy;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
+import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.RootDMVMNode;
+import org.eclipse.dd.dsf.ui.viewmodel.update.AutomaticUpdatePolicy;
+import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
+import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+/**
+ * Provides the VIEW MODEL for the DEBUG MODEL REGISTER view.
+ */
+@SuppressWarnings("restriction")
+public class RegisterVMProvider extends AbstractDMVMProvider implements IPropertyChangeListener {
+
+ /*
+ * Current default for register formatting.
+ */
+ public RegisterVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) {
+ super(adapter, context, session);
+
+ context.addPropertyChangeListener(this);
+
+ /*
+ * Create the register data access routines.
+ */
+ SyncRegisterDataAccess regAccess = new SyncRegisterDataAccess(session) ;
+
+ /*
+ * Create the top level node to deal with the root selection.
+ */
+ IRootVMNode rootNode = new RootDMVMNode(this);
+
+ IVMNode registerGroupNode = new RegisterGroupVMNode(this, getSession(), regAccess);
+ IVMNode registerNode = new RegisterVMNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), regAccess);
+ IVMNode bitFieldNode = new RegisterBitFieldVMNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), regAccess);
+
+ /*
+ * Create the Group nodes next. They represent the first level shown in the view.
+ */
+
+ addChildNodes(rootNode, new IVMNode[] { registerGroupNode, registerNode });
+
+ /*
+ * Create the next level which is the registers themselves.
+ */
+ addChildNodes(registerGroupNode, new IVMNode[] { registerNode, bitFieldNode });
+
+ /*
+ * Create the next level which is the bitfield level.
+ */
+ addChildNodes(registerNode, new IVMNode[] { bitFieldNode });
+
+ /*
+ * Now set this schema set as the layout set.
+ */
+ setRootNode(rootNode);
+ }
+
+ @Override
+ protected IVMUpdatePolicy[] createUpdateModes() {
+ return new IVMUpdatePolicy[] { new AutomaticUpdatePolicy(), new ManualUpdatePolicy(), new BreakpointHitUpdatePolicy() };
+ }
+
+ @Override
+ public void dispose() {
+ getPresentationContext().removePropertyChangeListener(this);
+ super.dispose();
+ }
+
+ @Override
+ public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
+ return new RegisterColumnPresentation();
+ }
+
+ @Override
+ public String getColumnPresentationId(IPresentationContext context, Object element) {
+ return RegisterColumnPresentation.ID;
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ handleEvent(event);
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ViewModelAdapter.java b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ViewModelAdapter.java
index 3ee862998..051e4abfa 100644
--- a/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/ViewModelAdapter.java
+++ b/plugins/org.eclipse.tm.tcf.dsf.ui/src/org/eclipse/tm/internal/tcf/dsf/ui/viewmodel/ViewModelAdapter.java
@@ -8,15 +8,15 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tm.internal.tcf.dsf.ui;
+package org.eclipse.tm.internal.tcf.dsf.ui.viewmodel;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.expression.ExpressionVMProvider;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.register.RegisterVMProvider;
-import org.eclipse.dd.dsf.debug.ui.viewmodel.variable.VariableVMProvider;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.expression.ExpressionVMProvider;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.ModulesVMProvider;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.variable.VariableVMProvider;
import org.eclipse.dd.dsf.service.DsfSession;
-import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMAdapter;
-import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMAdapter;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -42,7 +42,7 @@ public class ViewModelAdapter extends AbstractDMVMAdapter {
}
@Override
- protected AbstractDMVMProvider createViewModelProvider(IPresentationContext context) {
+ protected IVMProvider createViewModelProvider(IPresentationContext context) {
if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId()) ) {
return new LaunchVMProvider(this, context, getSession(), launch);
}
@@ -55,6 +55,9 @@ public class ViewModelAdapter extends AbstractDMVMAdapter {
if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId()) ) {
return new ExpressionVMProvider(this, context, getSession());
}
+ if (IDebugUIConstants.ID_MODULE_VIEW.equals(context.getId()) ) {
+ return new ModulesVMProvider(this, context, getSession());
+ }
return null;
}
}

Back to the top