diff options
Diffstat (limited to 'extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui')
55 files changed, 0 insertions, 4871 deletions
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.classpath b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.classpath deleted file mode 100644 index 098194ca4b7..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.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.7"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.project b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.project deleted file mode 100644 index ee60ec6da05..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.papyrus.qompass.designer.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.settings/org.eclipse.jdt.core.prefs b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f42de363afa..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/META-INF/MANIFEST.MF b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 972085ecb3b..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,32 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.qompass.designer.ui.handlers
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.ecore,
- org.eclipse.uml2.uml,
- org.eclipse.core.resources,
- org.eclipse.ui.ide,
- org.eclipse.papyrus.fcm.profile;bundle-version="1.2.0",
- org.eclipse.papyrus.marte.static.profile;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.widgets;bundle-version="1.2.0",
- org.eclipse.gef;bundle-version="3.8.0",
- org.eclipse.papyrus.uml.profile;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.properties;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.common.core;bundle-version="1.7.0",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
- org.eclipse.papyrus.qompass.designer.core;bundle-version="1.2.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-Activator: org.eclipse.papyrus.qompass.designer.ui.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.qompass.designer.ui;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/about.html b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/about.html deleted file mode 100644 index 209103075a7..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/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/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/build.properties b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/build.properties deleted file mode 100644 index f1e29af020a..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.properties,\ - about.html,\ - icons/,\ - plugin.xml -src.includes = about.html diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ADLInFlowPort.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ADLInFlowPort.gif Binary files differdeleted file mode 100644 index e2b32c65cac..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ADLInFlowPort.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Qompass-16x16.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Qompass-16x16.gif Binary files differdeleted file mode 100644 index c47d52ad211..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Qompass-16x16.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Stereotype.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Stereotype.gif Binary files differdeleted file mode 100644 index 145e5d589d8..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/Stereotype.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/allocation.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/allocation.gif Binary files differdeleted file mode 100644 index ced634f9c9c..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/allocation.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/depPlan.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/depPlan.gif Binary files differdeleted file mode 100644 index 712a2485f8d..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/depPlan.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/deploy.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/deploy.gif Binary files differdeleted file mode 100644 index 7a7ced35f3d..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/deploy.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-16x16.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-16x16.gif Binary files differdeleted file mode 100644 index 327caa73f59..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-16x16.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-32x32.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-32x32.gif Binary files differdeleted file mode 100644 index 9e1527b778f..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/ec3m-32x32.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sample.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sample.gif Binary files differdeleted file mode 100644 index 34fb3c9d8cb..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sample.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selConnector.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selConnector.gif Binary files differdeleted file mode 100644 index e47528e5447..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selConnector.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selContainer.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selContainer.gif Binary files differdeleted file mode 100644 index c16516c624b..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/selContainer.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sync.gif b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sync.gif Binary files differdeleted file mode 100644 index 5935eb3cbba..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/icons/sync.gif +++ /dev/null diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.properties b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.properties deleted file mode 100644 index 09415057ea6..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -###############################################################################
-# Copyright (c) 2013 CEA LIST.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# CEA LIST - initial API and implementation
-###############################################################################
-pluginName=Papyrus extra: Qompass Designer UI (Incubation)
-providerName=Eclipse Modeling Project
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.xml b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.xml deleted file mode 100644 index 8df44b89c05..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/plugin.xml +++ /dev/null @@ -1,248 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<plugin> - <extension - point="org.eclipse.ui.commands"> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.CreateDepPlanHandler" - description="Create deployment plan" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreateDepPlanCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.CreatePlatformHandler" - description="Create platform definition" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreatePlatformCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.InstantiateDepPlanHandler" - description="Generate deployment models and code from plan" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.InstantiateDepPlanCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.SyncHandler" - description="Synchronize derived elements" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SyncCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.SelectConnectorHandler" - description="Choose connector type and implementation" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionConnectorCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.SelectContainerHandler" - description="Choose container properties" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionContainerCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.ConfigureInstanceHandler" - description="Configure instance" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigureInstanceCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.ConfigurePortHandler" - description="Configure ports" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigurePortsCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.AddProfileAndModelLibsHandler" - description="Add Qompass profiles and model libraries" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.AddProfileAndModelLibsCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.AllocateHandler" - description="Allocate to node" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.AllocateCmd" - name="dummy"> - </command> - <command - categoryId="org.eclipse.papyrus.editor.category" - defaultHandler="org.eclipse.papyrus.qompass.designer.ui.handlers.TrafoAndCodegenHandler" - description="dummy" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.TrafoAndCodegenCmd" - name="dummy"> - </command> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup"> - <menu - icon="icons/Qompass-16x16.gif" - id="org.eclipse.papyrus.views.modelexplorer.popup.qompassdesigner" - label="Qompass Designer"> - </menu> - </menuContribution> - <menuContribution - allPopups="true" - locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=filtersMenu"> - <menu - icon="icons/Qompass-16x16.gif" - id="org.eclipse.papyrus.views.modelexplorer.popup.qompassdesigner" - label="Qompass Designer"> - </menu> - </menuContribution> - <menuContribution - allPopups="false" - locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popup.qompassdesigner"> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreateDepPlanCmd" - icon="icons/depPlan.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreateDepPlanMenu" - label="Qompass: Create deployment plan" - mnemonic="d" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreatePlatformCmd" - icon="icons/depPlan.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreatePlatformMenu" - label="Qompass: Create platform definition" - mnemonic="d" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.SyncCmd" - icon="icons/sync.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SyncMenu" - label="Qompass: Synchronize derived elements" - mnemonic="s" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.InstantiateDepPlanCmd" - icon="icons/deploy.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.CreateDepPlanMenu" - label="Qompass: Generate deployment models and code from plan" - mnemonic="g" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionConnectorCmd" - icon="icons/selConnector.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionConnectorMenu" - label="Qompass: Show / choose connector type and implementation" - mnemonic="C" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionContainerCmd" - icon="icons/selContainer.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.SelectionContainerMenu" - label="Qompass: Show / choose container properties" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigureInstanceCmd" - icon="icons/selContainer.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigureInstanceMenu" - label="Qompass: Configure instance properties" - mode="FORCE_TEXT" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigurePortsCmd" - icon="icons/selContainer.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.ConfigurePortsMenu" - label="Qompass: Configure ports" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.AddProfileAndModelLibsCmd" - icon="icons/Stereotype.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.AddProfileAndModelLibsMenu" - label="Qompass: Add profiles and model libraries" - mnemonic="P" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.AllocateCmd" - icon="icons/allocation.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.AllocateMenu" - label="Qompass: Allocate to node" - mnemonic="A" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - <command - commandId="org.eclipse.papyrus.qompass.designer.ui.menuActions.TrafoAndCodegenCmd" - icon="icons/deploy.gif" - id="org.eclipse.papyrus.qompass.designer.ui.menuActions.TrafoAndCodegenCmd" - label="Qompass: Execute transformation and generate code (w/o deployment)" - style="push"> - <visibleWhen - checkEnabled="true"> - </visibleWhen> - </command> - </menuContribution> - </extension> - <extension - point="org.eclipse.ui.preferencePages"> - <page - category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" - class="org.eclipse.papyrus.qompass.designer.ui.preferences.QompassPreferencePage" - id="org.eclipse.papyrus.qompass.designer.ui.preferences.QompassPreferencePage_ID" - name="Qompass preferences"> - </page> - </extension> - <extension - point="org.eclipse.core.runtime.preferences"> - <initializer - class="org.eclipse.papyrus.qompass.designer.ui.preferences.QompassPreferenceInitializer"> - </initializer> - </extension> -</plugin> diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/pom.xml b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/pom.xml deleted file mode 100644 index 9745a959a48..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>org.eclipse.papyrus.extra.releng</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.2.0-SNAPSHOT</version> - <relativePath>../../../releng/extra</relativePath> - </parent> - <artifactId>org.eclipse.papyrus.qompass.designer.ui</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project>
\ No newline at end of file diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Activator.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Activator.java deleted file mode 100644 index 54b1369473a..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Activator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.papyrus.qompass.designer.ui; - -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.qompass.designer.ui"; //$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) - */ - @Override - 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) - */ - @Override - 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; - } - -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Messages.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Messages.java deleted file mode 100644 index 53794a9743b..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/Messages.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.papyrus.qompass.designer.ui; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.papyrus.qompass.designer.ui.messages"; //$NON-NLS-1$ - - public static String ConfigurePortHandler_ConfigurePorts; - public static String ConfigurePortHandler_ConfigurePortsOfComponent; - public static String ConfigurePortHandler_ConfigureInstance; - - public static String ConfigurePortDialog_AvailPorts; - public static String ConfigurePortDialog_PortConfig; - public static String ConfigurePortDialog_NotAvail; - public static String ConfigurePortDialog_Kind; - public static String ConfigurePortDialog_None; - public static String ConfigurePortDialog_Type; - public static String ConfigurePortDialog_ChangeType; - public static String ConfigurePortDialog_IntfDerived; - public static String ConfigurePortDialog_Provided; - public static String ConfigurePortDialog_Required; - public static String ConfigurePortDialog_Undef; - - public static String CreateDepPlanHandler_CreateDPs; - public static String CreateDepPlanHandler_Sync; - public static String CreateDepPlanHandler_CreateNew; - public static String CreateDepPlanHandler_WhatShouldIDo; - public static String CreateDepPlanHandler_DPwithNameExistsAlready; - public static String CreateDepPlanHandler_DPwithNameExistsNoPackage; - public static String CreateDepPlanHandler_CannotSync; - public static String CreateDepPlanHandler_Cancel; - public static String CreateDepPlanHandler_CreateDP; - public static String CreateDepPlanHandler_CannotCreateDP; - public static String CreateDepPlanHandler_StereoApplicationFailed; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AllocationDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AllocationDialog.java deleted file mode 100644 index 14a3e457d49..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AllocationDialog.java +++ /dev/null @@ -1,311 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.draw2d.Label; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.emf.workspace.AbstractEMFOperation; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.FCM.DeploymentPlan; -import org.eclipse.papyrus.MARTE.MARTE_DesignModel.SRM.SW_Concurrency.SwSchedulableResource; -import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.ElementFilter; -import org.eclipse.papyrus.qompass.designer.core.commands.AddMarteAndFcmProfile; -import org.eclipse.papyrus.qompass.designer.core.deployment.AllocUtils; -import org.eclipse.papyrus.qompass.designer.core.deployment.BootLoaderGen; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.dialogs.SelectionStatusDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Allocate elements in a deployment plan to a node or thread - * - */ -public class AllocationDialog extends SelectionStatusDialog { - - private DeploymentPlan m_cdp; - - private Tree fTree; - - private Label fLabel; - - private Combo fAlloc; - - private InstanceSpecification currentIS; - - private EList<InstanceSpecification> nodeOrThreadList; - - public AllocationDialog(Shell parent, Package cdp) { - super(parent); - m_cdp = UMLUtil.getStereotypeApplication(cdp, DeploymentPlan.class); - nodeOrThreadList = new BasicEList<InstanceSpecification>(); - nodeOrThreadList.add(null); // dummy entry for no allocation - DepUtils.getAllInstances(cdp.getModel(), nodeOrThreadList, new ElementFilter() { - - @Override - public boolean acceptElement(Element element) { - if (element instanceof InstanceSpecification) { - InstanceSpecification instance = (InstanceSpecification) element; - if (instance.getName() == null) { - // donn't allocate to root element (detectable via the empty name) - return false; - } - Classifier cl = DepUtils.getClassifier(instance); - if (cl instanceof Class) { - if (StereotypeUtil.isApplied(cl, SwSchedulableResource.class)) { - // threads are valid allocation targets. Therefore, threads are always added to - // list, even if within a deployment plan. - return true; - } - if (StereotypeUtil.isApplied(instance.getNearestPackage(), DeploymentPlan.class)) { - // instance is part of a deployment plan => don't add to list. - return false; - } - return true; - } - } - return false; - } - }); - } - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - // nothing to do - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - // (parent, "Container rules", "Avail. extensions/interceptors"); - - fTree = new Tree(contents, SWT.H_SCROLL | SWT.BORDER); - fTree.setHeaderVisible(true); - GridData data = new GridData(GridData.FILL_BOTH); - fTree.setLayoutData(data); - data.heightHint = 150; - // data.widthHint = 200; - - // Turn off drawing to avoid flicker - fTree.setRedraw(false); - - TreeColumn instances = new TreeColumn(fTree, SWT.LEFT); - instances.setText("Instance"); - instances.setWidth(200); - TreeColumn explicitAlloc = new TreeColumn(fTree, SWT.LEFT); - explicitAlloc.setText("explicit allocation"); - explicitAlloc.setWidth(150); - TreeColumn implicitAlloc = new TreeColumn(fTree, SWT.LEFT); - implicitAlloc.setText("implicit allocation"); - implicitAlloc.setWidth(150); - - fillTree(fTree, null, m_cdp.getMainInstance()); - - // Turn drawing back on! - fTree.setRedraw(true); - - fTree.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - if (fTree.getSelection().length > 0) { - selectInstance(fTree.getSelection()[0]); - } - } - }); - - Label label = new Label(); - label.setText("seletected instance:"); - fLabel = new Label(); - - createAllocInfo(contents); - return contents; - } - - /** - * Helper method to fill a tree with data - * - * @param tree - * the tree to fill - */ - private void fillTree(Tree tree, TreeItem treeItem, InstanceSpecification is) { - TreeItem item; - if (treeItem != null) { - item = new TreeItem(treeItem, SWT.NONE); - } else { - item = new TreeItem(tree, SWT.NONE); - } - item.setData(is); - setTextFromData(item); - - // create children - for (InstanceSpecification subIS : DepUtils.getContainedNonSharedInstances(is)) { - fillTree(tree, item, subIS); - } - } - - // obtain name and explicit/implicit node Allocation - protected void setTextFromData(TreeItem ti) { - Object data = ti.getData(); - if (data instanceof InstanceSpecification) { - InstanceSpecification is = (InstanceSpecification) data; - - String name = is.getName(); - int index = name.lastIndexOf("."); //$NON-NLS-1$ - if (index != -1) { - name = name.substring(index + 1); - } - InstanceSpecification explicitNodeOrThread = AllocUtils.getNodeOrThread(is); - Classifier cl = DepUtils.getClassifier(is); - String nodeName; - if (explicitNodeOrThread == null) { - nodeName = "-"; //$NON-NLS-1$ - } else { - nodeName = getAllocName(explicitNodeOrThread); - } - if (cl instanceof Class) { - if (BootLoaderGen.hasUnconnectedStartRoutine(null, (Class) cl, null)) { - nodeName += " (main)"; //$NON-NLS-1$ - } - } - EList<InstanceSpecification> implicitNodes = AllocUtils.getAllNodesOrThreadsParent(is); - implicitNodes.addAll(AllocUtils.getAllNodesOrThreadsParent(is)); - String list = ""; //$NON-NLS-1$ - for (InstanceSpecification node : implicitNodes) { - if (list.equals("")) { //$NON-NLS-1$ - list = getAllocName(node); - } else { - list += ", " + getAllocName(node); //$NON-NLS-1$ - } - } - ti.setText(new String[] { name, nodeName, "[" + list + "]" }); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - protected void refreshTree(TreeItem ti) { - setTextFromData(ti); - for (TreeItem subItem : ti.getItems()) { - refreshTree(subItem); - } - } - - private String getAllocName(InstanceSpecification nodeOrThread) { - if (nodeOrThread == null) { - return "no explicit allocation"; - } else { - String name = nodeOrThread.getName(); - InstanceSpecification threadNode = AllocUtils.getNode(nodeOrThread); - return name + (threadNode != null ? " on " + threadNode.getName() : ""); - } - } - - protected void createAllocInfo(Composite parent) { - // create extension kind combo - fAlloc = DialogUtils.createComboWithText(parent, "Alloc to node:", - SWT.DROP_DOWN | SWT.READ_ONLY, SWT.NONE); - - String items[] = new String[nodeOrThreadList.size()]; - int i = 0; - for (InstanceSpecification nodeOrThread : nodeOrThreadList) { - items[i++] = getAllocName(nodeOrThread); - } - fAlloc.setItems(items); - fAlloc.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent event) { - if (currentIS != null) { - updateAllocation(currentIS, fAlloc.getSelectionIndex()); - // selectionCount should always be 1 - for (TreeItem ti : fTree.getSelection()) { - refreshTree(ti); - } - } - } - }); - - fAlloc.setEnabled(false); - } - - /** - * Select a rule, i.e. update the visual representation from the rule - * - * @param rule - */ - protected void selectInstance(TreeItem item) { - // for (Port port : rule.getPortSet ()) { - // fPorts.setSelection() - // } - currentIS = (InstanceSpecification) item.getData(); - fLabel.setText(currentIS.getName()); - - fAlloc.setEnabled(true); - InstanceSpecification nodeOrThread = AllocUtils.getNodeOrThread(currentIS); - - for (int i = 0; i < nodeOrThreadList.size(); i++) { - if (nodeOrThreadList.get(i) == nodeOrThread) { - fAlloc.select(i); - } - } - } - - private void updateAllocation(InstanceSpecification is, int index) { - InstanceSpecification oldNode = AllocUtils.getNodeOrThread(is); - InstanceSpecification newNode = nodeOrThreadList.get(index); - - if (oldNode == newNode) { - return; - } - - // add or update - if (oldNode == null) { - if (!AllocUtils.allocate(is, newNode)) { - if (MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Error", - "Stereotype application failed. The profile MARTE::Allocation is probably not applied. Try to apply it?")) { - AbstractEMFOperation applyProfile = new AddMarteAndFcmProfile(PackageUtil.getRootPackage(is), AddMarteAndFcmProfile.APPLY_ALLOC, TransactionUtil.getEditingDomain(is)); - CommandSupport.exec(applyProfile); - AllocUtils.allocate(is, newNode); - } - } - } else { - AllocUtils.updateAllocation(is, oldNode, newNode); - } - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AttributeLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AttributeLabelProvider.java deleted file mode 100644 index 568acd2541f..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/AttributeLabelProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -public class AttributeLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - if (element instanceof Property) { - Property p = (Property) element; - Type type = p.getType(); - return p.getClass_().getName() + "." + p.getName() + ((type != null) ? - " : " + type.getQualifiedName() : - ""); - } - else { - return "invalid"; - } - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChooseConfigOpt.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChooseConfigOpt.java deleted file mode 100644 index 8c2b5f6cda9..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChooseConfigOpt.java +++ /dev/null @@ -1,245 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import java.util.ArrayList; -import java.util.Collections; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.FCM.ConfigOption; -import org.eclipse.papyrus.FCM.ContainerRule; -import org.eclipse.papyrus.uml.profile.ui.dialogs.AlphabeticalViewerSorter; -import org.eclipse.papyrus.uml.profile.ui.dialogs.ChooseSetAssistedDialog; -import org.eclipse.papyrus.uml.profile.ui.dialogs.IChooseDialog; -import org.eclipse.papyrus.uml.properties.profile.ui.dialogs.StereotypeQualifiedLabelProvider; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Package; - - -public class ChooseConfigOpt extends ChooseSetAssistedDialog implements IChooseDialog { - - protected EList<Package> visitedPackages; - - /** - * LabelProvider for stereotype completion proposal provider with qualified names. - */ - final private StereotypeQualifiedLabelProvider qualifiedLabelProvider = new StereotypeQualifiedLabelProvider(); - - /** - * Default Constructor. - * - * @param parentShell - * the parent shell - * @param theElement - * the UML element to be modified - */ - public ChooseConfigOpt(Shell parentShell, Package model, ContainerRule rule) { - super(parentShell, - "Available configuration options: ", - "Applied configuration options: "); - labelProvider = new ConfigOptionLabelProvider(); - decoratedContentProposalProvider = new ConfigOptContentProposalProvider(); - - for (ConfigOption option : rule.getForConfig()) { - selectedElementList.addElement(option.getBase_Class()); - } - - visitedPackages = new BasicEList<Package>(); - EList<Class> configOptList = new BasicEList<Class>(); - getAvailConfigOpts(model, configOptList); - for (Class current : configOptList) { - if (!selectedElementList.contains(current)) { - possibleElementList.addElement(current); - } - } - } - - private void getAvailConfigOpts(Package pkg, EList<Class> configOptList) { - for (Element el : pkg.getMembers()) { - if (el instanceof Package) { - if (!visitedPackages.contains(el)) { - visitedPackages.add((Package) el); - getAvailConfigOpts((Package) el, configOptList); - } - } else if (el instanceof Class) { - if (StereotypeUtil.isApplied(el, ConfigOption.class)) { - configOptList.add((Class) el); - } - } - } - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - /** - * Creates the dialog area. - * - * @param parent - * the parent - * - * @return the control - */ - @Override - protected Control createDialogArea(Composite parent) { - Control composite = super.createDialogArea(parent); - - // Add 2 columns to the table area - // possibleElementsTable.setLinesVisible(true); - possibleElementsTable.setHeaderVisible(true); - - // 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!! - TableColumn column = new TableColumn(possibleElementsTable, SWT.CENTER, 0); - column.setText("Option"); - column.setWidth(100); - column.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); - } - }); - - // 2nd column with task Description - column = new TableColumn(possibleElementsTable, SWT.LEFT, 1); - column.setText("Information"); - column.setWidth(165); - // Add listener to column so tasks are sorted by description when clicked - column.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(1)); - } - }); - - // set sorter to the possible element table viewer - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); - - return composite; - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#runAddElement(java.lang.String) - */ - /** - * Run add element. - * - * @param name - * the name - */ - @Override - protected void runAddElement(String name) { - // find the stereotype in the list - Class option = null; - for (Object possibleElement : possibleElementList.getElements()) { - Class element = (Class) possibleElement; - if (name.equalsIgnoreCase(element.getName()) || - name.equalsIgnoreCase(element.getQualifiedName())) { - option = element; - } - } - if (option != null) { - runActionAdd(option); - } - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#isSelectableElement(java.lang.String) - */ - /** - * Checks if is selectable element. - * - * @param text - * the text - * - * @return true, if is selectable element - */ - @Override - protected boolean isSelectableElement(String text) { - // iterate through all possibilities and return true if text corresponds - for (Object possibleElement : possibleElementList.getElements()) { - Class element = (Class) possibleElement; - if (text.equalsIgnoreCase(element.getName()) || text.equalsIgnoreCase(element.getQualifiedName())) { - return true; - } - } - return false; - } - - /** - * Content Proposal provider for stereotypes dialog. Propose the simple - * name of the stereotype and its qualified name. - * - * @author Remi Schnekenburger - */ - public class ConfigOptContentProposalProvider extends DecoratedContentProposalProvider { - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog.DecoratedContentProposalProvider#getProposals(java.lang.String, int) - */ - /** - * Gets the proposals. - * - * @param contents - * the contents - * @param position - * the position - * - * @return the proposals - */ - @Override - public DecoratedContentProposal[] getProposals(String contents, int position) { - ArrayList<DecoratedContentProposal> proposals = new ArrayList<DecoratedContentProposal>(); - - if (possibleElementList != null) { - for (Object configOptObj : possibleElementList.getElements()) { - final Class configOpt = (Class) configOptObj; - final String simpleName = configOpt.getName(); - final String qualifiedName = configOpt.getQualifiedName(); - - if (position < simpleName.length() && contents.substring(0, position).equalsIgnoreCase(simpleName.substring(0, position))) { - proposals.add(new DecoratedContentProposal(configOpt, labelProvider)); - } - - if (position < qualifiedName.length() && contents.substring(0, position).equalsIgnoreCase(qualifiedName.substring(0, position))) { - proposals.add(new DecoratedContentProposal(configOpt, qualifiedLabelProvider)); - } - } - } - - Collections.sort(proposals); - return proposals.toArray(new DecoratedContentProposal[proposals.size()]); - } - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChoosePorts.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChoosePorts.java deleted file mode 100644 index df3f4e3e44f..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ChoosePorts.java +++ /dev/null @@ -1,244 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import java.util.ArrayList; -import java.util.Collections; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.FCM.InterceptionRule; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.uml.profile.ui.dialogs.AlphabeticalViewerSorter; -import org.eclipse.papyrus.uml.profile.ui.dialogs.ChooseSetAssistedDialog; -import org.eclipse.papyrus.uml.profile.ui.dialogs.IChooseDialog; -import org.eclipse.papyrus.uml.properties.profile.ui.dialogs.StereotypeQualifiedLabelProvider; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Feature; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Property; - - -public class ChoosePorts extends ChooseSetAssistedDialog implements IChooseDialog { - - protected EList<Package> visitedPackages; - - /** - * LabelProvider for stereotype completion proposal provider with qualified names. - */ - final private StereotypeQualifiedLabelProvider qualifiedLabelProvider = new StereotypeQualifiedLabelProvider(); - - /** - * Default Constructor. - * - * @param parentShell - * the parent shell - * @param theElement - * the UML element to be modified - */ - public ChoosePorts(Shell parentShell, Class component, InterceptionRule rule) { - super(parentShell, "Available features", "Intercepted features"); - labelProvider = new PortLabelProvider(); - decoratedContentProposalProvider = new ConfigOptContentProposalProvider(); - - for (Feature feature : rule.getInterceptionSet()) { - selectedElementList.addElement(feature); - } - - visitedPackages = new BasicEList<Package>(); - if (component != null) { - // local rule with intercept some policy: choose executor ports - for (Property current : component.getOwnedAttributes()) { - if (!selectedElementList.contains(current)) { - possibleElementList.addElement(current); - } - } - for (Feature current : Utils.getAllElementsOfType(component, Feature.class)) { - if (!selectedElementList.contains(current)) { - possibleElementList.addElement(current); - } - } - } else { - // global rule with intercept some policy - // choose all ports vs. ports of "standard components" - Package top = PackageUtil.getRootPackage(rule.getBase_Property()); - for (Feature current : Utils.getAllElementsOfType(top, Feature.class)) { - if (!selectedElementList.contains(current)) { - possibleElementList.addElement(current); - } - } - } - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - /** - * Creates the dialog area. - * - * @param parent - * the parent - * - * @return the control - */ - @Override - protected Control createDialogArea(Composite parent) { - Control composite = super.createDialogArea(parent); - - // Add 2 columns to the table area - // possibleElementsTable.setLinesVisible(true); - possibleElementsTable.setHeaderVisible(true); - - // 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!! - TableColumn column = new TableColumn(possibleElementsTable, SWT.CENTER, 0); - column.setText("Port"); - column.setWidth(60); - column.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); - } - }); - - // 2nd column with task Description - column = new TableColumn(possibleElementsTable, SWT.LEFT, 1); - column.setText("Type"); - column.setWidth(100); - // Add listener to column so tasks are sorted by description when clicked - column.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(1)); - } - }); - - // set sorter to the possible element table viewer - possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); - - return composite; - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#runAddElement(java.lang.String) - */ - /** - * Run add element. - * - * @param name - * the name - */ - @Override - protected void runAddElement(String name) { - // find the stereotype in the list - Port port = null; - for (Object possibleElement : possibleElementList.getElements()) { - Port element = (Port) possibleElement; - if (name.equalsIgnoreCase(element.getName()) || name.equalsIgnoreCase(element.getQualifiedName())) { - port = element; - } - } - if (port != null) { - runActionAdd(port); - } - } - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#isSelectableElement(java.lang.String) - */ - /** - * Checks if is selectable element. - * - * @param text - * the text - * - * @return true, if is selectable element - */ - @Override - protected boolean isSelectableElement(String text) { - // iterate through all possibilities and return true if text corresponds - for (Object possibleElement : possibleElementList.getElements()) { - Port element = (Port) possibleElement; - if (text.equalsIgnoreCase(element.getName()) || text.equalsIgnoreCase(element.getQualifiedName())) { - return true; - } - } - return false; - } - - /** - * Content Proposal provider for stereotypes dialog. Propose the simple - * name of the stereotype and its qualified name. - * - * @author Remi Schnekenburger - */ - public class ConfigOptContentProposalProvider extends DecoratedContentProposalProvider { - - /* - * (non-Javadoc) - * - * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog.DecoratedContentProposalProvider#getProposals(java.lang.String, int) - */ - /** - * Gets the proposals. - * - * @param contents - * the contents - * @param position - * the position - * - * @return the proposals - */ - @Override - public DecoratedContentProposal[] getProposals(String contents, int position) { - ArrayList<DecoratedContentProposal> proposals = new ArrayList<DecoratedContentProposal>(); - - if (possibleElementList != null) { - for (Object portObj : possibleElementList.getElements()) { - final Port port = (Port) portObj; - final String simpleName = port.getName(); - final String qualifiedName = port.getQualifiedName(); - - if (position < simpleName.length() && contents.substring(0, position).equalsIgnoreCase(simpleName.substring(0, position))) { - proposals.add(new DecoratedContentProposal(port, labelProvider)); - } - - if (position < qualifiedName.length() && contents.substring(0, position).equalsIgnoreCase(qualifiedName.substring(0, position))) { - proposals.add(new DecoratedContentProposal(port, qualifiedLabelProvider)); - } - } - } - - Collections.sort(proposals); - return proposals.toArray(new DecoratedContentProposal[proposals.size()]); - } - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigOptionLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigOptionLabelProvider.java deleted file mode 100644 index ec588505f20..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigOptionLabelProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.papyrus.qompass.designer.core.Description; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Class; - -public class ConfigOptionLabelProvider extends LabelProvider implements ITableLabelProvider { - - @Override - public String getText(Object element) { - return ((Class) element).getName(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - @Override - public String getColumnText(Object element, int columnIndex) { - if (columnIndex == 0) { - return getText(element); - } else if (columnIndex == 1) { - return Description.getDescription((Class) element); - } - return null; - } - - @Override - public Image getColumnImage(Object element, int columnIndex) { - // TODO Auto-generated method stub - return null; - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java deleted file mode 100644 index f5deb6de56c..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java +++ /dev/null @@ -1,642 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.FCM.ContainerRule; -import org.eclipse.papyrus.FCM.util.FCMUtil; -import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils; -import org.eclipse.papyrus.qompass.designer.core.ConfigUtils; -import org.eclipse.papyrus.qompass.designer.core.Description; -import org.eclipse.papyrus.qompass.designer.core.ElementFilter; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils; -import org.eclipse.papyrus.qompass.designer.core.sync.DepPlanSync; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Group; -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.Classifier; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Enumeration; -import org.eclipse.uml2.uml.EnumerationLiteral; -import org.eclipse.uml2.uml.Feature; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.InstanceValue; -import org.eclipse.uml2.uml.LiteralBoolean; -import org.eclipse.uml2.uml.LiteralInteger; -import org.eclipse.uml2.uml.LiteralString; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Slot; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Select container rules, either from a list of globally defined rules or from - * local rules which may be created "on the fly" by this dialog. - * - * TODO: extend rule application to instances (problematic, since rules - * transformation is done on type level) - */ -public class ConfigureInstanceDialog extends SelectionStatusDialog { - - protected Class m_component; - - protected Label fDescriptionLabel; - - protected Text fDescription; - - protected TreeViewer fInstanceList; - - protected TableViewer fPropertyList; - - protected Property m_currentAttribute; - - protected final String valueLabelPrefix = "Value:"; //$NON-NLS-1$ - - protected Label fValueLabel; - - protected Text fValue; - - protected Combo fComboValue; - - protected Package m_model; - - protected Feature m_feature; - - protected EList<Package> visitedPackages; - - protected boolean m_rulePropertiesOnly; - - protected InstanceSpecification m_instance; - - EList<InstanceSpecification> m_instanceList; - - public ConfigureInstanceDialog(Shell parent) { - super(parent); - } - - public boolean init(Class component, ExecutionEvent from) { - // visitedPackages = new BasicEList<Package> (); - DepPlanSync.syncAllDepPlans(component); - m_component = component; - m_instance = null; - m_feature = null; - m_model = PackageUtil.getUserModel(from); - if (m_model == null) { - return false; - } - return checkAndGetInstances(); - } - - public boolean init(InstanceSpecification instance, ExecutionEvent from) { - // visitedPackages = new BasicEList<Package> (); - DepPlanSync.syncDepPlan(instance.getNearestPackage()); - m_component = DepUtils.getImplementation(instance); - m_instance = instance; - m_feature = null; - m_model = PackageUtil.getUserModel(from); - return checkAndGetInstances(); - } - - public boolean init(Feature feature, ExecutionEvent from) { - // visitedPackages = new BasicEList<Package> (); - m_feature = feature; - m_model = PackageUtil.getUserModel(from); - if (m_model == null) { - m_model = PackageUtil.getRootPackage(feature); - } - m_instance = null; - if (feature instanceof Connector) { - org.eclipse.papyrus.FCM.Connector fcmConn = UMLUtil.getStereotypeApplication(feature, - org.eclipse.papyrus.FCM.Connector.class); - if ((fcmConn != null) && (fcmConn.getIc() != null)) { - m_component = fcmConn.getIc().getBase_Class(); - return checkAndGetInstances(); - } - } else if (feature instanceof Property) { - Type type = ((Property) feature).getType(); - if (type instanceof Class) { - m_component = (Class) type; - return checkAndGetInstances(); - } - } - return false; - } - - /** - * A filter class that selects instances associated with the selected feature or component - */ - class InstanceFilter implements ElementFilter { - - private String featureCandidateName; - - @Override - public boolean acceptElement(Element element) { - if (element instanceof InstanceSpecification) { - InstanceSpecification instance = (InstanceSpecification) element; - if (m_feature instanceof Property) { - EList<Slot> slots = DepUtils.getReferencingSlots(instance); - for (Slot slot : slots) { - if (slot.getDefiningFeature() == m_feature) { - return true; - } - } - } - else if (m_feature instanceof Connector) { - // Connector instances cannot be found via a slot. Since a connector is not a structural feature, - // it cannot be referenced via the "definingFeature" property of a slot. Therefore, the deployment - // plan creation (@see DepCreation.createDepPlan) simply omits slots, but still creates instances - // for the interaction components referenced by an FCM connector. - // TODO: the following code relies on specific order of instances and might not always work. - Element owner = m_feature.getOwner(); - if (DepUtils.getImplementation(instance) == owner) { - // instance is for owner of feature: examine name - featureCandidateName = instance.getName() + "." + m_feature.getName(); //$NON-NLS-1$ - } - else if (featureCandidateName != null) { - if (featureCandidateName.equals(instance.getName())) { - return true; - } - } - } else if (DepUtils.getImplementation(instance) == m_component) { - return true; - } - } - return false; - } - } - - - /** - * retrieve the instance list. Returns false, if no deployment plan could be found. - * - * @return - */ - public boolean checkAndGetInstances() { - visitedPackages = new BasicEList<Package>(); - m_instanceList = new BasicEList<InstanceSpecification>(); - - ElementFilter filter = new InstanceFilter(); - DepUtils.getAllInstances(m_model, m_instanceList, filter); - - if (m_instanceList.size() == 0) { - Shell shell = Display.getDefault().getActiveShell(); - if (DepPlanUtils.getAllDepPlans(m_model).size() == 0) { - MessageDialog.openInformation(shell, "Instance configuration", - "No deployment plans are defined. Create a deployment plan before configuring instances"); - return false; - } - else if (MessageDialog.openConfirm(shell, "Instance configuration", - "The list of available instances is empty. Synchronize deployment plans?")) { - DepPlanSync.syncAllDepPlans(m_model); - visitedPackages = new BasicEList<Package>(); - DepUtils.getAllInstances(m_model, m_instanceList, filter); - - if (m_instanceList.size() == 0) { - MessageDialog - .openInformation( - shell, - "Instance configuration", - "There are still no instances available\n. Check whether you created already a deployment plan for your system. Check as well, if the parts in your a composite use \"composite\" as aggregation kind. (Results of deployment plan synchronizations will be unrolled)"); - return false; - } - } - } - return true; - } - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - // nothing to do - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - // (parent, "Container rules", "Avail. extensions/interceptors"); - - createInstanceSelectionGroup(contents); - createInstanceConfigurationGroup(contents); - return contents; - } - - protected void createInstanceSelectionGroup(Composite parent) { - Composite instanceSelection = new Composite(parent, SWT.NONE); - GridLayout grid = new GridLayout(1, true); - GridData groupGridData = new GridData(); - - groupGridData.grabExcessVerticalSpace = true; - groupGridData.grabExcessHorizontalSpace = true; - groupGridData.horizontalAlignment = GridData.FILL; - groupGridData.verticalAlignment = GridData.FILL; - instanceSelection.setLayout(grid); - instanceSelection.setLayoutData(groupGridData); - - /* - * fRules = DialogUtils.createFilteredList (ruleSelGroup, new - * RuleLabelProvider(), 200, 200, SWT.BORDER | SWT.V_SCROLL | - * SWT.H_SCROLL); - */ - - // - // --------------- instance selection ------------------- - // - Group instanceSelGroup = new Group(instanceSelection, SWT.BORDER); - instanceSelGroup.setText(addSpaces("associated instance specifications")); - // ruleGroup.setLayout(new RowLayout (SWT.VERTICAL)); - instanceSelGroup.setLayout(new GridLayout(1, false)); - instanceSelGroup.setLayoutData(groupGridData); - - fInstanceList = new TreeViewer(instanceSelGroup, SWT.BORDER); - - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 100; - data.widthHint = 350; - - fInstanceList.getTree().setLayoutData(data); - fInstanceList.setLabelProvider(new InstanceLabelProvider()); - fInstanceList.setContentProvider(new ITreeContentProvider() { - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - @Override - public Object getParent(Object element) { - return null; - } - - @Override - public Object[] getElements(Object inputElement) { - return (Object[]) inputElement; - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof InstanceSpecification) { - return DepUtils.getContainedInstances((InstanceSpecification) parentElement).toArray(); - } - return new Object[0]; - } - }); - - fInstanceList.setInput(m_instanceList.toArray()); - fInstanceList.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = fInstanceList.getSelection(); - if (selection instanceof StructuredSelection) { - Object[] selected = ((StructuredSelection) selection) - .toArray(); - if ((selected.length == 1) - && (selected[0] instanceof InstanceSpecification)) { - m_instance = (InstanceSpecification) selected[0]; - Classifier cl = DepUtils.getClassifier(m_instance); - fPropertyList.setInput(getConfigAttributes(cl).toArray()); - selectProperty(m_currentAttribute); - } - } - } - }); - if (m_instance != null) { - int index = m_instanceList.indexOf(m_instance); - if (index != -1) { - TreeItem treeItem = fInstanceList.getTree().getItem(index); - fInstanceList.getTree().setSelection(treeItem); - } - } - } - - // create instance configuration group - protected void createInstanceConfigurationGroup(Composite parent) { - GridData groupGridData = DialogUtils.createFillGridData(); - - Group instanceConfigurationGroup = new Group(parent, SWT.BORDER); - instanceConfigurationGroup.setText(addSpaces("Configuration")); - instanceConfigurationGroup.setLayout(new RowLayout(SWT.VERTICAL)); - instanceConfigurationGroup.setLayout(new GridLayout(1, false)); - instanceConfigurationGroup.setLayoutData(groupGridData); - - // fRuleName = new Text (ruleInfoGroup, SWT.NONE); - Label configL = new Label(instanceConfigurationGroup, SWT.NONE); - configL.setText("Available properties:"); - - fPropertyList = new TableViewer(instanceConfigurationGroup, SWT.BORDER); - fPropertyList.setLabelProvider(new AttributeLabelProvider()); - fPropertyList.setContentProvider(new ArrayContentProvider()); - fPropertyList.setInput(getConfigAttributes(m_component).toArray()); - fPropertyList - .addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = fPropertyList.getSelection(); - if (selection instanceof StructuredSelection) { - Object[] selected = ((StructuredSelection) selection) - .toArray(); - if ((selected.length == 1) - && (selected[0] instanceof Property)) { - selectProperty((Property) selected[0]); - } - } - } - }); - - fValueLabel = new Label(instanceConfigurationGroup, SWT.NONE); - - GridData span2 = new GridData(); - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - span2.heightHint = 70; - fPropertyList.getTable().setLayoutData(span2); - - fValue = new Text(instanceConfigurationGroup, SWT.WRAP); - span2 = new GridData(); - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - fValue.setLayoutData(span2); - - fValue.addFocusListener(new FocusListener() { - - @Override - public void focusLost(FocusEvent e) { - // store value, once focus is lost (different element is - // selected) - String valueStr = fValue.getText(); - Slot valueSlot = null; - if (m_instance == null) { - // no instance has been selected - // (field should be inactive, if not selected) - return; - } - for (Slot slot : m_instance.getSlots()) { - if (slot.getDefiningFeature() == m_currentAttribute) { - valueSlot = slot; - } - } - if (valueSlot == null) { - // slot does not exist yet, create - valueSlot = DepCreation.createSlotForConfigProp(m_instance, - m_currentAttribute); - } - for (ValueSpecification value : valueSlot.getValues()) { - if (value instanceof LiteralString) { - ((LiteralString) value).setValue(valueStr); - } else if (value instanceof LiteralInteger) { - ((LiteralInteger) value).setValue(Integer - .parseInt(valueStr)); - } else if (value instanceof LiteralBoolean) { - ((LiteralBoolean) value).setValue(Boolean - .parseBoolean(valueStr)); - } - } - } - - @Override - public void focusGained(FocusEvent e) { - } - }); - - fComboValue = new Combo(instanceConfigurationGroup, SWT.NONE); - span2 = new GridData(); - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - fComboValue.setLayoutData(span2); - - fComboValue.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent event) { - // store value, once focus is lost (different element is - // selected) - int index = fComboValue.getSelectionIndex(); - if (m_instance == null) { - // no instance has been selected - // (field should be inactive, if not selected) - return; - } - Slot valueSlot = null; - for (Slot slot : m_instance.getSlots()) { - if (slot.getDefiningFeature() == m_currentAttribute) { - // slot for enumerations can only be configured with instanceValues. - // Destroy slots with do not contain at least one instanceValue - boolean destroySlot = true; - for (ValueSpecification value : slot.getValues()) { - if (value instanceof InstanceValue) { - destroySlot = false; - } - } - if (destroySlot) { - slot.destroy(); - } - else { - valueSlot = slot; - } - break; - } - } - if (valueSlot == null) { - // slot does not exist yet, create - valueSlot = DepCreation.createSlotForConfigProp(m_instance, - m_currentAttribute); - } - Enumeration enumeration = (Enumeration) m_currentAttribute.getType(); - for (ValueSpecification value : valueSlot.getValues()) { - if (value instanceof InstanceValue) { - ((InstanceValue) value).setInstance(enumeration.getOwnedLiterals().get(index)); - } - } - } - }); - - fDescriptionLabel = new Label(instanceConfigurationGroup, SWT.NONE); - fDescriptionLabel.setText("Description:"); - fDescriptionLabel.setLayoutData(span2); - - span2 = new GridData(); - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - span2.grabExcessVerticalSpace = true; - span2.verticalAlignment = GridData.FILL; - span2.heightHint = 80; - - fDescription = new Text(instanceConfigurationGroup, SWT.NONE | SWT.WRAP - | SWT.V_SCROLL | SWT.READ_ONLY); - fDescription.setLayoutData(span2); - // createMessageArea (ruleInfoGroup); - instanceConfigurationGroup.pack(); - setEnabled(false); - } - - /** - * Select a rule, i.e. update the visual representation from the rule - * - * @param rule - */ - protected void selectProperty(Property attribute) { - m_currentAttribute = attribute; - if ((attribute == null) || (fValue == null)) { - setEnabled(false); - return; - } - setEnabled(true); - fDescription.setText(Description.getDescription(attribute, "not available")); - fValueLabel.setText(getValueLabel(attribute)); - boolean isEnum = m_currentAttribute.getType() instanceof Enumeration; - fValue.setVisible(!isEnum); - fComboValue.setVisible(isEnum); - if (isEnum) { - Enumeration enumeration = (Enumeration) m_currentAttribute.getType(); - EList<EnumerationLiteral> literals = enumeration.getOwnedLiterals(); - String items[] = new String[literals.size()]; - for (int i = 0; i < literals.size(); i++) { - items[i] = literals.get(i).getName(); - } - fComboValue.setItems(items); - } - - for (Slot slot : m_instance.getSlots()) { - if (slot.getDefiningFeature() == m_currentAttribute) { - for (ValueSpecification value : slot.getValues()) { - if (value instanceof LiteralInteger) { - Integer intVal = ((LiteralInteger) value).getValue(); - fValue.setText(intVal.toString()); - return; - } - if (value instanceof InstanceValue) { - InstanceSpecification enumIS = ((InstanceValue) value).getInstance(); - if (enumIS instanceof EnumerationLiteral) { - EnumerationLiteral literal = (EnumerationLiteral) enumIS; - int index = literal.getEnumeration().getOwnedLiterals().indexOf(literal); - if (index != -1) { - fComboValue.select(index); - } - } - return; - } - else if (value instanceof LiteralBoolean) { - Boolean boolVal = ((LiteralBoolean) value).booleanValue(); - fValue.setText(boolVal.toString()); - return; - } - else if (value instanceof LiteralString) { - fValue.setText(((LiteralString) value).getValue()); - return; - } - } - } - } - fValue.setText(""); //$NON-NLS-1$ - } - - private void setEnabled(boolean enabled) { - fDescriptionLabel.setEnabled(enabled); - fDescription.setEnabled(enabled); - fValueLabel.setEnabled(enabled); - fValue.setEnabled(enabled); - if (!enabled) { - fValue.setText(""); //$NON-NLS-1$ - fDescription.setText(""); //$NON-NLS-1$ - fValueLabel.setText(valueLabelPrefix); - } - } - - private String getValueLabel(Property attribute) { - String label = valueLabelPrefix; - if (attribute.getDefault() != null) { - return label + " " + String.format("(default = %s)", attribute.getDefault()); //$NON-NLS-1$ //$NON-NLS-2$ - } - return label; - } - - private EList<Property> getConfigAttributes(Classifier component) { - EList<Property> list = new BasicEList<Property>(); - // add properties of component - list.addAll(ConfigUtils.getConfigAttributes(component)); - // now add properties of container rules - // TODO: is it possible that multiple container extensions of the same - // type exist, and if yes, how do we configure these? - if (component instanceof Class) { - EList<ContainerRule> rules = FCMUtil.getAllContainerRules((Class) component); - if (rules != null) { - for (ContainerRule aRule : rules) { - // (many, in case of a composite rule) - try { - list.addAll(ConfigUtils.getConfigAttributes(aRule)); - } catch (TransformationException e) { - } - } - } - } - return list; - } - - /** - * Add a space before and after - * - * @param text - * @return - */ - public static String addSpaces(String text) { - return " " + text + " "; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigurePortDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigurePortDialog.java deleted file mode 100644 index 7f8bc62475a..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigurePortDialog.java +++ /dev/null @@ -1,388 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import java.util.Collections; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.UniqueEList; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.papyrus.FCM.PortKind; -import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; -import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils; -import org.eclipse.papyrus.qompass.designer.core.Description; -import org.eclipse.papyrus.qompass.designer.core.PortUtils; -import org.eclipse.papyrus.qompass.designer.ui.Messages; -import org.eclipse.papyrus.uml.tools.providers.ServiceEditFilteredContentProvider; -import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.SelectionStatusDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Select container rules, either from a list of globally defined rules or from - * local rules which may be created "on the fly" by this dialog. - * - * TODO: extend rule application to instances (problematic, since rules - * transformation is done on type level) - * - */ -public class ConfigurePortDialog extends SelectionStatusDialog { - - protected Class m_component; - - protected Text fDescription; - - protected TableViewer fPortList; - - protected Port m_currentPort; - - protected Combo fKindCombo; - - protected EList<PortKind> portKindList; - - protected Label fType; - - protected Button fTypeButton; - - protected Label fProvided; - - protected Label fRequired; - - protected Package m_model; - - protected EList<Port> m_ports; - - public static final String COLON = ":"; //$NON-NLS-1$ - - public ConfigurePortDialog(Shell parent) { - super(parent); - } - - public boolean init(Port port) { - // visitedPackages = new BasicEList<Package> (); - m_component = port.getClass_(); - m_currentPort = port; // preselect port (don't call selectPort before initialization of dialog area); - m_model = PackageUtil.getRootPackage(m_component); - m_ports = PortUtils.getAllPorts(m_component); - return true; - } - - public boolean init(Class clazz) { - // visitedPackages = new BasicEList<Package> (); - m_component = clazz; - m_model = PackageUtil.getRootPackage(m_component); - m_currentPort = null; - m_ports = PortUtils.getAllPorts(m_component); - return true; - } - - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - // nothing to do - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - // (parent, "Container rules", "Avail. extensions/interceptors"); - - createPortConfigurationGroup(contents); - if (m_currentPort != null) { - int index = m_ports.indexOf(m_currentPort); - if (index != -1) { - fPortList.getTable().setSelection(index); - selectPort(m_currentPort); - } - } - return contents; - } - - // create instance configuration group - protected void createPortConfigurationGroup(Composite parent) { - GridData groupGridData = DialogUtils.createFillGridData(); - - // create grid data - GridData gridData = DialogUtils.createFillGridData(); - GridData gridDataH80Span2 = DialogUtils.createFillGridData(); - gridDataH80Span2.horizontalSpan = 2; - gridDataH80Span2.heightHint = 80; - GridData gridDataH25Span2 = DialogUtils.createFillGridData(); - gridDataH25Span2.horizontalSpan = 2; - gridDataH25Span2.heightHint = 25; - GridData gridDataH60 = DialogUtils.createFillGridData(); - gridDataH60.heightHint = 60; - GridData gridDataSpan2 = DialogUtils.createFillGridData(); - gridDataSpan2.horizontalSpan = 2; - - // fRuleName = new Text (ruleInfoGroup, SWT.NONE); - Group portSelection = new Group(parent, SWT.BORDER); - portSelection.setLayout(new GridLayout(1, false)); - // configL.setLayout(new RowLayout()); - - portSelection.setText(" " + Messages.ConfigurePortDialog_AvailPorts + " "); //$NON-NLS-1$ //$NON-NLS-2$ - portSelection.setLayoutData(gridDataH60); - - fPortList = new TableViewer(portSelection, SWT.BORDER); - fPortList.setLabelProvider(new PortLabelProvider()); - fPortList.setContentProvider(new ArrayContentProvider()); - fPortList.setInput(m_ports.toArray()); - fPortList.getTable().setLayoutData(gridDataH60); - fPortList.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = fPortList.getSelection(); - if (selection instanceof StructuredSelection) { - Object[] selected = ((StructuredSelection) selection) - .toArray(); - if ((selected.length == 1) - && (selected[0] instanceof Port)) { - selectPort((Port) selected[0]); - } - } - } - }); - portSelection.pack(); - - Group instanceConfigurationGroup = new Group(parent, SWT.BORDER); - instanceConfigurationGroup.setText(" " + Messages.ConfigurePortDialog_AvailPorts + " "); //$NON-NLS-1$ //$NON-NLS-2$ - instanceConfigurationGroup.setLayout(new GridLayout(2, false)); - instanceConfigurationGroup.setLayoutData(groupGridData); - - Label kindText = new Label(instanceConfigurationGroup, SWT.NONE); - kindText.setText(Messages.ConfigurePortDialog_Kind + COLON); - - fKindCombo = new Combo(instanceConfigurationGroup, SWT.NONE); - portKindList = getAvailableKinds(m_model); - if (portKindList.size() == 0) { - MessageDialog.openInformation(Display.getDefault().getActiveShell(), "No port kinds founds", "No port kinds are available. Please import a Qompass model library"); - } - String[] portKindStrList = new String[portKindList.size() + 1]; - portKindStrList[0] = Messages.ConfigurePortDialog_None; - for (int i = 0; i < portKindList.size(); i++) { - portKindStrList[i + 1] = portKindList.get(i).getBase_Class().getName(); - } - fKindCombo.setItems(portKindStrList); - fKindCombo.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - // changePortKind - org.eclipse.papyrus.FCM.Port fcmPort = StereotypeUtil.applyApp(m_currentPort, org.eclipse.papyrus.FCM.Port.class); - if (fcmPort != null) - { - int index = fKindCombo.getSelectionIndex(); - if (index > 0) { - PortKind kind = portKindList.get(index - 1); - fcmPort.setKind(kind); - selectPort(m_currentPort); - } - else { - StereotypeUtil.unapply(m_currentPort, org.eclipse.papyrus.FCM.Port.class); - selectPort(m_currentPort); - } - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - Label fTypeLabel = new Label(instanceConfigurationGroup, SWT.NONE); - fTypeLabel.setText(Messages.ConfigurePortDialog_Type + COLON); - fTypeLabel.setLayoutData(gridData); - - fType = new Label(instanceConfigurationGroup, SWT.NONE); - fType.setLayoutData(gridData); - - fTypeButton = new Button(instanceConfigurationGroup, SWT.NONE); - fTypeButton.setText(Messages.ConfigurePortDialog_ChangeType); - fTypeButton.setLayoutData(gridDataH25Span2); - fTypeButton.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - // use Papyrus type selection dialog ... - TreeSelectorDialog tsd = new TreeSelectorDialog(Display.getDefault().getActiveShell()); - - EStructuralFeature feature = UMLPackage.eINSTANCE.getTypedElement_Type(); - ServiceEditFilteredContentProvider contentProvider = - new ServiceEditFilteredContentProvider(m_currentPort, feature, new EObject[] { m_model }); - - EList<EClassifier> wantedMetaClasses = new BasicEList<EClassifier>(); - wantedMetaClasses.add(feature.getEType()); - // creates (indirect) dependency to org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelContentProvider - contentProvider.setWantedMetaclasses(wantedMetaClasses); - contentProvider.setNotWantedMetaclasses(Collections.EMPTY_LIST); - tsd.setContentProvider(contentProvider); - tsd.setLabelProvider(new UMLLabelProvider()); - tsd.open(); - Object result[] = tsd.getResult(); - if ((result != null) && (result.length == 1)) { - // if(result[0] instanceof IAdaptable) { - // Object type = ((IAdaptable)result[0]).getAdapter(EObject.class); - Object type = result[0]; - if (type instanceof Type) { - m_currentPort.setType((Type) type); - selectPort(m_currentPort); - } - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - // Label emptySpace = new Label(instanceConfigurationGroup, SWT.NONE); - // emptySpace.setLayoutData(gridDataSpan2); - - - // Composite derivedInterfaces = new Composite(instanceConfigurationGroup, SWT.NONE); - Group derivedInterfaces = new Group(instanceConfigurationGroup, SWT.NONE); - derivedInterfaces.setLayout(new GridLayout(2, false)); - - // Label dil = new Label(derivedInterfaces, SWT.NONE); - // dil.setText("Interfaces derived from port kind"); - derivedInterfaces.setText(Messages.ConfigurePortDialog_IntfDerived); - // dil.setLayoutData(gridDataSpan2); - derivedInterfaces.setLayoutData(gridDataSpan2); - - Label fProvidedLabel = new Label(derivedInterfaces, SWT.NONE); - fProvidedLabel.setText(Messages.ConfigurePortDialog_Provided + COLON); - fProvided = new Label(derivedInterfaces, SWT.NONE); - fProvided.setLayoutData(gridData); - - Label fRequiredLabel = new Label(derivedInterfaces, SWT.NONE); - fRequiredLabel.setText(Messages.ConfigurePortDialog_Required + COLON); - fRequired = new Label(derivedInterfaces, SWT.NONE); - fRequired.setLayoutData(gridData); - derivedInterfaces.pack(); - - fDescription = new Text(instanceConfigurationGroup, SWT.NONE | SWT.WRAP - | SWT.V_SCROLL | SWT.READ_ONLY); - fDescription.setLayoutData(gridDataH80Span2); - // createMessageArea (ruleInfoGroup); - instanceConfigurationGroup.pack(); - setEnabled(false); - } - - /** - * Select a rule, i.e. update the visual representation from the rule - * - * @param rule - */ - protected void selectPort(Port port) { - m_currentPort = port; - if (port == null) { - setEnabled(false); - return; - } - setEnabled(true); - org.eclipse.papyrus.FCM.Port fcmPort = UMLUtil.getStereotypeApplication(port, org.eclipse.papyrus.FCM.Port.class); - if (port.getType() != null) { - fType.setText(port.getType().getQualifiedName()); - } - else { - fType.setText(Messages.ConfigurePortDialog_Undef); - } - if ((fcmPort != null) && (fcmPort.getKind() != null)) { - PortKind kind = fcmPort.getKind(); - if (portKindList.contains(kind)) { - int index = portKindList.indexOf(kind) + 1; - fKindCombo.select(index); - } - fDescription.setText(Description.getDescription(kind.getBase_Class(), Messages.ConfigurePortDialog_NotAvail)); - Interface providedI = PortUtils.getProvided(port); - Interface requiredI = PortUtils.getRequired(port); - fProvided.setText(providedI != null ? providedI.getQualifiedName() : Messages.ConfigurePortDialog_None); - fRequired.setText(requiredI != null ? requiredI.getQualifiedName() : Messages.ConfigurePortDialog_None); - } - else { - fProvided.setText(port.getProvideds().size() > 0 ? port.getProvideds().get(0).getQualifiedName() : Messages.ConfigurePortDialog_None); - fRequired.setText(port.getRequireds().size() > 0 ? port.getRequireds().get(0).getQualifiedName() : Messages.ConfigurePortDialog_None); - fKindCombo.select(0); - fDescription.setText(""); //$NON-NLS-1$ - } - } - - private void setEnabled(boolean enabled) { - fDescription.setEnabled(enabled); - if (!enabled) { - fDescription.setText(""); //$NON-NLS-1$ - } - } - - protected EList<PortKind> getAvailableKinds(Package pkg) { - EList<PortKind> portKindList = new UniqueEList<PortKind>(); - EList<Package> visitedPackages = new BasicEList<Package>(); - getAvailableKinds(pkg, portKindList, visitedPackages); - return portKindList; - } - - protected void getAvailableKinds(Package pkg, EList<PortKind> portKindList, EList<Package> visitedPackages) { - for (Element el : pkg.getMembers()) { - if (el instanceof Package) { - if (!visitedPackages.contains(el)) { - visitedPackages.add((Package) el); - getAvailableKinds((Package) el, portKindList, visitedPackages); - } - } else if (el instanceof Class) { - PortKind portKind = UMLUtil.getStereotypeApplication(el, PortKind.class); - if (portKind != null) { - portKindList.add(portKind); - } - } - } - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConnectorSelectionDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConnectorSelectionDialog.java deleted file mode 100644 index 1652acc7663..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConnectorSelectionDialog.java +++ /dev/null @@ -1,371 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - - -import java.util.Arrays; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.UniqueEList; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.FCM.InteractionComponent; -import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils; -import org.eclipse.papyrus.qompass.designer.core.Description; -import org.eclipse.papyrus.qompass.designer.core.Log; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.qompass.designer.core.templates.ConnectorBinding; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.AbstractElementListSelectionDialog; -import org.eclipse.ui.dialogs.FilteredList; -import org.eclipse.ui.dialogs.SelectionStatusDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Feature; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Select a connector type and implementation (group) - * TODO: show information about the used connector [usage, implem properties, ...] - * similar help for ports? - * - * @author ansgar - * - */ -public class ConnectorSelectionDialog extends AbstractElementListSelectionDialog { - - protected Package m_model; - - protected EList<Package> visitedPackages; - - protected Text m_description; - - protected Button fTypeOnly; - - private EList<Class> connectorList; - - private Feature m_selectedConnector; - - private Object[] fUpperElements; - - protected FilteredList fUpper; - - protected FilteredList fLower; - - private InteractionComponent initialSelection = null; - - public ConnectorSelectionDialog(Shell parent, Package model, Feature selectedConnector) { - super(parent, new QNameLabelProvider()); - connectorList = new BasicEList<Class>(); - visitedPackages = new BasicEList<Package>(); - getAllConnectors(model, selectedConnector, connectorList); - m_selectedConnector = selectedConnector; - setMultipleSelection(false); - m_model = model; - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - createMessageArea(contents); - // createLabel(contents, "Connector type"); - GridData gridData = DialogUtils.createFillGridData(); - gridData.heightHint = 200; - - Group fUpperGroup = new Group(contents, SWT.NONE); - fUpperGroup.setLayout(new GridLayout()); - fUpperGroup.setLayoutData(gridData); - fUpperGroup.setText(" Abstract interaction components "); //$NON-NLS-1$ - createFilterText(fUpperGroup); - fUpper = createFilteredList(fUpperGroup); - - final Group fLowerGroup = new Group(contents, SWT.NONE); - fLowerGroup.setLayout(new GridLayout()); - fLowerGroup.setLayoutData(gridData); - fLowerGroup.setText(" Realizations/groups of interaction components "); //$NON-NLS-1$ - // createLabel(contents, lowerLabel); - fLower = createFilteredList(fLowerGroup); - fFilteredList = fUpper; - org.eclipse.papyrus.FCM.Connector fcmConnector = UMLUtil.getStereotypeApplication(m_selectedConnector, org.eclipse.papyrus.FCM.Connector.class); - if (fcmConnector != null) { - // getInitialElementSelections(); - initialSelection = fcmConnector.getIc(); - } else { - initialSelection = null; - } - - fTypeOnly = new Button(contents, SWT.CHECK); - fTypeOnly.setText("Select type only"); //$NON-NLS-1$ - SelectionListener fTypeOnlySL = new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - if (fTypeOnly.getSelection()) { - fLower.setEnabled(false); - fLowerGroup.setEnabled(false); - fLower.setSelection(new int[0]); - fLower.setElements(null); - } - else { - fLower.setEnabled(true); - fLowerGroup.setEnabled(true); - handleSelectionChanged(); - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }; - fTypeOnly.addSelectionListener(fTypeOnlySL); - - fUpper.setElements(connectorList.toArray()); - - // create initial selections - if (initialSelection instanceof InteractionComponent) { - InteractionComponent componentComp = initialSelection; - Class componentCompBase = componentComp.getBase_Class(); - if (!componentCompBase.isAbstract()) { - // get first superclass that is a component type - Class componentTypeBase = Utils.componentType(componentCompBase); - componentComp = UMLUtil.getStereotypeApplication(componentTypeBase, InteractionComponent.class); - } else { - // fLower.setEnabled (false); - // fLowerGroup.setEnabled(false); - fTypeOnly.setSelection(true); - } - // update status (listener does not evaluate passed data) - fTypeOnlySL.widgetSelected(null); - - // set initial selections - fUpper.setSelection(new Object[] { componentComp.getBase_Class() }); - } - - Label info = createMessageArea(contents); - info.setText("Information about connector implementation:"); //$NON-NLS-1$ - // m_description = createMessageArea(contents); - - GridData descriptionGD = new GridData(); - descriptionGD.horizontalAlignment = GridData.FILL; - descriptionGD.grabExcessHorizontalSpace = true; - descriptionGD.heightHint = 80; - descriptionGD.grabExcessVerticalSpace = true; - descriptionGD.verticalAlignment = GridData.FILL; - - m_description = new Text(contents, SWT.NONE | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY); - m_description.setLayoutData(descriptionGD); - - fLower.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - Object[] selected = fLower.getSelection(); - if ((selected.length > 0) && (selected[0] instanceof NamedElement)) { - NamedElement selectedNE = (NamedElement) selected[0]; - m_description.setText(Description.getDescription(selectedNE)); - } - else { - m_description.setText(""); - updateOkState(); - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - return contents; - } - - @Override - /** - * Update the enablement of the OK button based on whether or not there - * is a selection. - * - */ - protected void updateOkState() { - if (fTypeOnly.getSelection()) { - super.updateOkState(); - } else { - Button okButton = getOkButton(); - if (okButton != null) { - okButton.setEnabled(fLower.getSelection().length != 0); - } - } - } - - - protected Label createLabel(Composite parent, String name) { - if (name == null) { - return null; - } - Label label = new Label(parent, SWT.NONE); - label.setText(name); - label.setFont(parent.getFont()); - return label; - } - - /** - * Creates a label if name was not <code>null</code>. - * - * @param parent - * the parent composite. - * @param name - * the name of the label. - * @return returns a label if a name was given, <code>null</code> otherwise. - */ - - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - Object[] result = new Object[] { getSelectedElement(fTypeOnly.getSelection()) }; - setResult(Arrays.asList(result)); - } - - /** - * @see AbstractElementListSelectionDialog#handleDefaultSelected() - */ - @Override - protected void handleDefaultSelected() { - if (validateCurrentSelection() && (getSelectedElement(false) != null)) { - buttonPressed(IDialogConstants.OK_ID); - } - } - - /** - * @see AbstractElementListSelectionDialog#handleSelectionChanged() - */ - @Override - protected void handleSelectionChanged() { - handleUpperSelectionChanged(); - } - - private void handleUpperSelectionChanged() { - int index = getSelectionIndex(); - if (index >= 0) { - fUpperElements = getFoldedElements(index); - - if ((fUpperElements == null) || fTypeOnly.getSelection()) { - // lower list remains empty, if typeOnly is true - fLower.setElements(new Object[] {}); - } else { - fLower.setElements(getLowerList(fUpperElements[0])); - if (initialSelection instanceof InteractionComponent) { - // select existing selection in lower section - fLower.setSelection(new Object[] { initialSelection }); - // do not try to set it again. - initialSelection = null; - } - } - } - validateCurrentSelection(); - } - - /** - * Returns the selected element from the upper or lower pane. - * - * @return Object - */ - protected Object getSelectedElement(boolean upper) { - Object[] selection; - if (upper) { - selection = fFilteredList.getSelection(); - } else { - selection = fLower.getSelection(); - } - if (selection.length > 0) { - return selection[0]; - } - return null; - } - - protected Object[] getLowerList(Object selectedUpperObj) { - EList<Class> connectorList = new UniqueEList<Class>(); - if (selectedUpperObj instanceof Class) { - visitedPackages = new BasicEList<Package>(); - getImplGroups(m_model, (Class) selectedUpperObj, connectorList); - } - return connectorList.toArray(); - } - - void getAllConnectors(Package pkg, Feature selectedConnector, EList<Class> connectorList) { - for (Element el : pkg.getMembers()) { - if (el instanceof Package) { - if (!visitedPackages.contains(el)) { - visitedPackages.add((Package) el); - getAllConnectors((Package) el, selectedConnector, connectorList); - } - } else if (el instanceof Class) { - if (StereotypeUtil.isApplied(el, InteractionComponent.class) && Utils.isCompType((Class) el)) { - - if (selectedConnector == null) { - connectorList.add((Class) el); - } else { - try { - Element owner = selectedConnector.getOwner(); - if (owner instanceof Class) { - Class composite = (Class) owner; - Log.log(IStatus.INFO, Log.DIALOGS, "ConnectorSelectionDialog.getAllConnectors: try to bind connector " + //$NON-NLS-1$ - ((Class) el).getQualifiedName()); - ConnectorBinding.obtainBinding(composite, selectedConnector, (Class) el, false); - connectorList.add((Class) el); - } else { - connectorList.add((Class) el); - } - } catch (TransformationException e) { - // silently ignore exception: it is normal that we cannot find a binding for some connectors - } - } - } - } - } - } - - void getImplGroups(Package pkg, Class selectedConnType, EList<Class> implGroupList) { - for (Element el : pkg.getMembers()) { - if (el instanceof Package) { - if (!visitedPackages.contains(el)) { - visitedPackages.add((Package) el); - getImplGroups((Package) el, selectedConnType, implGroupList); - } - } else if (el instanceof Class) { - Class class_ = (Class) el; - if (class_.getGeneralization(selectedConnType) != null) { - implGroupList.add((Class) el); - } - } - } - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ContainerDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ContainerDialog.java deleted file mode 100644 index 32a4bc5881d..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ContainerDialog.java +++ /dev/null @@ -1,309 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.viewers.ArrayContentProvider; -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.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.FCM.ContainerRule; -import org.eclipse.papyrus.FCM.RuleApplication; -import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils; -import org.eclipse.papyrus.qompass.designer.core.Description; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.SWT; -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.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.SelectionStatusDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Select container rules, either from a list of globally defined rules - * or from local rules which may be created "on the fly" by this dialog. - * - * TODO: extend rule application to instances (problematic, since rules transformation - * is done on type level) - * - */ -public class ContainerDialog extends SelectionStatusDialog { - - protected Class m_component; - - // protected EList<Package> visitedPackages; - protected Text fDescription; - - // protected FilteredList fRules; - protected CheckboxTableViewer fRules; - - // protected Combo fInterceptionKind; - - // protected Button fInterButton; - - // protected Label fPortLabel; - // protected Text fRuleName; - // protected Button fOptionButton; - - // protected Button fPortButton; - - protected ContainerRule m_currentRule; - - protected Package m_model; - - protected boolean m_rulePropertiesOnly; - - public ContainerDialog(Shell parent, Class componentOrRule) { - super(parent); - // visitedPackages = new BasicEList<Package> (); - m_rulePropertiesOnly = StereotypeUtil.isApplied(componentOrRule, ContainerRule.class); - if (m_rulePropertiesOnly) { - // m_currentRule = UMLUtil.getStereotypeApplication(componentOrRule, ContainerRule.class); - } else { - m_component = componentOrRule; - } - m_model = PackageUtil.getRootPackage(componentOrRule); - } - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - // nothing to do - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - // (parent, "Container rules", "Avail. extensions/interceptors"); - - if (m_rulePropertiesOnly) { - createRuleInfoGroup(contents); - selectRule(m_currentRule); - } else { - createRuleSelectionGroup(contents); - createRuleInfoGroup(contents); - } - return contents; - } - - protected void createRuleSelectionGroup(Composite parent) { - Composite ruleSelections = new Composite(parent, SWT.NONE); - GridLayout grid = new GridLayout(1, true); - GridData groupGridData = new GridData(); - // data3.widthHint = 400; - // data3.heightHint = 300; - groupGridData.grabExcessVerticalSpace = true; - groupGridData.grabExcessHorizontalSpace = true; - groupGridData.horizontalAlignment = GridData.FILL; - groupGridData.verticalAlignment = GridData.FILL; - ruleSelections.setLayout(grid); - ruleSelections.setLayoutData(groupGridData); - ruleSelections.setSize(400, 300); - - /* - * fRules = DialogUtils.createFilteredList (ruleSelGroup, new RuleLabelProvider(), 200, 200, - * SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - */ - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 150; - data.widthHint = 200; - - ICheckStateListener checkListener = new ICheckStateListener() { - - @Override - public void checkStateChanged(CheckStateChangedEvent event) { - Object obj = event.getElement(); - if (obj instanceof ContainerRule) { - ContainerRule rule = (ContainerRule) obj; - if (event.getChecked()) { - applyRule(rule); - } - else { - unapplyRule(rule); - } - } - } - }; - - // - // --------------- global rules ------------------- - // - Group gRuleSelGroup = new Group(ruleSelections, SWT.BORDER); - gRuleSelGroup.setText(" available rules "); - // ruleGroup.setLayout(new RowLayout (SWT.VERTICAL)); - gRuleSelGroup.setLayout(new GridLayout(1, false)); - gRuleSelGroup.setLayoutData(groupGridData); - - EList<ContainerRule> globalRuleList = Utils.getAllRules(m_model); - // Table table = new Table(gRuleSelGroup, SWT.CHECK); - fRules = CheckboxTableViewer.newCheckList(gRuleSelGroup, SWT.BORDER); - // fRules = new CheckboxTableViewer(table); - - - GridData data2 = new GridData(GridData.FILL_BOTH); - data2.heightHint = 200; - // data.widthHint = 200; - fRules.getTable().setLayoutData(data); - fRules.setLabelProvider(new RuleLabelProvider()); - fRules.setContentProvider(new ArrayContentProvider()); - - fRules.setInput(globalRuleList.toArray()); - for (ContainerRule rule : globalRuleList) { - if (isRuleApplied(rule)) { - fRules.setChecked(rule, true); - } - } - fRules.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = fRules.getSelection(); - if (selection instanceof StructuredSelection) { - Object[] selected = ((StructuredSelection) selection).toArray(); - if ((selected.length == 1) && (selected[0] instanceof ContainerRule)) { - if (m_currentRule != selected[0]) { - selectRule((ContainerRule) selected[0]); - } - } - } - } - }); - fRules.addCheckStateListener(checkListener); - } - - protected void createRuleInfoGroup(Composite parent) { - GridData groupGridData = DialogUtils.createFillGridData(); - // data3.widthHint = 400; - // data3.heightHint = 300; - - Group ruleInfoGroup = new Group(parent, SWT.BORDER); - ruleInfoGroup.setText(" rule information "); - // ruleGroup.setLayout(new RowLayout (SWT.VERTICAL)); - ruleInfoGroup.setLayout(new GridLayout(2, false)); - ruleInfoGroup.setLayoutData(groupGridData); - - GridData span2 = new GridData(); - span2.horizontalSpan = 2; - span2.horizontalAlignment = GridData.FILL; - span2.grabExcessHorizontalSpace = true; - span2.grabExcessVerticalSpace = true; - span2.verticalAlignment = GridData.FILL; - span2.heightHint = 80; - - - fDescription = new Text(ruleInfoGroup, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY); - fDescription.setLayoutData(span2); - // createMessageArea (ruleInfoGroup); - ruleInfoGroup.pack(); - // fPortLabel = new Label (ruleInfoGroup, SWT.NONE); - // fPortLabel.setText ("for Ports"); - // fPortLabel.setEnabled (false); - } - - /** - * Select a rule, i.e. update the visual representation from the rule - * - * @param rule - */ - protected void selectRule(ContainerRule rule) { - m_currentRule = rule; - fDescription.setText(Description.getDescription(rule.getBase_Class())); - } - - /** - * Helper: add a local container rule to the current class - * - * @param name - * the name of the local rule - * @return - */ - ContainerRule addRule(String name) { - Class ruleCl = (Class) - m_component.createNestedClassifier(name, UMLPackage.eINSTANCE.getClass_()); - StereotypeUtil.apply(ruleCl, ContainerRule.class); - return UMLUtil.getStereotypeApplication(ruleCl, ContainerRule.class); - } - - /** - * Helper function: delete a container rule from a class - * - * @param rule - */ - void deleteRule(ContainerRule rule) { - Classifier ruleCl = m_component.getNestedClassifier(rule.getBase_Class().getName()); - if (ruleCl instanceof Class) { - ruleCl.destroy(); - } - } - - /** - * Helper: apply a container rule to current component - * - * @param rule - */ - void applyRule(ContainerRule rule) { - if (!StereotypeUtil.isApplied(m_component, RuleApplication.class)) { - StereotypeUtil.apply(m_component, RuleApplication.class); - } - RuleApplication containerConfig = - UMLUtil.getStereotypeApplication(m_component, RuleApplication.class); - containerConfig.getContainerRule().add(rule); - } - - /** - * Helper: apply a container rule to current component - * - * @param rule - */ - void unapplyRule(ContainerRule rule) { - RuleApplication containerConfig = - UMLUtil.getStereotypeApplication(m_component, RuleApplication.class); - int index = containerConfig.getContainerRule().indexOf(rule); - if ((index >= 0) && (index < containerConfig.getContainerRule().size())) { - containerConfig.getContainerRule().remove(index); - } - } - - /** - * check whether a container rule is applied - * h * @param rule - * - * @return true, if container rule is applied - */ - boolean isRuleApplied(ContainerRule rule) { - RuleApplication containerConfig = - UMLUtil.getStereotypeApplication(m_component, RuleApplication.class); - if (containerConfig != null) { - return containerConfig.getContainerRule().contains(rule); - } - return false; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/GenerationOptionsDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/GenerationOptionsDialog.java deleted file mode 100644 index fd6fc3d2116..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/GenerationOptionsDialog.java +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import java.util.Arrays; - -import org.eclipse.papyrus.qompass.designer.core.generate.GenerationOptions; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.SelectionStatusDialog; - -/** - * Select options for code generation. - * - * @author ansgar - */ -public class GenerationOptionsDialog extends SelectionStatusDialog implements GenerationOptions { - - protected Button fButtonModelOnly; - - protected Button fButtonRewriteSettings; - - protected Button fButtonOnlyChanged; - - protected Button fButtonCACOnly; - - public static int oldResultInt = 0; - - public GenerationOptionsDialog(Shell parent) { - super(parent); - } - - /** - * @see SelectionStatusDialog#computeResult() - */ - @Override - protected void computeResult() { - int resultInt = (isRewriteSettings() ? REWRITE_SETTINGS : 0) + - (isOnlyChanged() ? ONLY_CHANGED : 0) + - (isModelOnly() ? MODEL_ONLY : 0) + - (isCACOnly() ? CAC_ONLY : 0); - oldResultInt = resultInt; - Object[] result = new Object[] { - resultInt - }; - setResult(Arrays.asList(result)); - } - - @Override - public Control createDialogArea(Composite parent) { - Composite contents = (Composite) super.createDialogArea(parent); - // (parent, "Container rules", "Avail. extensions/interceptors"); - - fButtonCACOnly = new Button(contents, SWT.CHECK); - fButtonCACOnly.setText("Only perform container and connector expansion (intermediate model without code generation)"); - fButtonCACOnly.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - updateButtonEnableStatus(); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - fButtonCACOnly.setSelection((oldResultInt & CAC_ONLY) != 0); - - fButtonModelOnly = new Button(contents, SWT.CHECK); - fButtonModelOnly.setText("Only generate model (not code)"); - fButtonModelOnly.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(SelectionEvent e) { - // only write types that have changed does not make sense, if the whole directory is cleaned - boolean modelOnly = fButtonModelOnly.getSelection(); - fButtonOnlyChanged.setEnabled(!modelOnly); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - fButtonModelOnly.setSelection((oldResultInt & MODEL_ONLY) != 0); - - fButtonRewriteSettings = new Button(contents, SWT.CHECK); - fButtonRewriteSettings.setText("Rewrite project settings, if project exists already (may overwrite user settings)"); - fButtonRewriteSettings.setSelection((oldResultInt & REWRITE_SETTINGS) != 0); - - fButtonOnlyChanged = new Button(contents, SWT.CHECK); - fButtonOnlyChanged.setText("Experimental: only write types that have changed (based on a difference model via EMF compare)"); - fButtonOnlyChanged.setSelection((oldResultInt & ONLY_CHANGED) != 0); - - updateButtonEnableStatus(); - return contents; - } - - protected void updateButtonEnableStatus() { - boolean onlyCAC = fButtonCACOnly.getSelection(); - boolean modelOnly = fButtonModelOnly.getSelection(); - fButtonModelOnly.setEnabled(!onlyCAC); - fButtonOnlyChanged.setEnabled(!modelOnly && !onlyCAC); - fButtonRewriteSettings.setEnabled(!onlyCAC); - } - - public boolean isRewriteSettings() { - return fButtonRewriteSettings.getSelection(); - } - - public boolean isOnlyChanged() { - return fButtonOnlyChanged.getSelection(); - } - - public boolean isModelOnly() { - return fButtonModelOnly.getSelection(); - } - - public boolean isCACOnly() { - return fButtonCACOnly.getSelection(); - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InstanceLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InstanceLabelProvider.java deleted file mode 100644 index 72ed1a737f8..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InstanceLabelProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.NamedElement; - -public class InstanceLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - if (element instanceof NamedElement) { - String instanceName = ((NamedElement) element).getName(); - Element owner = ((Element) element).getOwner(); - if (owner instanceof NamedElement) { - return "Plan " + ((NamedElement) owner).getName() + ": " + instanceName; - } - else { - return instanceName; - } - } - else { - return "not a named element"; - } - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InteractiveImplementationChooser.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InteractiveImplementationChooser.java deleted file mode 100644 index bfdcf2d7040..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/InteractiveImplementationChooser.java +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.papyrus.qompass.designer.core.deployment.ImplementationChooser; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; - -public class InteractiveImplementationChooser implements ImplementationChooser { - - @Override - public Class chooseImplementation(Class componentType, EList<Class> implList) { - // SelectionDialog = SelectionDialog. - ILabelProvider ilabel = new LabelProvider() { - - @Override - public String getText(Object element) { - return ((NamedElement) element).getQualifiedName(); - } - }; - ElementListSelectionDialog dialog = - new ElementListSelectionDialog(Display.getDefault().getActiveShell(), ilabel); - - dialog.setTitle("Multiple implementations found"); - dialog.setMessage("Select an implementation for component type " + componentType.getName()); - - dialog.setElements(implList.toArray()); - - dialog.open(); - Object[] selection = dialog.getResult(); - if (selection.length == 1) { - if (selection[0] instanceof Class) { - return (Class) selection[0]; - } - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/NameLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/NameLabelProvider.java deleted file mode 100644 index fcf8a51c82c..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/NameLabelProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.uml2.uml.NamedElement; - -public class NameLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - return ((NamedElement) element).getName(); - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/PortLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/PortLabelProvider.java deleted file mode 100644 index b94bcf1bfca..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/PortLabelProvider.java +++ /dev/null @@ -1,80 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Port; - -/** - * A label provider for either UML or FCM ports - * - * @author ansgar - * - */ -public class PortLabelProvider extends LabelProvider implements ITableLabelProvider { - - /** - * small helper function: simply retrieval of port (element might be either a port or an FCM port) - * - * @param element - * @return - */ - private Port getUMLport(Object element) { - if (element instanceof org.eclipse.papyrus.FCM.Port) { - org.eclipse.papyrus.FCM.Port port = (org.eclipse.papyrus.FCM.Port) element; - if (port != null) { - return port.getBase_Port(); - } - } else if (element instanceof Port) { - return (Port) element; - } - return null; - } - - @Override - public String getText(Object element) { - Port umlPort = getUMLport(element); - if (umlPort != null) { - return umlPort.getName(); - } - return ""; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - @Override - public String getColumnText(Object element, int columnIndex) { - if (columnIndex == 0) { - return getText(element); - } else if (columnIndex == 1) { - Port umlPort = getUMLport(element); - if (umlPort != null) { - return umlPort.getType().getName(); - } - } - return ""; - } - - @Override - public Image getColumnImage(Object element, int columnIndex) { - // TODO Auto-generated method stub - return null; - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/QNameLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/QNameLabelProvider.java deleted file mode 100644 index 0bc904fc210..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/QNameLabelProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.uml2.uml.NamedElement; - -public class QNameLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - return ((NamedElement) element).getQualifiedName(); - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/RuleLabelProvider.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/RuleLabelProvider.java deleted file mode 100644 index 853eaa092b7..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/RuleLabelProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.dialogs; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.papyrus.FCM.ContainerRule; - -/** - * Return a label for ContainerRules. Since the name of the rule itself, is not - * really interesting for the user, the returned name is based on the interceptor - * (or extension) - * - * @author ansgar - * - */ -public class RuleLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - if (element instanceof ContainerRule) { - ContainerRule rule = (ContainerRule) element; - // TODO? Add information about contained parts? - return rule.getBase_Class().getName(); - } - return null; - } -}; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AddProfileAndModelLibsHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AddProfileAndModelLibsHandler.java deleted file mode 100644 index 588f0bc84de..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AddProfileAndModelLibsHandler.java +++ /dev/null @@ -1,92 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
-package org.eclipse.papyrus.qompass.designer.ui.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.qompass.designer.core.CommandSupport;
-import org.eclipse.papyrus.qompass.designer.core.commands.AddMarteAndFcmProfile;
-import org.eclipse.papyrus.qompass.designer.core.commands.AddQompassModelLibs;
-import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageImport;
-
-/**
- * This class adds the FCM profile, parts of the MARTE profile and required package imports to your model.
- */
-public class AddProfileAndModelLibsHandler extends CmdHandler {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isEnabled() {
- updateSelectedEObject();
- if (selectedEObject instanceof Package) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (!(selectedEObject instanceof Package)) {
- return null;
- }
- final Package selectedPkg = (Package) selectedEObject;
-
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(selectedPkg);
- AddMarteAndFcmProfile addProfiles = new AddMarteAndFcmProfile(selectedPkg,
- AddMarteAndFcmProfile.APPLY_FCM | AddMarteAndFcmProfile.APPLY_ALLOC | AddMarteAndFcmProfile.APPLY_HLAM_GCM,
- domain);
- AddQompassModelLibs addModelLibs = new AddQompassModelLibs(selectedPkg, domain);
-
- final ListSelectionDialog dialog = new ListSelectionDialog(Display.getDefault().getActiveShell(),
- addModelLibs.getAvailableImportPackages().toArray(),
- new ArrayContentProvider(),
- new LabelProvider() {
-
- @Override
- public String getText(Object pi) {
- return ((PackageImport) pi).getImportedPackage().getName();
- }
- },
- "Select Qompass model libraries for package import.\n" + //$NON-NLS-1$
- "Libraries that are already imported, are selected. Please note that additional\n" + //$NON-NLS-1$
- "Qompass model library might be loaded with the standard \"import registered library\" option\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "Pressing \"Ok\" will continue with the application of the FCM profile and (parts of) the MARTE profile\n");//$NON-NLS-1$
-
- dialog.setTitle("Select import library"); //$NON-NLS-1$
- dialog.setInitialElementSelections(addModelLibs.getAlreadyImportedPackages());
- // dialog.setElements (list.toArray ());
- int result = dialog.open();
- if (result == IDialogConstants.OK_ID) {
- addModelLibs.setImportList(dialog.getResult());
- CommandSupport.exec(addModelLibs);
- CommandSupport.exec(addProfiles);
- // open dialog?
- // MessageDialog.openWarning(Display.getDefault().getActiveShell(),
- // "Warning", "The MARTE profile is not available."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return null;
- }
-}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AllocateHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AllocateHandler.java deleted file mode 100644 index dd517e153c9..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/AllocateHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * All rights reserved. This program and the accompanying materials - * are property of the CEA, their use is subject to specific agreement - * with the CEA. - * - * Contributors: - * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.FCM.DeploymentPlan; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.AllocationDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; - -/** - * Implementation class for ClassAction action - */ -public class AllocateHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if (selectedEObject instanceof Package) { - return (StereotypeUtil.isApplied((Package) selectedEObject, DeploymentPlan.class)); - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) - throws ExecutionException { - if (!(selectedEObject instanceof Package)) { - return null; - } - - final Package cdp = (Package) selectedEObject; - final Shell shell = Display.getDefault().getActiveShell(); - - // org.eclipse.papyrus.qompass.designer.vsl.ParseVSL.test(); - if (DepUtils.getMainInstance(cdp) == null) { - MessageDialog.openInformation(shell, "Error", - "Deployment plan has no main instance (check stereotype attribute mainInstance)"); - return null; - } - - // 1. select possible connectors according to port types - // (only show compatible connectors check-box?) - // 2. select implementation group according to connector type - - // container dialog: either extension, rule or interceptor - // howto select? which? (and howto add/remove?) - Std - dialog is good? - CommandSupport.exec("Instance allocation", event, new RunnableWithResult() { - - @Override - public CommandResult run() { - AllocationDialog allocDialog = - new AllocationDialog(shell, cdp); - allocDialog.setTitle("Allocate instances"); - allocDialog.open(); - if (allocDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - else { - return CommandResult.newCancelledCommandResult(); - } - } - }); - - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigureInstanceHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigureInstanceHandler.java deleted file mode 100644 index 969ecd1d367..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigureInstanceHandler.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * All rights reserved. This program and the accompanying materials - * are property of the CEA, their use is subject to specific agreement - * with the CEA. - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.ConfigureInstanceDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.Feature; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Property; - -/** - * Implementation class for ClassAction action - */ -public class ConfigureInstanceHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Class) || - (selectedEObject instanceof Connector) || - (selectedEObject instanceof Property) || - (selectedEObject instanceof InstanceSpecification)) { - return true; - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (!(selectedEObject instanceof NamedElement)) { - return null; - } - - final NamedElement element = (NamedElement) selectedEObject; - final Shell shell = Display.getDefault().getActiveShell(); - final ExecutionEvent from = event; - - // 1. select possible connectors according to port types - // (only show compatible connectors check-box?) - // 2. select implementation group according to connector type - - if (element instanceof Class) { - // container dialog: either extension, rule or interceptor - // how-to select? which? (and how-to add/remove?) - is standard dialog sufficient? - CommandSupport.exec("Configure associated component instance", event, new RunnableWithResult() { //$NON-NLS-1$ - - @Override - public CommandResult run() { - ConfigureInstanceDialog configureInstanceDialog = - new ConfigureInstanceDialog(shell); - if (configureInstanceDialog.init((Class) element, from)) { - configureInstanceDialog.setTitle("Configure instance"); //$NON-NLS-1$ - configureInstanceDialog.setMessage("Configure instance for component " + element.getName()); //$NON-NLS-1$ - configureInstanceDialog.open(); - if (configureInstanceDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - } - return CommandResult.newCancelledCommandResult(); - } - }); - } else if (element instanceof Feature) { - CommandSupport.exec("Configure associated instance", event, new RunnableWithResult() { //$NON-NLS-1$ - - @Override - public CommandResult run() { - ConfigureInstanceDialog configureInstanceDialog = - new ConfigureInstanceDialog(shell); - if (configureInstanceDialog.init((Feature) element, from)) { - configureInstanceDialog.setTitle("Configure instance"); //$NON-NLS-1$ - configureInstanceDialog.setMessage("Configure instance for property/connector " + element.getName()); //$NON-NLS-1$ - configureInstanceDialog.open(); - if (configureInstanceDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - } - return CommandResult.newCancelledCommandResult(); - } - }); - - - } else if (element instanceof InstanceSpecification) { - - CommandSupport.exec("Configure instance", event, new RunnableWithResult() { //$NON-NLS-1$ - - @Override - public CommandResult run() { - ConfigureInstanceDialog configureInstanceDialog = - new ConfigureInstanceDialog(shell); - if (configureInstanceDialog.init((InstanceSpecification) element, from)) { - configureInstanceDialog.setMessage("Configure instance " + element.getName()); //$NON-NLS-1$ - configureInstanceDialog.open(); - if (configureInstanceDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - } - return CommandResult.newCancelledCommandResult(); - } - }); - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigurePortHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigurePortHandler.java deleted file mode 100644 index 3dcbc83e054..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/ConfigurePortHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * All rights reserved. This program and the accompanying materials - * are property of the CEA, their use is subject to specific agreement - * with the CEA. - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.ui.Messages; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.ConfigurePortDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Port; - -/** - * Implementation class for ClassAction action - */ -public class ConfigurePortHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Class) || - (selectedEObject instanceof Port)) { - return true; - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (!(selectedEObject instanceof NamedElement)) { - return null; - } - - final NamedElement element = (NamedElement) selectedEObject; - final Shell shell = Display.getDefault().getActiveShell(); - - // 1. select possible connectors according to port types - // (only show compatible connectors check-box?) - // 2. select implementation group according to connector type - - if (element instanceof Class) { - CommandSupport.exec(Messages.ConfigurePortHandler_ConfigurePorts, event, new RunnableWithResult() { - - @Override - public CommandResult run() { - ConfigurePortDialog configurePortDialog = - new ConfigurePortDialog(shell); - if (configurePortDialog.init((Class) element)) { - configurePortDialog.setTitle(Messages.ConfigurePortHandler_ConfigurePorts); - configurePortDialog.setMessage(Messages.ConfigurePortHandler_ConfigurePortsOfComponent + " " + element.getName()); //$NON-NLS-1$ - configurePortDialog.open(); - if (configurePortDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - } - return CommandResult.newCancelledCommandResult(); - } - }); - } else if (element instanceof Port) { - CommandSupport.exec(Messages.ConfigurePortHandler_ConfigurePorts, event, new RunnableWithResult() { - - @Override - public CommandResult run() { - ConfigurePortDialog configurePortDialog = - new ConfigurePortDialog(shell); - if (configurePortDialog.init((Port) element)) { - configurePortDialog.setTitle(Messages.ConfigurePortHandler_ConfigurePorts); - configurePortDialog.setMessage(Messages.ConfigurePortHandler_ConfigurePorts + " " + element.getName()); //$NON-NLS-1$ - configurePortDialog.open(); - if (configurePortDialog.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - } - return CommandResult.newCancelledCommandResult(); - } - }); - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreateDepPlanHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreateDepPlanHandler.java deleted file mode 100644 index 6ff9c26c533..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreateDepPlanHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils; -import org.eclipse.papyrus.qompass.designer.core.deployment.DeployConstants; -import org.eclipse.papyrus.qompass.designer.core.sync.DepPlanSync; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException; -import org.eclipse.papyrus.qompass.designer.ui.Messages; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Stereotype; - -public class CreateDepPlanHandler extends CmdHandler { - - private Package depPlans; - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Class) && Utils.isCompImpl((Class) selectedEObject)) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (!(selectedEObject instanceof Class)) { - return null; - } - final Class selectedComposite = (Class) selectedEObject; - - CommandSupport.exec(Messages.CreateDepPlanHandler_CreateDPs, event, new Runnable() { - - @Override - public void run() { - // execute with transaction support - depPlans = DepPlanUtils.getDepPlanRoot(selectedComposite); - } - }); - - try { - String name = selectedComposite.getName() + DeployConstants.DepPlanPostfix; - if (depPlans.getMember(name) != null) { - Shell shell = Display.getDefault().getActiveShell(); - String dialogButtonLabels[] = new String[] { - Messages.CreateDepPlanHandler_Cancel, - Messages.CreateDepPlanHandler_Sync, - Messages.CreateDepPlanHandler_CreateNew - }; - MessageDialog dialog = new MessageDialog(shell, Messages.CreateDepPlanHandler_WhatShouldIDo, null, - String.format(Messages.CreateDepPlanHandler_DPwithNameExistsAlready, name), - MessageDialog.QUESTION, dialogButtonLabels, 0); - int result = dialog.open(); - if (result == 0) { - return null; - } - else if (result == 1) { - NamedElement existing = depPlans.getMember(name); - if (existing instanceof Package) { - DepPlanSync.syncDepPlan((Package) existing); - } - else { - MessageDialog.openError(shell, Messages.CreateDepPlanHandler_CannotSync, - String.format(Messages.CreateDepPlanHandler_DPwithNameExistsNoPackage, name)); - } - } - else { - for (int i = 2;; i++) { - name = selectedComposite.getName() + DeployConstants.DepPlanPostfix + i; - if (depPlans.getMember(name) == null) { - break; - } - } - - } - } - final String depPlanName = name; - - CommandSupport.exec(Messages.CreateDepPlanHandler_CreateDP, event, new RunnableWithResult() { - - @Override - public CommandResult run() { - Package cdp = depPlans.createNestedPackage(depPlanName); - Stereotype st = StereotypeUtil.apply(cdp, org.eclipse.papyrus.FCM.DeploymentPlan.class); - if (st == null) { - MessageDialog.openInformation(Display.getDefault().getActiveShell(), - Messages.CreateDepPlanHandler_CannotCreateDP, - Messages.CreateDepPlanHandler_StereoApplicationFailed); - return CommandResult.newErrorCommandResult(Messages.CreateDepPlanHandler_CannotCreateDP); - } - try { - InstanceSpecification newRootIS = - DepCreation.createDepPlan(cdp, selectedComposite, DeployConstants.MAIN_INSTANCE, true); - DepCreation.initAutoValues(newRootIS); - return CommandResult.newOKCommandResult(); - } - catch (TransformationException e) { - MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.CreateDepPlanHandler_CannotCreateDP, - e.getMessage()); - return CommandResult.newErrorCommandResult(e.getMessage()); - } - } - }); - - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreatePlatformHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreatePlatformHandler.java deleted file mode 100644 index 22dc6281a47..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/CreatePlatformHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation; -import org.eclipse.papyrus.qompass.designer.core.deployment.DeployConstants; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationRTException; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Package; - -public class CreatePlatformHandler extends CmdHandler { - - private Package platform; - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if (selectedEObject instanceof Class) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (!(selectedEObject instanceof Class)) { - return null; - } - final Class selectedComposite = (Class) selectedEObject; - - CommandSupport.exec("Create platform model", event, new Runnable() { //$NON-NLS-1$ - - @Override - public void run() { - // execute with transaction support - platform = Utils.getRoot(selectedComposite, DeployConstants.depPlanFolderHw); - } - }); - - final String newPlatform = selectedComposite.getName() + DeployConstants.DepPlanPostfixHw; - - try { - if (platform.getMember(newPlatform) != null) { - Shell shell = Display.getDefault().getActiveShell(); - MessageDialog.openInformation(shell, "Error", //$NON-NLS-1$ - "Platform definition \"" + newPlatform + "\" exists already"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - CommandSupport.exec("Create platform definition", event, new Runnable() { //$NON-NLS-1$ - - @Override - public void run() { - Package platformPkg = platform.createNestedPackage(newPlatform); - try { - DepCreation.createPlatformInstances(platformPkg, selectedComposite, null); - } - catch (TransformationException e) { - throw new TransformationRTException(e.getMessage()); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenCollaborationUseHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenCollaborationUseHandler.java deleted file mode 100644 index 614bc5b139e..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenCollaborationUseHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.action.IAction; -import org.eclipse.papyrus.FCM.Connector; -import org.eclipse.papyrus.FCM.util.FCMUtil; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * TODO: for testing, currently unused - */ -@Deprecated -public class GenCollaborationUseHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - return null; - } - - /** - * /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - updateSelectedEObject(); - - org.eclipse.uml2.uml.Connector selectedConnector = (org.eclipse.uml2.uml.Connector) selectedEObject; - Connector fcmConn = UMLUtil.getStereotypeApplication(selectedConnector, Connector.class); - FCMUtil.generateCollaborationUse(fcmConn); - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenConnectionPatternHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenConnectionPatternHandler.java deleted file mode 100644 index 5b56d15f739..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/GenConnectionPatternHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.action.IAction; -import org.eclipse.papyrus.FCM.InteractionComponent; -import org.eclipse.papyrus.FCM.util.FCMUtil; -import org.eclipse.papyrus.qompass.designer.core.Log; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.ui.IViewPart; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * TODO: for testing, currently unused - */ -@Deprecated -public class GenConnectionPatternHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - return null; - } - - /** - * (non-Javadoc) - * - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - } - - /** - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - // only one model is selected - Class selectedClass = (Class) selectedEObject; - Log.log(IStatus.INFO, Log.DIALOGS, "GenConnectionPattern.run: " + selectedClass.getName()); - InteractionComponent connType = UMLUtil.getStereotypeApplication(selectedClass, InteractionComponent.class); - FCMUtil.generateDefaultConnectionPattern(connType); - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java deleted file mode 100644 index 0c16e370d42..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.FCM.Configuration; -import org.eclipse.papyrus.qompass.designer.core.ProjectManagement; -import org.eclipse.papyrus.qompass.designer.core.transformations.InstantiateDepPlan; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.GenerationOptionsDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * handler for instantiating a deployment plan - */ -public class InstantiateDepPlanHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Package) || (selectedEObject instanceof Class)) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // only one model is selected - selectedCDP = null; - if ((selectedEObject instanceof Package) || (selectedEObject instanceof Class)) { - selectedCDP = (NamedElement) selectedEObject; - } else { - return null; - } - project = ProjectManagement.getCurrentProject(); - - GenerationOptionsDialog optionsDialog = new GenerationOptionsDialog(Display.getDefault().getActiveShell()); - optionsDialog.open(); - if (optionsDialog.getReturnCode() == IDialogConstants.OK_ID) { - - final int genOptions = (Integer) optionsDialog.getResult()[0]; - Job job = new Job("Create deployment model (OO)") { - - @Override - protected IStatus run(IProgressMonitor monitor) { - // execute the task ... - if (selectedCDP instanceof Package) { - new InstantiateDepPlan().instantiate((Package) selectedCDP, monitor, project, genOptions); - } else if (StereotypeUtil.isApplied(selectedCDP, Configuration.class)) { - Configuration configuration = UMLUtil.getStereotypeApplication(selectedCDP, Configuration.class); - new InstantiateDepPlan().instantiate(configuration, monitor, project, genOptions); - } - return Status.OK_STATUS; - } - }; - job.setUser(true); - job.schedule(); - } - - return null; - } - - private NamedElement selectedCDP; - - private IProject project; -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectConnectorHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectConnectorHandler.java deleted file mode 100644 index 0dc3eb1607f..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectConnectorHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * All rights reserved. This program and the accompanying materials - * are property of the CEA, their use is subject to specific agreement - * with the CEA. - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.FCM.InteractionComponent; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.ConnectorSelectionDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.Feature; -import org.eclipse.uml2.uml.Model; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Implementation class for ClassAction action - */ -public class SelectConnectorHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Connector) || (selectedEObject instanceof Property)) { - return true; - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // feature is a common superclass of Connector and Property - if (!(selectedEObject instanceof Feature)) { - return null; - } - // get selected connector - final Feature selectedFeature = (Feature) selectedEObject; - Shell shell = Display.getDefault().getActiveShell(); - - // 1. select possible connectors according to port types - // (only show compatible connectors check-box?) - // 2. select implementation group according to connector type - - Model model = selectedFeature.getModel(); - - ConnectorSelectionDialog elementSelector = - new ConnectorSelectionDialog(shell, model, selectedFeature); - elementSelector.setTitle("Select connector"); - elementSelector.setMessage("Select an implementation for connector " + selectedFeature.getName()); - elementSelector.open(); - if (elementSelector.getReturnCode() == IDialogConstants.OK_ID) { - final Object[] result = elementSelector.getResult(); - if ((result.length == 1) && (result[0] instanceof Class)) { - CommandSupport.exec("Select connector", event, new Runnable() { - - @Override - public void run() { - org.eclipse.papyrus.FCM.Connector fcmSelectedConnector = StereotypeUtil.applyApp(selectedFeature, org.eclipse.papyrus.FCM.Connector.class); - InteractionComponent newConnType = UMLUtil.getStereotypeApplication((Class) result[0], InteractionComponent.class); - fcmSelectedConnector.setIc(newConnType); - } - }); - } - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectContainerHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectContainerHandler.java deleted file mode 100644 index dd7771eea86..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SelectContainerHandler.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * All rights reserved. This program and the accompanying materials - * are property of the CEA, their use is subject to specific agreement - * with the CEA. - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.ui.dialogs.ContainerDialog; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * Call the dialogs for selecting a container rule - */ -public class SelectContainerHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - if ((selectedEObject instanceof Class) || - (selectedEObject instanceof InstanceSpecification)) { - return true; - } - if (selectedEObject instanceof Property) { - Type type = ((Property) selectedEObject).getType(); - if (type instanceof Class) { - return true; - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (!(selectedEObject instanceof NamedElement)) { - return null; - } - - NamedElement ne = (NamedElement) selectedEObject; - final Shell shell = Display.getDefault().getActiveShell(); - - if (ne instanceof Property) { - // treat property as the associated type - Type type = ((Property) ne).getType(); - if (type instanceof Class) { - ne = type; - } - } - final NamedElement element = ne; - - // 1. select possible connectors according to port types - // (only show compatible connectors check-box?) - // 2. select implementation group according to connector type - - if (element instanceof Class) { - // container dialog: either extension, rule or interceptor - // howto select? which? (and howto add/remove?) - Std - dialog is good? - CommandSupport.exec("Select container", event, new RunnableWithResult() { - - @Override - public CommandResult run() { - ContainerDialog elementSelector = - new ContainerDialog(shell, (Class) element); - elementSelector.setTitle("Select container rules for component " + element.getName()); - elementSelector.open(); - if (elementSelector.getReturnCode() == IDialogConstants.OK_ID) { - return CommandResult.newOKCommandResult(); - } - else { - return CommandResult.newCancelledCommandResult(); - } - } - }); - } else if (element instanceof InstanceSpecification) { - /* - * ConnectorSelectionDialog elementSelector = - * new ConnectorSelectionDialog (shell, model, (InstanceSpecification) element); - * elementSelector.setTitle("Select connector"); - * elementSelector.setMessage("Select an implementation for connector " + selectedConnector.getName ()); - * elementSelector.open(); - * if (elementSelector.getReturnCode () == IDialogConstants.OK_ID) { - * final Object[] result = elementSelector.getResult (); - * if ((result.length == 2) && (result[0] instanceof Class) && (result[1] instanceof Class)) { - * CommandSupport.exec ("Select connector", new Runnable () { - * public void run () { - * Object newConnType = StereotypeUtil.getApplication ((Class) result[0], ConnectorType.class); - * Object newConnImpl = StereotypeUtil.getApplication ((Class) result[1], ConnectorImpl.class); - * } - * }); - * } - * } - */ - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java deleted file mode 100644 index 93708d5888e..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java +++ /dev/null @@ -1,147 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.FCM.DeploymentPlan; -import org.eclipse.papyrus.qompass.designer.core.CommandSupport; -import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult; -import org.eclipse.papyrus.qompass.designer.core.Utils; -import org.eclipse.papyrus.qompass.designer.core.sync.CompImplSync; -import org.eclipse.papyrus.qompass.designer.core.sync.DepPlanSync; -import org.eclipse.papyrus.qompass.designer.core.sync.InterfaceSync; -import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationRTException; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; - -/** - * Handler for synchronizing derived elements. Will do different - * things, depending on the currently selected object. - */ -public class SyncHandler extends CmdHandler { - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - // if a property is selected, use the associated type - if (selectedEObject instanceof Property) { - selectedEObject = ((Property) selectedEObject).getType(); - } - - if (selectedEObject instanceof Interface) { - return true; - } - if (selectedEObject instanceof Class) { - if (Utils.isComponent((Class) selectedEObject)) { - return true; - } - } - else if (selectedEObject instanceof Package) { - if (StereotypeUtil.isApplied((Package) selectedEObject, DeploymentPlan.class)) { - return true; - } - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // if a property is selected, use the associated type - if (selectedEObject instanceof Property) { - selectedEObject = ((Property) selectedEObject).getType(); - } - - if (selectedEObject instanceof Interface) { - final Interface selectedIntf = (Interface) selectedEObject; - CommandSupport.exec("Synchronize interface", event, new Runnable() { - - @Override - public void run() { - InterfaceSync.syncSignalReceptionSupport(selectedIntf); - } - }); - } - - else if (selectedEObject instanceof Class) { - final Class selectedClass = (Class) selectedEObject; - if (Utils.isCompImpl(selectedClass)) { - CommandSupport.exec("Synchronize component via implementation", event, new RunnableWithResult() { - - @Override - public CommandResult run() { - CompImplSync.updatePorts(selectedClass); - try { - CompImplSync.syncRealizations(selectedClass); - } - catch (TransformationRTException e) { - MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Problems during synchronization", e.getMessage()); - return CommandResult.newErrorCommandResult(e.getMessage()); - } - - // CompImplSync.syncContextOps (selectedClass, true); - CompImplSync.interfaceModifications(selectedClass, null); - return CommandResult.newOKCommandResult(); - } - }); - } else if (Utils.isCompType(selectedClass)) { - CommandSupport.exec("Synchronize component via type", event, new Runnable() { - - @Override - public void run() { - if (!CompImplSync.syncViaType(selectedClass, false)) { - MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning: ineffective command", - "Synchronization applied on a component type (abstract class) will synchronize all implementations, i.e. non-abstract classes inheriting from it. However, the selected type has no implementations"); - } - // CompImplSync.syncContextOps (selectedClass, true); - } - }); - } - } - else if (selectedEObject instanceof Package) { - final Package selectedPkg = (Package) selectedEObject; - CommandSupport.exec("Synchronize deployment plan", event, new RunnableWithResult() { - - @Override - public CommandResult run() { - try { - DepPlanSync.syncDepPlan(selectedPkg); - return CommandResult.newOKCommandResult(); - } - catch (TransformationRTException e) { - Shell shell = Display.getDefault().getActiveShell(); - MessageDialog.openError(shell, "Can not synchronize deployment plan", e.getMessage()); - return CommandResult.newErrorCommandResult(e.getMessage()); - } - } - }); - } - return null; - } -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/TrafoAndCodegenHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/TrafoAndCodegenHandler.java deleted file mode 100644 index f129bdaa807..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/TrafoAndCodegenHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.eclipse.papyrus.qompass.designer.ui.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.papyrus.qompass.designer.core.ProjectManagement; -import org.eclipse.papyrus.qompass.designer.core.transformations.TrafoAndCodegenPackage; -import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler; -import org.eclipse.uml2.uml.Package; - -public class TrafoAndCodegenHandler extends CmdHandler { - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - updateSelectedEObject(); - return (selectedEObject instanceof Package); - } - - /** - * {@inheritDoc} - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // only one model is selected - selectedPkg = null; - if (selectedEObject instanceof Package) { - selectedPkg = (Package) selectedEObject; - } else { - return null; - } - project = ProjectManagement.getCurrentProject(); - - Job job = new Job("Execute transformations and generate code") { - - @Override - protected IStatus run(IProgressMonitor monitor) { - // execute the task ... - TrafoAndCodegenPackage.instantiate(selectedPkg, monitor, project); - monitor.done(); - return Status.OK_STATUS; - } - }; - job.setUser(true); - job.schedule(); - - return null; - } - - protected Package selectedPkg; - - protected IProject project; -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/messages.properties b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/messages.properties deleted file mode 100644 index 40a457cfc83..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/messages.properties +++ /dev/null @@ -1,27 +0,0 @@ -ConfigurePortHandler_ConfigurePorts=Configure ports -ConfigurePortHandler_ConfigurePortsOfComponent=Configure ports of component -ConfigurePortHandler_ConfigureInstance=Configure instance - -ConfigurePortDialog_AvailPorts=Available Ports -ConfigurePortDialog_PortConfig=Port configuration -ConfigurePortDialog_NotAvail=not available -ConfigurePortDialog_Kind=Kind -ConfigurePortDialog_None=none -ConfigurePortDialog_Type=Type -ConfigurePortDialog_ChangeType=change type -ConfigurePortDialog_IntfDerived=Interfaces derived from kind and type -ConfigurePortDialog_Provided=Provided -ConfigurePortDialog_Required=Required -ConfigurePortDialog_Undef=undefined - -CreateDepPlanHandler_CreateDPs=Create deployment plans -CreateDepPlanHandler_Sync=Synchronize -CreateDepPlanHandler_CreateNew=create new (auto number name) -CreateDepPlanHandler_WhatShouldIDo=What should I do? -CreateDepPlanHandler_DPwithNameExistsAlready=Deployment plan with name %s exists already. You can always synchronize an existing deployment plan via the context menu "Synchronize derived elements" -CreateDepPlanHandler_DPwithNameExistsNoPackage=Element with name %s exists, but is not a package -CreateDepPlanHandler_CannotSync=Cannot synchronize -CreateDepPlanHandler_Cancel=Cancel -CreateDepPlanHandler_CreateDP=Create deployment plan -CreateDepPlanHandler_CannotCreateDP=Cannot create deployment plan -CreateDepPlanHandler_StereoApplicationFailed=Application of stereotype "FCM::DeploymentPlan" failed. Check, if FCM profile is applied diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferenceInitializer.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferenceInitializer.java deleted file mode 100644 index f28c634a309..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferenceInitializer.java +++ /dev/null @@ -1,39 +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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.qompass.designer.ui.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.qompass.designer.core.preferences.QompassPreferenceConstants; - -/** - * Class used to initialize default preference values. - */ -public class QompassPreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = org.eclipse.papyrus.qompass.designer.core.Activator.getDefault().getPreferenceStore(); - store.setDefault(QompassPreferenceConstants.P_SHOW_PROV_REQ_AS_PORT_ICONS, false); - store.setDefault(QompassPreferenceConstants.P_ALL_ATTRIBUTES_ARE_CONFIG_ATTRIBUTES, false); - store.setDefault(QompassPreferenceConstants.P_TREAT_NONE_AS_COMPOSITE, false); - store.setDefault(QompassPreferenceConstants.P_CODE_GEN_PREFIX, "// generated with Qompass toolchain"); - } - -} diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferencePage.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferencePage.java deleted file mode 100644 index c5552e6020b..00000000000 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/preferences/QompassPreferencePage.java +++ /dev/null @@ -1,76 +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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.qompass.designer.ui.preferences; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.papyrus.qompass.designer.core.Activator; -import org.eclipse.papyrus.qompass.designer.core.preferences.QompassPreferenceConstants; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * This class represents the EC3M 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 QompassPreferencePage - extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - - public QompassPreferencePage() { - super(GRID); - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - setDescription("Qompass 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. - */ - @Override - public void createFieldEditors() { - addField(new BooleanFieldEditor( - QompassPreferenceConstants.P_SHOW_PROV_REQ_AS_PORT_ICONS, - "&Show icons associated with derived provided/required interfaces instead of kind", - getFieldEditorParent())); - - addField(new BooleanFieldEditor( - QompassPreferenceConstants.P_TREAT_NONE_AS_COMPOSITE, - "Treat aggregation kind \"&None\" as \"Composite\"", - getFieldEditorParent())); - - addField(new BooleanFieldEditor( - QompassPreferenceConstants.P_ALL_ATTRIBUTES_ARE_CONFIG_ATTRIBUTES, - "Treat all attributes as configuration attributes (if false, only attributes of abstract classes and attributes explicitly tagged as FCM::ConfigurationProperty will be considered as configuration attribute", - getFieldEditorParent())); - - addField(new StringFieldEditor( - QompassPreferenceConstants.P_CODE_GEN_PREFIX, - "Code generation prefix: ", getFieldEditorParent())); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - @Override - public void init(IWorkbench workbench) { - } -} |