Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 12:25:31 +0000
committercletavernie2011-10-25 12:25:31 +0000
commit09c77c6cee410460ea41b7a238d71e53b9d6f4e6 (patch)
tree91c7e540b15382ea177ac6ee903e8195973e2562 /plugins/core
parentab4412fe1ebfcedb13243ac6caa0757ec6d9eaf5 (diff)
downloadorg.eclipse.papyrus-09c77c6cee410460ea41b7a238d71e53b9d6f4e6.tar.gz
org.eclipse.papyrus-09c77c6cee410460ea41b7a238d71e53b9d6f4e6.tar.xz
org.eclipse.papyrus-09c77c6cee410460ea41b7a238d71e53b9d6f4e6.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/core')
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/.classpath7
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/.project28
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/.settings/net.sf.jautodoc.prefs6
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF18
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/build.properties7
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/Papyrus_16x16.gifbin561 -> 0 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_model.gifbin561 -> 0 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_project.gifbin384 -> 0 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/messages.properties39
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/plugin.properties13
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/plugin.xml32
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/schema/templates.exsd138
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Activator.java70
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateModelWizard.java520
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateSeveralModelsWizard.java211
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitDiagramAction.java84
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitModelWizard.java290
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Messages.java129
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWithMultiModelsWizard.java91
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWizard.java176
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewProjectAction.java46
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/SettingsHelper.java192
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryDescriptor.java171
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryRegistry.java154
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/NewPapyrusModelCommand.java51
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/PapyrusModelFromExistingDomainModelCommand.java87
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindContentProvider.java121
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindLabelProvider.java95
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/NewModelFilePage.java150
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramCategoryPage.java354
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramKindPage.java589
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectRootElementPage.java213
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/InitFromTemplateCommand.java204
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplateDescription.java179
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesContentProvider.java145
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesLabelProvider.java96
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/SelectModelTemplateComposite.java153
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/utils/WizardsHelper.java41
41 files changed, 0 insertions, 4943 deletions
diff --git a/plugins/core/org.eclipse.papyrus.wizards/.classpath b/plugins/core/org.eclipse.papyrus.wizards/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/.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/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.wizards/.project b/plugins/core/org.eclipse.papyrus.wizards/.project
deleted file mode 100644
index b60bcdea41d..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.wizards</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/plugins/core/org.eclipse.papyrus.wizards/.settings/net.sf.jautodoc.prefs b/plugins/core/org.eclipse.papyrus.wizards/.settings/net.sf.jautodoc.prefs
deleted file mode 100644
index 9cbe5fb19ec..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/.settings/net.sf.jautodoc.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed May 25 16:48:29 CEST 2011
-add_header=true
-eclipse.preferences.version=1
-header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Saadia DHOUIB (CEA LIST) - Initial API and implementation\r\n *\r\n *****************************************************************************/
-project_specific_settings=true
-replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
diff --git a/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.jdt.core.prefs b/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 9cd5e8b61b8..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Wed May 25 16:49:25 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.ltk.core.refactoring.prefs b/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index 60e61ba6eb2..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed May 25 16:48:29 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF
deleted file mode 100644
index eb31cdd2242..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.wizards;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.wizards.Activator
-Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.8.0",
- org.eclipse.emf.edit.ui;bundle-version="2.4.0",
- org.eclipse.emf.ecore.edit;bundle-version="2.4.0",
- org.eclipse.ui.intro;bundle-version="3.4.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: %pluginProvider
-Export-Package: org.eclipse.papyrus.wizards,
- org.eclipse.papyrus.wizards.category,
- org.eclipse.papyrus.wizards.kind,
- org.eclipse.papyrus.wizards.pages
diff --git a/plugins/core/org.eclipse.papyrus.wizards/about.html b/plugins/core/org.eclipse.papyrus.wizards/about.html
deleted file mode 100644
index 209103075a7..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/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 (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/build.properties b/plugins/core/org.eclipse.papyrus.wizards/build.properties
deleted file mode 100644
index 30831a30c0c..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-#Mon Sep 12 09:30:25 CEST 2011
-bin.includes=META-INF/,.,icons/,plugin.xml,schema/,plugin.properties,about.html,messages.properties
-output..=bin/
-src.includes=about.html,schema/,l,META-INF/,.,icons/,plugin.xml,plugin.properties,messages.properties
-source..=src/
-bin..=bin/
diff --git a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/Papyrus_16x16.gif b/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/Papyrus_16x16.gif
deleted file mode 100644
index 8a31f458379..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/Papyrus_16x16.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_model.gif b/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_model.gif
deleted file mode 100644
index 8a31f458379..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_model.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_project.gif b/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_project.gif
deleted file mode 100644
index fa2cba6ea62..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/icons/papyrus/new_papyrus_project.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.wizards/messages.properties b/plugins/core/org.eclipse.papyrus.wizards/messages.properties
deleted file mode 100644
index b0951eab8bf..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/messages.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-CreateModelWizard_new_papyrus_model_title=New Papyrus Model
-CreateSeveralModelsWizard_cannot_initiate_page=Cannot initiate NewModelFilePage for {0}
-CreateSeveralModelsWizard_new_model_file_page_title=Create a new model for {0} category
-InitModelWizard_diagram_name_is_different_from_domain_model=Diagram file name should be the same as domain model file name ({0})
-InitModelWizard_init_papyrus_diagram=Init Papyrus Diagram
-InitModelWizard_init_papyrus_model=Init a new Papyrus model
-InitModelWizard_init_papyrus_model_desc=Init a new Papyrus model from the existing domain model
-NewPapyrusProjectWithMultiModelsWizard_exception_on_project_opening=Problems during opening of the project
-NewPapyrusProjectWizard_exception_on_opening=Problems during opening of the project
-NewPapyrusProjectWizard_new_papyrus_project=New Papyrus Project
-NewPapyrusProjectWizard_papyrus_project=Papyrus Project
-NewPapyrusProjectWizard_papyrus_project_desc=Create a New Papyrus Project
-
-DiagramCategoryRegistry_bad_class_name_of_category=Could not find implementation for a diagram category
-
-DiagramKindLabelProvider_undefined_element=<undefined>
-
-ModelTemplatesLabelProvider_model_template_description_text={0} ({1})
-
-NewModelFilePage_3=New Papyrus Model
-NewModelFilePage_default_diagram_name=model
-NewModelFilePage_diagram_file_was_renamed=Thus, the diagram file has been renamed from {0} to {1}
-NewModelFilePage_new_diagram_category_needs_specific_extension=The new diagram category requires a specific diagram file extension.
-NewModelFilePage_page_desc=Create a new empty Papyrus model
-SelectDiagramCategoryPage_cannot_find_category=Could not find DiagramCategory for {0}
-SelectDiagramCategoryPage_diagram_language_group=Diagram Language:
-SelectDiagramCategoryPage_select_language=Select language of the diagram
-SelectDiagramCategoryPage_select_one_category=Please select at least one category
-SelectDiagramKindPage_default_diagram_name=NewDiagram
-SelectDiagramKindPage_diagram_name_group=Diagram Name:
-SelectDiagramKindPage_diagram_name_is_empty=The diagram name should not be empty.
-SelectDiagramKindPage_load_template_group=You can load a template:
-SelectDiagramKindPage_page_desc=Select name and kind of the diagram
-SelectDiagramKindPage_page_title=Initialization information
-SelectDiagramKindPage_remember_current_selection_text=Remember current selection
-SelectDiagramKindPage_remember_current_selection_tooltip=The current selection will be used when you open the wizard next time
-SelectDiagramKindPage_select_kind_group=Select a Diagram Kind:
-SelectRootElementPage_select_root_element_desc=Select the root element
-SelectRootElementPage_select_root_element_title=Select the root element
diff --git a/plugins/core/org.eclipse.papyrus.wizards/plugin.properties b/plugins/core/org.eclipse.papyrus.wizards/plugin.properties
deleted file mode 100644
index 56b077e65cf..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 Obeo.
-# 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:
-# Obeo - initial API and implementation
-###############################################################################
-pluginName=Papyrus Wizards (Incubation)
-pluginProvider=Eclipse Modeling Project
-NewWizards.project.description=Create a project for a new Papyrus model (UML or SysML)
diff --git a/plugins/core/org.eclipse.papyrus.wizards/plugin.xml b/plugins/core/org.eclipse.papyrus.wizards/plugin.xml
deleted file mode 100644
index 236f3ab5a40..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/plugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin>
-<extension point="org.eclipse.ui.newWizards">
- <category
- id="org.eclipse.papyrus.wizards.category"
- name="Papyrus">
- </category>
- <wizard
- category="org.eclipse.papyrus.wizards.category"
- class="org.eclipse.papyrus.wizards.NewPapyrusProjectWizard"
- finalPerspective="org.eclipse.papyrus.core.perspective"
- icon="icons/papyrus/new_papyrus_project.gif"
- id="org.eclipse.papyrus.wizards.1createproject"
- name="Papyrus Project"
- project="true">
- <description>
- %NewWizards.project.description
- </description>
- </wizard>
- <wizard
- category="org.eclipse.papyrus.wizards.category"
- class="org.eclipse.papyrus.wizards.InitModelWizard"
- finalPerspective="org.eclipse.papyrus.core.perspective"
- icon="icons/papyrus/new_papyrus_model.gif"
- id="org.eclipse.papyrus.wizards.createmodel"
- name="Papyrus Model">
- </wizard>
-</extension>
-
-<extension-point id="templates" name="UML2 Model Templates" schema="schema/templates.exsd"/>
-
-</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.wizards/schema/templates.exsd b/plugins/core/org.eclipse.papyrus.wizards/schema/templates.exsd
deleted file mode 100644
index bc2d1139030..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/schema/templates.exsd
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.papyrus.diagram.common" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.papyrus.diagram.common" id="templates" name="UML2 Model Templates"/>
- </appinfo>
- <documentation>
- This extension point registers UML2 model templates that can be selected when creating new diagrams using the MOSKitt-UML2 editor to initialize new files.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="template" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="template">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="name"/>
- </appinfo>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A unique identifier for a template.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A human readable description of the model template.
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="file" type="string" use="required">
- <annotation>
- <documentation>
- The uml model file that is used as template.
- </documentation>
- <appinfo>
- <meta.attribute kind="resource"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="notation_file" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="resource"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="di_file" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="resource"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="language" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.papyrus.core.papyrusDiagram/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
-
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Activator.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Activator.java
deleted file mode 100644
index 0b5a64f35df..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Activator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import org.eclipse.papyrus.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle.
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public class Activator extends AbstractUIPlugin {
-
- /** The Constant PLUGIN_ID. */
- public static final String PLUGIN_ID = "org.eclipse.papyrus.wizards"; //$NON-NLS-1$
-
- // The shared instance
- /** The plugin. */
- private static Activator plugin;
-
- /** Logging helper. */
- public static LogHelper log;
-
- /**
- * The constructor.
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateModelWizard.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateModelWizard.java
deleted file mode 100644
index 88ce296ab53..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateModelWizard.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo, 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:
- * Obeo - initial API and implementation
- * Tatiana Fesenko(CEA) - [313179] Refactor CreateModelWizard
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *******************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import static org.eclipse.papyrus.wizards.Activator.log;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
-import org.eclipse.papyrus.core.extension.commands.IModelCreationCommand;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.papyrus.wizards.category.DiagramCategoryDescriptor;
-import org.eclipse.papyrus.wizards.category.DiagramCategoryRegistry;
-import org.eclipse.papyrus.wizards.category.NewPapyrusModelCommand;
-import org.eclipse.papyrus.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramKindPage.CategoryProvider;
-import org.eclipse.papyrus.wizards.template.InitFromTemplateCommand;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * Create new model file and initialize a selected diagram. This wizard create
- * several files :
- * <li>*.di : the DI file to store Di diagrams and references all
- * external diagrams like GMF diagrams.</li>
- * <li>*.notation : the file to store pure GMF
- * diagrams</li>
- * <li>*.uml : the standard UML file to store UML semantics elements.
- * (Model, Package, Class,...)</li>
- *
- * Those files can be used with the PapyrusEditor (see plugin.xml).
- */
-public class CreateModelWizard extends Wizard implements INewWizard {
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.wizards.createmodel"; //$NON-NLS-1$
-
- /** The Constant NEW_MODEL_SETTINGS. */
- public static final String NEW_MODEL_SETTINGS = "NewModelWizard"; //$NON-NLS-1$
-
- /** New model file page for the file. */
- private NewModelFilePage newModelFilePage;
-
- /** Select kind of new diagram the wizard must create. */
- private SelectDiagramKindPage selectDiagramKindPage;
-
- /** The select diagram category page. */
- private SelectDiagramCategoryPage selectDiagramCategoryPage;
-
- /** Current workbench. */
- private IWorkbench workbench;
-
- /**
- * Instantiates a new creates the model wizard.
- */
- public CreateModelWizard() {
- super();
- setWindowTitle(Messages.CreateModelWizard_new_papyrus_model_title);
- }
-
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- addPageIfNotNull(newModelFilePage);
- addPageIfNotNull(selectDiagramCategoryPage);
- addPageIfNotNull(selectDiagramKindPage);
- }
-
- /**
- * Adds the page if not null.
- *
- * @param page the page
- */
- protected final void addPageIfNotNull(IWizardPage page) {
- if(page != null) {
- addPage(page);
- }
- }
-
- /**
- * Inits the.
- *
- * @param workbench the workbench
- * @param selection the selection
- * {@inheritDoc}
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
-
- IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection(NEW_MODEL_SETTINGS);
- if(section == null) {
- section = workbenchSettings.addNewSection(NEW_MODEL_SETTINGS);
- }
- setDialogSettings(section);
-
- newModelFilePage = createNewModelFilePage(selection);
- selectDiagramCategoryPage = createSelectDiagramCategoryPage();
- selectDiagramKindPage = createSelectDiagramKindPage();
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- DiResourceSet diResourceSet = new DiResourceSetExt();
- String[] diagramCategoryIds = getDiagramCategoryIds();
- if(diagramCategoryIds.length == 0) {
- return false;
- }
- String diagramCategoryId = diagramCategoryIds[0];
-
- final IFile newFile = createNewModelFile(diagramCategoryId);
- createAndOpenPapyrusModel(diResourceSet, newFile, diagramCategoryId);
-
- saveDiagramCategorySettings();
- saveDiagramKindSettings();
- return true;
- }
-
- /**
- * Creates the and open papyrus model.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- * @param diagramCategoryId the diagram category id
- * @return true, if successful
- */
- protected boolean createAndOpenPapyrusModel(DiResourceSet diResourceSet, IFile newFile, String diagramCategoryId) {
- if(newFile == null) {
- return false;
- }
- createPapyrusModels(diResourceSet, newFile);
-
- initDomainModel(diResourceSet, newFile, diagramCategoryId);
-
- initDiagramModel(diResourceSet, diagramCategoryId);
-
- openDiagram(newFile);
-
- return true;
- }
-
- /**
- * Gets the diagram category ids.
- *
- * @return the diagram category ids
- */
- protected String[] getDiagramCategoryIds() {
- if(selectDiagramCategoryPage != null) {
- return selectDiagramCategoryPage.getDiagramCategories();
- }
- return null;
- }
-
- /**
- * Gets the diagram file extension.
- *
- * @param diagramCategoryId the diagram category id
- * @return the diagram file extension
- */
- protected String getDiagramFileExtension(String diagramCategoryId) {
- return getDiagramFileExtension(diagramCategoryId, NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION);
- }
-
- /**
- * Gets the diagram file extension.
- *
- * @param categoryId the category id
- * @param defaultExtension the default extension
- * @return the diagram file extension
- */
- protected String getDiagramFileExtension(String categoryId, String defaultExtension) {
- DiagramCategoryDescriptor diagramCategory = getDiagramCategoryMap().get(categoryId);
- String extensionPrefix = diagramCategory != null ? diagramCategory.getExtensionPrefix() : null;
- return (extensionPrefix != null) ? extensionPrefix + "." + defaultExtension : defaultExtension; //$NON-NLS-1$
- }
-
- /**
- * Creates the new model file page.
- *
- * @param selection the selection
- * @return the new model file page
- */
- protected NewModelFilePage createNewModelFilePage(IStructuredSelection selection) {
- return new NewModelFilePage(selection);
- }
-
- /**
- * Creates the select diagram category page.
- *
- * @return the select diagram category page
- */
- protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() {
- return new SelectDiagramCategoryPage();
- }
-
- /**
- * Creates the select diagram kind page.
- *
- * @return the select diagram kind page
- */
- protected SelectDiagramKindPage createSelectDiagramKindPage() {
- return new SelectDiagramKindPage(new CategoryProvider() {
-
- public String[] getCurrentCategories() {
- return getDiagramCategoryIds();
- }
-
- });
- }
-
- /**
- * Creates the new model file.
- *
- * @param categoryId the category id
- * @return the i file
- */
- protected IFile createNewModelFile(String categoryId) {
- return newModelFilePage.createNewFile();
- }
-
- /**
- * Inits the domain model.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- * @param diagramCategoryId the diagram category id
- */
- protected void initDomainModel(DiResourceSet diResourceSet, final IFile newFile, String diagramCategoryId) {
- boolean isToInitFromTemplate = selectDiagramKindPage.getTemplatePath() != null;
- if(isToInitFromTemplate) {
- initDomainModelFromTemplate(diResourceSet);
- } else {
- createEmptyDomainModel(diResourceSet, diagramCategoryId);
- }
- }
-
- /**
- * Inits the domain model from template.
- *
- * @param diResourceSet the di resource set
- */
- protected void initDomainModelFromTemplate(DiResourceSet diResourceSet) {
- //getCommandStack(diResourceSet).execute(new InitFromTemplateCommand(diResourceSet.getTransactionalEditingDomain(), diResourceSet.getModelResource(), diResourceSet.getDiResource(), diResourceSet.getNotationResource(), selectDiagramKindPage.getTemplatePluginId(), selectDiagramKindPage.getTemplatePath(),selectDiagramKindPage.getNotationTemplatePath(),selectDiagramKindPage.getDiTemplatePath()));
- getCommandStack(diResourceSet).execute(new InitFromTemplateCommand(diResourceSet.getTransactionalEditingDomain(), diResourceSet, selectDiagramKindPage.getTemplatePluginId(), selectDiagramKindPage.getTemplatePath(),selectDiagramKindPage.getNotationTemplatePath(),selectDiagramKindPage.getDiTemplatePath()));
- }
-
- /**
- * Creates the empty domain model.
- *
- * @param diResourceSet the di resource set
- * @param diagramCategoryId the diagram category id
- */
- protected void createEmptyDomainModel(DiResourceSet diResourceSet, String diagramCategoryId) {
- try {
- IModelCreationCommand creationCommand = getDiagramCategoryMap().get(diagramCategoryId).getCommand();
- creationCommand.createModel(diResourceSet);
- } catch (BackboneException e) {
- log.error(e);
- }
- }
-
- /**
- * Creates the papyrus models.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- */
- protected void createPapyrusModels(DiResourceSet diResourceSet, IFile newFile) {
- RecordingCommand command = new NewPapyrusModelCommand(diResourceSet, newFile);
- getCommandStack(diResourceSet).execute(command);
- }
-
- /**
- * Save diagram category settings.
- */
- protected void saveDiagramCategorySettings() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- SettingsHelper settingsHelper = new SettingsHelper(settings);
- settingsHelper.saveDefaultDiagramCategory(getDiagramCategoryIds());
- }
- }
-
- /**
- * Save diagram kind settings.
- */
- protected void saveDiagramKindSettings() {
- IDialogSettings settings = getDialogSettings();
- if(settings == null) {
- return;
- }
- SettingsHelper settingsHelper = new SettingsHelper(settings);
- for (String category: getDiagramCategoryIds()) {
- if(selectDiagramKindPage.isRememberCurrentSelection()) {
- saveDefaultDiagramKinds(settingsHelper, category);
- saveDefaultTemplates(settingsHelper, category);
- } else {
- settingsHelper.saveDefaultDiagramKinds(category, Collections.<String> emptyList());
- settingsHelper.saveDefaultTemplates(category, Collections.<String> emptyList());
- }
- }
- settingsHelper.saveRememberCurrentSelection(selectDiagramKindPage.isRememberCurrentSelection());
- }
-
- /**
- * Save default diagram kinds.
- *
- * @param settingsHelper the settings helper
- * @param category the category
- */
- private void saveDefaultDiagramKinds(SettingsHelper settingsHelper, String category) {
- String[] selected = selectDiagramKindPage.getSelectedDiagramKinds(category);
- settingsHelper.saveDefaultDiagramKinds(category, Arrays.asList(selected));
- }
-
- /**
- * Save default templates.
- *
- * @param settingsHelper the settings helper
- * @param category the category
- */
- private void saveDefaultTemplates(SettingsHelper settingsHelper, String category) {
- if(!selectDiagramKindPage.templatesEnabled()) {
- return;
- }
- String path = selectDiagramKindPage.getTemplatePath();
- settingsHelper.saveDefaultTemplates(category, Collections.singletonList(path));
- }
-
- /**
- * Open diagram.
- *
- * @param newFile the new file
- */
- protected void openDiagram(final IFile newFile) {
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- if(page != null) {
- try {
- IDE.openEditor(page, newFile, true);
- } catch (PartInitException e) {
- log.error(e);
- }
- }
- }
-
-
- /**
- * Inits the diagram model.
- *
- * @param diResourceSet the di resource set
- * @param categoryId the category id
- */
- protected void initDiagramModel(DiResourceSet diResourceSet, String categoryId) {
- initDiagrams(diResourceSet, categoryId);
- saveDiagram(diResourceSet);
- }
-
- /**
- * Save diagram.
- *
- * @param diResourceSet the di resource set
- */
- private void saveDiagram(DiResourceSet diResourceSet) {
- try {
- diResourceSet.save(new NullProgressMonitor());
- } catch (IOException e) {
- log.error(e);
- // return false;
- }
- }
-
- /**
- * Inits the diagrams.
- *
- * @param diResourceSet the di resource set
- * @param categoryId the category id
- */
- protected void initDiagrams(DiResourceSet diResourceSet, String categoryId) {
- initDiagrams(diResourceSet, null, categoryId);
- }
-
- /**
- * Inits the diagrams.
- *
- * @param resourceSet the resource set
- * @param root the root
- * @param categoryId the category id
- */
- protected void initDiagrams(DiResourceSet resourceSet, EObject root, String categoryId) {
- List<ICreationCommand> creationCommands = getDiagramKindsFor(categoryId);
- String diagramName = selectDiagramKindPage.getDiagramName();
- if(creationCommands.isEmpty()) {
- createEmptyDiagramEditor(resourceSet);
- } else {
- for(int i = 0; i < creationCommands.size(); i++) {
- creationCommands.get(i).createDiagram(resourceSet, root, diagramName);
- }
- }
- }
-
- /**
- * Gets the diagram kinds for.
- *
- * @param categoryId the category id
- * @return the diagram kinds for
- */
- protected List<ICreationCommand> getDiagramKindsFor(String categoryId) {
- return selectDiagramKindPage.getCreationCommands(categoryId);
- }
-
-
- /**
- * Creates the empty diagram editor.
- *
- * @param diResourceSet the di resource set
- */
- private void createEmptyDiagramEditor(DiResourceSet diResourceSet) {
- // Create an empty editor (no diagrams opened)
- // Geting an IPageMngr is enough to initialize the
- // SashSystem.
- EditorUtils.getTransactionalIPageMngr(diResourceSet.getDiResource(), diResourceSet.getTransactionalEditingDomain());
- }
-
- /**
- * Gets the command stack.
- *
- * @param diResourceSet the di resource set
- * @return the command stack
- */
- protected final CommandStack getCommandStack(DiResourceSet diResourceSet) {
- return diResourceSet.getTransactionalEditingDomain().getCommandStack();
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- protected Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- return DiagramCategoryRegistry.getInstance().getDiagramCategoryMap();
- }
-
- /**
- * Diagram category changed.
- *
- * @param newCategories the new categories
- * @return the i status
- */
- public IStatus diagramCategoryChanged(String... newCategories) {
- if(newModelFilePage != null) {
- String firstCategory = newCategories.length > 0 ? newCategories[0] : null;
- if(newCategories.length > 0) {
- //316943 - [Wizard] Wrong suffix for file name when creating a profile model
- return newModelFilePage.diagramExtensionChanged(getDiagramFileExtension(firstCategory));
- }
- }
- return Status.OK_STATUS;
- }
-
- // Bug 339504 - [Wizard] NPE when init diagram from an existing model
- /**
- * The Class DiResourceSetExt.
- */
- public static class DiResourceSetExt extends DiResourceSet {
-
- // open access to protected method to be set in PapyrusModelFromExistingDomainModelCommand
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.resource.ModelSet#setFilenameWithoutExtension(org.eclipse.core.runtime.IPath)
- */
- @Override
- public void setFilenameWithoutExtension(IPath filenameWithoutExtension) {
- super.setFilenameWithoutExtension(filenameWithoutExtension);
- }
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateSeveralModelsWizard.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateSeveralModelsWizard.java
deleted file mode 100644
index 652c49d25ba..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/CreateSeveralModelsWizard.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-import org.eclipse.papyrus.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * Creates several new model files - one each selected diagram category.
- * This functionality in under development now.
- */
-// TODO: Provide proper file names for the new model file pages after the first one
-// TODO: Allow the user to skip NewModelFile page and invoke finish in advance.
-public class CreateSeveralModelsWizard extends CreateModelWizard {
-
- /** The my category2model file page map. */
- private Map<String, NewModelFilePage> myCategory2modelFilePageMap = new TreeMap<String, NewModelFilePage>();
-
- /** The my selection. */
- private IStructuredSelection mySelection;
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#createNewModelFilePage(org.eclipse.jface.viewers.IStructuredSelection)
- */
- @Override
- protected NewModelFilePage createNewModelFilePage(IStructuredSelection selection) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- super.init(workbench, selection);
- this.mySelection = selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#diagramCategoryChanged(java.lang.String[])
- */
- @Override
- public IStatus diagramCategoryChanged(String... newCategories) {
- // clean pages
- List<String> newCategoriesList = Arrays.asList(newCategories);
- Collection<String> keys = new HashSet<String>(myCategory2modelFilePageMap.keySet());
- for(String oldCategory : keys) {
- if(!newCategoriesList.contains(oldCategory)) {
- myCategory2modelFilePageMap.remove(oldCategory);
- }
- }
- for(String newCategory : newCategories) {
- if(!myCategory2modelFilePageMap.containsKey(newCategory)) {
- NewModelFilePage newPage = createNewModelFilePage(mySelection, newCategory);
- myCategory2modelFilePageMap.put(newCategory, newPage);
- }
- }
- return Status.OK_STATUS;
- }
-
- /**
- * Creates the new model file page.
- *
- * @param selection the selection
- * @param categoryId the category id
- * @return the new model file page
- */
- protected NewModelFilePage createNewModelFilePage(IStructuredSelection selection, String categoryId) {
- NewModelFilePage newPage = new NewModelFilePage(createModelFilePageId(categoryId), selection);
- newPage.setWizard(this);
- newPage.setDescription(Messages.bind(Messages.CreateSeveralModelsWizard_new_model_file_page_title, categoryId));
- return newPage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- String pageId = page.getName();
- if (SelectDiagramKindPage.PAGE_ID.equals(pageId)) {
- String nextKey = myCategory2modelFilePageMap.keySet().iterator().next();
- return myCategory2modelFilePageMap.get(nextKey);
- }
- if (isModelFilePageId(pageId) && myCategory2modelFilePageMap.containsKey(getCategoryForPage(pageId))) {
- String category = getCategoryForPage(pageId);
- Iterator<String> iterator = myCategory2modelFilePageMap.keySet().iterator();
- while (iterator.hasNext()) {
- if (category.equals(iterator.next())) {
- if (iterator.hasNext()) {
- String nextKey = iterator.next();
- return myCategory2modelFilePageMap.get(nextKey);
- }
- }
- }
- return null;
- }
- return super.getNextPage(page);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- // TODO allow navigation between pages
- return super.getPreviousPage(page);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#createSelectDiagramCategoryPage()
- */
- @Override
- protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() {
- return new SelectDiagramCategoryPage(true);
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- for (String category: getDiagramCategoryIds()) {
-
- final IFile newFile = createNewModelFile(category);
- DiResourceSet diResourceSet = new DiResourceSet();
- createAndOpenPapyrusModel(diResourceSet, newFile, category);
- }
-
- saveDiagramCategorySettings();
- saveDiagramKindSettings();
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#createNewModelFile(java.lang.String)
- */
- @Override
- protected IFile createNewModelFile(String category) {
- NewModelFilePage newModelFilePage = myCategory2modelFilePageMap.get(category);
- if (newModelFilePage == null) {
- Activator.log.error(Messages.bind(Messages.CreateSeveralModelsWizard_cannot_initiate_page, category), new Exception());
- return null;
- }
- return newModelFilePage.createNewFile();
- }
-
- /**
- * Creates the model file page id.
- *
- * @param categoryId the category id
- * @return the string
- */
- private static String createModelFilePageId(String categoryId) {
- return NEW_MODEL_FILE_PAGE_PREFIX + categoryId;
- }
-
- /**
- * Checks if is model file page id.
- *
- * @param pageId the page id
- * @return true, if is model file page id
- */
- private static boolean isModelFilePageId(String pageId) {
- return pageId.startsWith(NEW_MODEL_FILE_PAGE_PREFIX);
- }
-
- /**
- * Gets the category for page.
- *
- * @param pageId the page id
- * @return the category for page
- */
- private static String getCategoryForPage(String pageId) {
- return pageId.substring(NEW_MODEL_FILE_PAGE_PREFIX.length());
- }
-
- /** The Constant NEW_MODEL_FILE_PAGE_PREFIX. */
- private static final String NEW_MODEL_FILE_PAGE_PREFIX = NewModelFilePage.PAGE_ID + "_"; //$NON-NLS-1$
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitDiagramAction.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitDiagramAction.java
deleted file mode 100644
index cdb56665a08..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitDiagramAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This action initialize the "CreateModelWizard" with the selected domain file,
- * and launch the wizard to create Diagram Interchange resources required by
- * Papyrus editor.
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public abstract class InitDiagramAction implements IObjectActionDelegate {
-
- /** The active part. */
- private IWorkbenchPart targetPart;
-
- /** The current selection;. */
- IStructuredSelection mySelection;
-
- /**
- * Sets the active part.
- *
- * @param action the action
- * @param targetPart the target part
- * {@inheritDoc}
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-
- /**
- * Selection changed.
- *
- * @param action the action
- * @param selection the selection
- * {@inheritDoc}
- */
- public void selectionChanged(IAction action, ISelection selection) {
- IStructuredSelection sselection = (IStructuredSelection)selection;
- mySelection = sselection;
- action.setEnabled(InitModelWizard.isSupportedDomainModelFile(sselection));
- }
-
- /**
- * Gets the shell.
- *
- * @return the current Shell to display dialog
- */
- private Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- /**
- * Run.
- *
- * @param action the action
- * {@inheritDoc}
- */
- public void run(IAction action) {
- InitModelWizard wizard = new InitModelWizard();
- wizard.init(targetPart.getSite().getWorkbenchWindow().getWorkbench(), mySelection);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
- dialog.open();
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitModelWizard.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitModelWizard.java
deleted file mode 100644
index a8c200311bd..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/InitModelWizard.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-import org.eclipse.papyrus.resource.uml.UmlModel;
-import org.eclipse.papyrus.wizards.category.PapyrusModelFromExistingDomainModelCommand;
-import org.eclipse.papyrus.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramKindPage.CategoryProvider;
-import org.eclipse.papyrus.wizards.pages.SelectRootElementPage;
-import org.eclipse.ui.IWorkbench;
-
-/**
- *
- * The New Papyrus Model Wizard.
- * If being invoke on the *.uml file - initializes a new Papyrus diagram for the selected domain model.
- * If is selected is empty or in not uml - creates a new Papyrus Model.
- */
-public class InitModelWizard extends CreateModelWizard {
-
- /** Select the root element containing the new diagram. */
- private SelectRootElementPage selectRootElementPage;
-
- /** The is init from existing domain model. */
- private boolean isInitFromExistingDomainModel;
-
- /**
- * Inits the.
- *
- * @param workbench the workbench
- * @param selection the selection
- * {@inheritDoc}
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- IFile file = getSelectedFile(selection);
- isInitFromExistingDomainModel = isSupportedDomainModelFile(file);
- super.init(workbench, selection);
- selectRootElementPage = createSelectRootElementPage(file);
- if(isCreateFromExistingDomainModel()) {
- // Init Model not Create a new one
- setWindowTitle(Messages.InitModelWizard_init_papyrus_diagram);
- }
- }
-
- /**
- * Creates the select root element page.
- *
- * @param file the file
- * @return the select root element page
- */
- protected SelectRootElementPage createSelectRootElementPage(IFile file) {
- if(!isCreateFromExistingDomainModel()) {
- // create model - nothing to choose from
- return null;
- }
- return new SelectRootElementPage(file);
- }
-
- /**
- * Creates the select diagram kind page.
- *
- * @return the select diagram kind page
- * {@inheritDoc}
- */
- @Override
- protected SelectDiagramKindPage createSelectDiagramKindPage() {
- if(isCreateFromExistingDomainModel()) {
- return new SelectDiagramKindPage(false, new CategoryProvider() {
-
- public String[] getCurrentCategories() {
- return getDiagramCategoryIds();
- }
-
- }, SelectDiagramKindPage.DEFAULT_CREATION_COMMAND_REGISTRY);
- };
- return super.createSelectDiagramKindPage();
- }
-
- /**
- * Creates the new model file page.
- *
- * @param selection the selection
- * @return the new model file page
- * {@inheritDoc}
- */
- @Override
- protected NewModelFilePage createNewModelFilePage(IStructuredSelection selection) {
- if(!isCreateFromExistingDomainModel()) {
- return super.createNewModelFilePage(selection);
- }
- return new NewDiagramForExistingModelPage(selection, getDiagramFileName(getSelectedFile(selection)) + "." + getDiagramFileExtension(null), getDiagramFileExtension(null)); //$NON-NLS-1$
- }
-
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
- addPageIfNotNull(selectRootElementPage);
- };
-
- /**
- * Returns true is the file can be served as a model model for the diagram.
- *
- * @param file
- * the file
- * @return true, if is supported domain model file
- */
- public static boolean isSupportedDomainModelFile(IFile file) {
-// if(file != null && UmlModel.UML_FILE_EXTENSION.equals(file.getFileExtension())){System.err.println("is SupportedDomainModelFile");}
-// else {System.err.println("not SupportedDomainModelFile");}
- return file != null && UmlModel.UML_FILE_EXTENSION.equals(file.getFileExtension());
- }
-
- /**
- * Checks if is supported domain model file.
- *
- * @param sselection
- * the sselection
- * @return true, if is supported domain model file
- */
- public static boolean isSupportedDomainModelFile(IStructuredSelection sselection) {
- IFile file = getSelectedFile(sselection);
-// if(!isSupportedDomainModelFile(file)){System.err.println("not SupportedDomainModelFile");}
- return isSupportedDomainModelFile(file);
- }
-
- /**
- * Creates the papyrus models.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- * {@inheritDoc}
- */
- @Override
- protected void createPapyrusModels(DiResourceSet diResourceSet, IFile newFile) {
- if(isCreateFromExistingDomainModel()) {
- RecordingCommand command = new PapyrusModelFromExistingDomainModelCommand(diResourceSet, newFile, getRoot());
- getCommandStack(diResourceSet).execute(command);
- } else {
- super.createPapyrusModels(diResourceSet, newFile);
- }
- }
-
- /**
- * Inits the domain model.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- * @param diagramCategoryId the diagram category id
- * {@inheritDoc}
- */
- @Override
- protected void initDomainModel(DiResourceSet diResourceSet, final IFile newFile, String diagramCategoryId) {
- if(isCreateFromExistingDomainModel()) {
- // do nothing
- } else {
- super.initDomainModel(diResourceSet, newFile, diagramCategoryId);
- }
- }
-
- /**
- * Inits the diagrams.
- *
- * @param diResourceSet the di resource set
- * @param categoryId the category id
- * {@inheritDoc}
- */
- @Override
- protected void initDiagrams(DiResourceSet diResourceSet, String categoryId) {
- initDiagrams(diResourceSet, getRoot(), categoryId);
- }
-
- /**
- * Checks if is creates the from existing domain model.
- *
- * @return true, if is creates the from existing domain model
- */
- protected boolean isCreateFromExistingDomainModel() {
- return isInitFromExistingDomainModel;
- }
-
- /**
- * Suggests a name of diagram file for the domain model file without extension.
- *
- * @param domainModel the domain model
- * @return the diagram file name
- */
- protected String getDiagramFileName(IFile domainModel) {
- return domainModel.getLocation().removeFileExtension().lastSegment();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#getDiagramFileExtension(java.lang.String)
- */
- @Override
- protected String getDiagramFileExtension(String diagramCategoryId) {
- if(isCreateFromExistingDomainModel()) {
- return NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION;
- }
- return super.getDiagramFileExtension(diagramCategoryId);
- }
-
- /**
- * Returns the first file from the given selection.
- *
- * @param selection the selection
- * @return the selected file
- */
- private static IFile getSelectedFile(IStructuredSelection selection) {
- if(selection != null && !selection.isEmpty() && selection.getFirstElement() instanceof IFile) {
- return (IFile)selection.getFirstElement();
- }
- return null;
- }
-
- /**
- * Gets the root.
- *
- * @return the root
- */
- private EObject getRoot() {
- if(selectRootElementPage != null) {
- return selectRootElementPage.getModelElement();
- }
- return null;
- }
-
- /**
- * The Class NewDiagramForExistingModelPage.
- */
- protected class NewDiagramForExistingModelPage extends NewModelFilePage {
-
- /** The my diagram file name. */
- private String myDiagramFileName;
-
- /**
- * Instantiates a new new diagram for existing model page.
- *
- * @param selection the selection
- * @param defaultFileName the default file name
- * @param diagramExtension the diagram extension
- */
- public NewDiagramForExistingModelPage(IStructuredSelection selection, String defaultFileName, String diagramExtension) {
- super(selection);
- myDiagramFileName = defaultFileName;
- setFileName(defaultFileName);
- setFileExtension(diagramExtension);
- setTitle(Messages.InitModelWizard_init_papyrus_model);
- setDescription(Messages.InitModelWizard_init_papyrus_model_desc);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage()
- */
- protected boolean validatePage() {
- if(!super.validatePage()) {
- return false;
- }
- if(!myDiagramFileName.equals(getFileName())) {
- setErrorMessage(Messages.bind(Messages.InitModelWizard_diagram_name_is_different_from_domain_model, myDiagramFileName));
- return false;
- }
- return true;
- };
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Messages.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Messages.java
deleted file mode 100644
index 593c1e974a2..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/Messages.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.papyrus.wizards;
-
-import org.eclipse.osgi.util.NLS;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class Messages.
- */
-public class Messages extends NLS {
-
- /** The Constant BUNDLE_NAME. */
- private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
-
- /** The Create model wizard_new_papyrus_model_title. */
- public static String CreateModelWizard_new_papyrus_model_title;
-
- /** The Create several models wizard_cannot_initiate_page. */
- public static String CreateSeveralModelsWizard_cannot_initiate_page;
-
- /** The Create several models wizard_new_model_file_page_title. */
- public static String CreateSeveralModelsWizard_new_model_file_page_title;
-
- /** The Init model wizard_diagram_name_is_different_from_domain_model. */
- public static String InitModelWizard_diagram_name_is_different_from_domain_model;
-
- /** The Init model wizard_init_papyrus_diagram. */
- public static String InitModelWizard_init_papyrus_diagram;
-
- /** The Init model wizard_init_papyrus_model. */
- public static String InitModelWizard_init_papyrus_model;
-
- /** The Init model wizard_init_papyrus_model_desc. */
- public static String InitModelWizard_init_papyrus_model_desc;
-
- /** The New papyrus project with multi models wizard_exception_on_project_opening. */
- public static String NewPapyrusProjectWithMultiModelsWizard_exception_on_project_opening;
-
- /** The New papyrus project wizard_exception_on_opening. */
- public static String NewPapyrusProjectWizard_exception_on_opening;
-
- /** The New papyrus project wizard_new_papyrus_project. */
- public static String NewPapyrusProjectWizard_new_papyrus_project;
-
- /** The New papyrus project wizard_papyrus_project. */
- public static String NewPapyrusProjectWizard_papyrus_project;
-
- /** The New papyrus project wizard_papyrus_project_desc. */
- public static String NewPapyrusProjectWizard_papyrus_project_desc;
-
- /** The Diagram category registry_bad_class_name_of_category. */
- public static String DiagramCategoryRegistry_bad_class_name_of_category;
-
- /** The Diagram kind label provider_undefined_element. */
- public static String DiagramKindLabelProvider_undefined_element;
-
- /** The Model templates label provider_model_template_description_text. */
- public static String ModelTemplatesLabelProvider_model_template_description_text;
-
- /** The New model file page_3. */
- public static String NewModelFilePage_3;
-
- /** The New model file page_default_diagram_name. */
- public static String NewModelFilePage_default_diagram_name;
-
- /** The New model file page_diagram_file_was_renamed. */
- public static String NewModelFilePage_diagram_file_was_renamed;
-
- /** The New model file page_new_diagram_category_needs_specific_extension. */
- public static String NewModelFilePage_new_diagram_category_needs_specific_extension;
-
- /** The New model file page_page_desc. */
- public static String NewModelFilePage_page_desc;
-
- /** The Select diagram category page_cannot_find_category. */
- public static String SelectDiagramCategoryPage_cannot_find_category;
-
- /** The Select diagram category page_diagram_language_group. */
- public static String SelectDiagramCategoryPage_diagram_language_group;
-
- /** The Select diagram category page_select_language. */
- public static String SelectDiagramCategoryPage_select_language;
-
- /** The Select diagram category page_select_one_category. */
- public static String SelectDiagramCategoryPage_select_one_category;
-
- /** The Select diagram kind page_default_diagram_name. */
- public static String SelectDiagramKindPage_default_diagram_name;
-
- /** The Select diagram kind page_diagram_name_group. */
- public static String SelectDiagramKindPage_diagram_name_group;
-
- /** The Select diagram kind page_diagram_name_is_empty. */
- public static String SelectDiagramKindPage_diagram_name_is_empty;
-
- /** The Select diagram kind page_load_template_group. */
- public static String SelectDiagramKindPage_load_template_group;
-
- /** The Select diagram kind page_page_desc. */
- public static String SelectDiagramKindPage_page_desc;
-
- /** The Select diagram kind page_page_title. */
- public static String SelectDiagramKindPage_page_title;
-
- /** The Select diagram kind page_remember_current_selection_text. */
- public static String SelectDiagramKindPage_remember_current_selection_text;
-
- /** The Select diagram kind page_remember_current_selection_tooltip. */
- public static String SelectDiagramKindPage_remember_current_selection_tooltip;
-
- /** The Select diagram kind page_select_kind_group. */
- public static String SelectDiagramKindPage_select_kind_group;
-
- /** The Select root element page_select_root_element_desc. */
- public static String SelectRootElementPage_select_root_element_desc;
-
- /** The Select root element page_select_root_element_title. */
- public static String SelectRootElementPage_select_root_element_title;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * Instantiates a new messages.
- */
- private Messages() {
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWithMultiModelsWizard.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWithMultiModelsWizard.java
deleted file mode 100644
index bdc29af359a..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWithMultiModelsWizard.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-import org.eclipse.papyrus.wizards.pages.SelectDiagramCategoryPage;
-
-/**
- * The Wizard creates a new Project and a several Papyrus Models of different categories inside it.
- */
-public class NewPapyrusProjectWithMultiModelsWizard extends NewPapyrusProjectWizard {
-
- /** The my do not create model for no diagrams. */
- private boolean myDoNotCreateModelForNoDiagrams;
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.wizards.1createproject.several"; //$NON-NLS-1$
-
-
- /**
- * Instantiates a new new papyrus project with multi models wizard.
- */
- public NewPapyrusProjectWithMultiModelsWizard() {
- this(false);
- }
-
- /**
- * Instantiates a new new papyrus project with multi models wizard.
- *
- * @param doNotCreateModelForNoDiagrams the do not create model for no diagrams
- */
- public NewPapyrusProjectWithMultiModelsWizard(boolean doNotCreateModelForNoDiagrams) {
- myDoNotCreateModelForNoDiagrams = doNotCreateModelForNoDiagrams;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.papyrus.wizards.CreateModelWizard#createSelectDiagramCategoryPage()
- */
- @Override
- protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() {
- return new SelectDiagramCategoryPage(true);
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- IProject newProjectHandle;
- try {
- newProjectHandle = createNewProject();
- } catch (CoreException e) {
- Activator.log.error(Messages.NewPapyrusProjectWithMultiModelsWizard_exception_on_project_opening, e);
- return false;
- }
- if (newProjectHandle == null) {
- return false;
- }
- for (String category: getDiagramCategoryIds()) {
- if (myDoNotCreateModelForNoDiagrams && getDiagramKindsFor(category).isEmpty()){
- // don't create model
- continue;
- }
- final IFile newFile = createNewModelFile(category);
- DiResourceSet diResourceSet = new DiResourceSet();
- createAndOpenPapyrusModel(diResourceSet, newFile, category);
- }
-
- saveDiagramCategorySettings();
- saveDiagramKindSettings();
- return true;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWizard.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWizard.java
deleted file mode 100644
index 21157cecb10..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewPapyrusProjectWizard.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import java.net.URI;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.wizards.pages.NewModelFilePage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * The Wizard creates a new Project and a Papyrus Model inside it.
- */
-public class NewPapyrusProjectWizard extends CreateModelWizard {
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.wizards.1createproject"; //$NON-NLS-1$
-
- /** The new project page. */
- private WizardNewProjectCreationPage myNewProjectPage;
-
- /** The initial project name. */
- private String initialProjectName;
-
- /**
- * Inits the.
- *
- * @param workbench the workbench
- * @param selection the selection
- * {@inheritDoc}
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- super.init(workbench, selection);
- setWindowTitle(Messages.NewPapyrusProjectWizard_new_papyrus_project);
- myNewProjectPage = createNewProjectCreationPage();
- }
-
- /**
- * Creates the new project creation page.
- *
- * @return the wizard new project creation page
- */
- protected WizardNewProjectCreationPage createNewProjectCreationPage() {
- WizardNewProjectCreationPage newProjectPage = new WizardNewProjectCreationPage("papyrusNewProjectPage"); //$NON-NLS-1$
- newProjectPage.setInitialProjectName(initialProjectName);
- newProjectPage.setTitle(Messages.NewPapyrusProjectWizard_papyrus_project);
- newProjectPage.setDescription(Messages.NewPapyrusProjectWizard_papyrus_project_desc);
- return newProjectPage;
- }
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- addPage(myNewProjectPage);
- super.addPages();
- }
-
- /**
- * Creates the new model file page.
- *
- * @param selection the selection
- * @return the new model file page
- * {@inheritDoc}
- */
- @Override
- protected NewModelFilePage createNewModelFilePage(IStructuredSelection selection) {
- return null;
- }
-
-
- /**
- * Perform finish.
- *
- * @return true, if successful
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- IProject newProjectHandle;
- try {
- newProjectHandle = createNewProject();
- } catch (CoreException e) {
- Activator.log.error(Messages.NewPapyrusProjectWizard_exception_on_opening, e);
- return false;
- }
- if (newProjectHandle == null) {
- return false;
- }
- return super.performFinish();
- }
-
- /**
- * Creates the new project.
- *
- * @return the i project
- * @throws CoreException the core exception
- */
- protected IProject createNewProject() throws CoreException {
- // get a project handle
- final IProject project = myNewProjectPage.getProjectHandle();
-
- // get a project descriptor
- URI projectLocationURI = null;
- if (!myNewProjectPage.useDefaults()) {
- projectLocationURI = myNewProjectPage.getLocationURI();
- }
-
- IProjectDescription projectDescription = null;
- NullProgressMonitor progressMonitor = new NullProgressMonitor();
- if (!project.exists())
- {
- projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
- if (projectLocationURI != null)
- {
- projectDescription.setLocationURI(projectLocationURI);
- }
- project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1));
- project.open(new SubProgressMonitor(progressMonitor, 1));
- }
- else
- {
- projectDescription = project.getDescription();
- project.open(new SubProgressMonitor(progressMonitor, 1));
- }
-
- return project;
- }
-
- /**
- * Creates the new model file.
- *
- * @param categoryId the category id
- * @return the i file
- * {@inheritDoc}
- */
- @Override
- protected IFile createNewModelFile(String categoryId) {
- IPath newFilePath = myNewProjectPage.getProjectHandle().getFullPath().append(NewModelFilePage.DEFAULT_NAME + "." + getDiagramFileExtension(categoryId)); //$NON-NLS-1$
- return ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath);
- }
-
- /**
- * Sets the initial project name.
- *
- * @param initialProjectName
- * the new initial project name
- */
- public void setInitialProjectName(String initialProjectName) {
- this.initialProjectName = initialProjectName;
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewProjectAction.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewProjectAction.java
deleted file mode 100644
index 00aca331a33..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/NewProjectAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/package org.eclipse.papyrus.wizards;
-
-import java.util.Properties;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.internal.intro.impl.IntroPlugin;
-import org.eclipse.ui.intro.IIntroSite;
-import org.eclipse.ui.intro.config.IIntroAction;
-
-/**
- * The Class NewProjectAction. It is used on the Welcome Page.
- */
-public class NewProjectAction implements IIntroAction {
-
- /**
- * Run.
- *
- * @param site the site
- * @param params the params
- * @see org.eclipse.ui.intro.config.IIntroAction#run(org.eclipse.ui.intro.IIntroSite, java.util.Properties)
- */
- public void run(IIntroSite site, Properties params) {
- IntroPlugin.getDefault().closeIntro();
-
- NewPapyrusProjectWizard wizard = new NewPapyrusProjectWizard();
- wizard.init(site.getWorkbenchWindow().getWorkbench(), new StructuredSelection());
- WizardDialog dialog = new WizardDialog(site.getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
- dialog.open();
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/SettingsHelper.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/SettingsHelper.java
deleted file mode 100644
index e2661bd06c5..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/SettingsHelper.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-/**
- * The Class SettingsUtils allows the Wizard to remember last selected diagram kinds and categories.
- */
-public class SettingsHelper {
-
- /** The Constant DIAGRAM_KIND_SEPARATOR. */
- private static final String DIAGRAM_KIND_SEPARATOR = ","; //$NON-NLS-1$
-
- /** The Constant TEMPLATE_SEPARATOR. */
- private static final String TEMPLATE_SEPARATOR = ","; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_REMEMBER_CURRENT_SELECTION. */
- private static final String SETTINGS_KEY_REMEMBER_CURRENT_SELECTION = "RememberCurrentSelection"; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_DIAGRAM_KINDS. */
- private static final String SETTINGS_KEY_DIAGRAM_KINDS = "DiagramKindsFor_"; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_DIAGRAM_TEMPLATES. */
- private static final String SETTINGS_KEY_DIAGRAM_TEMPLATES = "DiagramTemplatesFor_"; //$NON-NLS-1$
-
- /** The Constant LAST_SELECTED_CATEGORY. */
- private static final String LAST_SELECTED_CATEGORY = "diagramCategory"; //$NON-NLS-1$
-
- /** The my settings. */
- private final IDialogSettings mySettings;
-
- /**
- * Instantiates a new settings utils.
- *
- * @param settings
- * the settings
- */
- public SettingsHelper(IDialogSettings settings) {
- mySettings = settings;
- }
-
- /**
- * Gets the default diagram category.
- *
- * @return the default diagram category
- */
- public String[] getDefaultDiagramCategories() {
- return mySettings.getArray(LAST_SELECTED_CATEGORY);
- }
-
- /**
- * Save default diagram category.
- *
- * @param categories the categories
- */
- public void saveDefaultDiagramCategory(String[] categories) {
- mySettings.put(LAST_SELECTED_CATEGORY, categories);
- }
-
- /**
- * Gets the default diagram kinds.
- *
- * @param category
- * the category
- * @return the default diagram kinds
- */
- public List<String> getDefaultDiagramKinds(String category) {
- String csl = mySettings.get(getKeyForDiagramKind(category));
- if(csl == null || csl == "") { //$NON-NLS-1$
- return Collections.emptyList();
- }
- List<String> result = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(csl, DIAGRAM_KIND_SEPARATOR);
- while(tokenizer.hasMoreTokens()) {
- result.add(tokenizer.nextToken().trim());
- }
- return result;
- }
-
- /**
- * Save default diagram kinds.
- *
- * @param category
- * the category
- * @param kinds
- * the kinds
- */
- public void saveDefaultDiagramKinds(String category, List<String> kinds) {
- String value = ""; //$NON-NLS-1$
- for(String kind : kinds) {
- value += kind;
- value += DIAGRAM_KIND_SEPARATOR;
- }
- mySettings.put(getKeyForDiagramKind(category), value);
- }
-
- /**
- * Gets the default templates.
- *
- * @param category
- * the category
- * @return the default templates
- */
- public List<String> getDefaultTemplates(String category) {
- String csl = mySettings.get(getKeyForTemplate(category));
- if(csl == null || csl == "") { //$NON-NLS-1$
- return Collections.emptyList();
- }
- List<String> result = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(csl, TEMPLATE_SEPARATOR);
- while(tokenizer.hasMoreTokens()) {
- result.add(tokenizer.nextToken().trim());
- }
- return result;
- }
-
- /**
- * Save default templates.
- *
- * @param category
- * the category
- * @param templates
- * the templates
- */
- public void saveDefaultTemplates(String category, List<String> templates) {
- String value = ""; //$NON-NLS-1$
- for(String template : templates) {
- value += template;
- value += TEMPLATE_SEPARATOR;
- }
- mySettings.put(getKeyForTemplate(category), value);
- }
-
- /**
- * Save remember current selection.
- *
- * @param remember
- * the remember
- */
- public void saveRememberCurrentSelection(boolean remember) {
- mySettings.put(SETTINGS_KEY_REMEMBER_CURRENT_SELECTION, remember);
- }
-
- /**
- * Remember current selection.
- *
- * @param settings
- * the settings
- * @return true, if successful
- */
- public boolean rememberCurrentSelection(IDialogSettings settings) {
- return mySettings.getBoolean(SETTINGS_KEY_REMEMBER_CURRENT_SELECTION);
- }
-
- /**
- * Gets the key for diagram kind.
- *
- * @param category the category
- * @return the key for diagram kind
- */
- private String getKeyForDiagramKind(String category) {
- return SETTINGS_KEY_DIAGRAM_KINDS + category;
- }
-
- /**
- * Gets the key for template.
- *
- * @param category the category
- * @return the key for template
- */
- private String getKeyForTemplate(String category) {
- return SETTINGS_KEY_DIAGRAM_TEMPLATES + category;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryDescriptor.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryDescriptor.java
deleted file mode 100644
index 4c4a040cfe7..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryDescriptor.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.category;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
-import org.eclipse.papyrus.core.extension.commands.IModelCreationCommand;
-
-/**
- * The Class DiagramCategoryDescriptor.
- */
-public class DiagramCategoryDescriptor {
-
- /** The my id. */
- private String myId;
-
- /** The my label. */
- private String myLabel;
-
- /** The my description. */
- private String myDescription;
-
- /** The my file extension. */
- private String myFileExtension;
-
- /** The my icon. */
- private ImageDescriptor myIcon;
-
- /** The instance. */
- private IModelCreationCommand instance;
-
- /** The my creation command class. */
- protected Class<? extends IModelCreationCommand> myCreationCommandClass;
-
- /**
- * Instantiates a new diagram category descriptor.
- *
- * @param id the id
- * @param label the label
- * @param creationCommandClass the creation command class
- */
- public DiagramCategoryDescriptor(String id, String label, Class<? extends IModelCreationCommand> creationCommandClass) {
- myId = id;
- myLabel = label;
- myCreationCommandClass = creationCommandClass;
- }
-
- /**
- * Gets the id.
- *
- * @return the id
- */
- public String getId() {
- return myId;
- }
-
- /**
- * Gets the label.
- *
- * @return the label
- */
- public String getLabel() {
- return myLabel;
- }
-
- /**
- * constructor.
- *
- * @return the creation command
- * @throws BackboneException the backbone exception
- */
- public IModelCreationCommand getCommand() throws BackboneException {
- if(instance == null)
- instance = createCommand();
-
- return instance;
- }
-
- /**
- * Creates the command.
- *
- * @return the i model creation command
- * @throws BackboneException the backbone exception
- */
- private IModelCreationCommand createCommand() throws BackboneException {
- try {
- IModelCreationCommand command = myCreationCommandClass.newInstance();
- return command;
- } catch (SecurityException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return myDescription;
- }
-
- /**
- * Gets the icon.
- *
- * @return the icon
- */
- public ImageDescriptor getIcon() {
- return myIcon;
- }
-
- /**
- * Gets the file extension.
- *
- * @return the file extension
- */
- public String getExtensionPrefix() {
- return myFileExtension;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- myDescription = description;
- }
-
- /**
- * Sets the icon.
- *
- * @param icon the new icon
- */
- public void setIcon(ImageDescriptor icon) {
- myIcon = icon;
- }
-
- /**
- * Sets the file extension.
- *
- * @param fileExtension the new file extension
- */
- public void setExtensionPrefix(String fileExtension) {
- myFileExtension = fileExtension;
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryRegistry.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryRegistry.java
deleted file mode 100644
index a510fedcb19..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/DiagramCategoryRegistry.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.category;
-
-import static org.eclipse.papyrus.wizards.Activator.log;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.core.extension.BadClassNameException;
-import org.eclipse.papyrus.core.extension.ExtensionUtils;
-import org.eclipse.papyrus.core.extension.commands.IModelCreationCommand;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The Class DiagramCategoryRegistry reads available DiagramCategories from plugin descriptors.
- */
-public class DiagramCategoryRegistry extends ExtensionUtils {
-
- /** The Constant CATEGORY_EXTENSION_POINT_NAME. */
- private static final String CATEGORY_EXTENSION_POINT_NAME = "org.eclipse.papyrus.core.papyrusDiagram"; //$NON-NLS-1$
-
- /** ID of the editor extension (schema filename). */
- public static final String CATEGORY_ELEMENT_NAME = "diagramCategory"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_ID. */
- private static final String CATEGORY_ID = "id"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_LABEL. */
- private static final String CATEGORY_LABEL = "label"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_DESCRIPTION. */
- private static final String CATEGORY_DESCRIPTION = "description"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_ICON. */
- private static final String CATEGORY_ICON = "icon"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_CLASS. */
- private static final String CATEGORY_CLASS = "class"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_FILE_EXTENSION_PREFIX. */
- private static final String CATEGORY_FILE_EXTENSION_PREFIX = "extensionPrefix"; //$NON-NLS-1$
-
- /** The diagram categories. */
- private static Map<String, DiagramCategoryDescriptor> diagramCategories;
-
- /** The our instance. */
- private static DiagramCategoryRegistry ourInstance;
-
- /**
- * Instantiates a new diagram category registry.
- */
- private DiagramCategoryRegistry() {
- }
-
- /**
- * Gets the single instance of DiagramCategoryRegistry.
- *
- * @return single instance of DiagramCategoryRegistry
- */
- public static DiagramCategoryRegistry getInstance() {
- if(ourInstance == null) {
- ourInstance = new DiagramCategoryRegistry();
- }
- return ourInstance;
- }
-
- /**
- * Gets the diagram categories.
- *
- * @return the diagram categories
- */
- public List<DiagramCategoryDescriptor> getDiagramCategories() {
- if(diagramCategories == null) {
- diagramCategories = buildDiagramCategories();
- }
- return new ArrayList<DiagramCategoryDescriptor>(diagramCategories.values());
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- public Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- if(diagramCategories == null) {
- diagramCategories = buildDiagramCategories();
- }
- return diagramCategories;
- }
-
- /**
- * Builds the diagram categories.
- *
- * @return the hash map
- */
- public Map<String, DiagramCategoryDescriptor> buildDiagramCategories() {
- Map<String, DiagramCategoryDescriptor> result = new HashMap<String, DiagramCategoryDescriptor>();
-
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CATEGORY_EXTENSION_POINT_NAME);
- for(IExtension extension : extensionPoint.getExtensions()) {
- for(IConfigurationElement confElement : extension.getConfigurationElements()) {
- if(CATEGORY_ELEMENT_NAME.equals(confElement.getName())) {
- DiagramCategoryDescriptor diagramCategoryDescriptor;
- try {
- diagramCategoryDescriptor = buildCategoryDescriptor(confElement);
- result.put(diagramCategoryDescriptor.getId(), diagramCategoryDescriptor);
- } catch (BadClassNameException e) {
- log.error(Messages.DiagramCategoryRegistry_bad_class_name_of_category, e);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Builds the category descriptor.
- *
- * @param confElement the conf element
- * @return the diagram category descriptor
- * @throws BadClassNameException the bad class name exception
- */
- protected DiagramCategoryDescriptor buildCategoryDescriptor(IConfigurationElement confElement) throws BadClassNameException {
- Class<IModelCreationCommand> commandClazz = (Class<IModelCreationCommand>)parseClass(confElement, CATEGORY_CLASS, CATEGORY_ELEMENT_NAME);
- DiagramCategoryDescriptor diagramCategoryDescriptor = new DiagramCategoryDescriptor(confElement.getAttribute(CATEGORY_ID), confElement.getAttribute(CATEGORY_LABEL), commandClazz);
- diagramCategoryDescriptor.setDescription(confElement.getAttribute(CATEGORY_DESCRIPTION));
- diagramCategoryDescriptor.setExtensionPrefix(confElement.getAttribute(CATEGORY_FILE_EXTENSION_PREFIX));
- String iconPath = confElement.getAttribute(CATEGORY_ICON);
- if(iconPath != null) {
- diagramCategoryDescriptor.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(confElement.getNamespaceIdentifier(), iconPath));
- }
- return diagramCategoryDescriptor;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/NewPapyrusModelCommand.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/NewPapyrusModelCommand.java
deleted file mode 100644
index 74ab2de9f04..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/NewPapyrusModelCommand.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.category;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.papyrus.resource.ModelSet;
-
-/**
- * The Command to create a new Papyrus Model.
- */
-public class NewPapyrusModelCommand extends RecordingCommand {
-
- /** The my model set. */
- private final ModelSet myModelSet;
-
- /** The my file. */
- private final IFile myFile;
-
- /**
- * Instantiates a new new papyrus model command.
- *
- * @param modelSet the di resource set
- * @param newFile the new file
- */
- public NewPapyrusModelCommand(ModelSet modelSet, IFile newFile) {
- super(modelSet.getTransactionalEditingDomain());
- myModelSet = modelSet;
- myFile = newFile;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
- */
- @Override
- protected void doExecute() {
- myModelSet.createsModels(myFile);
- }
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/PapyrusModelFromExistingDomainModelCommand.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/PapyrusModelFromExistingDomainModelCommand.java
deleted file mode 100644
index 6102160db71..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/category/PapyrusModelFromExistingDomainModelCommand.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.category;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.papyrus.resource.IModel;
-import org.eclipse.papyrus.resource.ModelSet;
-import org.eclipse.papyrus.resource.notation.NotationModel;
-import org.eclipse.papyrus.resource.sasheditor.DiModel;
-import org.eclipse.papyrus.resource.uml.UmlModel;
-import org.eclipse.papyrus.wizards.CreateModelWizard.DiResourceSetExt;
-
-/**
- * The command to initialize Papyrus diagram for a given domain model.
- */
-public class PapyrusModelFromExistingDomainModelCommand extends RecordingCommand {
-
- /** The my di resource set. */
- private final ModelSet myDiResourceSet;
-
- /** The my file name without extension. */
- private final IPath myFileNameWithoutExtension;
-
- /** The my root. */
- private final EObject myRoot;
-
- /**
- * Instantiates a new papyrus model from existing domain model command.
- *
- * @param diResourceSet the di resource set
- * @param newFile the new file
- * @param root the root
- */
- public PapyrusModelFromExistingDomainModelCommand(ModelSet diResourceSet, IFile newFile, EObject root) {
- super(diResourceSet.getTransactionalEditingDomain());
- myDiResourceSet = diResourceSet;
- myFileNameWithoutExtension = newFile.getFullPath().removeFileExtension();
- // Bug 339504 - [Wizard] NPE when init diagram from an existing model
- ((DiResourceSetExt)diResourceSet).setFilenameWithoutExtension(myFileNameWithoutExtension);
- myRoot = root;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
- */
- @Override
- protected void doExecute() {
- IModel model = myDiResourceSet.getModel(DiModel.MODEL_ID);
- model.createModel(myFileNameWithoutExtension);
- model = myDiResourceSet.getModel(NotationModel.MODEL_ID);
- model.createModel(myFileNameWithoutExtension);
- // START OF WORKAROUND for #315083
- IModel umlModel = new UmlModel() {
-
- public void createModel(IPath fullPath) {
- try {
- resourceURI = myRoot.eResource().getURI();
- // as resource already exists, use rs.getResource() not rs.createResource() here
- resource = getResourceSet().getResource(resourceURI, true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- };
- };
- myDiResourceSet.registerModel(umlModel);
- umlModel.createModel(null);
-
- // // call snippets to allow them to do their stuff
- // snippets.performStart(this);
- // END OF WORKAROUND for #315083
- }
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindContentProvider.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindContentProvider.java
deleted file mode 100644
index b181593dd6d..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindContentProvider.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.kind;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.core.extension.commands.ICreationCommandRegistry;
-
-/**
- * The ContentProvider for DiagramCategory table.
- * Returns available diagram kinds for the giben diagram category(ies).
- */
-public class DiagramKindContentProvider implements IStructuredContentProvider {
-
- /** The creation command registry. */
- private final ICreationCommandRegistry creationCommandRegistry;
-
-
- /**
- * Instantiates a new diagram kind content provider.
- *
- * @param creationCommandRegistry the creation command registry
- */
- public DiagramKindContentProvider(ICreationCommandRegistry creationCommandRegistry) {
- this.creationCommandRegistry = creationCommandRegistry;
- }
-
-
- /**
- * Dispose.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * Input changed.
- *
- * @param viewer the viewer
- * @param oldInput the old input
- * @param newInput the new input
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * Gets the elements.
- *
- * @param inputElement the input element
- * @return the elements
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof Object[]) {
- List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
- for (Object next: (Object[])inputElement) {
- if (next instanceof String) {
- String diagramCategory = (String)next;
- result.addAll(getCreationCommands(diagramCategory));
- }
- }
- Collections.sort(result, new Comparator<CreationCommandDescriptor>() {
-
- public int compare(CreationCommandDescriptor o1, CreationCommandDescriptor o2) {
- return o1.getLabel().compareTo(o2.getLabel());
- }
- });
- return result.toArray(new Object[result.size()]);
- }
- if(inputElement instanceof String) {
- String diagramCategory = (String)inputElement;
- List<CreationCommandDescriptor> result = getCreationCommands(diagramCategory);
- return result.toArray(new Object[result.size()]);
- }
- return null;
- }
-
- /**
- * Gets the creation commands.
- *
- * @param diagramCategory the diagram category
- * @return the creation commands
- */
- protected List<CreationCommandDescriptor> getCreationCommands(String diagramCategory) {
- List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
- for(CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
- if(diagramCategory != null && diagramCategory.equals(desc.getLanguage())) {
- result.add(desc);
- }
- }
- return result;
- }
-
- /**
- * Gets the creation command registry.
- *
- * @return the creation command registry
- */
- private ICreationCommandRegistry getCreationCommandRegistry() {
- return creationCommandRegistry;
- }
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindLabelProvider.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindLabelProvider.java
deleted file mode 100644
index 64925e0ef29..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/kind/DiagramKindLabelProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.kind;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The LabelProvider for DiagramCategory table.
- * Returns labels and images for the categories as is specified in its descriptor(e.g. read from plugin.xml).
- */
-public class DiagramKindLabelProvider implements ILabelProvider {
-
- /** The Constant UNDEFINED_ELEMENT. */
- private static final String UNDEFINED_ELEMENT = Messages.DiagramKindLabelProvider_undefined_element;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- // TODO use ImageRegistry to store images
- if(element instanceof CreationCommandDescriptor) {
- ImageDescriptor image = ((CreationCommandDescriptor)element).getIcon();
- // image is an optional attribute
- if(image != null) {
- return new Image(null, image.getImageData());
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if(element instanceof CreationCommandDescriptor) {
- return ((CreationCommandDescriptor)element).getLabel();
- }
- return UNDEFINED_ELEMENT;
- }
-
- /**
- * Adds the listener.
- *
- * @param listener the listener
- * {@inheritDoc}
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * Dispose.
- *
- * {@inheritDoc}
- */
- public void dispose() {
- }
-
- /**
- * Checks if is label property.
- *
- * @param element the element
- * @param property the property
- * @return true, if is label property
- * {@inheritDoc}
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * Removes the listener.
- *
- * @param listener the listener
- * {@inheritDoc}
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/NewModelFilePage.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/NewModelFilePage.java
deleted file mode 100644
index f3d846c9218..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/NewModelFilePage.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * 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:
- * Obeo - initial API and implementation
- * Tatiana Fesenko(CEA) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.wizards.pages;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.wizards.Activator;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * This WizardPage can create an empty .uml2 file for the PapyrusEditor.
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public class NewModelFilePage extends WizardNewFileCreationPage {
-
- /** The Constant DEFAULT_NAME. */
- public static final String DEFAULT_NAME = Messages.NewModelFilePage_default_diagram_name;
-
- /** The Constant DIAGRAM_EXTENSION. */
- public static final String DEFAULT_DIAGRAM_EXTENSION = "di"; //$NON-NLS-1$
-
- /** The Constant PAGE_ID. */
- public static final String PAGE_ID = "NewPapyrusModel"; //$NON-NLS-1$
-
- /**
- * Instantiates a new new model file page.
- *
- * @param selection
- * the selection
- */
- public NewModelFilePage(IStructuredSelection selection) {
- this(PAGE_ID, selection);
- }
-
- /**
- * Instantiates a new new model file page.
- *
- * @param pageId the page id
- * @param selection the selection
- */
- public NewModelFilePage(String pageId, IStructuredSelection selection) {
- super(pageId, selection);
- setTitle(Messages.NewModelFilePage_3);
- setDescription(Messages.NewModelFilePage_page_desc);
- setFileExtension(DEFAULT_DIAGRAM_EXTENSION);
- }
-
- /**
- * Creates the control.
- *
- * @param parent the parent
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- setFileName(getUniqueFileName(getContainerFullPath(), getFileName(), getFileExtension()));
- setPageComplete(validatePage());
- }
-
- /**
- * Diagram extension changed.
- *
- * @param newExtension the new extension
- * @return the i status
- */
- public IStatus diagramExtensionChanged(String newExtension) {
- String currentExtension = getFileExtension();
- if(!currentExtension.equals(newExtension)) {
-
- String oldFileName = getFileName();
- String newFileName = NewModelFilePage.getUniqueFileName(getContainerFullPath(), getFileName(), newExtension);
-
- setFileName(newFileName);
- setFileExtension(newExtension);
-
- String message1 = Messages.NewModelFilePage_new_diagram_category_needs_specific_extension;
- String message2 = Messages.bind(Messages.NewModelFilePage_diagram_file_was_renamed, oldFileName, newFileName);
- String message = message1 + message2;
- Status resultStatus = new Status(Status.INFO, Activator.PLUGIN_ID, message);
-
- String errorMessage = getErrorMessage();
- if(errorMessage != null) {
- resultStatus = new Status(Status.ERROR, Activator.PLUGIN_ID, errorMessage);
- }
- return resultStatus;
- }
- return Status.OK_STATUS;
- }
-
-
- /**
- * Gets the unique file name.
- *
- * @param containerFullPath
- * the container full path
- * @param fileName
- * the file name
- * @param extension
- * the extension
- * @return the unique file name
- */
- protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
- if(extension == null) {
- extension = ""; //$NON-NLS-1$
- }
-
- if(containerFullPath == null) {
- containerFullPath = new Path(""); //$NON-NLS-1$
- }
- if(fileName == null || fileName.trim().length() == 0) {
- fileName = DEFAULT_NAME;
- }
-
- if(fileName.contains(".")) { //$NON-NLS-1$
- fileName = fileName.substring(0, fileName.indexOf(".")); //$NON-NLS-1$
- }
-
- IPath filePath = containerFullPath.append(fileName);
- filePath = containerFullPath.append(fileName);
- filePath = filePath.addFileExtension(extension);
-
- int i = 1;
- while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) {
- i++;
- filePath = containerFullPath.append(fileName + i);
- if(extension != null) {
- filePath = filePath.addFileExtension(extension);
- }
- }
- return filePath.lastSegment();
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramCategoryPage.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramCategoryPage.java
deleted file mode 100644
index 75fa5934dbf..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramCategoryPage.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.pages;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.wizards.CreateModelWizard;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.papyrus.wizards.SettingsHelper;
-import org.eclipse.papyrus.wizards.category.DiagramCategoryDescriptor;
-import org.eclipse.papyrus.wizards.category.DiagramCategoryRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-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.Group;
-
-
-/**
- * The Class SelectDiagramCategoryPage.
- */
-public class SelectDiagramCategoryPage extends WizardPage {
-
- /** The my diagram kind buttons. */
- final private List<Button> myDiagramKindButtons = new ArrayList<Button>();
-
- /** The diagram category. */
- private final List<String> mySelectedDiagramCategoryIds = new LinkedList<String>();
-
- /** The Constant PAGE_ID. */
- public static final String PAGE_ID = "SelectDiagramCategory"; //$NON-NLS-1$
-
- /** The Constant DEFAULT_EXTENSION. */
- public static final String DEFAULT_EXTENSION = "uml"; //$NON-NLS-1$
-
- /** The my allow several categories. */
- private final boolean myAllowSeveralCategories;
-
- /**
- * Instantiates a new select diagram category page.
- *
- */
- public SelectDiagramCategoryPage() {
- this(false);
- }
-
- /**
- * Instantiates a new select diagram category page.
- *
- * @param allowSeveralCategories the allow several categories
- */
- public SelectDiagramCategoryPage(boolean allowSeveralCategories) {
- super(PAGE_ID);
- myAllowSeveralCategories = allowSeveralCategories;
- setTitle(Messages.SelectDiagramCategoryPage_select_language);
- }
-
- /**
- * Sets the wizard.
- *
- * @param newWizard the new wizard
- * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- @Override
- public void setWizard(IWizard newWizard) {
- super.setWizard(newWizard);
- SettingsHelper settingsHelper = new SettingsHelper(getDialogSettings());
- String[] defaultDiagramCategory = settingsHelper.getDefaultDiagramCategories();
- if (defaultDiagramCategory != null && defaultDiagramCategory.length > 0) {
- if (myAllowSeveralCategories) {
- setDefaultDiagramCategories(defaultDiagramCategory);
- } else {
- setDefaultDiagramCategories(new String[]{defaultDiagramCategory[0]});
- }
- }
- }
-
- /**
- * Creates the control.
- *
- * @param parent the parent
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginWidth = 10;
- plate.setLayout(gridLayout);
- setControl(plate);
-
- createDiagramCategoryForm(plate);
-
- setPageComplete(validatePage());
- }
-
- /**
- *
- * Gets the diagram category.
- *
- * @return the diagram category
- * @deprecated Use getDiagramCategories() instead.
- */
- public String getDiagramCategory() {
- if(!mySelectedDiagramCategoryIds.isEmpty()) {
- return mySelectedDiagramCategoryIds.get(0);
- }
- return null;
- }
-
- /**
- * Gets the diagram categories.
- *
- * @return the diagram categories
- */
- public String[] getDiagramCategories() {
- return mySelectedDiagramCategoryIds.toArray(new String[mySelectedDiagramCategoryIds.size()]);
- }
-
- /**
- * Sets the default diagram categories.
- *
- * @param categories the new default diagram categories
- */
- protected final void setDefaultDiagramCategories(String[] categories) {
- mySelectedDiagramCategoryIds.clear();
- mySelectedDiagramCategoryIds.addAll(Arrays.asList(categories));
- }
-
-
- /**
- * Validate page.
- *
- * @return true, if successful
- */
- protected boolean validatePage() {
- setMessage(null);
- setErrorMessage(null);
- String[] categories = getDiagramCategories();
- if(categories == null || categories.length == 0) {
- setErrorMessage(Messages.SelectDiagramCategoryPage_select_one_category);
- return false;
- }
- for(String newCategory : categories) {
- if(!validateCategoryExists(newCategory)) {
- return false;
- }
- }
- if(!validateFileExtension(categories)) {
- return false;
- }
- return true;
- }
-
- /**
- * Validate file extension.
- *
- * @param categories the categories
- * @return true, if successful
- */
- protected boolean validateFileExtension(String... categories) {
- IStatus status = ((CreateModelWizard)getWizard()).diagramCategoryChanged(categories);
- switch(status.getSeverity()) {
- case Status.ERROR:
- setErrorMessage(status.getMessage());
- return false;
- case Status.WARNING:
- setMessage(status.getMessage(), IMessageProvider.WARNING);
- break;
- case Status.INFO:
- setMessage(status.getMessage(), IMessageProvider.INFORMATION);
- break;
- }
- return true;
- }
-
- /**
- * Validate category exists.
- *
- * @param newCategory the new category
- * @return true, if successful
- */
- protected boolean validateCategoryExists(String newCategory) {
- DiagramCategoryDescriptor selected = getDiagramCategoryMap().get(newCategory);
- if(selected == null) {
- setErrorMessage(Messages.bind(Messages.SelectDiagramCategoryPage_cannot_find_category,newCategory));
- return false;
- }
- return true;
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- protected Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- return DiagramCategoryRegistry.getInstance().getDiagramCategoryMap();
- }
-
- /**
- * Creates the diagram language form.
- *
- * @param composite
- * the composite
- */
- private void createDiagramCategoryForm(Composite composite) {
- Group group = createGroup(composite, Messages.SelectDiagramCategoryPage_diagram_language_group);
-
- SelectionListener listener = new SelectionListener() {
-
- private SelectionEvent prevEvent;
-
- public void widgetSelected(SelectionEvent e) {
- if(e == prevEvent) {
- return;
- }
- Button selected = ((Button)e.widget);
- diagramCategorySelected((String)selected.getData(), selected.getSelection());
- setPageComplete(validatePage());
- prevEvent = e;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
- for(DiagramCategoryDescriptor diagramCategoryDescriptor : getDiagramCategoryMap().values()) {
- Button button = createCategoryButton(diagramCategoryDescriptor, group);
- button.addSelectionListener(listener);
- myDiagramKindButtons.add(button);
- }
- checkDiagramCategoryButtons();
- }
-
- /**
- * Diagram category selected.
- *
- * @param category the category
- * @param checked the checked
- */
- protected void diagramCategorySelected(String category, boolean checked) {
- if(checked) {
- mySelectedDiagramCategoryIds.add(category);
- } else {
- mySelectedDiagramCategoryIds.remove(category);
- }
- }
-
- /**
- * Check diagram category buttons.
- */
- protected void checkDiagramCategoryButtons() {
- checkButtonsFor(mySelectedDiagramCategoryIds.toArray(new String[mySelectedDiagramCategoryIds.size()]));
- }
-
- /**
- * Check buttons for.
- *
- * @param diagramCategories the diagram categories
- */
- protected void checkButtonsFor(String... diagramCategories) {
- for(Button button : myDiagramKindButtons) {
- button.setSelection(false);
- }
- for(Button button : myDiagramKindButtons) {
- for(String diagramCategory : diagramCategories) {
- if(diagramCategory.equals(button.getData())) {
- button.setSelection(true);
- }
- }
- }
- }
-
- /**
- * Creates the category button.
- *
- * @param diagramCategoryDescriptor the diagram category descriptor
- * @param group the group
- * @return the button
- */
- private Button createCategoryButton(DiagramCategoryDescriptor diagramCategoryDescriptor, Group group) {
- Button button = new Button(group, myAllowSeveralCategories ? SWT.CHECK : SWT.RADIO);
- button.setText(diagramCategoryDescriptor.getLabel());
- button.setData(diagramCategoryDescriptor.getId());
- Image image = getImage(diagramCategoryDescriptor.getIcon());
- if(image != null) {
- button.setImage(image);
- }
- button.setToolTipText(diagramCategoryDescriptor.getDescription());
- return button;
- }
-
- /**
- * Gets the image.
- *
- * @param imageDescriptor the image descriptor
- * @return the image
- */
- private static Image getImage(ImageDescriptor imageDescriptor) {
- if(imageDescriptor != null) {
- return new Image(null, imageDescriptor.getImageData());
- }
- return null;
- }
-
- /**
- * Creates the group.
- *
- * @param parent
- * the parent
- * @param name
- * the name
- * @return the group
- */
- private static Group createGroup(Composite parent, String name) {
- Group group = new Group(parent, SWT.NONE);
- group.setText(name);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- group.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- group.setLayoutData(data);
- return group;
- }
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramKindPage.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramKindPage.java
deleted file mode 100644
index b7e26aea02e..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectDiagramKindPage.java
+++ /dev/null
@@ -1,589 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * 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:
- * Obeo - initial API and implementation
- * Tatiana Fesenko(CEA) - improved look&feel
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *******************************************************************************/
-package org.eclipse.papyrus.wizards.pages;
-
-import static org.eclipse.papyrus.wizards.Activator.log;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.core.extension.commands.CreationCommandRegistry;
-import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
-import org.eclipse.papyrus.core.extension.commands.ICreationCommandRegistry;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.papyrus.wizards.SettingsHelper;
-import org.eclipse.papyrus.wizards.kind.DiagramKindContentProvider;
-import org.eclipse.papyrus.wizards.kind.DiagramKindLabelProvider;
-import org.eclipse.papyrus.wizards.template.ModelTemplateDescription;
-import org.eclipse.papyrus.wizards.template.SelectModelTemplateComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Group;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * This WizardPage to select the kind of Papyrus Diagram. List all kind of diagrams registered with
- * creationCommand attribute in PapyrusDiagram Eclipse extension.
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- * @author Tatiana Fesenko
- */
-public class SelectDiagramKindPage extends WizardPage {
-
- /** The Constant PAGE_ID. */
- public static final String PAGE_ID = "SelectDiagramKind"; //$NON-NLS-1$
-
- /** The diagram name text field. */
- private Text nameText;
-
- /** The diagram kind table viewer. */
- private CheckboxTableViewer diagramKindTableViewer;
-
- /** The my settings helper. */
- private SettingsHelper mySettingsHelper;
-
- /** The select template composite. */
- private SelectModelTemplateComposite selectTemplateComposite;
-
- /** The remember current selection. */
- private Button rememberCurrentSelection;
-
- /** The my category provider. */
- private final CategoryProvider myCategoryProvider;
-
- /** The allow templates. */
- private final boolean allowTemplates;
-
- /** The my creation command registry. */
- private final ICreationCommandRegistry myCreationCommandRegistry;
-
- /** The Constant DEFAULT_CREATION_COMMAND_REGISTRY. */
- public static final ICreationCommandRegistry DEFAULT_CREATION_COMMAND_REGISTRY = CreationCommandRegistry.getInstance(org.eclipse.papyrus.core.Activator.PLUGIN_ID);
-
- /**
- * Instantiates a new select diagram kind page.
- *
- * @param categoryProvider the category provider
- */
- public SelectDiagramKindPage(CategoryProvider categoryProvider) {
- this(true, categoryProvider, DEFAULT_CREATION_COMMAND_REGISTRY);
- }
-
- /**
- * Instantiates a new select diagram kind page.
- *
- * @param allowTemplates the allow templates
- * @param categoryProvider the category provider
- * @param creationCommandRegistry the creation command registry
- */
- public SelectDiagramKindPage(boolean allowTemplates, CategoryProvider categoryProvider, ICreationCommandRegistry creationCommandRegistry) {
- super(PAGE_ID);
- setTitle(Messages.SelectDiagramKindPage_page_title);
- setDescription(Messages.SelectDiagramKindPage_page_desc);
- this.allowTemplates = allowTemplates;
- myCategoryProvider = categoryProvider;
- myCreationCommandRegistry = creationCommandRegistry;
- }
-
- /**
- * Creates the control.
- *
- * @param parent
- * the parent {@inheritDoc}
- */
- public void createControl(Composite parent) {
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout gridLayout = new GridLayout(1, false);
- gridLayout.marginWidth = 10;
- plate.setLayout(gridLayout);
- setControl(plate);
-
- String[] categories = getDiagramCategories();
-
- createNameForm(plate);
-
- createDiagramKindForm(plate);
- diagramKindTableViewer.setInput(categories);
-
- createModelTemplateComposite(plate);
-
- createRememberCurrentSelectionForm(plate);
-
- fillInTables(categories);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- @Override
- public void setWizard(IWizard newWizard) {
- super.setWizard(newWizard);
- setSettingsHelper(new SettingsHelper(getDialogSettings()));
- }
-
- /**
- * Sets the settings helper.
- *
- * @param helper
- * the new settings helper
- */
- protected void setSettingsHelper(SettingsHelper helper) {
- mySettingsHelper = helper;
- }
-
- /**
- * Sets the visible.
- *
- * @param visible the new visible
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fillInTables(getDiagramCategories());
- validatePage();
- if(!allowTemplates) {
- selectTemplateComposite.disable();
- }
- }
- }
-
- /**
- * Fill in tables.
- *
- * @param categories the categories
- */
- private void fillInTables(String[] categories) {
- if(categories == null || categories.length == 0) {
- return;
- }
- diagramKindTableViewer.setInput(categories);
- selectTemplateComposite.setInput(categories);
- selectDefaultDiagramKinds(categories);
- selectDefaultDiagramTemplates(categories);
- }
-
-
- /**
- * Gets the uml model template path.
- *
- * @return the template path
- */
- public String getTemplatePath() {
- return selectTemplateComposite.getTemplatePath();
- }
-
- /**
- * Gets the notation model template path.
- *
- * @return the notation template path
- */
- public String getNotationTemplatePath() {
- return selectTemplateComposite.getNotationTemplatePath();
- }
- /**
- * Gets the di model template path.
- *
- * @return the di template path
- */
- public String getDiTemplatePath() {
- return selectTemplateComposite.getDiTemplatePath();
- }
-
- /**
- * Gets the template plugin id.
- *
- * @return the template plugin id
- */
- public String getTemplatePluginId() {
- return selectTemplateComposite.getTemplatePluginId();
- }
-
- /**
- * Gets the diagram category.
- *
- * @return the diagram category
- */
- private String[] getDiagramCategories() {
- return myCategoryProvider.getCurrentCategories();
- }
-
-
- /**
- * Gets the diagram name.
- *
- * @return the new diagram name
- */
- public String getDiagramName() {
- return nameText.getText();
- }
-
- /**
- * Templates enabled.
- *
- * @return true, if successful
- */
- public boolean templatesEnabled() {
- return allowTemplates;
- }
-
- /**
- * Gets the creation commands.
- *
- * @return the creation command
- */
- public List<ICreationCommand> getCreationCommands() {
- CreationCommandDescriptor[] selected = getSelectedDiagramKindDescriptors();
- List<ICreationCommand> commands = new ArrayList<ICreationCommand>();
- for(int i = 0; i < selected.length; i++) {
-
- ICreationCommand command;
- try {
- command = (selected[i]).getCommand();
- commands.add(command);
- } catch (Exception e) {
- log.error(e);
- }
- }
- return commands;
- }
-
- /**
- * Gets the creation commands.
- *
- * @param categoryId the category id
- * @return the creation commands
- */
- public List<ICreationCommand> getCreationCommands(String categoryId) {
- List<CreationCommandDescriptor> selected = getSelectedCommandDescriptors(categoryId);
- List<ICreationCommand> commands = new ArrayList<ICreationCommand>();
- for(CreationCommandDescriptor next : selected) {
- ICreationCommand command;
- try {
- command = next.getCommand();
- commands.add(command);
- } catch (Exception e) {
- log.error(e);
- }
- }
- return commands;
- }
-
- /**
- * Gets the selected command descriptors.
- *
- * @param categoryId the category id
- * @return the selected command descriptors
- */
- protected List<CreationCommandDescriptor> getSelectedCommandDescriptors(String categoryId) {
- CreationCommandDescriptor[] selected = getSelectedDiagramKindDescriptors();
- List<CreationCommandDescriptor> commands = new ArrayList<CreationCommandDescriptor>();
- for(int i = 0; i < selected.length; i++) {
- if(selected[i].getLanguage().equals(categoryId)) {
- commands.add(selected[i]);
- }
- }
- return commands;
- }
-
- /**
- * Creates the model template composite.
- *
- * @param composite the composite
- */
- private void createModelTemplateComposite(Composite composite) {
- Group group = createGroup(composite, Messages.SelectDiagramKindPage_load_template_group);
- selectTemplateComposite = new SelectModelTemplateComposite(group);
- }
-
- /**
- * Creates the diagram kind form.
- *
- * @param composite
- * the composite
- */
- private void createDiagramKindForm(Composite composite) {
- Group group = createGroup(composite, Messages.SelectDiagramKindPage_select_kind_group);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- group.setData(data);
-
- final Table diagramKindTable = new Table(group, SWT.NO_BACKGROUND | SWT.CHECK);
- diagramKindTable.setFont(group.getFont());
- diagramKindTable.setBackground(group.getBackground());
-
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- diagramKindTable.setLayout(layout);
-
- GridData data2 = new GridData(SWT.FILL, SWT.FILL, true, true);
- diagramKindTable.setLayoutData(data2);
-
- diagramKindTable.addSelectionListener(new SelectionListener() {
-
- /**
- * {@inheritDoc}
- */
- public void widgetSelected(SelectionEvent e) {
- if(e.detail == SWT.CHECK) {
- validatePage();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- // does nothing
- }
- });
- diagramKindTableViewer = new CheckboxTableViewer(diagramKindTable);
- diagramKindTableViewer.setContentProvider(new DiagramKindContentProvider(getCreationCommandRegistry()));
- diagramKindTableViewer.setLabelProvider(createDiagramKindLabelProvider());
- }
-
- /**
- * Creates the diagram kind label provider.
- *
- * @return the i base label provider
- */
- protected IBaseLabelProvider createDiagramKindLabelProvider() {
- return new DiagramKindLabelProvider();
- }
-
-
- /**
- * Creates the group.
- *
- * @param parent
- * the parent
- * @param name
- * the name
- * @return the group
- */
- private static Group createGroup(Composite parent, String name) {
- Group group = new Group(parent, SWT.NONE);
- group.setText(name);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- group.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- group.setLayoutData(data);
- return group;
- }
-
- /**
- * Creates the name form.
- *
- * @param composite
- * the composite
- */
- private void createNameForm(Composite composite) {
- Group group = createGroup(composite, Messages.SelectDiagramKindPage_diagram_name_group);
-
- nameText = new Text(group, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- nameText.setLayoutData(data);
- nameText.setText(Messages.SelectDiagramKindPage_default_diagram_name);
- nameText.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
- }
-
- /**
- * Creates the remember current selection form.
- *
- * @param composite the composite
- */
- private void createRememberCurrentSelectionForm(Composite composite) {
- Composite plate = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- plate.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- plate.setLayoutData(data);
-
- rememberCurrentSelection = new Button(plate, SWT.CHECK);
- rememberCurrentSelection.setText(Messages.SelectDiagramKindPage_remember_current_selection_text);
- rememberCurrentSelection.setToolTipText(Messages.SelectDiagramKindPage_remember_current_selection_tooltip);
-
- rememberCurrentSelection.setSelection(mySettingsHelper.rememberCurrentSelection(getDialogSettings()));
- }
-
- /**
- * Validate page.
- *
- * @return true, if successful
- */
- private boolean validatePage() {
- if(getDiagramName() == null || getDiagramName().length() == 0) {
- updateStatus(Messages.SelectDiagramKindPage_diagram_name_is_empty);
- return false;
- }
- // if(getCreationCommands().isEmpty()) {
- // updateStatus("At least one diagram kind should be selected.");
- // return false;
- // }
- updateStatus(null);
- return true;
- }
-
- /**
- * Update page status.
- *
- * @param message
- * is the error message.
- */
- private void updateStatus(String message) {
- setErrorMessage(message);
- setPageComplete(message == null);
- }
-
- /**
- * Checks if is remember current selection.
- *
- * @return true, if is remember current selection
- */
- public boolean isRememberCurrentSelection() {
- return rememberCurrentSelection.getSelection();
- }
-
- /**
- * Gets the selected diagram kinds.
- *
- * @param categoryId the category id
- * @return the selected diagram kinds
- */
- public String[] getSelectedDiagramKinds(String categoryId) {
- List<CreationCommandDescriptor> descriptors = getSelectedCommandDescriptors(categoryId);
- String[] result = new String[descriptors.size()];
- for(int i = 0; i < descriptors.size(); i++) {
- result[i] = descriptors.get(i).getCommandId();
- }
- return result;
- }
-
- /**
- * Gets the selected diagram kind descriptors.
- *
- * @return the selected diagram kind descriptors
- */
- protected CreationCommandDescriptor[] getSelectedDiagramKindDescriptors() {
- Object[] checked = diagramKindTableViewer.getCheckedElements();
- // as Object is not a subclass of String we cannot cast Object[] to String[]
- CreationCommandDescriptor[] result = Arrays.asList(checked).toArray(new CreationCommandDescriptor[checked.length]);
- return result;
- }
-
- /**
- * Select default diagram kinds.
- *
- * @param categories the categories
- */
- private void selectDefaultDiagramKinds(String[] categories) {
- Set<String> kinds = new HashSet<String>();
- for(String category : categories) {
- kinds.addAll(mySettingsHelper.getDefaultDiagramKinds(category));
- }
- CreationCommandDescriptor[] elementsToCheck = findCreationCommandDescriptorsFor(kinds);
- diagramKindTableViewer.setCheckedElements(elementsToCheck);
- }
-
- /**
- * Find creation command descriptors for.
- *
- * @param kinds the kinds
- * @return the creation command descriptor[]
- */
- protected CreationCommandDescriptor[] findCreationCommandDescriptorsFor(Collection<String> kinds) {
- List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
- Collection<CreationCommandDescriptor> availableDescriptors = getCreationCommandRegistry().getCommandDescriptors();
- for(CreationCommandDescriptor desc : availableDescriptors) {
- if(kinds.contains(desc.getCommandId())) {
- result.add(desc);
- }
- }
- return result.toArray(new CreationCommandDescriptor[result.size()]);
- }
-
- /**
- * Select default diagram templates.
- *
- * @param categories the categories
- */
- private void selectDefaultDiagramTemplates(String[] categories) {
- List<String> defaultTemplates = new ArrayList<String>();
- List<Object> availableTemplates = new ArrayList<Object>();
- for(String category : categories) {
- defaultTemplates.addAll(mySettingsHelper.getDefaultTemplates(category));
- availableTemplates.addAll(Arrays.asList(selectTemplateComposite.getContentProvider().getElements(category)));
- }
- for(Object next : availableTemplates) {
- ModelTemplateDescription desc = (ModelTemplateDescription)next;
-
- if(defaultTemplates.contains(desc.getUml_path())) {
- selectTemplateComposite.selectElement(desc);
- return;
- }
- }
- }
-
-
- /**
- * Gets the creation command registry.
- *
- * @return the creation command registry
- */
- protected final ICreationCommandRegistry getCreationCommandRegistry() {
- return myCreationCommandRegistry;
- }
-
- /**
- * The Interface CategoryProvider.
- */
- public static interface CategoryProvider {
-
- /**
- * Gets the current categories.
- *
- * @return the current categories
- */
- String[] getCurrentCategories();
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectRootElementPage.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectRootElementPage.java
deleted file mode 100644
index 9eebb060e2e..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/pages/SelectRootElementPage.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.wizards.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IWrapperItemProvider;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.resource.ModelSet;
-import org.eclipse.papyrus.wizards.Messages;
-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.Label;
-
-/**
- * Wizard page that allows to select element from model.
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public class SelectRootElementPage extends WizardPage {
-
- /** The selected model element. */
- protected EObject selectedModelElement;
-
- /** TreeViewer use to display the content of the domain model. */
- private TreeViewer modelViewer;
-
- /** The my domain model resource. */
- private final Resource myDomainModelResource;
-
- /** The Constant PAGE_ID. */
- public static final String PAGE_ID = "SelectRootPage"; //$NON-NLS-1$
-
- /**
- * Constructor.
- *
- * @param file the file
- */
- public SelectRootElementPage(IFile file) {
- super(PAGE_ID);
- setTitle(Messages.SelectRootElementPage_select_root_element_title);
- setDescription(Messages.SelectRootElementPage_select_root_element_desc);
-
- myDomainModelResource = getResourceForFile(file);
-
- }
-
- /**
- * Gets the model element.
- *
- * @return the selected model element
- */
- public EObject getModelElement() {
- return selectedModelElement;
- }
-
- /**
- * Creates the control.
- *
- * @param parent the parent
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
-
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- plate.setLayout(layout);
- setControl(plate);
-
- Label label = new Label(plate, SWT.NONE);
- // label.setText("Select the root model element");
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- layoutData.heightHint = 300;
- layoutData.widthHint = 300;
- modelViewer.getTree().setLayoutData(layoutData);
- AdapterFactory adapterFactory = createAdapterFactory();
- modelViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
-
- modelViewer.setInput(myDomainModelResource);
-
- selectedModelElement = getModelRoot(myDomainModelResource);
- modelViewer.setSelection(selectedModelElement == null ? new StructuredSelection() : new StructuredSelection(selectedModelElement));
-
- modelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelection((IStructuredSelection)event.getSelection());
- }
- });
-
- setPageComplete(validatePage());
- }
-
- /**
- * Gets the model root.
- *
- * @param modelResource the model resource
- * @return the model root
- */
- private EObject getModelRoot(Resource modelResource) {
- if (modelResource == null) {
- //log
- return null;
- }
- return modelResource.getContents().get(0);
- }
-
- /**
- * Gets the resource for file.
- *
- * @param file the file
- * @return the resource for file
- */
- private Resource getResourceForFile(IFile file) {
- if (file == null) {
- // log
- return null;
- }
- return new ModelSet().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
- }
-
- /**
- * Update selection.
- *
- * @param selection
- * the selection
- */
- protected void updateSelection(IStructuredSelection selection) {
- selectedModelElement = null;
- if(selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if(selectedElement instanceof IWrapperItemProvider) {
- selectedElement = ((IWrapperItemProvider)selectedElement).getValue();
- }
- if(selectedElement instanceof FeatureMap.Entry) {
- selectedElement = ((FeatureMap.Entry)selectedElement).getValue();
- }
- if(selectedElement instanceof EObject) {
- selectedModelElement = (EObject)selectedElement;
- }
- }
- setPageComplete(validatePage());
- }
-
- /**
- * Validate page.
- *
- * @return true, if successful
- */
- protected boolean validatePage() {
- return selectedModelElement != null;
- }
-
- /**
- * Creates the adapter factory.
- *
- * @return the composed adapter factory
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- List<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- fillItemProviderFactories(factories);
- return new ComposedAdapterFactory(factories);
- }
-
- /**
- * Fill item provider factories.
- *
- * @param factories
- * the factories
- */
- protected void fillItemProviderFactories(List<AdapterFactory> factories) {
- // custom icons for model elements
- factories.add(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/InitFromTemplateCommand.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/InitFromTemplateCommand.java
deleted file mode 100644
index f0bbd5f37ee..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/InitFromTemplateCommand.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.template;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import java.util.List;
-
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.Diagram;
-
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-
-import org.eclipse.papyrus.sashwindows.di.SashWindowsMngr;
-import org.eclipse.papyrus.wizards.utils.WizardsHelper;
-
-
-/**
- * The Class InitFromTemplateCommand.
- */
-public class InitFromTemplateCommand extends RecordingCommand {
-
- /** The my model resource. */
- private final Resource myModelUMLResource;
-
- /** The my model di resource. */
- private final Resource myModelDiResource;
-
- /** The my model notation resource. */
- private final Resource myModelNotationResource;
-
- /** The my template path. */
- private final String myUmlTemplatePath;
-
- /** The my di template path. */
- private final String myDiTemplatePath;
-
- /** The my notation template path. */
- private final String myNotationTemplatePath;
-
- /** The my plugin id. */
- private final String myPluginId;
-
- /**
- * Instantiates a new inits the from template command.
- *
- * @param editingDomain the editing domain
- * @param diResouceSet the di resouce set
- * @param pluginId the plugin id
- * @param umlTemplatePath the uml template path
- * @param notationTemplatePath the notation template path
- * @param diTemplatePath the di template path
- */
- public InitFromTemplateCommand(TransactionalEditingDomain editingDomain, DiResourceSet diResouceSet, String pluginId, String umlTemplatePath, String notationTemplatePath, String diTemplatePath) {
- super(editingDomain);
- myModelUMLResource = diResouceSet.getModelResource();
- myModelDiResource = diResouceSet.getDiResource();
- myModelNotationResource = diResouceSet.getNotationResource();
- myPluginId = pluginId;
- myUmlTemplatePath = umlTemplatePath;
- myDiTemplatePath = diTemplatePath;
- myNotationTemplatePath = notationTemplatePath;
-
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
- */
- @Override
- protected void doExecute() {
- try {
- initializeFromTemplate();
- //verify if .di file and .notation file were filled in the org.eclipse.papyrus.wizards.templates extension
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
-
-
-
- /**
- * Initialize from template.
- *
-
- * @throws IOException Signals that an I/O exception has occurred.
- */
- private void initializeFromTemplate() throws IOException {
- Resource templateDiResource=null;
- Resource templateNotationResource=null;
- Resource templateUmlResource=null;
-
-
- //0. initalization of the UML object
- ResourceSet resourceSet = new ResourceSetImpl();
- templateUmlResource = loadTemplateResource(myUmlTemplatePath,resourceSet);
-
-
- //1. prepare the copy of UML element
- List<EObject> eObjectsToAdd = new ArrayList<EObject>();
- eObjectsToAdd = (templateUmlResource.getContents());
-
-
- //2. test if di and notation exist
- //verify if .di file and .notation file were filled in the org.eclipse.papyrus.wizards.templates extension
- if ((myDiTemplatePath!=null) && (myNotationTemplatePath!=null)){
- //2.1 verify if the .di , .notation and .uml files have the same name
- String diFileName= WizardsHelper.getFileNameWithoutExtension(myDiTemplatePath);
- String umlFileName= WizardsHelper.getFileNameWithoutExtension(myUmlTemplatePath);
- String notationFileName= WizardsHelper.getFileNameWithoutExtension(myNotationTemplatePath);
-
- if (diFileName.contentEquals(umlFileName) && diFileName.contentEquals(notationFileName)){
-
- //2.2 load di resource
- if( myDiTemplatePath!=null){
- templateDiResource = loadTemplateResource(myDiTemplatePath,resourceSet);
- }
-
- //2.3 load notation resource
- if( myNotationTemplatePath!=null){
- templateNotationResource = loadTemplateResource(myNotationTemplatePath,resourceSet);
- }
-
- //Visits all proxies in the resource set and tries to resolve them.
- EcoreUtil.resolveAll(resourceSet);
-
- //2.4 prepare the copy of di and notation elements
- if(templateNotationResource!=null){
- eObjectsToAdd.addAll(templateNotationResource.getContents());}
- if(templateDiResource!=null){
- eObjectsToAdd.addAll(templateDiResource.getContents());
- }
- }
- }
- //3. copy all element into eObjectResult
- List<EObject> eObjectsResult = new ArrayList<EObject>();
- eObjectsResult.addAll((List<EObject>)EcoreUtil.copyAll(eObjectsToAdd));
-
-
- //4. set copied elements in goods resources
- for(EObject eObject : eObjectsResult) {
- if( eObject.eContainer()==null){
- if (eObject instanceof Diagram)
- {
- myModelNotationResource.getContents().add(eObject);
- }
- else
- if (eObject instanceof SashWindowsMngr)
- {myModelDiResource.getContents().add(eObject);}
- else
- {myModelUMLResource.getContents().add(eObject);}
- }
- }
- }
-
-
-
- /**
- * Load template resource.
- *
- * @param path the path
- * @return the resource
- */
- private Resource loadTemplateResource(String path, ResourceSet resourceSet) {
- java.net.URL templateURL = Platform.getBundle(myPluginId).getResource(path);
- String fullUri = templateURL.getPath();
- URI uri = URI.createPlatformPluginURI(myPluginId + fullUri, true);
- Resource resource = resourceSet.getResource(uri, true);
- if(resource.isLoaded()) {
- return resource;
- }
- return null;
- }
-
-
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplateDescription.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplateDescription.java
deleted file mode 100644
index 29c7e5cee26..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplateDescription.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.template;
-
-import org.eclipse.papyrus.wizards.utils.WizardsHelper;
-
-/**
- * The Class ModelTemplateDescription.
- */
-public class ModelTemplateDescription {
-
- /** The name. */
- private String name;
-
-
-
-
- /** The uml_path. */
- private String uml_path;
-
- /** The di_path. */
- private String di_path;
-
- /** The notation_path. */
- private String notation_path;
-
- /** The plugin id. */
- private String pluginId;
-
- /** The language. */
- private String language;
-
- /**
- * Instantiates a new model template description.
- *
- * @param name the name
- * @param pluginId the plugin id
- * @param uml_path the uml_path
- * @param notation_path the notation_path
- * @param di_path the di_path
- */
- public ModelTemplateDescription(String name, String pluginId, String uml_path, String notation_path, String di_path) {
- super();
- this.name = name;
- // this.e = metamodelURI;
-
- this.setDi_path(di_path);
- this.setNotation_path(notation_path);
- this.setUml_path(uml_path);
- this.pluginId = pluginId;
- }
-
- /**
- * Sets the language.
- *
- * @param language the new language
- */
- public void setLanguage(String language) {
- this.language = language;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- // /**
- // * @return the metamodelURI
- // */
- // public String getMetamodelURI() {
- // return metamodelURI;
- // }
-
- /**
- * Gets the path.
- *
- * @return the path
- */
-
-
- /**
- * Gets the file name.
- *
- * @return the file name
- */
- public String getFileName() {
-// String[] pathParts = uml_path.split("/"); //$NON-NLS-1$
-// return pathParts[pathParts.length - 1];
- return WizardsHelper.getFileNameWithoutExtension(uml_path);
- }
-
- /**
- * Gets the plugin id.
- *
- * @return the plugin id
- */
- public String getPluginId() {
- return pluginId;
- }
-
- /**
- * Gets the language.
- *
- * @return the language
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * Gets the uml_path.
- *
- * @return the uml_path
- */
- public String getUml_path() {
- return uml_path;
- }
-
- /**
- * Sets the uml_path.
- *
- * @param uml_path the new uml_path
- */
- public void setUml_path(String uml_path) {
- this.uml_path = uml_path;
- }
-
- /**
- * Gets the di_path.
- *
- * @return the di_path
- */
- public String getDi_path() {
- return di_path;
- }
-
- /**
- * Sets the di_path.
- *
- * @param di_path the new di_path
- */
- public void setDi_path(String di_path) {
- this.di_path = di_path;
- }
-
- /**
- * Gets the notation_path.
- *
- * @return the notation_path
- */
- public String getNotation_path() {
- return notation_path;
- }
-
- /**
- * Sets the notation_path.
- *
- * @param notation_path the new notation_path
- */
- public void setNotation_path(String notation_path) {
- this.notation_path = notation_path;
- }
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesContentProvider.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesContentProvider.java
deleted file mode 100644
index b63eb77c0d7..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesContentProvider.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.template;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
-
-/**
- * The Class ModelTemplatesContentProvider.
- */
-public class ModelTemplatesContentProvider implements IStructuredContentProvider {
-
- /** The Constant EXTENSION_POINT_ID. */
- private static final String EXTENSION_POINT_ID = "org.eclipse.papyrus.wizards.templates"; //$NON-NLS-1$
-
- /** The Constant ATTRIBUTE_NAME. */
- private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
-
- /** The Constant ATTRIBUTE_FILE. */
- private static final String ATTRIBUTE_UML_FILE = "file"; //$NON-NLS-1$
-
- /** The Constant ATTRIBUTE_NOTATION_FILE. */
- private static final String ATTRIBUTE_NOTATION_FILE = "notation_file"; //$NON-NLS-1$
-
- /** The Constant ATTRIBUTE_DI_FILE. */
- private static final String ATTRIBUTE_DI_FILE = "di_file"; //$NON-NLS-1$
-
- /** The Constant ATTRIBUTE_LANGUAGE. */
- private static final String ATTRIBUTE_LANGUAGE = "language"; //$NON-NLS-1$
-
- /** The my template descriptions. */
- private ModelTemplateDescription[] myTemplateDescriptions;
-
- /**
- * Dispose.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * Gets the templates description.
- *
- * @return the templates description
- */
- private ModelTemplateDescription[] getTemplatesDescription() {
- if (myTemplateDescriptions == null) {
- List<ModelTemplateDescription> templates = new ArrayList<ModelTemplateDescription>();
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtension[] extensions = registry.getExtensionPoint(EXTENSION_POINT_ID).getExtensions();
-
- for(IExtension extension : extensions) {
- templates.addAll(processExtension(extension));
- }
- myTemplateDescriptions = templates.toArray(new ModelTemplateDescription[templates.size()]);
- }
- return myTemplateDescriptions;
- }
-
- /**
- * Process extension.
- *
- * @param extension the extension
- * @return the collection
- */
- private Collection<ModelTemplateDescription> processExtension(IExtension extension) {
- List<ModelTemplateDescription> templates = new ArrayList<ModelTemplateDescription>();
- for(IConfigurationElement configElement : extension.getConfigurationElements()) {
- ModelTemplateDescription template = new ModelTemplateDescription(configElement.getAttribute(ATTRIBUTE_NAME), extension.getContributor().getName(), configElement.getAttribute(ATTRIBUTE_UML_FILE),configElement.getAttribute(ATTRIBUTE_NOTATION_FILE),configElement.getAttribute(ATTRIBUTE_DI_FILE));
- template.setLanguage(configElement.getAttribute(ATTRIBUTE_LANGUAGE));
- templates.add(template);
- }
- return templates;
- }
-
- /**
- * Gets the elements.
- *
- * @param inputElement the input element
- * @return the elements
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
-
- if(inputElement instanceof Object[]) {
- List<ModelTemplateDescription> result = new ArrayList<ModelTemplateDescription>();
-
- for (Object next: (Object[])inputElement) {
- if (next instanceof String) {
- String diagramCategory = (String)next;
- for(ModelTemplateDescription template : getTemplatesDescription()) {
- if(diagramCategory == null || diagramCategory.equals(template.getLanguage())) {
- result.add(template);
- }
- }
- }
- }
- return result.toArray();
- }
-
- return new Object[0];
- }
-
- /**
- * Input changed.
- *
- * @param viewer the viewer
- * @param oldInput the old input
- * @param newInput the new input
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(viewer instanceof TableViewer) {
- ((TableViewer)viewer).add(getElements(null));
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesLabelProvider.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesLabelProvider.java
deleted file mode 100644
index 2bbf02c3944..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/ModelTemplatesLabelProvider.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.template;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.papyrus.wizards.Messages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The Class ModelTemplatesLabelProvider.
- */
-public class ModelTemplatesLabelProvider implements ITableLabelProvider {
-
- /**
- * Gets the column image.
- *
- * @param element the element
- * @param columnIndex the column index
- * @return the column image
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * Gets the column text.
- *
- * @param element the element
- * @param columnIndex the column index
- * @return the column text
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if(element instanceof ModelTemplateDescription) {
- ModelTemplateDescription modelTemplate = (ModelTemplateDescription)element;
- return Messages.bind(org.eclipse.papyrus.wizards.Messages.ModelTemplatesLabelProvider_model_template_description_text, modelTemplate.getName(), modelTemplate.getFileName());
- }
- return null;
- }
-
- /**
- * Adds the listener.
- *
- * @param listener the listener
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /**
- * Dispose.
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
-
- }
-
- /**
- * Checks if is label property.
- *
- * @param element the element
- * @param property the property
- * @return true, if is label property
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
-
- return false;
- }
-
- /**
- * Removes the listener.
- *
- * @param listener the listener
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/SelectModelTemplateComposite.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/SelectModelTemplateComposite.java
deleted file mode 100644
index 5e0ec828ffb..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/template/SelectModelTemplateComposite.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.template;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class SelectModelTemplateComposite.
- */
-public class SelectModelTemplateComposite extends Composite {
-
-
- /** The template table viewer. */
- private CheckboxTableViewer templateTableViewer;
-
- /**
- * Instantiates a new select model template composite.
- *
- * @param parent
- * the parent
- */
- public SelectModelTemplateComposite(Composite parent) {
- super(parent, SWT.NONE);
-
- setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- GridLayout layout = new GridLayout();
- layout.marginWidth = layout.marginHeight = 0;
- setLayout(layout);
- createTemplatesViewer(this);
- }
-
- /**
- * Disable.
- */
- public void disable() {
- templateTableViewer.getTable().setEnabled(false);
- }
-
- /**
- * Creates the templates viewer.
- *
- * @param composite
- * the composite
- */
- private void createTemplatesViewer(Composite composite) {
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- templateTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.NO_BACKGROUND);
- templateTableViewer.getTable().setBackground(composite.getBackground());
- templateTableViewer.getTable().setLayoutData(data);
- templateTableViewer.getTable().setEnabled(true);
-
- templateTableViewer.setContentProvider(new ModelTemplatesContentProvider());
- templateTableViewer.setLabelProvider(new ModelTemplatesLabelProvider());
- templateTableViewer.getControl().setEnabled(true);
-
- templateTableViewer.getTable().setLayout(new GridLayout());
- }
-
- /**
- * Gets the uml model template path.
- *
- * @return the uml model template path
- */
- public String getTemplatePath() {
- Object[] selected = templateTableViewer.getCheckedElements();
- if (selected.length > 0) {
- return ((ModelTemplateDescription)selected[0]).getUml_path();
- }
- return null;
- }
-
- /**
- * Gets the di file template path.
- *
- * @return the di file template path
- */
- public String getDiTemplatePath() {
- Object[] selected = templateTableViewer.getCheckedElements();
- if (selected.length > 0) {
- return ((ModelTemplateDescription)selected[0]).getDi_path();
- }
- return null;
- }
-
- /**
- * Gets the notation template path.
- *
- * @return the notation template path
- */
- public String getNotationTemplatePath() {
- Object[] selected = templateTableViewer.getCheckedElements();
- if (selected.length > 0) {
- return ((ModelTemplateDescription)selected[0]).getNotation_path();
- }
- return null;
- }
- /**
- * Gets the template plugin id.
- *
- * @return the template plugin id
- */
- public String getTemplatePluginId() {
- Object[] selected = templateTableViewer.getCheckedElements();
- if (selected.length > 0) {
- return ((ModelTemplateDescription)selected[0]).getPluginId();
- }
- return null;
- }
-
- /**
- * Select template.
- *
- * @param toSelect the to select
- */
- public void selectElement(Object toSelect) {
- templateTableViewer.setCheckedElements(new Object[]{toSelect});
- }
-
- /**
- * Gets the content provider.
- *
- * @return the content provider
- */
- public ModelTemplatesContentProvider getContentProvider() {
- return (ModelTemplatesContentProvider)templateTableViewer.getContentProvider();
- }
-
- /**
- * Sets the input.
- *
- * @param input
- * the new input
- */
- public void setInput(Object input) {
- templateTableViewer.setInput(input);
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/utils/WizardsHelper.java b/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/utils/WizardsHelper.java
deleted file mode 100644
index 613b8730269..00000000000
--- a/plugins/core/org.eclipse.papyrus.wizards/src/org/eclipse/papyrus/wizards/utils/WizardsHelper.java
+++ /dev/null
@@ -1,41 +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:
- * Saadia DHOUIB (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.wizards.utils;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class WizardsHelper.
- */
-public class WizardsHelper {
-
- /**
- * Gets the file name without extension.
- *
- * @param path the path of the file
- * @return the file name without extension
- */
- public static String getFileNameWithoutExtension(String path) {
- if( path!= null){
- String[] pathParts = path.split("/"); //$NON-NLS-1$
- String fileName= pathParts[pathParts.length - 1];
- int index = fileName.lastIndexOf('.');
- if (index > 0 && index <= fileName.length() - 2) {
- System.out.println("Filename without Extension: "
- + fileName.substring(0, index));
- return fileName.substring(0, index);
- }
- }
- return null;
- }
-}

Back to the top