Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2013-01-28 13:37:38 +0000
committeraradermache2013-01-28 13:37:38 +0000
commitebd5809581875b8c12cb622ae81c8067d668b945 (patch)
treef854e1f8841efea14d48498360f65cbb9926e202 /extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints
parent2744195194144042bef2c17eda5e1ef35d009933 (diff)
downloadorg.eclipse.papyrus-ebd5809581875b8c12cb622ae81c8067d668b945.tar.gz
org.eclipse.papyrus-ebd5809581875b8c12cb622ae81c8067d668b945.tar.xz
org.eclipse.papyrus-ebd5809581875b8c12cb622ae81c8067d668b945.zip
Initial version for migration of Qompass designer from 0.9.2 to the trunk (0.10)
Diffstat (limited to 'extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints')
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.classpath7
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.project28
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF22
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/about.html28
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/build.properties10
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/contexts.xml13
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gifbin0 -> 204 bytes
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gifbin0 -> 372 bytes
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gifbin0 -> 204 bytes
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.properties12
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.xml34
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java78
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java44
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java521
14 files changed, 797 insertions, 0 deletions
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.classpath b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.classpath
new file mode 100644
index 00000000000..64c5e31b7a2
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.project b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.project
new file mode 100644
index 00000000000..657d2f7a65c
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.views.tracepoints</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/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ccd7816299a
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.views.tracepoints; singleton:=true
+Bundle-Version: 0.9.2.qualifier
+Bundle-Activator: org.eclipse.papyrus.views.tracepoints.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.services.tracepoints;bundle-version="0.9.2",
+ org.eclipse.core.resources;bundle-version="3.7.0",
+ org.eclipse.emf.ecore;bundle-version="2.8.0",
+ org.eclipse.gef;bundle-version="3.8.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.9.2",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.9.2",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.common.ui;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %pluginProvider
+Bundle-Localization: plugin
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/about.html b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/build.properties b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/build.properties
new file mode 100644
index 00000000000..8c05b0ac6b9
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ contexts.xml,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/contexts.xml b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/contexts.xml
new file mode 100644
index 00000000000..b3b18ae3d68
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/contexts.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contexts>
+ <context id="viewer" title="Sample View">
+ <description>This is the context help for the sample view with a table viewer. It was generated by a PDE template.</description>
+ <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
+ <enablement>
+ <with variable="platform">
+ <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
+ </with>
+ </enablement>
+ </topic>
+ </context>
+</contexts>
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif
new file mode 100644
index 00000000000..f529c5a4225
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif
Binary files differ
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif
new file mode 100644
index 00000000000..cf62b63ae3e
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif
Binary files differ
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif
new file mode 100644
index 00000000000..c1751c3ff4f
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif
Binary files differ
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.properties b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.properties
new file mode 100644
index 00000000000..b02f21505bc
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2013 CEA LIST.
+# 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:
+# CEA LIST - initial API and implementation
+###############################################################################
+pluginName=Papyrus Tracepoint View (Incubation)
+pluginProvider=Eclipse Modeling Project
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.xml b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.xml
new file mode 100644
index 00000000000..43cfbf7e29e
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="Tracepoints"
+ icon="icons/breakpoint_view.gif"
+ category="org.eclipse.papyrus.views.category"
+ class="org.eclipse.papyrus.views.tracepoints.views.TracepointView"
+ id="org.eclipse.papyrus.views.tracepoints.views.Tracepoints">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <view
+ ratio="0.5"
+ relative="org.eclipse.ui.views.TaskList"
+ relationship="right"
+ id="org.eclipse.papyrus.views.tracepoints.views.SampleView">
+ </view>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="contexts.xml">
+ </contexts>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java
new file mode 100644
index 00000000000..e12d420e77b
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Ansgar Radermacher (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.tracepoints;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+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.papyrus.views.tracepoints"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java
new file mode 100644
index 00000000000..d1dc6b933aa
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+* Copyright (c) 2012 CEA LIST.
+*
+*
+ * 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:
+* Ansgar Radermacher (CEA LIST) - Initial API and implementation
+*
+*****************************************************************************/
+
+package org.eclipse.papyrus.views.tracepoints.views;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.views.tracepoints.Activator;
+import org.eclipse.swt.graphics.Image;
+
+
+public class TraceViewImages {
+
+ public static ImageDescriptor getGotoObjID() {
+ org.eclipse.papyrus.infra.widgets.Activator widgetsActivator =
+ org.eclipse.papyrus.infra.widgets.Activator.getDefault();
+ return widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, "icons/gotoobj_tsk.gif");
+ }
+
+ public static ImageDescriptor getSkipAllID() {
+ org.eclipse.papyrus.infra.widgets.Activator widgetsActivator =
+ org.eclipse.papyrus.infra.widgets.Activator.getDefault();
+ return widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, "icons/skip_brkp.gif");
+ }
+
+ public static Image getSkipAllImage() {
+ if(skipAllImage == null) {
+ skipAllImage = getSkipAllID().createImage();
+ }
+ return skipAllImage;
+ }
+
+ protected static Image skipAllImage = null;
+}
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java
new file mode 100644
index 00000000000..ace3d79213b
--- /dev/null
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java
@@ -0,0 +1,521 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Ansgar Radermacher (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.tracepoints.views;
+
+
+import java.util.Map;
+
+import javax.swing.text.View;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager;
+import org.eclipse.gmf.runtime.common.ui.resources.IFileObserver;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.OpenStrategy;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.papyrus.infra.services.tracepoints.MarkerUtils;
+import org.eclipse.papyrus.infra.services.tracepoints.TraceFunctions;
+import org.eclipse.papyrus.infra.services.tracepoints.TraceState;
+import org.eclipse.papyrus.infra.services.tracepoints.TracepointConstants;
+import org.eclipse.papyrus.infra.services.tracepoints.dialogs.TraceActionSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+
+
+/**
+ * This sample class demonstrates how to plug-in a new
+ * workbench view. The view shows data obtained from the
+ * model. The sample creates a dummy model on the fly,
+ * but a real implementation would connect to the model
+ * available either in this or another plug-in (e.g. the workspace).
+ * The view is connected to the model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model objects should be presented in the view. Each view can present the same model objects using
+ * different labels and icons, if needed. Alternatively, a single label provider can be shared between views in order to ensure that objects of the
+ * same type are presented in the same way everywhere.
+ * <p>
+ */
+
+public class TracepointView extends ViewPart implements ISelectionListener {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.papyrus.views.tracepoints.views.Tracepoints";
+
+
+ private CheckboxTableViewer viewer;
+
+ protected Action actionDelete;
+
+ protected Action actionDeleteAll;
+
+ protected Action actionGoto;
+
+ protected Action actionSkip;
+
+ protected Action actionTraceSelect;
+
+ private Action doubleClickAction;
+
+ private IFileObserver fileObserver = null;
+
+ protected TraceActionSelection tas;
+
+ /**
+ * The content provider class is responsible for
+ * providing objects to the view. It can wrap
+ * existing objects in adapters or simply return
+ * objects as-is. These objects may be sensitive
+ * to the current input of the view, or ignore
+ * it and always show the same content
+ * (like Task List, for example).
+ */
+ class ViewContentProvider implements IStructuredContentProvider {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object parent) {
+ try {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if(root != null) {
+ return root.findMarkers(TracepointConstants.tpOrbpMarker, true, IResource.DEPTH_INFINITE);
+ }
+ } catch (CoreException e) {
+ }
+ return new String[]{};
+ }
+ }
+
+
+
+ class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public ViewLabelProvider() {
+ this.traceImage = new TraceFunctions();
+ }
+
+ public String getColumnText(Object obj, int index) {
+ if(obj instanceof IMarker) {
+ EObject eobj = MarkerUtils.getEObjectOfMarker((IMarker)obj);
+ if(eobj instanceof NamedElement) {
+ return ((NamedElement)eobj).getQualifiedName();
+ } else if(eobj != null) {
+ return eobj.toString();
+ }
+ }
+ return getText(obj);
+
+ }
+
+ public Image getColumnImage(Object obj, int index) {
+ if(TraceState.skipAllTracepoints) {
+ return TraceViewImages.getSkipAllImage();
+ }
+ if(obj instanceof IMarker) {
+ IMarker marker = (IMarker)obj;
+ ImageDescriptor id = traceImage.getImageDescriptorForGE(marker);
+ if(id != null) {
+ // TODO: leaks!
+ return id.createImage();
+ }
+ }
+ return null;
+ }
+
+ private TraceFunctions traceImage;
+ }
+
+ class NameSorter extends ViewerSorter {
+ }
+
+ /**
+ * The constructor.
+ */
+ public TracepointView() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.setContentProvider(new ViewContentProvider());
+ viewer.setLabelProvider(new ViewLabelProvider());
+ viewer.setCheckStateProvider(new ICheckStateProvider() {
+
+ public boolean isGrayed(Object element) {
+ return false;
+ }
+
+ public boolean isChecked(Object element) {
+ if(element instanceof IMarker) {
+ IMarker marker = (IMarker)element;
+ return marker.getAttribute(TracepointConstants.isActive, false);
+ }
+ return false;
+ }
+ });
+
+ viewer.setSorter(new NameSorter());
+ viewer.setInput(getViewSite());
+
+ getViewSite().getPage().addSelectionListener(this);
+
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.eclipse.papyrus.views.tracepoints.viewer");
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+ viewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ boolean isChecked = event.getChecked();
+ if(element instanceof IMarker) {
+ IMarker marker = (IMarker)element;
+ try {
+ marker.setAttribute(TracepointConstants.isActive, isChecked);
+ switchUI();
+ } catch (CoreException e) {
+ }
+ }
+ }
+ });
+
+ fileObserver = new IFileObserver() {
+
+ public void handleMarkerDeleted(IMarker marker, @SuppressWarnings("rawtypes") Map attributes) {
+ switchUI();
+ }
+
+ public void handleMarkerChanged(IMarker marker) {
+ switchUI();
+ }
+
+ public void handleMarkerAdded(IMarker marker) {
+ switchUI();
+ }
+
+ // TODO need to handle?
+ public void handleFileRenamed(IFile oldFile, IFile file) {
+ }
+
+ public void handleFileMoved(IFile oldFile, IFile file) {
+ }
+
+ public void handleFileDeleted(IFile file) {
+ }
+
+ public void handleFileChanged(IFile file) {
+ }
+ };
+
+ FileChangeManager.getInstance().addFileObserver(fileObserver);
+ }
+
+ @Override
+ public void dispose() {
+ if(fileObserver != null) {
+ FileChangeManager.getInstance().addFileObserver(fileObserver);
+ }
+ super.dispose();
+ }
+
+ public void switchUI() {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ // ... do any work that updates the screen ...
+ viewer.refresh();
+ }
+ });
+ }
+
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager manager) {
+ TracepointView.this.fillContextMenu(manager);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ protected void fillLocalPullDown(IMenuManager manager) {
+ manager.add(actionDelete);
+ manager.add(new Separator());
+ manager.add(actionGoto);
+ }
+
+ protected void fillContextMenu(IMenuManager manager) {
+ manager.add(actionDelete);
+ manager.add(actionGoto);
+ // Other plug-ins can contribute there actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ protected void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(actionDelete);
+ manager.add(actionDeleteAll);
+ manager.add(actionGoto);
+ manager.add(actionSkip);
+ manager.add(actionTraceSelect);
+ }
+
+ protected void makeActions() {
+ actionSkip = new Action("Skip all", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ TraceState.skipAllTracepoints = !TraceState.skipAllTracepoints;
+ switchUI();
+ }
+ };
+ actionSkip.setChecked(TraceState.skipAllTracepoints);
+
+ actionSkip.setImageDescriptor(TraceViewImages.getSkipAllID());
+ actionSkip.setToolTipText("Toggle skipping all trace/break points");
+
+ actionDelete = new Action("Delete") {
+
+ @Override
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if(obj instanceof IMarker) {
+ IMarker marker = (IMarker)obj;
+ try {
+ marker.delete();
+ } catch (CoreException e) {
+ }
+ }
+ }
+ };
+ actionDelete.setToolTipText("Delete trace/breakpoint");
+ actionDelete.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE));
+
+ actionDeleteAll = new Action() {
+
+ @Override
+ public void run() {
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if(root != null) {
+ try {
+ root.deleteMarkers(TracepointConstants.tpOrbpMarker, true, 0);
+ } catch (CoreException e) {
+ }
+ }
+ }
+ };
+ actionDeleteAll.setText("Delete all");
+ actionDeleteAll.setToolTipText("Delete all trace/breakpoint");
+ actionDeleteAll.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL));
+
+ actionGoto = new Action() {
+
+ @Override
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if(obj instanceof IMarker) {
+ IMarker marker = (IMarker)obj;
+ boolean onlyNavigatoToActiveEditor = false;
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if(onlyNavigatoToActiveEditor) {
+ IEditorPart part = activePage.getActiveEditor();
+ if(part instanceof IGotoMarker) {
+ ((IGotoMarker)part).gotoMarker(marker);
+ }
+ } else {
+ try {
+ IDE.openEditor(activePage, marker, OpenStrategy.activateOnOpen());
+ } catch (PartInitException e) {
+
+ }
+ }
+ }
+ }
+ };
+ actionGoto.setText("Goto");
+ actionGoto.setToolTipText("Navigate to trace/breakpoint");
+ actionGoto.setImageDescriptor(TraceViewImages.getGotoObjID());
+ doubleClickAction = actionGoto;
+
+ actionTraceSelect = new Action() {
+
+ @Override
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if(obj instanceof IMarker) {
+ // EditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, null);
+ IMarker marker = (IMarker)obj;
+ EObject eobj = MarkerUtils.getEObjectOfMarker(marker);
+ if(eobj instanceof Element) {
+ TraceActionSelection tad = new TraceActionSelection(new Shell(), (IMarker)obj, (Element)eobj);
+ tad.open();
+ if(tad.getReturnCode() == IDialogConstants.OK_ID) {
+ Object[] result = tad.getResult();
+ int traceAction = (Integer)result[0];
+ String traceMechanism = (String)result[1];
+ try {
+ marker.setAttribute(TracepointConstants.traceAction, traceAction);
+ marker.setAttribute(TracepointConstants.traceMechanism, traceMechanism);
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+ }
+
+ };
+ actionTraceSelect.setText("trace action");
+ actionTraceSelect.setToolTipText("Select trace action");
+ actionTraceSelect.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+ }
+
+ protected void hookDoubleClickAction() {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ doubleClickAction.run();
+ }
+ });
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ // TODO: function not used currently
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ IStructuredSelection sSelection = null;
+ if(selection instanceof IStructuredSelection) {
+ sSelection = (IStructuredSelection)selection;
+ }
+
+ // exclude case of an empty selection which is not a Tree selection, since changing views provokes an
+ // empty selection (selection gets lost, although same element remains selected)
+ if((selection != null) && (sSelection != null) && sSelection.isEmpty()) {
+ return;
+ }
+ currentElement = null;
+
+ // No available selection: switch to default panel
+ if((sSelection == null) || (sSelection.size() != 1)) {
+ switchUI();
+ return;
+ }
+
+ // Retrieve selected object
+ Object currentObject = sSelection.getFirstElement();
+ // If the object is an edit part, try to get semantic bridge
+ if(currentObject instanceof GraphicalEditPart) {
+ GraphicalEditPart editPart = (GraphicalEditPart)currentObject;
+ if(editPart.getModel() instanceof View) {
+ View view = (View)editPart.getModel();
+ if(view.getElement() instanceof Element) {
+ currentObject = view.getElement();
+ }
+ }
+ } else if(currentObject instanceof IAdaptable) {
+ // modisco ModelElementItem supports IAdaptable (cleaner than cast / dependency with modisco)
+ currentObject = ((IAdaptable)currentObject).getAdapter(EObject.class);
+ }
+
+ if(currentObject instanceof Element) {
+ currentElement = (Element)currentObject;
+ // switchUI();
+ }
+ }
+
+ protected Element currentElement;
+}

Back to the top