Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/.classpath7
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/.project28
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/META-INF/MANIFEST.MF16
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/build.properties4
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/plugin.xml9
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/Activator.java43
-rw-r--r--examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java61
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/plugin.xml1
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/schema/presentation_provider.exsd67
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFModel.java51
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFPresentationProvider.java55
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DisconnectCommand.java6
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DropToFrameCommand.java35
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/StepCommand.java6
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/SuspendCommand.java6
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/TerminateCommand.java9
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java26
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNode.java10
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java62
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFRunnable.java41
22 files changed, 514 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
index 135fe4da9..85092af50 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,8 +6,9 @@
workspace
debug-workspace
-# examples/org.eclipse.tcf.examples.daytime/
+# examples/
examples/org.eclipse.tcf.examples.daytime/bin
+examples/org.eclipse.tcf.examples.presentation/bin
# features/
features/build-directory
diff --git a/examples/org.eclipse.tcf.examples.presentation/.classpath b/examples/org.eclipse.tcf.examples.presentation/.classpath
new file mode 100644
index 000000000..ad32c83a7
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/org.eclipse.tcf.examples.presentation/.project b/examples/org.eclipse.tcf.examples.presentation/.project
new file mode 100644
index 000000000..59d1c6166
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tcf.examples.presentation</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/org.eclipse.tcf.examples.presentation/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.tcf.examples.presentation/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f287d53cf
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/examples/org.eclipse.tcf.examples.presentation/META-INF/MANIFEST.MF b/examples/org.eclipse.tcf.examples.presentation/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..a0eee0703
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test
+Bundle-SymbolicName: org.eclipse.tcf.examples.presentation;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.tcf.examples.presentation.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.tcf.debug.ui,
+ org.eclipse.tcf
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.debug.core,
+ org.eclipse.debug.internal.ui.viewers.model.provisional,
+ org.eclipse.debug.ui,
+ org.eclipse.tcf.debug.ui
diff --git a/examples/org.eclipse.tcf.examples.presentation/build.properties b/examples/org.eclipse.tcf.examples.presentation/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/examples/org.eclipse.tcf.examples.presentation/plugin.xml b/examples/org.eclipse.tcf.examples.presentation/plugin.xml
new file mode 100644
index 000000000..c1635b2ab
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="org.eclipse.tcf.debug.ui.presentation_provider">
+ <class name="org.eclipse.tcf.examples.presentation.PresentationExample"/>
+ </extension>
+
+</plugin>
diff --git a/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/Activator.java b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/Activator.java
new file mode 100644
index 000000000..c6a33ad12
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/Activator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.examples.presentation;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.tcf.examples.presentation"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public Activator() {
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java
new file mode 100644
index 000000000..904546701
--- /dev/null
+++ b/examples/org.eclipse.tcf.examples.presentation/src/org/eclipse/tcf/examples/presentation/PresentationExample.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.examples.presentation;
+
+import org.eclipse.debug.core.IRequest;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.tcf.debug.ui.ITCFModel;
+import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
+
+/**
+ * This example demonstrates how to provide icons in the Registers view.
+ * Using this approach, clients can alter all aspects of TCF debug model presentation.
+ */
+@SuppressWarnings("restriction")
+public class PresentationExample implements ITCFPresentationProvider {
+
+ @Override
+ public boolean onModelCreated(ITCFModel model) {
+ /* true means we want to listen for UI requests on this model */
+ return true;
+ }
+
+ @Override
+ public void onModelDisposed(ITCFModel model) {
+ }
+
+ @Override
+ public boolean updateStarted(IRequest request) {
+ /* true means we want the model to start handling of this request */
+ return true;
+ }
+
+ @Override
+ public boolean updateComplete(IRequest request) {
+ if (request instanceof ILabelUpdate) {
+ ILabelUpdate update = (ILabelUpdate)request;
+ String id = update.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) {
+ /* This request is for label in the Registers view.
+ * Let's override the default icon with something else.
+ */
+ ImageDescriptor image = DebugUITools.getImageDescriptor(
+ IDebugUIConstants.IMG_OBJS_VARIABLE);
+ update.setImageDescriptor(image, 0);
+ }
+ }
+ /* true means we want the model to finish handling of this request */
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tcf.debug.ui/plugin.xml
index e0996765d..e3420c79e 100644
--- a/plugins/org.eclipse.tcf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.tcf.debug.ui/plugin.xml
@@ -15,6 +15,7 @@
<extension-point id="launch_context" name="TCF Launch Context" schema="schema/launch_context.exsd"/>
<extension-point id="annotation_provider" name="TCF Annotation Provider" schema="schema/annotation_provider.exsd"/>
+ <extension-point id="presentation_provider" name="TCF Presentation Provider" schema="schema/presentation_provider.exsd"/>
<extension-point id="pretty_expression_provider" name="TCF Pretty Expression Provider" schema="schema/pretty_expression_provider.exsd"/>
<extension point="org.eclipse.tcf.startup"/>
diff --git a/plugins/org.eclipse.tcf.debug.ui/schema/presentation_provider.exsd b/plugins/org.eclipse.tcf.debug.ui/schema/presentation_provider.exsd
new file mode 100644
index 000000000..afa95b3ba
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/schema/presentation_provider.exsd
@@ -0,0 +1,67 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.tcf.debug.ui" id="presentation_provider" name="TCF Presentation Provider"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to register plugins
+that want to extends TCF debugger functionality.
+Implementing the extension allows a plugin to intercept all
+update requests of the debugger UI.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="class" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="class">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Class should implement org.eclipse.tcf.debug.ui.ITCFPresentationProvider interface
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+
+</schema>
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFModel.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFModel.java
new file mode 100644
index 000000000..c2eab35f3
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFModel.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.debug.ui;
+
+import org.eclipse.debug.core.Launch;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tcf.protocol.IChannel;
+
+/**
+ * TCFModel represents remote target state as it is known to host.
+ * The main job of the model is caching remote data,
+ * keeping the cache in a coherent state,
+ * and feeding UI with up-to-date data.
+ */
+public interface ITCFModel {
+
+ /**
+ * Get TCF communication channel that is used by this model.
+ * @return IChannel interface.
+ */
+ IChannel getChannel();
+
+ /**
+ * Get display that is used by this model.
+ * @return Display object.
+ */
+ Display getDisplay();
+
+ /**
+ * Get launch object associated with this model.
+ * @return Launch object.
+ */
+ Launch getLaunch();
+
+ /**
+ * Get model object with given ID.
+ * @param id - TCF ID of remote object.
+ * @return ITCFObject interface or null - if model does not include such object.
+ * Note that the model is built lazily (on demand): getNode() can return null even if
+ * "id" is valid ID of existing remote object.
+ */
+ ITCFObject getNode(String id);
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFPresentationProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFPresentationProvider.java
new file mode 100644
index 000000000..c56df7521
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/debug/ui/ITCFPresentationProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.debug.ui;
+
+import org.eclipse.debug.core.IRequest;
+
+/**
+ * TCF clients can implement ITCFPresentationProvider to participate in presentation of TCF debug model.
+ * The implementation is registered through extension point: org.eclipse.tcf.debug.ui.presentation_provider
+ */
+public interface ITCFPresentationProvider {
+
+ /**
+ * Debug model created notification.
+ * @param model - the model.
+ * @return - true if the client wants to listen for updateStarted/updateComplete events on the model,
+ * returning false stops ant further client notifications from that model.
+ */
+ boolean onModelCreated(ITCFModel model);
+
+ /**
+ * Debug model disposed notification.
+ * @param model - the model.
+ */
+ void onModelDisposed(ITCFModel model);
+
+ /**
+ * This method is called for every presentation data request before
+ * the debug model starts to fill the request with the requested data.
+ * @param request - data request from the debugger UI.
+ * @return - true if the client wants the debug model to continue processing the
+ * request. If the client returns false, it is his responsibility to fill
+ * the request and to call "IRequest.done".
+ */
+ boolean updateStarted(IRequest request);
+
+ /**
+ * This method is called for every presentation data request after
+ * the debug model has filled the request with the requested data,
+ * but before it calls "done" method of the request.
+ * Clients can modify the data that is stored in the request object.
+ * @param request - data request from the debugger UI.
+ * @return - true if the client wants the debug model to continue processing the
+ * request. If the client returns false, it is his responsibility to call "IRequest.done".
+ */
+ boolean updateComplete(IRequest request);
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DisconnectCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DisconnectCommand.java
index 43836faac..e997c1872 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DisconnectCommand.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DisconnectCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2012 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
@@ -28,7 +28,7 @@ public class DisconnectCommand implements IDisconnectHandler {
}
public void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
monitor.setEnabled(model.getLaunch().canDisconnect());
monitor.setStatus(Status.OK_STATUS);
@@ -38,7 +38,7 @@ public class DisconnectCommand implements IDisconnectHandler {
}
public boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
try {
model.getLaunch().closeChannel();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DropToFrameCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DropToFrameCommand.java
index 46929b6f5..cd1acf03a 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DropToFrameCommand.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/DropToFrameCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2012 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
@@ -99,15 +99,15 @@ public class DropToFrameCommand implements IDropToFrameHandler {
}
public void canExecute(final IEnabledStateRequest request) {
- final Object[] elements = request.getElements();
- if (elements.length != 1 || !(elements[0] instanceof TCFNodeStackFrame)) {
- request.setEnabled(false);
- request.done();
- return;
- }
- final TCFNodeStackFrame frameNode = (TCFNodeStackFrame) elements[0];
- new TCFRunnable(request) {
+ new TCFRunnable(model, request) {
public void run() {
+ Object[] elements = request.getElements();
+ if (elements.length != 1 || !(elements[0] instanceof TCFNodeStackFrame)) {
+ request.setEnabled(false);
+ done();
+ return;
+ }
+ TCFNodeStackFrame frameNode = (TCFNodeStackFrame) elements[0];
if (frameNode.getFrameNo() < 1) {
request.setEnabled(false);
done();
@@ -150,15 +150,15 @@ public class DropToFrameCommand implements IDropToFrameHandler {
}
public boolean execute(final IDebugCommandRequest request) {
- final Object[] elements = request.getElements();
- if (elements.length != 1 || !(elements[0] instanceof TCFNodeStackFrame)) {
- request.setStatus(Status.CANCEL_STATUS);
- request.done();
- return false;
- }
- final TCFNodeStackFrame frameNode = (TCFNodeStackFrame) elements[0];
- new TCFRunnable(request) {
+ new TCFRunnable(model, request) {
public void run() {
+ Object[] elements = request.getElements();
+ if (elements.length != 1 || !(elements[0] instanceof TCFNodeStackFrame)) {
+ request.setStatus(Status.CANCEL_STATUS);
+ done();
+ return;
+ }
+ final TCFNodeStackFrame frameNode = (TCFNodeStackFrame) elements[0];
int frameNo = frameNode.getFrameNo();
if (frameNo < 1) {
request.setStatus(Status.CANCEL_STATUS);
@@ -174,6 +174,7 @@ public class DropToFrameCommand implements IDropToFrameHandler {
if (state_data == null || !state_data.is_suspended) {
request.setStatus(Status.CANCEL_STATUS);
done();
+ return;
}
if (!exeNode.getStackTrace().validate(this)) return;
Map<String, TCFNode> stack = exeNode.getStackTrace().getData();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/StepCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/StepCommand.java
index 54e142845..11f5adc01 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/StepCommand.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/StepCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2012 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
@@ -83,7 +83,7 @@ abstract class StepCommand implements IDebugCommandHandler {
}
public final void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
if (!monitor.isCanceled()) {
@@ -98,7 +98,7 @@ abstract class StepCommand implements IDebugCommandHandler {
}
public final boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/SuspendCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/SuspendCommand.java
index 1f3e3798e..e83458ce2 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/SuspendCommand.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/SuspendCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2012 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
@@ -40,7 +40,7 @@ public class SuspendCommand implements ISuspendHandler {
}
public void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
Object[] elements = monitor.getElements();
@@ -88,7 +88,7 @@ public class SuspendCommand implements ISuspendHandler {
}
public boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
Object[] elements = monitor.getElements();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/TerminateCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/TerminateCommand.java
index 376f80bbe..a72812b7a 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/TerminateCommand.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/TerminateCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2012 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
@@ -32,11 +32,14 @@ import org.eclipse.tcf.util.TCFDataCache;
public class TerminateCommand implements ITerminateHandler {
+ private final TCFModel model;
+
public TerminateCommand(TCFModel model) {
+ this.model = model;
}
public void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
Object[] elements = monitor.getElements();
@@ -78,7 +81,7 @@ public class TerminateCommand implements ITerminateHandler {
}
public boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
+ new TCFRunnable(model, monitor) {
public void run() {
if (done) return;
Object[] elements = monitor.getElements();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
index 80c89e54e..2ed4a32a5 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
@@ -85,7 +85,9 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tcf.core.Command;
+import org.eclipse.tcf.debug.ui.ITCFModel;
import org.eclipse.tcf.debug.ui.ITCFSourceDisplay;
+import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
import org.eclipse.tcf.internal.debug.actions.TCFAction;
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupDirector;
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupParticipant;
@@ -142,7 +144,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
* keeping the cache in a coherent state,
* and feeding UI with up-to-date data.
*/
-public class TCFModel implements IElementContentProvider, IElementLabelProvider, IViewerInputProvider,
+public class TCFModel implements ITCFModel, IElementContentProvider, IElementLabelProvider, IViewerInputProvider,
IModelProxyFactory, IColumnPresentationFactory, ITCFSourceDisplay, ISuspendTrigger, IElementMementoProvider {
/** The id of the expression hover presentation context */
@@ -197,6 +199,8 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
private final List<ISuspendTriggerListener> suspend_trigger_listeners =
new LinkedList<ISuspendTriggerListener>();
+ final List<ITCFPresentationProvider> view_request_listeners;
+
private int display_source_generation;
private int suspend_trigger_generation;
private int auto_disconnect_generation;
@@ -689,6 +693,16 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
};
listener.propertyChange(null);
prefs.addPropertyChangeListener(listener);
+ List<ITCFPresentationProvider> l = new ArrayList<ITCFPresentationProvider>();
+ for (ITCFPresentationProvider p : TCFPresentationProvider.getPresentationProviders()) {
+ try {
+ if (p.onModelCreated(this)) l.add(p);
+ }
+ catch (Throwable x) {
+ Activator.log("Unhandled exception in a presentation provider", x);
+ }
+ }
+ view_request_listeners = l.size() > 0 ? l : null;
}
/**
@@ -956,6 +970,16 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
}
void dispose() {
+ if (view_request_listeners != null) {
+ for (ITCFPresentationProvider p : view_request_listeners) {
+ try {
+ p.onModelDisposed(this);
+ }
+ catch (Throwable x) {
+ Activator.log("Unhandled exception in a presentation provider", x);
+ }
+ }
+ }
launch.removeActionsListener(actions_listener);
expr_manager.removeExpressionListener(expressions_listener);
for (TCFConsole c : process_consoles.values()) c.close();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNode.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNode.java
index e15f07b59..47ca7c0ec 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNode.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNode.java
@@ -214,7 +214,7 @@ public abstract class TCFNode extends PlatformObject implements ITCFObject, Comp
* @param update - children count update request.
*/
final void update(final IChildrenCountUpdate update) {
- new TCFRunnable(update) {
+ new TCFRunnable(model, update) {
public void run() {
if (!done) {
if (!update.isCanceled()) {
@@ -237,7 +237,7 @@ public abstract class TCFNode extends PlatformObject implements ITCFObject, Comp
* @param update - children update request.
*/
final void update(final IChildrenUpdate update) {
- new TCFRunnable(update) {
+ new TCFRunnable(model, update) {
public void run() {
if (!done) {
if (!update.isCanceled()) {
@@ -257,7 +257,7 @@ public abstract class TCFNode extends PlatformObject implements ITCFObject, Comp
* @param update - "has children" update request.
*/
final void update(final IHasChildrenUpdate update) {
- new TCFRunnable(update) {
+ new TCFRunnable(model, update) {
public void run() {
if (!done) {
if (!update.isCanceled()) {
@@ -280,7 +280,7 @@ public abstract class TCFNode extends PlatformObject implements ITCFObject, Comp
* @param update - label update request.
*/
final void update(final ILabelUpdate update) {
- new TCFRunnable(update) {
+ new TCFRunnable(model, update) {
public void run() {
if (!done) {
if (!update.isCanceled()) {
@@ -305,7 +305,7 @@ public abstract class TCFNode extends PlatformObject implements ITCFObject, Comp
* @param update - input update request.
*/
final void update(final IViewerInputUpdate update) {
- new TCFRunnable(update) {
+ new TCFRunnable(model, update) {
public void run() {
if (!done) {
if (!update.isCanceled()) {
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java
new file mode 100644
index 000000000..5940d3cc3
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.internal.debug.ui.model;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
+import org.eclipse.tcf.internal.debug.ui.Activator;
+import org.osgi.framework.Bundle;
+
+/**
+ * TCF clients can implement ITCFPresentationProvider to participate in presentation of TCF debug model.
+ * The implementation is registered through extension point: org.eclipse.tcf.debug.ui.presentation_provider
+ */
+public class TCFPresentationProvider {
+
+ private static ArrayList<ITCFPresentationProvider> providers;
+
+ public static Iterable<ITCFPresentationProvider> getPresentationProviders() {
+ if (providers == null) {
+ providers = new ArrayList<ITCFPresentationProvider>();
+ try {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
+ Activator.PLUGIN_ID, "presentation_provider"); //$NON-NLS-1$
+ IExtension[] extensions = point.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ try {
+ Bundle bundle = Platform.getBundle(extensions[i].getContributor().getName());
+ bundle.start(Bundle.START_TRANSIENT);
+ IConfigurationElement[] e = extensions[i].getConfigurationElements();
+ for (int j = 0; j < e.length; j++) {
+ String nm = e[j].getName();
+ if (nm.equals("class")) { //$NON-NLS-1$
+ Class<?> c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$
+ providers.add((ITCFPresentationProvider)c.newInstance());
+ }
+ }
+ }
+ catch (Throwable x) {
+ Activator.log("Cannot access presentation provider extension points", x);
+ }
+ }
+ }
+ catch (Exception x) {
+ Activator.log("Cannot access presentation provider extension points", x);
+ }
+ }
+ return providers;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFRunnable.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFRunnable.java
index 81ba31d40..58dd614d4 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFRunnable.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFRunnable.java
@@ -11,23 +11,58 @@
package org.eclipse.tcf.internal.debug.ui.model;
import org.eclipse.debug.core.IRequest;
+import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
+import org.eclipse.tcf.internal.debug.ui.Activator;
import org.eclipse.tcf.protocol.Protocol;
-
+/**
+ * TCFRunnable is a wrapper for IRequest.
+ * It implements Runnable interface and is used by TCFModel to handle the request.
+ */
public abstract class TCFRunnable implements Runnable {
private final IRequest request;
+ private final Iterable<ITCFPresentationProvider> listeners;
protected boolean done;
- public TCFRunnable(IRequest request) {
+ public TCFRunnable(TCFModel model, IRequest request) {
this.request = request;
- Protocol.invokeLater(this);
+ listeners = model.view_request_listeners;
+ if (listeners == null) {
+ Protocol.invokeLater(this);
+ return;
+ }
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ assert !done;
+ for (ITCFPresentationProvider l : listeners) {
+ try {
+ if (!l.updateStarted(TCFRunnable.this.request)) return;
+ }
+ catch (Throwable x) {
+ Activator.log("Unhandled exception in a presentation provider", x);
+ }
+ }
+ TCFRunnable.this.run();
+ }
+ });
}
public void done() {
assert !done;
done = true;
+ if (listeners != null) {
+ for (ITCFPresentationProvider l : listeners) {
+ try {
+ if (!l.updateComplete(request)) return;
+ }
+ catch (Throwable x) {
+ Activator.log("Unhandled exception in a presentation provider", x);
+ }
+ }
+ }
// Don't call Display.asyncExec: display thread can be blocked waiting for the request.
// For example, display thread is blocked for action state update requests.
// Calling back into Eclipse on TCF thread is dangerous too - if Eclipse blocks TCF thread

Back to the top