diff options
author | aradermache | 2013-01-28 13:58:14 +0000 |
---|---|---|
committer | aradermache | 2013-01-28 13:58:14 +0000 |
commit | 78330fa2c9677294e349a9d2bda216c47c5c0107 (patch) | |
tree | 289eee613b2da12584f27e3c31f2bc54323af3fb /incoming | |
parent | d2cd7b77108ab183d8a16a31ca521d7285f065cf (diff) | |
download | org.eclipse.papyrus-78330fa2c9677294e349a9d2bda216c47c5c0107.tar.gz org.eclipse.papyrus-78330fa2c9677294e349a9d2bda216c47c5c0107.tar.xz org.eclipse.papyrus-78330fa2c9677294e349a9d2bda216c47c5c0107.zip |
Remove obsolete plugins (are now part of extraplugins/qompass-designer)
Diffstat (limited to 'incoming')
51 files changed, 0 insertions, 3177 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/.classpath b/incoming/org.eclipse.papyrus.infra.services.tracepoints/.classpath deleted file mode 100644 index 9d5026e8ffd..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/.project b/incoming/org.eclipse.papyrus.infra.services.tracepoints/.project deleted file mode 100644 index 07350fea43f..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.papyrus.infra.services.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/incoming/org.eclipse.papyrus.infra.services.tracepoints/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.services.tracepoints/META-INF/MANIFEST.MF deleted file mode 100644 index 158bdc2362c..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf;bundle-version="2.6.0",
- org.eclipse.emf.ecore;bundle-version="2.6.1",
- org.eclipse.core.resources;bundle-version="3.6.0",
- org.apache.commons.lang;bundle-version="2.3.0",
- org.eclipse.emf.edit.ui;bundle-version="2.6.0",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.0.100",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.services.decoration;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
- org.eclipse.gef;bundle-version="3.8.1",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.uml2.uml;bundle-version="4.0.0"
-Export-Package: org.eclipse.papyrus.infra.services.tracepoints,
- org.eclipse.papyrus.infra.services.tracepoints.commands,
- org.eclipse.papyrus.infra.services.tracepoints.preferences
-Bundle-Vendor: %pluginProvider
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.9.0.qualifier
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.services.tracepoints.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.infra.services.tracepoints;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Localization: plugin
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/about.html b/incoming/org.eclipse.papyrus.infra.services.tracepoints/about.html deleted file mode 100644 index 209103075a7..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!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 ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/incoming/org.eclipse.papyrus.infra.services.tracepoints/build.properties b/incoming/org.eclipse.papyrus.infra.services.tracepoints/build.properties deleted file mode 100644 index 0b6402711a2..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -#
-#Mon Sep 12 09:30:24 CEST 2011
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- plugin.xml,\
- icons/
-output..=bin/
-src.includes = about.html
-source..=src/
-bin..=bin/
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_16x16.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_16x16.gif Binary files differdeleted file mode 100644 index a831fe72782..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_16x16.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_9x9.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_9x9.gif Binary files differdeleted file mode 100644 index 3678b09c6bf..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_9x9.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp.gif Binary files differdeleted file mode 100644 index 173661c5df7..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp_disabled.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp_disabled.gif Binary files differdeleted file mode 100644 index 5ea466bcb2a..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkp_grp_disabled.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_16x16.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_16x16.gif Binary files differdeleted file mode 100644 index 74b26c31a4d..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_16x16.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_9x9.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_9x9.gif Binary files differdeleted file mode 100644 index d6d8d31b06f..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/brkpd_9x9.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/debug.gif b/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/debug.gif Binary files differdeleted file mode 100644 index d90a29fead8..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/icons/etool16/debug.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.properties b/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.properties deleted file mode 100644 index ea04e256463..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -###############################################################################
-# Copyright (c) 2010 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 Validation Integration (Incubation)
-pluginProvider=Eclipse Modeling Project
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.xml b/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.xml deleted file mode 100644 index c366e3e572a..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/plugin.xml +++ /dev/null @@ -1,167 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> - -<plugin> - <extension-point id="traceMechanism" name="traceMechanism" schema="schema/traceMechanism.exsd"/> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup"> - <menu - icon="icons/etool16/debug.gif" - id="org.eclipse.papyrus.views.modelexplorer.popup.tracing" - label="Tracing"> - </menu> - </menuContribution> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popup.tracing"> - <command - commandId="org.eclipse.papyrus.tracepoints.toggletracepoint" - icon="icons/etool16/brkp_16x16.gif" - id="org.eclipse.papyrus.tracepoints.toggletracepoint" - label="Toggle tracepoint"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.toggletracepointactivation" - icon="icons/etool16/brkpd_16x16.gif" - id="org.eclipse.papyrus.tracepoints.toggletracepointactivation" - label="Toggle tracepoint activation"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.togglebreakpoint" - icon="icons/etool16/brkp_16x16.gif" - id="org.eclipse.papyrus.tracepoints.togglebreakpoint" - label="Toggle breakpoint"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.togglebreakpointactivation" - icon="icons/etool16/brkpd_16x16.gif" - id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation" - label="Toggle breakpoint activation"> - </command> - </menuContribution> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=filtersMenu"> - <menu - icon="icons/etool16/debug.gif" - id="org.eclipse.papyrus.views.gmf.popup.tracing" - label="Tracing"> - </menu> - </menuContribution> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.papyrus.views.gmf.popup.tracing"> - <command - commandId="org.eclipse.papyrus.tracepoints.toggletracepoint" - icon="icons/etool16/brkp_16x16.gif" - id="org.eclipse.papyrus.tracepoints.toggletracepoint" - label="Toggle tracepoint"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.toggletracepointactivation" - icon="icons/etool16/brkpd_16x16.gif" - id="org.eclipse.papyrus.tracepoints.toggletracepointactivation" - label="Toggle tracepoint activation"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.togglebreakpoint" - icon="icons/etool16/brkp_16x16.gif" - id="org.eclipse.papyrus.tracepoints.togglebreakpoint" - label="Toggle breakpoint"> - </command> - <command - commandId="org.eclipse.papyrus.tracepoints.togglebreakpointactivation" - icon="icons/etool16/brkpd_16x16.gif" - id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation" - label="Toggle breakpoint activation"> - </command> - </menuContribution> - </extension> - <extension - point="org.eclipse.ui.commands"> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.infra.services.tracepoints.handler.ToggleTracepointHandler" - description="ToggleTracepoint" - id="org.eclipse.papyrus.tracepoints.toggletracepoint" - name="ToggleTracepoint"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.infra.services.tracepoints.handler.ToggleTracepointActivationHandler" - description="ToggleTracepointActivation" - id="org.eclipse.papyrus.tracepoints.toggletracepointactivation" - name="ToggleTracepointActivation"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.infra.services.tracepoints.handler.ToggleBreakpointHandler" - description="ToggleBreakpoint" - id="org.eclipse.papyrus.tracepoints.togglebreakpoint" - name="ToggleBreakpoint"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.infra.services.tracepoints.handler.ToggleBreakpointActivationHandler" - description="ToggleBreakpointActivation" - id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation" - name="ToggleBreakpointActivation"> - </command> - </extension> - <extension - point="org.eclipse.papyrus.infra.services.decoration.decorationSpecificFunctions"> - <client - class="org.eclipse.papyrus.infra.services.tracepoints.TraceFunctions" - decorationType="org.eclipse.papyrus.tporbpmarker"> - </client> - </extension> - <extension - id="org.eclipse.papyrus.tporbpmarker" - name="tracepoint or breakpoint marker" - point="org.eclipse.core.resources.markers"> - <super - type="org.eclipse.papyrus.modelmarker"> - </super> - <attribute - name="isActive"> - </attribute> - <attribute - name="isTracepoint"> - </attribute> - <persistent - value="true"> - </persistent> - </extension> - <extension - id="org.eclipse.papyrus.tpmarker" - name="tracepoint marker" - point="org.eclipse.core.resources.markers"> - <super - type="org.eclipse.papyrus.tporbpmarker"> - </super> - <attribute - name="traceAction"> - </attribute> - <attribute - name="traceMechanism"> - </attribute> - <persistent - value="true"> - </persistent> - </extension> - <extension - point="org.eclipse.ui.preferencePages"> - <page - category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" - class="org.eclipse.papyrus.infra.services.tracepoints.preferences.TPPreferencePage" - id="org.eclipse.papyrus.infra.services.tracepoints.preferences.TPPreferencePage_ID" - name="Tracepoint preferences"> - </page> - </extension> -</plugin> diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/schema/traceMechanism.exsd b/incoming/org.eclipse.papyrus.infra.services.tracepoints/schema/traceMechanism.exsd deleted file mode 100644 index ba8ed1aca6d..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/schema/traceMechanism.exsd +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.papyrus.infra.services.tracepoints" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.papyrus.infra.services.tracepoints" id="traceMechanism" name="traceMechanism"/> - </appinfo> - <documentation> - Possibility to add implementations of a trace mechanism - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <choice minOccurs="0" maxOccurs="unbounded"> - <element ref="client"/> - </choice> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="client"> - <complexType> - <attribute name="traceMechID" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/Activator.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/Activator.java deleted file mode 100644 index 9cba95d5b41..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/Activator.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -// TODO: Auto-generated Javadoc -/** - * The activator class controls the plug-in life cycle. - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - /** The Constant PLUGIN_ID. */ - public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.services.tracepoints"; //$NON-NLS-1$ - - // The shared instance - /** The plugin. */ - private static Activator plugin; - - /** The log service. */ - public static LogHelper log; - - /** - * The constructor. - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - /** - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - * - * @param context - * @throws Exception - */ - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - log = new LogHelper(plugin); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - /** - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - * - * @param context - * @throws Exception - */ - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - log = null; - super.stop(context); - } - - /** - * Returns the shared instance. - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/ITraceMechanism.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/ITraceMechanism.java deleted file mode 100644 index 0bfdb027b35..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/ITraceMechanism.java +++ /dev/null @@ -1,74 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - - -/** - * The trace mechanism itself is not specific for specific implementations such - * as instrumenting code generators. Thus, the following interface may be defined - * by extensions that provide an implementation of a trace point. - * The first operation gets a set of available trace implementations that are supplied - * by the extension (in conjunction with other mechanisms). - * This interface is used for mechanisms that have a way of implementing trace point - * - * @author ansgar - * - */ -public interface ITraceMechanism { - - /** - * @param eObj - * the element on which tracing is applied. It is passed, since the - * list of available trace mechanisms may depend on this object - * @return a list of IDs corresponding to available trace mechanisms - */ - EList<String> getTraceMechanismIDs(EObject eObj); - - /** - * Provide a description of the trace mechanism - * - * @param id - * the id of the trace mechanism - * @return its description - */ - String getTraceMechanismDescription(EObject eObj, String id); - - /** - * Apply the tracing. This usually means that an implementation specific - * mechanism will add additional information to the EObject, for instance - * in form of additional markings or stereotypes (there is no assumption - * how this is actually done). The idea is that these markings will be - * evaluated during code generation to produce the right result. - * - * @param id - * the ID of a trace mechanism - * @param element - * the element that should be trace - * @param traceOption - * an encoded trace option. e.g. that only the called operation - * should be trace and not the values of the passed parameters. - */ - boolean applyTraceMechanism(EObject eObj, String id, int traceOption); - - /** - * Configure the trace mechanisms for runtime, in particular evaluate activate/inactive - * tracepoint settings to obtain a suitable runtime configuration. - * - * @return - */ - boolean configureTraceMechanisms(); -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/MarkerUtils.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/MarkerUtils.java deleted file mode 100644 index 536728ff1ff..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/MarkerUtils.java +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - -import java.util.MissingResourceException; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.papyrus.infra.core.markers.MarkerConstants; - -/** - * Utilities for Markers (TODO: some of these are generic marker services (move to infra core markers) and not specific to tracepoints). - * - * @author ansgar - * - */ -public class MarkerUtils { - - public static URI getURI(IMarker marker) { - String uriOfMarkerStr = marker.getAttribute(MarkerConstants.uri, null); - if(uriOfMarkerStr != null) { - return URI.createURI(uriOfMarkerStr); - } - return null; - } - - /** - * return the EObject of a marker (provided that it is a marker with a URI) - * - * @param marker - * @return the associated EObject - */ - public static EObject getEObjectOfMarker(IMarker marker) { - return getEObjectOfMarker(resourceSet, marker); - } - - /** - * return the EObject of a marker (provided that it is a marker with a URI) - * - * @param pResourceSet - * : the resourceSet into which the model associated with the eObject should - * be loaded - * @param marker - * @return the associated EObject - */ - public static EObject getEObjectOfMarker(ResourceSet pResourceSet, IMarker marker) { - URI uriOfMarker = getURI(marker); - if(uriOfMarker != null) { - try { - pResourceSet.getResource(uriOfMarker.trimFragment(), true); - return pResourceSet.getEObject(uriOfMarker, true); - } catch (MissingResourceException e) { - System.err.println("Missing resource"); - } - } - return null; - } - - public static boolean isActive(IMarker marker) { - return marker.getAttribute(TracepointConstants.isActive, false); - } - - /** - * our own copy of resource set - * we do not use the Papyrus resourceSet, since every editor keeps his own copy of the resource set (which is probably - * quite bad) and thus no resourceSet would be available, if Papyrus is not open. - */ - public static ResourceSet resourceSet = new ResourceSetImpl(); -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceActions.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceActions.java deleted file mode 100644 index 12af32c3342..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceActions.java +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - - -public class TraceActions { - - public enum TraceScope { - clazz, - operation, - state, - activity, - }; - - // Trace actions for a class. Note that multiple elements may be selected for - // a given model element (tool takes care on computing a 2^index value that allows - // bitwise or - public enum TAClass { - Creation, - Destruction, - AllOperations, - AllPorts, - AllStates - // +(?) all properties/all operations - // +(all ports?) - // +all state changes? (hierarchical propagation?) - - }; - - public enum TAOperation { - OnlyCall, - ParameterValues, // here exclusive (parameter values and OnlyCall may not be selected at the same time) - }; - - public enum TAAttribute { - PropertyRead, - PropertyWrite; // write old and new value - }; - - public enum TAState { - StateEnter, // add incoming transition to trace? - StateLeave, // add outgoing transition to trace? - Transition // nothing (?) (triggers are known? - no, could be one out of many triggers) - }; - - public enum TAActivity { - activity // (i.e. call operation action) explicit choice of (named attribute?) - }; -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceFunctions.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceFunctions.java deleted file mode 100644 index a3dd23ecf32..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceFunctions.java +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.services.decoration.IDecorationSpecificFunctions; -import org.eclipse.papyrus.infra.services.decoration.util.Decoration.PreferedPosition; -import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration; - - -public class TraceFunctions implements IDecorationSpecificFunctions { - - public static final String activeBreakpoint16 = "icons/etool16/brkp_16x16.gif"; - - public static final String inActiveBreakpoint16 = "icons/etool16/brkpd_16x16.gif"; - - public static final String activeBreakpoint9 = "icons/etool16/brkp_9x9.gif"; - - public static final String inActiveBreakpoint9 = "icons/etool16/brkpd_9x9.gif"; - - - /** - * Return the image descriptor associated with a trace or breakpoint marker - */ - public ImageDescriptor getImageDescriptorForGE(IMarker marker) { - - org.eclipse.papyrus.infra.widgets.Activator widgetsActivator = - org.eclipse.papyrus.infra.widgets.Activator.getDefault(); - ImageDescriptor overlay = null; - boolean isActive = marker.getAttribute(TracepointConstants.isActive, false); - if(isActive) { - overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, activeBreakpoint16); - } - else { - overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, inActiveBreakpoint16); - } - - return overlay; - } - - /** - * Return the image descriptor associated with a trace or breakpoint marker - */ - public ImageDescriptor getImageDescriptorForME(IMarker marker) { - org.eclipse.papyrus.infra.widgets.Activator widgetsActivator = - org.eclipse.papyrus.infra.widgets.Activator.getDefault(); - ImageDescriptor overlay = null; - boolean isActive = marker.getAttribute(TracepointConstants.isActive, false); - if(isActive) { - overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, activeBreakpoint9); - } - else { - overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, inActiveBreakpoint9); - } - - return overlay; - } - - public PreferedPosition getPreferedPosition(IMarker marker) { - return PreferedPosition.SOUTH_EAST; - } - - public String getMessage(IMarker marker) { - boolean isActive = marker.getAttribute(TracepointConstants.isActive, false); - boolean isTracepoint = marker.getAttribute(TracepointConstants.isTracepoint, false); - return (isActive ? "active" : "inactive") + " " + - (isTracepoint ? "trace point" : "break point"); - } - - public int getPriority(IMarker marker) { - return 0; // all markers have same priority (and we should not have multiple markers on the same model element). - } - - public IPapyrusDecoration markerPropagation(EList<IPapyrusDecoration> childDecorations) { - return null; - } - - public MarkChildren supportsMarkerPropagation() { - return MarkChildren.NO; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceMechanism.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceMechanism.java deleted file mode 100644 index aeeefc610ec..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceMechanism.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; - - -/** - * Support for multiple trace mechanisms via the Eclipse extension mechanism - */ - -public class TraceMechanism { - - public static final String ITRACE_MECHANISM_ID = Activator.PLUGIN_ID + ".traceMechanism"; - - public static EList<ITraceMechanism> getTraceMechanisms() - { - EList<ITraceMechanism> mechanisms = new BasicEList<ITraceMechanism>(); - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] configElements = reg.getConfigurationElementsFor(ITRACE_MECHANISM_ID); - for(IConfigurationElement configElement : configElements) { - try { - // TODO: cache returned instance (avoid creating a new instance each time => more efficient, no need for static attributes) - final Object obj = configElement.createExecutableExtension("class"); - if(obj instanceof ITraceMechanism) { - mechanisms.add((ITraceMechanism)obj); - } - } catch (CoreException exception) { - exception.printStackTrace(); - } - } - return mechanisms; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceState.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceState.java deleted file mode 100644 index 275d277cd68..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TraceState.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - - -public class TraceState { - - public static boolean skipAllTracepoints = false; -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TracepointConstants.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TracepointConstants.java deleted file mode 100644 index f4d617c6e7c..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/TracepointConstants.java +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints; - - - -public class TracepointConstants { - - /** - * The id of the marker used for tracepoints and breakpoints - */ - public static final String tpOrbpMarker = "org.eclipse.papyrus.tporbpmarker"; - - public static final String isActive = "isActive"; - - public static final String isTracepoint = "isTracepoint"; - - public static final String traceAction = "traceAction"; - - public static final String traceMechanism = "traceMechanism"; -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/AbstractTracepointCommand.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/AbstractTracepointCommand.java deleted file mode 100644 index 3da1319bcd9..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/AbstractTracepointCommand.java +++ /dev/null @@ -1,167 +0,0 @@ -/***************************************************************************** - * 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 Radermarcher (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.services.tracepoints.commands; - -import java.util.Collections; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.core.markers.MarkerConstants; -import org.eclipse.papyrus.infra.services.tracepoints.Activator; -import org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.TraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.TracepointConstants; -import org.eclipse.papyrus.infra.services.tracepoints.preferences.TPPreferenceConstants; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.State; - -/** - * Action used for pasting either a model element or a shape (i.e. the model element represented - * by the shape). Delegates to PasteShapeOrElementCommand - * - * @author Ansgar Radermacher (CEA LIST) - */ -abstract public class AbstractTracepointCommand extends AbstractTransactionalCommand { - - protected TransactionalEditingDomain domain; - - protected EObject selectedElement; - - /** - * Creates a new ImportLibraryFromRepositoryCommand - * - * @param editingDomain - * editing domain that manages the changed objects - * @param runnable - * process that executes the modifications - * @param label - * the label of the command - * @param description - * description of the command - */ - - public AbstractTracepointCommand(String label, TransactionalEditingDomain domain, EObject selectedElement) { - super(domain, label, Collections.EMPTY_LIST); - this.domain = domain; - this.selectedElement = selectedElement; - } - - protected void updateResourceAndURI() { - resource = selectedElement.eResource(); - uri = resource.getURI() + "#" + resource.getURIFragment(selectedElement); - iresource = WorkspaceSynchronizer.getFile(selectedElement.eResource()); - } - - protected IMarker findMarker(String type) { - - if(iresource != null) { - try { - for(IMarker marker : iresource.findMarkers(type, false, IResource.DEPTH_INFINITE)) { - String markerURI = marker.getAttribute(MarkerConstants.uri, ""); - if((markerURI != null) && markerURI.equals(uri)) { - return marker; - } - } - } catch (CoreException ce) { - } - } - return null; - } - - protected void toggleMarker() { - try { - if(iresource != null) { - IMarker marker = findMarker(TracepointConstants.tpOrbpMarker); - if(marker == null) { // marker does not exist => create - marker = iresource.createMarker(TracepointConstants.tpOrbpMarker); - marker.setAttribute(MarkerConstants.uri, uri); - marker.setAttribute(TracepointConstants.isActive, true); - } - else { - // marker exists => delete - marker.delete(); - } - - } - } catch (CoreException ce) { - } - } - - protected void toggleMarkerActivation() { - try { - if(iresource != null) { - IMarker marker = findMarker(TracepointConstants.tpOrbpMarker); - if(marker == null) { // marker does not exist => create - marker = iresource.createMarker(TracepointConstants.tpOrbpMarker); - marker.setAttribute(MarkerConstants.uri, uri); - marker.setAttribute(TracepointConstants.isActive, true); - - // apply trace mechanism according to default in preferences - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - String id = null; - if(selectedElement instanceof Operation) { - id = store.getDefaultString(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_OP); - } - else if(selectedElement instanceof Port) { - id = store.getDefaultString(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_OP); - } - else if(selectedElement instanceof State) { - id = store.getDefaultString(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_SM); - } - if(id != null) { - EList<ITraceMechanism> mechanisms = TraceMechanism.getTraceMechanisms(); - for(ITraceMechanism mechanism : mechanisms) { - for(String providedID : mechanism.getTraceMechanismIDs(selectedElement)) { - if(id.equals(providedID)) { - mechanism.applyTraceMechanism(selectedElement, id, 0); - } - } - } - } - } - else { - // marker exists => change activation status - boolean isSet = marker.getAttribute(TracepointConstants.isActive, false); - marker.setAttribute(TracepointConstants.isActive, !isSet); - } - } - } catch (CoreException ce) { - System.err.println(ce); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public boolean canExecute() { - return (selectedElement != null); - } - - protected Resource resource; - - protected IResource iresource; - - protected String uri; -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointActivationCommand.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointActivationCommand.java deleted file mode 100644 index aac91107a20..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointActivationCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; - - -public class ToggleBreakpointActivationCommand extends AbstractTracepointCommand { - - public ToggleBreakpointActivationCommand(EObject selectedElement) { - super("Toggle Breakpoint activation", TransactionUtil.getEditingDomain(selectedElement), selectedElement); - } - - /** - * {@inheritDoc} - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - updateResourceAndURI(); - toggleMarkerActivation(); - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointCommand.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointCommand.java deleted file mode 100644 index 1ed763a155b..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleBreakpointCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; - - -public class ToggleBreakpointCommand extends AbstractTracepointCommand { - - public ToggleBreakpointCommand(EObject selectedElement) { - super("Toggle Breakpoint", TransactionUtil.getEditingDomain(selectedElement), selectedElement); - } - - /** - * {@inheritDoc} - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - updateResourceAndURI(); - toggleMarker(); - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointActivationCommand.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointActivationCommand.java deleted file mode 100644 index 0b636e0b2cc..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointActivationCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; - - -public class ToggleTracepointActivationCommand extends AbstractTracepointCommand { - - public ToggleTracepointActivationCommand(EObject selectedElement) { - super("Toggle tracepoint activation", TransactionUtil.getEditingDomain(selectedElement), selectedElement); - } - - /** - * {@inheritDoc} - */ - @Override - public CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - updateResourceAndURI(); - toggleMarkerActivation(); - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointCommand.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointCommand.java deleted file mode 100644 index 69694d4c6ca..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/commands/ToggleTracepointCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; - - -public class ToggleTracepointCommand extends AbstractTracepointCommand { - - public static final String tracepointMarkerID = "org.eclipse.papyrus.markers.tracepoint"; - - public static final String modelrefMarkerID = "org.eclipse.papyrus.markers.modelref"; - - public ToggleTracepointCommand(EObject selectedElement) { - super("Toggle tracepoint", TransactionUtil.getEditingDomain(selectedElement), selectedElement); - } - - /** - * {@inheritDoc} - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - updateResourceAndURI(); - toggleMarker(); - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/AbstractCommandHandler.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/AbstractCommandHandler.java deleted file mode 100644 index eca98a6a377..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/AbstractCommandHandler.java +++ /dev/null @@ -1,165 +0,0 @@ -/*****************************************************************************
- * 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.infra.services.tracepoints.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.infra.services.tracepoints.Activator;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <pre>
- *
- * This abstract command handler manages:
- * - current selection in order to build a list of the selected {@link EObject}
- * - execute the command (returned by children) in Papyrus {@link TransactionalEditingDomain}
- * - calculate the command enablement and visibility regarding the command executability
- * (the command is now shown in menu if not executable).
- *
- * </pre>
- */
-public abstract class AbstractCommandHandler extends AbstractHandler {
-
- /**
- * <pre>
- *
- * Returns the command to execute (to be implemented
- * in children implementing this class)
- *
- * @return the command to execute
- *
- * </pre>
- */
- protected abstract Command getCommand();
-
- /**
- * <pre>
- * Get the selected element, the first selected element if several are selected or null
- * if no selection or the selection is not an {@link EObject}.
- *
- * @return selected {@link EObject} or null
- * </pre>
- *
- */
- protected EObject getSelectedElement() {
- EObject eObject = null;
- Object selection = null;
-
- // Get current selection
- selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
-
- // Get first element if the selection is an IStructuredSelection
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- selection = structuredSelection.getFirstElement();
- }
-
- // Treat non-null selected object (try to adapt and return EObject)
- if(selection != null) {
- Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(selection);
- if(businessObject instanceof EObject) {
- eObject = (EObject)businessObject;
- }
- }
- return eObject;
- }
-
- /**
- * <pre>
- * Parse current selection and extract the list of {@link EObject} from
- * this selection.
- *
- * This also tries to adapt selected element into {@link EObject}
- * (for example to get the {@link EObject} from a selection in the ModelExplorer).
- *
- * @return a list of currently selected {@link EObject}
- * </pre>
- *
- */
- protected List<EObject> getSelectedElements() {
-
- List<EObject> selectedEObjects = new ArrayList<EObject>();
-
- // Parse current selection
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- for(Object current : structuredSelection.toArray()) {
- // Adapt current selection to EObject
- if(current instanceof IAdaptable) {
- selectedEObjects.add((EObject)((IAdaptable)current).getAdapter(EObject.class));
- }
- }
- } else { // Not a IStructuredSelection
- if(selection != null) {
- // Adapt current selection to EObject
- if(selection instanceof IAdaptable) {
- selectedEObjects.add((EObject)((IAdaptable)selection).getAdapter(EObject.class));
- }
- }
- }
-
- return selectedEObjects;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return null
- * @throws ExecutionException
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- try {
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
- util.getTransactionalEditingDomain().getCommandStack().execute(getCommand());
- } catch (ServiceException e) {
- Activator.log.error("Unexpected error while executing command.", e); //$NON-NLS-1$
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isEnabled() {
- return getCommand().canExecute();
- }
-
- /**
- *
- * @return true (visible) when the command can be executed.
- */
- public boolean isVisible() {
- return getCommand().canExecute();
- }
-
-
-}
diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointActivationHandler.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointActivationHandler.java deleted file mode 100644 index c87f90782d8..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointActivationHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.handler; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.services.tracepoints.commands.ToggleBreakpointActivationCommand; - -/** - * Action used for pasting either a model element or a shape (i.e. the model element represented - * by the shape). Delegates to PasteShapeOrElementCommand - * - * @author Ansgar Radermacher (CEA LIST) - */ -public class ToggleBreakpointActivationHandler extends AbstractCommandHandler { - - @Override - protected Command getCommand() { - // not useful to cache command, since selected element may change - return new GMFtoEMFCommandWrapper(new ToggleBreakpointActivationCommand(getSelectedElement())); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointHandler.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointHandler.java deleted file mode 100644 index d07e33c77e7..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleBreakpointHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.handler; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.services.tracepoints.commands.ToggleBreakpointCommand; - -/** - * Action used for pasting either a model element or a shape (i.e. the model element represented - * by the shape). Delegates to PasteShapeOrElementCommand - * - * @author Ansgar Radermacher (CEA LIST) - */ -public class ToggleBreakpointHandler extends AbstractCommandHandler { - - @Override - protected Command getCommand() { - // not useful to cache command, since selected element may change - return new GMFtoEMFCommandWrapper(new ToggleBreakpointCommand(getSelectedElement())); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointActivationHandler.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointActivationHandler.java deleted file mode 100644 index fa8bae52105..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointActivationHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.handler; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.services.tracepoints.commands.ToggleTracepointActivationCommand; - -/** - * Action used for pasting either a model element or a shape (i.e. the model element represented - * by the shape). Delegates to PasteShapeOrElementCommand - * - * @author Ansgar Radermacher (CEA LIST) - */ -public class ToggleTracepointActivationHandler extends AbstractCommandHandler { - - @Override - protected Command getCommand() { - // not useful to cache command, since selected element may change - return new GMFtoEMFCommandWrapper(new ToggleTracepointActivationCommand(getSelectedElement())); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointHandler.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointHandler.java deleted file mode 100644 index 12589148ec0..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/handler/ToggleTracepointHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.handler; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.services.tracepoints.commands.ToggleTracepointCommand; - -/** - * Action used for pasting either a model element or a shape (i.e. the model element represented - * by the shape). Delegates to PasteShapeOrElementCommand - * - * @author Ansgar Radermacher (CEA LIST) - */ -public class ToggleTracepointHandler extends AbstractCommandHandler { - - @Override - protected Command getCommand() { - // not useful to cache command, since selected element may change - return new GMFtoEMFCommandWrapper(new ToggleTracepointCommand(getSelectedElement())); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MUFromXtext.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MUFromXtext.java deleted file mode 100644 index 6532160758b..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MUFromXtext.java +++ /dev/null @@ -1,234 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 itemis AG (http://www.itemis.eu) 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 - * - *******************************************************************************/ -package org.eclipse.papyrus.infra.services.tracepoints.preferences; - -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; - - -/** - * @author Dennis Hübner - Initial contribution and API - * - */ -public abstract class MUFromXtext extends FieldEditor { - - private Composite checkBoxBox; - - private final boolean useGroup; - - protected final String[][] labelsAndValues; - - private final int numColumns; - - private Button[] checkBoxButtons; - - protected String result; - - // better name: CheckBoxGroupFieldEditor - public MUFromXtext(String name, String labeltext, int numColumns, String[][] labelsAndValues, - Composite fieldEditorParent, boolean useGroup) { - init(name, labeltext); - this.numColumns = numColumns; - this.labelsAndValues = labelsAndValues.clone(); - this.useGroup = useGroup; - createControl(fieldEditorParent); - } - - /** - * @param settings - * String[][fieldName,fieldValue,isChecked] - * @return value as String - */ - protected abstract String calculateResult(String[][] settings); - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int) - */ - @Override - protected void adjustForNumColumns(int numColumns) { - Control control = getLabelControl(); - if(control != null) { - ((GridData)control.getLayoutData()).horizontalSpan = numColumns; - } - ((GridData)checkBoxBox.getLayoutData()).horizontalSpan = numColumns; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt - * .widgets.Composite, int) - */ - @Override - protected void doFillIntoGrid(Composite parent, int numColumns) { - if(useGroup) { - Control control = getCheckBoxControl(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - control.setLayoutData(gd); - } - else { - Control control = getLabelControl(parent); - GridData gd = new GridData(); - gd.horizontalSpan = numColumns; - control.setLayoutData(gd); - control = getCheckBoxControl(parent); - gd = new GridData(); - gd.horizontalSpan = numColumns; - control.setLayoutData(gd); - } - } - - private Control getCheckBoxControl(Composite parent) { - if(checkBoxBox == null) { - Font font = parent.getFont(); - if(useGroup) { - Group group = new Group(parent, SWT.NONE); - group.setFont(font); - String text = getLabelText(); - if(text != null) { - group.setText(text); - } - checkBoxBox = group; - GridLayout layout = new GridLayout(); - layout.horizontalSpacing = HORIZONTAL_GAP; - layout.numColumns = numColumns; - checkBoxBox.setLayout(layout); - } - else { - checkBoxBox = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.horizontalSpacing = HORIZONTAL_GAP; - layout.numColumns = numColumns; - checkBoxBox.setLayout(layout); - checkBoxBox.setFont(font); - } - - checkBoxButtons = new Button[labelsAndValues.length]; - for(int i = 0; i < labelsAndValues.length; i++) { - Button checkBox = new Button(checkBoxBox, SWT.CHECK | SWT.LEFT); - checkBoxButtons[i] = checkBox; - String[] labelAndValue = labelsAndValues[i]; - checkBox.setText(labelAndValue[0]); - checkBox.setData(labelAndValue[1]); - checkBox.setFont(font); - checkBox.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent event) { - setPresentsDefaultValue(false); - String oldResult = result; - result = gatherSettings(); - fireValueChanged(VALUE, oldResult, result); - } - }); - } - checkBoxBox.addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent event) { - checkBoxBox = null; - checkBoxButtons = null; - } - }); - } - else { - checkParent(checkBoxBox, parent); - } - return checkBoxBox; - } - - private String gatherSettings() { - String[][] settings = new String[checkBoxButtons.length][3]; - for(int i = 0; i < checkBoxButtons.length; i++) { - Button currentCheckBox = checkBoxButtons[i]; - String name = currentCheckBox.getText(); - String value = (String)currentCheckBox.getData(); - String checked = String.valueOf(currentCheckBox.getSelection()); - settings[i] = new String[]{ name, value, checked }; - } - return calculateResult(settings); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditor#doLoad() - */ - @Override - protected void doLoad() { - setupControls(getPreferenceStore().getString(getPreferenceName())); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault() - */ - @Override - protected void doLoadDefault() { - setupControls(getPreferenceStore().getDefaultString(getPreferenceName())); - } - - private void setupControls(String valueToSet) { - for(int i = 0; i < checkBoxButtons.length; i++) { - Button currentCheckBox = checkBoxButtons[i]; - currentCheckBox.setSelection(isSelected(currentCheckBox.getText(), valueToSet)); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditor#doStore() - */ - @Override - protected void doStore() { - if(result == null) { - return; - } - getPreferenceStore().setValue(getPreferenceName(), result); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls() - */ - @Override - public int getNumberOfControls() { - return 1; - } - - @Override - public void setEnabled(boolean enabled, Composite parent) { - if(!useGroup) { - super.setEnabled(enabled, parent); - } - for(Button button : checkBoxButtons) { - button.setEnabled(enabled); - } - } - - abstract protected boolean isSelected(String fieldName, String valueToSet); -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MultipleChoiceFieldEditor.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MultipleChoiceFieldEditor.java deleted file mode 100644 index a0161946545..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/MultipleChoiceFieldEditor.java +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.preferences; - -import org.eclipse.swt.widgets.Composite; - - -public class MultipleChoiceFieldEditor extends MUFromXtext { - - /* - * public MultipleChoiceFieldEditor(String name, String labelText, Composite parent) { - * super(name, labelText, parent); - * } - */ - - public MultipleChoiceFieldEditor(String name, String labeltext, int numColumns, String[][] labelsAndValues, Composite fieldEditorParent, boolean useGroup) { - super(name, labeltext, numColumns, labelsAndValues, fieldEditorParent, useGroup); - // TODO Auto-generated constructor stub - } - - @Override - protected String calculateResult(String[][] settings) { - int traceActionValue = 0; - int index = 0; - for(String setting[] : settings) { - // [0] = name, [1] = value [2] = checked - if(setting[2].equals("true")) { - traceActionValue += 1 << index; - } - index++; - }; - /* - * String traceMechanism = ""; - * for(Object tableElement : fTraceImplementations.getCheckedElements()) { - * traceMechanism = (String)tableElement; - * }; - * - * Object[] result = new Object[]{ - * traceActionValue, - * traceMechanism - * }; - */ - return String.valueOf(traceActionValue); - } - - @Override - protected boolean isSelected(String fieldName, String valueToSet) { - try { - int value = new Integer(valueToSet); - int index = 0; - for(String setting[] : labelsAndValues) { - // [0] = name, [1] = value [2] = checked - if(setting[0].equals(fieldName)) { - return (value & (1 << index)) > 0; - } - index++; - }; - } catch (NumberFormatException e) { - } - return false; - } - -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceConstants.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceConstants.java deleted file mode 100644 index 2a0845bb849..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceConstants.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.preferences; - -/** - * Constant definitions for plug-in preferences - */ -public class TPPreferenceConstants { - - /** - * The trace mechanism that should be used by default - */ - public static final String P_TRACE_IMPLEMENTATION_PORT = "papyrus.trace.implementation.port"; - - /** - * The trace mechanism that should be used by default - */ - public static final String P_TRACE_IMPLEMENTATION_OP = "papyrus.trace.implementation.op"; - - /** - * The trace mechanism that should be used by default - */ - public static final String P_TRACE_IMPLEMENTATION_SM = "papyrus.trace.implementation.sm"; - - - /** - * Options for trace implementation via state machines - */ - public static final String P_TRACE_OPTION_CLASS = "papyrus.trace.option.class"; - - /** - * Options for trace implementation for operations - */ - public static final String P_TRACE_OPTION_STATE = "papyrus.trace.option.state"; - - /** - * Options for trace implementation via state machines - */ - public static final String P_TRACE_OPTION_OP = "papyrus.trace.option.op"; -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceInitializer.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceInitializer.java deleted file mode 100644 index 96112c096cd..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferenceInitializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.services.tracepoints.Activator; -import org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.TraceMechanism; - -/** - * Class used to initialize default preference values. - */ -public class TPPreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - EList<ITraceMechanism> mechanisms = TraceMechanism.getTraceMechanisms(); - String mechanismID = ""; - if(mechanisms.size() > 0) { - ITraceMechanism mechanism = mechanisms.get(0); - // TODO: function need to support null object - EList<String> mechanismIDs = mechanism.getTraceMechanismIDs(null); - if(mechanismIDs.size() > 0) { - mechanismID = mechanismIDs.get(0); - } - } - store.setDefault(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_PORT, mechanismID); - store.setDefault(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_OP, mechanismID); - store.setDefault(TPPreferenceConstants.P_TRACE_IMPLEMENTATION_SM, mechanismID); - - store.setDefault(TPPreferenceConstants.P_TRACE_OPTION_CLASS, 0); - store.setDefault(TPPreferenceConstants.P_TRACE_OPTION_STATE, 0); - store.setDefault(TPPreferenceConstants.P_TRACE_OPTION_OP, 0); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferencePage.java b/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferencePage.java deleted file mode 100644 index 726aaa91b7e..00000000000 --- a/incoming/org.eclipse.papyrus.infra.services.tracepoints/src/org/eclipse/papyrus/infra/services/tracepoints/preferences/TPPreferencePage.java +++ /dev/null @@ -1,124 +0,0 @@ -/***************************************************************************** - * 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.infra.services.tracepoints.preferences; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.preference.ComboFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAClass; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAOperation; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAState; -import org.eclipse.papyrus.infra.services.tracepoints.TraceMechanism; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * This class represents the TracePoint preference page - * <p> - * This page is used to modify preferences only. They are stored in the preference store that belongs to the main plug-in class. That way, preferences - * can be accessed directly via the preference store. - */ - -public class TPPreferencePage - extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - - public TPPreferencePage() { - super(GRID); - setPreferenceStore(org.eclipse.papyrus.infra.services.tracepoints.Activator.getDefault().getPreferenceStore()); - setDescription("Trace options"); - } - - /** - * Creates the field editors. Field editors are abstractions of - * the common GUI blocks needed to manipulate various types - * of preferences. Each field editor knows how to save and - * restore itself. - */ - public void createFieldEditors() { - EList<ITraceMechanism> mechanisms = TraceMechanism.getTraceMechanisms(); - int elements = 0; - int i; - for(ITraceMechanism mechanism : mechanisms) { - // TODO: function need to support null object - EList<String> mechanismIDs = mechanism.getTraceMechanismIDs(null); - elements += mechanismIDs.size(); - } - String[][] mechList = new String[elements][2]; - elements = 0; - for(ITraceMechanism mechanism : mechanisms) { - // TODO: function need to support null object - EList<String> mechanismIDs = mechanism.getTraceMechanismIDs(null); - for(String id : mechanismIDs) { - mechList[elements][1] = id; - mechList[elements][0] = mechanism.getTraceMechanismDescription(null, id); - elements++; - } - } - - String[][] taClassOptions = new String[TAClass.values().length][2]; - String[][] taStateOptions = new String[TAState.values().length][2]; - i = 0; - for(TAClass tLiteral : TAClass.values()) { - taClassOptions[i][1] = tLiteral.name(); - taClassOptions[i][0] = tLiteral.name(); - i++; - } - i = 0; - for(TAState tLiteral : TAState.values()) { - taStateOptions[i][1] = tLiteral.name(); - taStateOptions[i][0] = tLiteral.name(); - i++; - } - String[][] taOperationOptions = new String[TAOperation.values().length][2]; - i = 0; - for(TAOperation tLiteral : TAOperation.values()) { - taOperationOptions[i][1] = tLiteral.name(); - taOperationOptions[i][0] = tLiteral.name(); - i++; - } - - addField(new MultipleChoiceFieldEditor(TPPreferenceConstants.P_TRACE_OPTION_CLASS, "Class options", 3, taClassOptions, getFieldEditorParent(), true)); - - addField(new MultipleChoiceFieldEditor(TPPreferenceConstants.P_TRACE_OPTION_STATE, "State options", 3, taStateOptions, getFieldEditorParent(), true)); - - addField(new RadioGroupFieldEditor( - TPPreferenceConstants.P_TRACE_OPTION_OP, - "Operations options", 3, taOperationOptions, getFieldEditorParent(), true)); - - - addField(new ComboFieldEditor( - TPPreferenceConstants.P_TRACE_IMPLEMENTATION_PORT, - "Trace Mechanism for ports", mechList, getFieldEditorParent())); - - addField(new ComboFieldEditor( - TPPreferenceConstants.P_TRACE_IMPLEMENTATION_OP, - "Trace Mechanism for operations (+construction/destruction)", mechList, getFieldEditorParent())); - - addField(new ComboFieldEditor( - TPPreferenceConstants.P_TRACE_IMPLEMENTATION_SM, - "Trace Mechanism for state machines", mechList, getFieldEditorParent())); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - } -} diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/.classpath b/incoming/org.eclipse.papyrus.views.tracepoints/.classpath deleted file mode 100644 index ad32c83a788..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?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/incoming/org.eclipse.papyrus.views.tracepoints/.project b/incoming/org.eclipse.papyrus.views.tracepoints/.project deleted file mode 100644 index 657d2f7a65c..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?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/incoming/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF deleted file mode 100644 index 7d182e8ee24..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Tracepoints -Bundle-SymbolicName: org.eclipse.papyrus.views.tracepoints; singleton:=true -Bundle-Version: 1.0.0.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.0", - 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.0", - org.eclipse.papyrus.infra.widgets;bundle-version="0.9.0", - 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", - org.eclipse.ui.ide;bundle-version="3.8.100" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/build.properties b/incoming/org.eclipse.papyrus.views.tracepoints/build.properties deleted file mode 100644 index caaec514ba8..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - contexts.xml diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/contexts.xml b/incoming/org.eclipse.papyrus.views.tracepoints/contexts.xml deleted file mode 100644 index b3b18ae3d68..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/contexts.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?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/incoming/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif b/incoming/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif Binary files differdeleted file mode 100644 index f529c5a4225..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/icons/breakpoint_view.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif b/incoming/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif Binary files differdeleted file mode 100644 index cf62b63ae3e..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/icons/gotoobj_tsk.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif b/incoming/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif Binary files differdeleted file mode 100644 index c1751c3ff4f..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/icons/skip_brkp.gif +++ /dev/null diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/plugin.xml b/incoming/org.eclipse.papyrus.views.tracepoints/plugin.xml deleted file mode 100644 index 43cfbf7e29e..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/plugin.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java b/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java deleted file mode 100644 index e12d420e77b..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/Activator.java +++ /dev/null @@ -1,78 +0,0 @@ -/***************************************************************************** - * 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/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/dialogs/TraceActionSelection.java b/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/dialogs/TraceActionSelection.java deleted file mode 100644 index 45914dbdba9..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/dialogs/TraceActionSelection.java +++ /dev/null @@ -1,343 +0,0 @@ -/***************************************************************************** - * 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.dialogs; - -import java.util.Arrays; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -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.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.services.tracepoints.ITraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAAttribute; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAClass; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAOperation; -import org.eclipse.papyrus.infra.services.tracepoints.TraceActions.TAState; -import org.eclipse.papyrus.infra.services.tracepoints.TraceMechanism; -import org.eclipse.papyrus.infra.services.tracepoints.preferences.MultipleChoiceFieldEditor; -import org.eclipse.papyrus.infra.services.tracepoints.preferences.TPPreferenceConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.dialogs.SelectionStatusDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Property; - -public class TraceActionSelection extends SelectionStatusDialog { - - protected CheckboxTableViewer fTraceActions; - - protected CheckboxTableViewer fTraceImplementations; - - protected Text fDescription; - - /** - * The model element that has a trace marker - */ - private Element m_me; - - public TraceActionSelection(Shell parent, IMarker marker, Element me) { - super(parent); - m_me = me; - // int traceAction = marker.getAttribute(TracepointConstants.traceAction, 0); - } - - - /** - * @see SelectionStatusDialog#computeResult() - * need to return two values: trace action & mechanism - */ - protected void computeResult() { - // nothing to do - int traceActionValue = 0; - for(Object tableElement : fTraceActions.getCheckedElements()) { - int index = ((Enum<?>)tableElement).ordinal(); - traceActionValue += 1 << index; - }; - String traceMechanism = ""; - for(Object tableElement : fTraceImplementations.getCheckedElements()) { - traceMechanism = (String)tableElement; - }; - - Object[] result = new Object[]{ - traceActionValue, - traceMechanism - }; - setResult(Arrays.asList(result)); - } - - class EnumLabelProvider extends LabelProvider implements ITableLabelProvider { - - public String getColumnText(Object obj, int index) { - if(obj instanceof Enum) { - return ((Enum<?>)obj).name(); - } - return obj.toString(); - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - } - - class TraceActionCP implements IStructuredContentProvider { - - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - Object items[] = null; - int i = 0; - if(m_me instanceof Class) { - items = new TAClass[TAClass.values().length]; - - for(TAClass tLiteral : TAClass.values()) { - items[i++] = tLiteral; - } - } - else if(m_me instanceof Operation) { - items = new TAOperation[TAOperation.values().length]; - for(TAOperation tLiteral : TAOperation.values()) { - items[i++] = tLiteral; - } - } - else if(m_me instanceof Property) { - items = new TraceActions.TAAttribute[TraceActions.TAAttribute.values().length]; - for(TAAttribute tLiteral : TAAttribute.values()) { - items[i++] = tLiteral; - } - } - return items; - } - } - - class TraceMechanismsCP implements IStructuredContentProvider { - - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - Object items[] = null; - // - // Implementations of a tracing mechanism are depending on the injection mechanism and (likely) on the - // programming language. Therefore, they are not part of this plugin shipped with Papyrus, but use an - // extension mechanism. - - EList<ITraceMechanism> mechanisms = TraceMechanism.getTraceMechanisms(); - if(mechanisms.size() == 0) { - items = new String[]{ "no plugins provide trace extension mechanism" }; - } - else { - EList<String> idList = new BasicEList<String>(); - for(ITraceMechanism mechanism : mechanisms) { - for(String id : mechanism.getTraceMechanismIDs(m_me)) { - idList.add(id); - } - } - items = idList.toArray(new String[0]); - } - return items; - } - } - - public Control createDialogArea(Composite parent) { - Composite contents = (Composite)super.createDialogArea(parent); - - Label label = new Label(contents, SWT.NONE); - label.setText("Select trace action for this element"); - - // need context dependent dialogs on options - // we may need more than one options (e.g. AllOperations + OperationsWithParameters + (begin/end or both?)) - // clean way: accumulate all options, distribute them automatically accordingly. Better (even if less efficient, if strings) - String[][] taClassOptions = new String[TAClass.values().length][2]; - String[][] taStateOptions = new String[TAState.values().length][2]; - int i; - i = 0; - for(TAClass tLiteral : TAClass.values()) { - taClassOptions[i][1] = tLiteral.name(); - taClassOptions[i][0] = tLiteral.name(); - i++; - } - i = 0; - for(TAState tLiteral : TAState.values()) { - taStateOptions[i][1] = tLiteral.name(); - taStateOptions[i][0] = tLiteral.name(); - i++; - } - String[][] taOperationOptions = new String[TAOperation.values().length][2]; - i = 0; - for(TAOperation tLiteral : TAOperation.values()) { - taOperationOptions[i][1] = tLiteral.name(); - taOperationOptions[i][0] = tLiteral.name(); - i++; - } - - new MultipleChoiceFieldEditor(TPPreferenceConstants.P_TRACE_OPTION_CLASS, "Class options", 3, taClassOptions, contents, true); - - fTraceActions = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - - fTraceActions.setContentProvider(new TraceActionCP()); - fTraceActions.setLabelProvider(new EnumLabelProvider()); - fTraceActions.setInput(this); - - // fTraceActions.setItems(items); - - fTraceActions.addCheckStateListener(new ICheckStateListener() { - - public void checkStateChanged(CheckStateChangedEvent event) { - Object element = event.getElement(); - boolean isChecked = event.getChecked(); - if(isChecked) { - Object traceCall = null; - Object traceCallWP = null; - - for(Object checkedElement : fTraceActions.getCheckedElements()) { - if(checkedElement == TAOperation.OnlyCall) { - traceCall = checkedElement; - } - if(checkedElement == TAOperation.ParameterValues) { - traceCallWP = checkedElement; - } - } - if((traceCall != null) && (traceCallWP != null)) { - // unset the element that was not checked by the event. - if(element == traceCall) { - fTraceActions.setChecked(traceCallWP, false); - } - else if(element == traceCallWP) { - fTraceActions.setChecked(traceCall, false); - } - } - } - } - }); - - - - // need additional item how the trace mechanism should be realized, i.e. available tracing mechanisms - fTraceImplementations = CheckboxTableViewer.newCheckList(parent, SWT.H_SCROLL | SWT.V_SCROLL); - - fTraceImplementations.setContentProvider(new TraceMechanismsCP()); - fTraceImplementations.setInput(this); - - fTraceImplementations.addCheckStateListener(new ICheckStateListener() { - - public void checkStateChanged(CheckStateChangedEvent event) { - Object element = event.getElement(); - boolean isChecked = event.getChecked(); - // assure radio button functionality - if(isChecked) { - for(Object checkedElement : fTraceImplementations.getCheckedElements()) { - if(checkedElement != element) { - fTraceImplementations.setChecked(checkedElement, false); - } - } - } - } - }); - - fTraceImplementations.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = event.getSelection(); - if(selection instanceof IStructuredSelection) { - Object first = ((IStructuredSelection)selection).getFirstElement(); - if(first instanceof String) { - EList<ITraceMechanism> mechanisms = TraceMechanism.getTraceMechanisms(); - boolean noDesc = true; - for(ITraceMechanism mechanism : mechanisms) { - String description = mechanism.getTraceMechanismDescription(m_me, (String)first); - if(description != null) { - fDescription.setText(description); - noDesc = false; - break; - } - } - if(noDesc) { - fDescription.setText("<not available>"); - } - } - } - } - }); - - fDescription = new Text(parent, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY); - - GridData span = new GridData(); - span.horizontalAlignment = GridData.FILL; - span.grabExcessHorizontalSpace = true; - span.grabExcessVerticalSpace = true; - span.verticalAlignment = GridData.FILL; - span.heightHint = 150; - - fTraceActions.getTable().setLayoutData(span); - fTraceImplementations.getTable().setLayoutData(span); - - GridData span2 = new GridData(); - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - span2.grabExcessVerticalSpace = true; - span2.verticalAlignment = GridData.FILL; - span2.heightHint = 80; - fDescription.setLayoutData(span2); - - // ruleGroup.setLayout(new RowLayout (SWT.VERTICAL)); - parent.setLayout(new GridLayout(1, false)); - // parent.setLayoutData(groupGridData); - return contents; - } - - // obtain name and explicit/implicit node Allocation - protected void setTextFromData(TreeItem ti) { - Object data = ti.getData(); - if(data instanceof InstanceSpecification) { - // ti.setText(new String[]{ name, nodeName, "[" + list + "]" }); - } - } - - protected void refreshTree(TreeItem ti) { - setTextFromData(ti); - for(TreeItem subItem : ti.getItems()) { - refreshTree(subItem); - } - } -} diff --git a/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java b/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java deleted file mode 100644 index d1dc6b933aa..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TraceViewImages.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** -* 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/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java b/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java deleted file mode 100644 index 90825a3ca64..00000000000 --- a/incoming/org.eclipse.papyrus.views.tracepoints/src/org/eclipse/papyrus/views/tracepoints/views/TracepointView.java +++ /dev/null @@ -1,533 +0,0 @@ -/***************************************************************************** -* 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.views.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. - */ - 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() { - - @Override - public boolean isGrayed(Object element) { - return false; - } - - @Override - 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() { - - @Override - public void handleMarkerDeleted(IMarker marker, @SuppressWarnings("rawtypes") Map attributes) { - switchUI(); - } - - @Override - public void handleMarkerChanged(IMarker marker) { - switchUI(); - } - - @Override - public void handleMarkerAdded(IMarker marker) { - switchUI(); - } - - // TODO need to handle? - @Override - public void handleFileRenamed(IFile oldFile, IFile file) { - } - - @Override - public void handleFileMoved(IFile oldFile, IFile file) { - } - - @Override - public void handleFileDeleted(IFile file) { - } - - @Override - 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) { - - 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") { - - 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() { - - 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() { - - 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() { - - 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. - */ - 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 = (Element)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; -} |