Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-11-03 22:21:40 +0000
committerChristian W. Damus2014-11-06 15:23:38 +0000
commitd3603f98fc66b59b7991839b4a472097e3030aca (patch)
treea9211fcc09f463081c3940a230ee8b7dc58918e6 /sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource
parent6a3bb4e7260aa46db59f6d4c048f63b82fd84b9d (diff)
downloadorg.eclipse.papyrus-d3603f98fc66b59b7991839b4a472097e3030aca.tar.gz
org.eclipse.papyrus-d3603f98fc66b59b7991839b4a472097e3030aca.tar.xz
org.eclipse.papyrus-d3603f98fc66b59b7991839b4a472097e3030aca.zip
399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files
https://bugs.eclipse.org/bugs/show_bug.cgi?id=399859 Externalize the UI strings in the control-mode plug-in. (+57 squashed commits) Squashed commits: [31a95fd] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Support basic stereotype repair use cases in decorator model resources. ---- [3eaa4ad] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Improve re-application of externalized profiles for migration scenarios, doing away with hacky internalize and re-externalize steps that make a mess of the ordering of stereotype applications in the resource contents. ---- [fa20519] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Complete the copyright updates. ---- [5af536d] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Pluggable profile-application delegate API makes the private AppliedProfilesProvider redundant. ---- [b1e7f68] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Further copyright updates. ---- [ed0788d] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Now that the required UML2 API is available we can remove work-arounds for access to custom profile- and stereotype-application helpers. ---- [b262c2c] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Fix copyright headers. ---- [c4f04a5] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Support for migration of externally applied profiles to a new version. ---- [1892e18] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Additional slightly less trivial test cases for control-mode refactoring. ---- [7e530bd] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Don't create eCrossReferences() lists that compute and cache derived references that don't need refactoring. ---- [a35a57e] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files The undo of control refactoring for unloaded resources needs the same split treatment as for uncontrol. ---- [83249b2] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Automated tests for control-mode participant for refactoring of decorator models. ---- [d4a5149] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Fixes undo/redo of the uncontrolled refactoring for unloaded decorator models, which when undoing would find that the base uncontrol's undo hadn't yet restored the sub-unit resource in which we need to resolve referenced objects. ---- [46f4998] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Fixes to the automatic saving of decorator-model refactoring in (un)control command: - improve the determination of the editor to save (if any) - ensure that we only try to run the save runnable in the workbench window if on the UI thread ---- [1e65796] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Only prompt the user about save requirement if the control action was UI-initiated. Duh. ---- [75ea465] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Initial support for refactoring of currently loaded and unloaded decorator models that apply profiles directly or indirectly to the packages being controlled. ---- [71dfab4] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Fix errors in Javadocs and allow the control command to re-create a resource that the resource set had attempted to load for proxy resolution but failed because it doesn't exist. ---- [45fe94e] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Packages must also inherit externally applied profiles from their nesting package chain. ---- [24428c1] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Refresh the property sheet for the selected package after externalizing profiles to ensure that the "Applications" tab is showing. ---- [4763809">4763809] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Replace "Decorator Model" terminology in the UI with simply "Profile Application". ---- [77c00fb] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Remember the user's last auto-prompt load selections for initial selection on next open of the same resource. ---- [651fe70] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Improve JUnit test coverage of core plug-in. ---- [f2d5e7a] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Add an action in the Decorators property tab for packages to duplicate a loaded or unloaded decorator model with support for filtering out certain profile applications. ---- [37eb425] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Fix failure to refresh diagram for CSS styles affected by loading a decorator model the first time (and ensure all subsequent, also). ---- [1d62d00] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Fix problem in refreshing decorator model names in the Decorators property tab. Fix broken "Don't show this again" options in the load-decorator-models wizard. ---- [8ad5bd0] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Option to suppress prompt to unload conflicting decorator models in the Decorator property tab for packages and instead just automatically unload them (supporting quick switch use case). ---- [dde50a3] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Do not confuse users by showing the "decorator models available" icon decoration in Model Explorer on models that are decorated by the decorator model that the user opened in the editor. Only show the icon for referenced ("library") models that are reachable from such models. ---- [a82eb1b] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Improve liveness of action enablement and other tasks (esp. on the UI thread) that depend on the decorator model index. Implement a general-purpose Jobs-based ListenableFuture to support reporting blocked UI tasks in the blocked-jobs dialog. A few more rename refactorings in the API. Improve JUnit test coverage (and fix problems found by new tests). ---- [1cdaa01] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Implement Decorators property tab for packages that have decorator models, to provide easy access to loading and unloading them. ---- [de1cc1c] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Rationalize the handling of empty decorator models by prompting to delete and deleting all Papyrus model member resources in case of deletion. ---- [9bb18ac] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Never prompt to load additional decorator models when opening a decorator model, even if the user model that it decorates has more decorators available and the preference to auto-prompt is enabled. ---- [b1e3315] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Promote the Workspace Model Index and any-root-namespace content type describer APIs to the infra layer. ---- [f708155] 399859: [Decorator Models] Papyrus shall enable to manage profile applications in separate files Ensure responsiveness of label decorators. Apply label decorations to workspace resources in Project Explorer that are decorator models. ---- [4379197">4379197] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files WORKAROUNDS for absence of the required new UML API until it becomes available. ---- [68db5f0] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files WORKAROUNDS for absence of the required new UML API until it becomes available. ---- [0bf4163] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Add missing dependency information to top POMs. ---- [04d0935] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Add new plug-ins to top POMs. ---- [d4346cf] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Releng integration. ---- [40cfc0d] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Fix further refresh issues in diagrams when loading decorator models. When existing stereotype applications are loaded, they won't emit SET notifications for the base_Xyz references. Instead, they eventually emit RESOLVE notifications when their base reference proxies are resolved. ---- [f393d19] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Further API refactorings for 'decorator model' terminology. ---- [a3e9dd4] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Only prompt to load decorator models if opening in an editor. ---- [38885bc] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Refactor for 'decorator model' terminology and move the plug-ins into the main source tree. ---- [63c305e] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Various usability enhancements: - label decorators in Model Explorer and applied profiles in package properties indicating source profile externalization model names - prevent conflicts in externalization of profile applications into existing resources - never present profile application resources as available that conflict with native profile applications - revert ModelSet save change that breaks initialization of model from existing UML resource ---- [c1bb42b] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Profile application externalization wizard enhancements: - remember last file extension entered by the user (in case more than just .uml) - let user specify the model name, when creating a new file - verify that when adding to an existing file, it's a profile application model - include the profile application model name in the index ---- [4d1169b] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Enforce uniqueness of profile applications: prevent loading of multiple external profile applications that apply the same profile to the same package. ---- [ac15898] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Require saving dirty profile-application resources before unloading them. ---- [9ad9b0f] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Ensure that PapyrusListeners see changes in profile-application resources as well as the user-model resources. Fix the PapyrusStereotypeListener to handle unloading of a resource containing stereotype applications to interpret the stereotypes as being unapplied. ---- [4c52edd] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Handle problems in (re)building the workspace model index, add a listener protocol, and make it independent of the UML layer. ---- [402c77c] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Add a label decorator (just a placeholder icon for now) for models that have available unloaded profile applications. Add a preference (enabled by default) to prompt to load available profile applications on opening a model, if it has unloaded profile applications available. ---- [8566806">8566806] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Add some JUnit tests for the workspace model index framework. ---- [6f500b8] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Ensure that the user models to which a profile-application model contributes profile applications are loaded when the latter is loaded in the Papyrus Editor. ---- [16a0884] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Enable storage of profile applications in UML resources anywhere in the workspace, even in different projects than the models to which they are applied. Uses a new workspace-wide index of cross references between profile-application resources and user model resources, built at start-up and maintained in the background as the workspace changes. ---- [6fe515d] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Hide profile application models in the Model Explorer by default. ---- [69ef817] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Added context-menu actions in the Model Explorer for loading available profile applications that are not yet loaded and for unloading and loaded externalized profile applications (for any currently open controlled units). ---- [d9bb954] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Initial implementation of separate storage of profile applications and their defined stereotype applications in a separate resource. Includes - externalize profile applications refactoring wizard - internalize profile applications refactoring wizard - load profile applications context-menu action in Project Explorer - unload profile applications context-menu action in Model Explorer - enhanced Profile applications table in Properties view for packages ---- [b8578c3] 399859: [Profiles] Papyrus shall enable to manage profile applications in separate files Propagate standard JDT preferences to the sandbox projects. Signed-off-by: Christian W. Damus <give.a.damus@gmail.com> ---- [ec61dd2] 399859: [Profile Applications] Papyrus shall enable to manage profile applications in separate files Update build dependencies to pick up latest UML2 integration build with new APIs required for profile applications feature. Change-Id: Ifa20519ec3209393c88e0a1ac322eac715e541f4
Diffstat (limited to 'sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource')
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.classpath7
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.project28
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/META-INF/MANIFEST.MF22
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/about.html28
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/build.properties7
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/conception.textile27
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/documentation.pdoc4
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/plugin.xml16
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/Activator.java55
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/AbstractStereotypeApplicationLocationStrategy.java35
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExtendedProfileApplicationHelper.java34
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExternalResourceProfileUtils.java173
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/IStereotypeApplicationLocationStrategy.java51
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/OneResourceOnlyStrategy.java112
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java111
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ResourcePerProfileStrategy.java261
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StandardApplicationLocationStrategy.java72
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StrategyRegistry.java62
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/UpdateStereotypeApplicationsLocationCommand.java56
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/model/StereotypeApplicationExternalResourceModel.java252
21 files changed, 0 insertions, 1420 deletions
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.classpath b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.classpath
deleted file mode 100644
index ad32c83a788..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.project b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.project
deleted file mode 100644
index ac80b81cd93..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.uml.profile.externalresource</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/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.settings/org.eclipse.jdt.core.prefs b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index c537b63063c..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/META-INF/MANIFEST.MF b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/META-INF/MANIFEST.MF
deleted file mode 100644
index 177e7f343cc..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UML2 Profile Management in External Resources (Incubation)
-Bundle-SymbolicName: org.eclipse.papyrus.uml.profile.externalresource;singleton:=true
-Bundle-Version: 0.10.1.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.profile.externalresource.Activator
-Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
- org.eclipse.uml2.uml;bundle-version="4.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.tools;bundle-version="0.10.1",
- org.eclipse.emf.transaction;bundle-version="1.4.0",
- com.google.guava;bundle-version="10.0.1",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.uml.profile.externalresource,
- org.eclipse.papyrus.uml.profile.externalresource.helper,
- org.eclipse.papyrus.uml.profile.externalresource.model
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/about.html b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/about.html
deleted file mode 100644
index d35d5aed64c..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/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>June 5, 2007</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>
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/build.properties b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/build.properties
deleted file mode 100644
index 4b957fe857b..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- documentation.pdoc,\
- plugin.xml
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/conception.textile b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/conception.textile
deleted file mode 100644
index eb6708f2bab..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/conception.textile
+++ /dev/null
@@ -1,27 +0,0 @@
-
-h1. Conception of the external profile application management module
-
-
-h2. Context
-
-Currently, profile applications are serialized within the same file as the model itself. This feature will enable to serialize profile applications within a dedicated file. This feature will be an option that the user may configure within the Papyrus preferences. If one applies several profiles on a model, each profile application is serialized within its own resource. It has to be possible to switch from one configuration to the other, i.e. either to externalize profile applications or to internalize them.
-Control mode shall be taken into consideration here and should continue to work correctly.
-
-Enable external profile application
-The purpose of this task will consist in patching the UML2 component in order this latter can fully support the possibility to apply profiles on UML models by serializing this profile application in a separate file and vice-versa. Papyrus UI has also to be enriched in order to enable the user to configure Papyrus in order to enable or disable this option. The process will be reversible, i.e. profiles would be serializable individually in or out the model resources. In addition, the tool will also support the ability to apply several times the same profile. In case of a profile has been applied several time (values of the stereotype properties would be possibly different in that case), only one profile application is defined as part of the current configuration.
-Control mode extension
-This task will consist in analyzing the impact of the externalization of profile serialization and update its design in order the control mode can still run correctly in that case. The test set of the control mode will also be extended to cover this new use case.
-
-h2. Thoughts
-
-# currently, the profile application themselves are part of the model (this is a real element in the UML metamodel). the stereotype applications are located in the same resource as the model, at the same level as the model itself. The goal of this module is to separate the stereotype applications from the model resource and to put them in one or several external resources.
-# Several strategies are possible to manage profile applications in external resources. Each profile application can be saved in a separated resource, or all profile applications can have their own resource. This would ease the management of view points on the model (loading or not a given profile would be easy, and so specific domain concepts would be present or not. The sub profiles should also be taken into account: do each sub-profile need its own resource, or the resource is managed by the main profile (example of SysML)
-# The naming of the resource: name of the profile should be present. the name of the UML element on which the profile is applied should be used, in order to be able to have several external resources for the same profile in case of control mode. Should the version of the profile be present also ?
-# integration with the control mode: should one/several new resource be created when splitting the model?
-# integration with rename/copy files
-# integration with copy paste: does the current extension of the copy/paste work with this module?
-
-h2. Current external mechanism limitations
-
-UML2 module provides a framework for externalization of the stereotype applications, but this mechanism is rather basic. It relies with a singleton helper, referenced in the java system properties. If the externalization is done, it will be done for all components in the installation relying on UML2 metamodel, not only Papyrus models. Moreover, only one Eclipse component can provide a customization. If another component that Papyrus relies on that extension mechanism, only one will work at the same time.
-
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/documentation.pdoc b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/documentation.pdoc
deleted file mode 100644
index a971d3ea382..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/documentation.pdoc
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="Plugin to manage profile and stereotype application in external resources">
- <referent firstName="Remi" lastName="Schnekenburger" eMail="remi.schnekenburger@cea.fr" currentCompany="CEA LIST"/>
-</doc:Documentation>
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/plugin.xml b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/plugin.xml
deleted file mode 100644
index 59f092516b4..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/plugin.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.papyrus.infra.core.model">
- <model
- classname="org.eclipse.papyrus.uml.profile.externalresource.model.StereotypeApplicationExternalResourceModel">
- <dependency>
- <loadAfter
- identifier="org.eclipse.papyrus.infra.core.resource.uml.UmlModel">
- </loadAfter>
- </dependency>
- </model>
- </extension>
-
-</plugin>
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/Activator.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/Activator.java
deleted file mode 100644
index 5875dc1d46a..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/Activator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.papyrus.uml.profile.externalresource;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.profile.externalresource"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** logger helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- log = null;
- super.stop(context);
- }
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/AbstractStereotypeApplicationLocationStrategy.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/AbstractStereotypeApplicationLocationStrategy.java
deleted file mode 100644
index f6521a180a6..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/AbstractStereotypeApplicationLocationStrategy.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.Element;
-
-
-/**
- * Abstract strategy class for stereotype application location
- */
-public abstract class AbstractStereotypeApplicationLocationStrategy implements IStereotypeApplicationLocationStrategy {
-
- /**
- * @param element
- * @param definition
- * @return
- */
- protected EList<EObject> getDefaultContainmentList(Element element, EClass definition) {
- return element.eResource().getContents();
- }
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExtendedProfileApplicationHelper.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExtendedProfileApplicationHelper.java
deleted file mode 100644
index d95aab82d65..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExtendedProfileApplicationHelper.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.util.UMLUtil.ProfileApplicationHelper;
-
-
-/**
- * Extended profile application helper for Papyrus tool.
- * <P>
- * When this helper is activated, profiles are located in external resources
- * </P>
- */
-public class ExtendedProfileApplicationHelper extends ProfileApplicationHelper {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterable<Package> getOtherApplyingPackages(Package package_) {
- return super.getOtherApplyingPackages(package_);
- }
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExternalResourceProfileUtils.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExternalResourceProfileUtils.java
deleted file mode 100644
index 802a38de3eb..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ExternalResourceProfileUtils.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.uml.profile.externalresource.Activator;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.ProfileApplication;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Utility class for stereotype application management in external resources
- */
-public class ExternalResourceProfileUtils {
-
- /**
- * @param profileApplication
- */
- public static IStatus updateStereotypeApplicationsLocation(ProfileApplication profileApplication, IStereotypeApplicationLocationStrategy oldStrategy, IStereotypeApplicationLocationStrategy newStrategy) {
- // 1. retrieve all stereotype applications concerned by the given profile application
- // 2. move the stereotype application in their new containment list
- Map<EClass, List<EObject>> allStereotypeApplications = findStereotypeApplicationsByDefinition(profileApplication, oldStrategy);
-
- // now have a map of all definitions of stereotypes contained in the profile applied, now they should be moved according to the new strategy
- for(Entry<EClass, List<EObject>> entry : allStereotypeApplications.entrySet()) {
- EClass definition = entry.getKey();
- for(EObject stereotypeApplication : entry.getValue()) {
- // move the EObject in the new containment list
- Element baseElement = UMLUtil.getBaseElement(stereotypeApplication);
- List<EObject> containmentList = newStrategy.getContainmentList(baseElement, definition);
- if(!containmentList.contains(stereotypeApplication)) { // move the stereotype application only if it was not already there (to avoid useless moves)
- containmentList.add(stereotypeApplication); // move stereotype at the right place
- };
- }
- }
-
- // update Eannotation that stores the new strategy
- PapyrusStereotypeApplicationHelper.setCurrentLocationStrategy(profileApplication, newStrategy);
-
- return Status.OK_STATUS;
- }
-
- /**
- * @param profileApplication
- * @return
- */
- public static Map<EClass, List<EObject>> findStereotypeApplicationsByDefinition(ProfileApplication profileApplication, IStereotypeApplicationLocationStrategy oldStrategy) throws RuntimeException{
- Map<EClass, List<EObject>> allStereotypeApplications = new HashMap<EClass, List<EObject>>();
-
- Resource modelResource = profileApplication.eResource();
- if(modelResource == null) {
- Activator.log.error("Profile Application is not in a resource. "+profileApplication, null);
- return Collections.emptyMap();
- }
- ModelSet modelSet = null;
- if(!(modelResource.getResourceSet() instanceof ModelSet)) {
- Activator.log.error("Trying to modify the stereotype application outside a Papyrus Model Set", null);
- return Collections.emptyMap();
-
- } else {
- modelSet = (ModelSet)modelResource.getResourceSet();
- }
-
- // For all resources, retrieve the containment list that should hold the stereotype application for the given profile, for all UML elements at the root of the resource (should test for all elements, but would be really slow)
- // for all elements in the containment list that corresponds to the profile application, store in a new list
- List<EClassifier> classifiers = profileApplication.getAppliedDefinition().getEClassifiers();
- for(final EClassifier classifier : classifiers) {
- if(classifier instanceof EClass) {
- final EClass definition = (EClass)classifier;
- List<EObject> stereotypeApplications = new ArrayList<EObject>();
- for(Resource resource : modelSet.getResources()) {
- // if resource = read only (model import, etc.), nothing should be done
- if(!modelSet.getTransactionalEditingDomain().isReadOnly(resource)) {
- for(EObject object : resource.getContents()) {
- if(object instanceof Element) {
- // retrieve the containment list for this element and all the stereotype applications of the applied profile
- Element element = ((Element)object);
- EList<EObject> fullList = oldStrategy.getContainmentList(element, definition);
- for(EObject possibleStereotypeApplication : fullList) {
- if(definition.equals(possibleStereotypeApplication.eClass())) {
- stereotypeApplications.add(possibleStereotypeApplication);
- }
- }
- }
- }
- }
- }
- allStereotypeApplications.put(definition, stereotypeApplications);
- }
- }
- return allStereotypeApplications;
- }
-
- public static ICommand createUpdateStereotypeApplicationsLocationCommand( ProfileApplication profileApplication, IStereotypeApplicationLocationStrategy oldStrategy, IStereotypeApplicationLocationStrategy newStrategy) {
- if(profileApplication ==null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- // create a command based on #updateStereotypeApplicationsLocation()
- return new UpdateStereotypeApplicationsLocationCommand(profileApplication, oldStrategy, newStrategy);
- }
-
-
- public static ICommand createUpdateStereotypeApplicationsLocationCommand( Element element, IStereotypeApplicationLocationStrategy oldStrategy, IStereotypeApplicationLocationStrategy newStrategy) {
- if(element ==null) {
- return null;
- }
- // retrieve all stereotype applications from the element (should be for each root => subpackages and over), all stereotype applications
- EObject root = EcoreUtil.getRootContainer(element, true);
- if(root instanceof Package) {
- List<ProfileApplication> profileApplications = new ArrayList<ProfileApplication>();
- computeAllProfileApplications((Package)root, true, profileApplications);
- return createUpdateStereotypeApplicationsLocationCommand(profileApplications, oldStrategy, newStrategy);
- }
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @param element
- * @param recursive <code>true</code> if profile applications should be searched in nested packages
- * @return
- */
- protected static void computeAllProfileApplications(Package package_, boolean recursive, List<ProfileApplication> profileApplications) {
- List<ProfileApplication> thisPackageProfileApplications = package_.getProfileApplications();
- if(thisPackageProfileApplications != null && thisPackageProfileApplications.size() > 0) {
- profileApplications.addAll(thisPackageProfileApplications);
- }
-
- if(recursive) {
- for(Package ownedPackage : package_.getNestedPackages()) {
- computeAllProfileApplications(ownedPackage, recursive, profileApplications);
- }
- }
- }
-
- public static ICommand createUpdateStereotypeApplicationsLocationCommand(List<ProfileApplication> profileApplications, IStereotypeApplicationLocationStrategy oldStrategy, IStereotypeApplicationLocationStrategy newStrategy) {
- if(profileApplications == null || profileApplications.size() < 1) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- ICommand resultCommand = null;
- for(ProfileApplication profileApplication : profileApplications) {
- resultCommand = new UpdateStereotypeApplicationsLocationCommand(profileApplication, oldStrategy, newStrategy).compose(resultCommand);
- }
- return resultCommand;
- }
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/IStereotypeApplicationLocationStrategy.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/IStereotypeApplicationLocationStrategy.java
deleted file mode 100644
index 0dc998c92b0..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/IStereotypeApplicationLocationStrategy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.Element;
-
-
-/**
- * Interface implemented by all strategies in charge of the management of resources for stereotype applications
- */
-public interface IStereotypeApplicationLocationStrategy {
-
- /**
- * Returns the containment list in which stereotype applications should be read/added.
- * @param element the stereotyped element
- * @param definition the definition of the stereotype to apply
- * @return the containment list for the new stereotype application. if any problem, this will be the default location (direct content of the resource containing the element)
- */
- public EList<EObject> getContainmentList(Element element, EClass definition);
-
- /**
- * Returns the list of URIs of the resources in which stereotype applications are placed.
- * @param root element of the model from which all profile applications are found
- * @return the list of URIS, an empty collection if not URIs are found.
- */
- public Set<URI> getProfileApplicationResourceURIs(EObject root);
-
-
- /**
- * Returns the identifier of this strategy
- * @return the identifier of this strategy, should never be <code>null</code>.
- */
- public String getIdentifier();
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/OneResourceOnlyStrategy.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/OneResourceOnlyStrategy.java
deleted file mode 100644
index 77def9cb776..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/OneResourceOnlyStrategy.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.resource.UMLResource;
-
-/**
- * Strategy for only one resource for all profile applications
- */
-public class OneResourceOnlyStrategy extends AbstractStereotypeApplicationLocationStrategy {
-
- /** identifier of this strategy */
- public static final String ID = "OneResourceOnlyStrategy"; //$NON-NLS-1$
-
- /** default extension for the profile URI */
- public static final String PROFILE_DEFAULT_EXTENSION = "profiles";
-
- /** singleton instance */
- private static OneResourceOnlyStrategy instance;
-
- /**
- * Returns the singleton instance for this strategy
- *
- * @return the singleton instance for this strategy
- */
- public static OneResourceOnlyStrategy getInstance() {
- if(instance == null) {
- instance = new OneResourceOnlyStrategy();
- }
- return instance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EList<EObject> getContainmentList(Element element, EClass definition) {
- // 1. only one resource => look if there is a custom name. Otherwise, use a standard name for the resource
- // compute the URI of the resource
- Resource baseResource = element.eResource();
- if(baseResource == null) {
- return null;
- }
- URI newURI = getProfileResourceURI(element, definition);
- ResourceSet resourceSet = baseResource.getResourceSet();
- if(resourceSet instanceof ModelSet && newURI != null) {
- ModelSet modelSet = (ModelSet)resourceSet;
- Resource resource = ModelUtils.getOrCreateResource(modelSet, true, newURI, UMLResource.UML_CONTENT_TYPE_IDENTIFIER);
- return resource.getContents();
- }
- // by default, return the resource containing the element
- return getDefaultContainmentList(element, definition);
- }
-
- /**
- * @param element
- * @param definition
- * @return
- */
- protected URI getProfileResourceURI(Element element, EClass definition) {
- if(element.eResource() !=null) {
- URI uri = element.eResource().getURI();
- if(uri !=null) {
- return uri.trimFileExtension().appendFileExtension(PROFILE_DEFAULT_EXTENSION);
- }
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<URI> getProfileApplicationResourceURIs(EObject root) {
- URI uri = root.eResource().getURI();
- if(uri !=null) {
- return Collections.singleton(uri.trimFileExtension().appendFileExtension(PROFILE_DEFAULT_EXTENSION));
- }
- return Collections.emptySet();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getIdentifier() {
- return ID;
- }
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java
deleted file mode 100644
index 7dc45da2678..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
-
-
-/**
- * Specific Stereotype Application Helper for Papyrus tool. If it detects the model is not a model handled by Papyrus, it will delegate to the standard Stereotype application helper.
- */
-public class PapyrusStereotypeApplicationHelper extends StereotypeApplicationHelper {
-
- /** Key for the location strategy value */
- public static final String LOCATION_STRATEGY_KEY = "locationStrategy";
-
- /** source for the eannotation that is used to store specific URI for stereotype application resource */
- public static final String PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE = "http://www.eclipse.org/papyrus/uml/profile/externalresource"; //$NON-NLS-1$
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject applyStereotype(Element element, EClass definition) {
- return super.applyStereotype(element, definition);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean addToContainmentList(Element element, EObject stereotypeApplication) {
- return super.addToContainmentList(element, stereotypeApplication);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected EList<EObject> getContainmentList(Element element, EClass definition) {
- // 1. find the current strategy used for the model element
- // 2. use the strategy to find the resource and the containment list
- // 3. if no strategy found, return usual strategy ==> stereotype application are directly contained by the resource containing the stereotyped element.
- IStereotypeApplicationLocationStrategy locationStrategy = getCurrentLocationStrategy(element);
- if(locationStrategy ==null) {
- return StandardApplicationLocationStrategy.getInstance().getContainmentList(element, definition);
- }
- return locationStrategy.getContainmentList(element, definition);
- }
-
- /**
- * Returns the specific location strategy to use for the given model element
- * @param element the stereotyped element
- * @return the location strategy or the standard one if none was found
- */
- public static IStereotypeApplicationLocationStrategy getCurrentLocationStrategy(EObject element) {
- EObject container = EcoreUtil.getRootContainer(element, true);
- if(container instanceof Element) {
- EAnnotation annotation = ((Element)container).getEAnnotation(PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
- if(annotation == null) {
- return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
- }
-
- String location = annotation.getDetails().get(LOCATION_STRATEGY_KEY);
- if(location == null) {
- return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
- }
-
- IStereotypeApplicationLocationStrategy strategy = StrategyRegistry.getInstance().getStrategy(location);
- if(strategy != null) {
- return strategy;
- }
- }
- return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
- }
-
- /**
- * Sets the specific location strategy to use for the given model element
- * Warning: this method modifies the model, it should be executed in a command.
- * @param element the stereotyped element
- * @return the location strategy or <code>null</code> if none was found
- */
- public static void setCurrentLocationStrategy(EObject element, IStereotypeApplicationLocationStrategy newStrategy) {
- EObject container = EcoreUtil.getRootContainer(element, true);
- if(container instanceof Element) {
- EAnnotation annotation = ((Element)container).getEAnnotation(PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
- if(annotation == null) {
- // create a new one
- annotation = ((Element)container).createEAnnotation(PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
- }
- // update or create
- annotation.getDetails().put(LOCATION_STRATEGY_KEY, newStrategy.getIdentifier());
- }
- }
-
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ResourcePerProfileStrategy.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ResourcePerProfileStrategy.java
deleted file mode 100644
index df2d511cb29..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/ResourcePerProfileStrategy.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.ProfileApplication;
-import org.eclipse.uml2.uml.resource.UMLResource;
-
-/**
- * Strategy that uses one resource per profile application
- */
-public class ResourcePerProfileStrategy implements IStereotypeApplicationLocationStrategy {
-
- /** default resource name */
- protected static final String DEFAULT_RESOURCE_NAME = "default"; //$NON-NLS-1$
-
- /** default resource extension */
- protected static final String DEFAULT_RESOURCE_EXTENSION = "profile"; //$NON-NLS-1$
-
- /** key for the value of the eannotation that is used to store specific URI for stereotype application resource */
- public static final String SPECIFIC_URI_EANNOTATION_KEY = "specificURI"; //$NON-NLS-1$
-
- /** identifier of this strategy */
- public static final String ID = "ResourcePerProfileStrategy"; //$NON-NLS-1$
-
- /** singleton instance */
- private static ResourcePerProfileStrategy instance;
-
- /**
- * Returns the singleton instance for this strategy
- *
- * @return the singleton instance for this strategy
- */
- public static ResourcePerProfileStrategy getInstance() {
- if(instance == null) {
- instance = new ResourcePerProfileStrategy();
- }
- return instance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getIdentifier() {
- return ID;
- }
-
- /**
- * Returns the resource where the stereotype application should be added for the given couple element/stereotype
- *
- * @param element
- * the stereotyped element
- * @param definition
- * the definition of the stereotype to apply
- * @return the resource where the stereotype application should be added
- */
- public Resource getStereotypeApplicationResource(Element element, EClass definition) {
- // in this case, the resource is specific to the profile application.
- // the profile application should give the right path.
- // 1. retrieve profile application
- // 2. ask it for the resource name (by default, it should give the name of the profile)
- // 3. compute the resource name
- // 4. ask to create on demand ?
- // 5. return the content of this resource
- ProfileApplication profileApplication = getProfileApplication(element, definition);
- Resource baseResource = element.eResource();
- if(baseResource==null) {
- return null;
- }
- ResourceSet resourceSet = baseResource.getResourceSet();
- if(resourceSet instanceof ModelSet) {
- ModelSet modelSet = (ModelSet)resourceSet;
- URI newURI = getProfileApplicationResourceURI(profileApplication, baseResource);
- Resource resource = ModelUtils.getOrCreateResource(modelSet, true, newURI, UMLResource.UML_CONTENT_TYPE_IDENTIFIER);
- return resource;
- }
- // by default, return the resource containing the element
- return element.eResource();
- }
-
- /**
- * Returns the specific URI indicated on the profile application
- *
- * @param profileApplication
- * the profile application that should have stereotype applications in resource with specific URI
- * @return the specific URI or <code>null</code>
- */
- protected URI getSpecificURI(ProfileApplication profileApplication, Resource baseResource) {
- EAnnotation annotation = profileApplication.getEAnnotation(PapyrusStereotypeApplicationHelper.PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
- if(annotation != null) {
- String value = annotation.getDetails().get(SPECIFIC_URI_EANNOTATION_KEY);
- URI newURI = baseResource.getURI();
- newURI = newURI.trimSegments(1);
- newURI = newURI.appendSegment(value);
- return newURI;
- }
- return null;
- }
-
- /**
- * Checks if the profile application should use a specific URI for the steroetype application resources
- *
- * @param profileApplication
- * profile application that should have stereotype applications in resource with specific URI
- * @return <code>true</code> if a specific URI is specified for the profile application
- */
- protected boolean hasSpecificURI(ProfileApplication profileApplication) {
- EAnnotation annotation = profileApplication.getEAnnotation(PapyrusStereotypeApplicationHelper.PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
- return annotation != null;
- }
-
- protected String getStereotypeApplicationResourceExtension(ProfileApplication profileApplication, boolean basedOnMainProfile) {
- // 1. check if nested profiles have the same resource or if each nested profile has its own resource
- // 2. deduce the name from the profile application
- // 3. return the string. This will be the extension of the file
- String resourceExtension = null;
- if(profileApplication != null) {
- Profile profile = profileApplication.getAppliedProfile();
- if(profile != null) {
- // if based on main profile => retrieve the main profile name.
- // otherwise, returns the name of the profile
- if(basedOnMainProfile) {
- Profile parentProfile = profile;
- while(parentProfile.getNestingPackage() instanceof Profile) {
- parentProfile = (Profile)parentProfile.getNestingPackage();
- }
- resourceExtension = parentProfile.getName() + "Profile"; // warning, can not return an extension which is linked to another factory than a UML Factory
- } else {
- resourceExtension = profile.getName() + "Profile";
- }
- }
- }
- if(resourceExtension == null) {
- resourceExtension = DEFAULT_RESOURCE_EXTENSION;
- }
- return resourceExtension;
- }
-
- protected String getStereotypeApplicationResourceName(ProfileApplication profileApplication, boolean basedOnMainProfile) {
- // 1. check if nested profiles have the same resource or if each nested profile has its own resource
- // 2. deduce the name from the profile application.
- // 3. return the string. This will be the extension of the file
- String resourceName = null;
- if(profileApplication != null) {
- Package applyingPackage = profileApplication.getApplyingPackage();
- if(applyingPackage != null) {
- resourceName = applyingPackage.eResource().getURI().trimFileExtension().lastSegment();
- }
- }
- if(resourceName == null) {
- resourceName = DEFAULT_RESOURCE_NAME;
- }
- return resourceName;
- }
-
- /**
- * Returns the profile application for the given element on which the stereotype with specified definition is or will be applied
- *
- * @param element
- * the UML element on which stereotype is applied
- * @return the profile application or <code>null</code> if none was found.
- */
- protected ProfileApplication getProfileApplication(Element element, EClass definition) {
- Package nearestPackage = element.getNearestPackage();
- if(nearestPackage == null) {
- return null;
- }
- List<ProfileApplication> profileApplications = nearestPackage.getAllProfileApplications();
- for(ProfileApplication profileApplication : profileApplications) {
- EPackage appliedDefinition = profileApplication.getAppliedDefinition();
- List<EClassifier> classifiers = appliedDefinition.getEClassifiers();
- if(classifiers != null && !classifiers.isEmpty() && classifiers.contains(definition)) {
- return profileApplication;
- }
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EList<EObject> getContainmentList(Element element, EClass definition) {
- Resource stereotypeApplicationResource = getStereotypeApplicationResource(element, definition);
- if(stereotypeApplicationResource != null) {
- return stereotypeApplicationResource.getContents();
- }
- // fallback: adds stereotype at the root of the UML resource.
- Resource elementResource = element.eResource();
- if(elementResource != null) {
- return elementResource.getContents();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<URI> getProfileApplicationResourceURIs(EObject root) {
- Set<URI> uris = new HashSet<URI>();
- // 1. retrieve all profile applications
- // 2. retrieve all URI from all this profile applications
- if(root instanceof Element && root.eResource()!=null) {
- Package nearestPackage = ((Element)root).getNearestPackage();
- if(nearestPackage != null) {
- List<ProfileApplication> profileApplications = nearestPackage.getAllProfileApplications();
- for(ProfileApplication profileApplication : profileApplications) {
- URI newURI = getProfileApplicationResourceURI(profileApplication, root.eResource());
- uris.add(newURI);
- }
- }
- }
- return uris;
- }
-
- protected URI getProfileApplicationResourceURI(ProfileApplication profileApplication, Resource baseResource) {
- // test if it needs a specific name. Otherwise, it will use a default name
- URI newURI = null;
- if(hasSpecificURI(profileApplication)) {
- newURI = getSpecificURI(profileApplication, baseResource);
- }
- if(newURI == null) {
- URI baseURI = baseResource.getURI();
- newURI = baseURI.trimSegments(1);
- String resourceName = getStereotypeApplicationResourceName(profileApplication, true);
- newURI = newURI.appendSegment(resourceName);
- String extension = getStereotypeApplicationResourceExtension(profileApplication, true);
- newURI = newURI.appendFileExtension(extension);
- }
- return newURI;
- }
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StandardApplicationLocationStrategy.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StandardApplicationLocationStrategy.java
deleted file mode 100644
index d0e4de7274a..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StandardApplicationLocationStrategy.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.Element;
-
-
-/**
- * Usual stereotype application strategy
- */
-public class StandardApplicationLocationStrategy implements IStereotypeApplicationLocationStrategy {
-
- /** identifier of this strategy */
- public static final String ID = "standardStrategy"; //$NON-NLS-1$
-
- /** singleton instance */
- protected static StandardApplicationLocationStrategy instance;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getIdentifier() {
- return ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EList<EObject> getContainmentList(Element element, EClass definition) {
- if(element.eResource() !=null) {
- return element.eResource().getContents();
- }
- return null;
- }
-
- /**
- * @return
- */
- public static StandardApplicationLocationStrategy getInstance() {
- if(instance ==null) {
- instance = new StandardApplicationLocationStrategy();
- }
- return instance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<URI> getProfileApplicationResourceURIs(EObject root) {
- return Collections.emptySet();
- }
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StrategyRegistry.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StrategyRegistry.java
deleted file mode 100644
index 07af6bfd0b7..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/StrategyRegistry.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * Registry for all {@link IStereotypeApplicationLocationStrategy}.
- */
-public class StrategyRegistry {
-
- /** singleton instance */
- private static StrategyRegistry instance;
-
- /** map identifier - strategies */
- private Map<String, IStereotypeApplicationLocationStrategy> registry;
-
- /**
- * Returns the singleton instance for this strategy
- *
- * @return the singleton instance for this strategy
- */
- public static StrategyRegistry getInstance() {
- if(instance == null) {
- instance = new StrategyRegistry();
- instance.init();
- }
- return instance;
- }
-
- /**
- * Initialize the strategy registry, reading extension points.
- */
- protected void init() {
- // TODO: read extension points.
- registry = new HashMap<String, IStereotypeApplicationLocationStrategy>();
- registry.put(StandardApplicationLocationStrategy.ID, StandardApplicationLocationStrategy.getInstance());
- registry.put(OneResourceOnlyStrategy.ID, OneResourceOnlyStrategy.getInstance());
- registry.put(ResourcePerProfileStrategy.ID, ResourcePerProfileStrategy.getInstance());
- }
-
- /**
- * Returns the strategy for the given identifier
- * @param identifier identifier of the strategy
- * @return the strategy found or <code>null</code> if none was found
- */
- public IStereotypeApplicationLocationStrategy getStrategy(String identifier) {
- return registry.get(identifier);
- }
-}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/UpdateStereotypeApplicationsLocationCommand.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/UpdateStereotypeApplicationsLocationCommand.java
deleted file mode 100644
index b45fa8fc07a..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/UpdateStereotypeApplicationsLocationCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.helper;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.uml2.uml.ProfileApplication;
-
-/**
- * Command to update stereotype application locations when strategy is changed
- */
-public class UpdateStereotypeApplicationsLocationCommand extends AbstractTransactionalCommand {
-
- protected ProfileApplication profileApplication;
- protected IStereotypeApplicationLocationStrategy oldStrategy;
- protected IStereotypeApplicationLocationStrategy newStrategy;
-
- /**
- * Default Constructor
- * @param profileApplication the profile application for which stereotype applications should be moved
- * @param oldStrategy old strategy currently used to store stereotype applications
- * @param newStrategy new strategy to use for stereotype application management
- */
- public UpdateStereotypeApplicationsLocationCommand(ProfileApplication profileApplication, IStereotypeApplicationLocationStrategy oldStrategy, IStereotypeApplicationLocationStrategy newStrategy) {
- super(TransactionUtil.getEditingDomain(profileApplication), "Update Stereotype Applications Location", getWorkspaceFiles(profileApplication));
- this.profileApplication = profileApplication;
- this.oldStrategy = oldStrategy;
- this.newStrategy = newStrategy;
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IStatus status = ExternalResourceProfileUtils.updateStereotypeApplicationsLocation(profileApplication, oldStrategy, newStrategy);
- return new CommandResult(status);
- }
-
-} \ No newline at end of file
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/model/StereotypeApplicationExternalResourceModel.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/model/StereotypeApplicationExternalResourceModel.java
deleted file mode 100644
index dff5b807a7d..00000000000
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/model/StereotypeApplicationExternalResourceModel.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.model;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPath;
-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.xmi.XMIResource;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
-import org.eclipse.papyrus.infra.core.resource.AbstractModel;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.core.resource.IModelSnippet;
-import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.uml.profile.externalresource.Activator;
-import org.eclipse.papyrus.uml.profile.externalresource.helper.IStereotypeApplicationLocationStrategy;
-import org.eclipse.papyrus.uml.profile.externalresource.helper.PapyrusStereotypeApplicationHelper;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.uml2.uml.resource.UMLResource;
-
-/**
- * Model to manage stereotype applications in external resources.
- */
-public class StereotypeApplicationExternalResourceModel extends AbstractModel implements IModel {
-
- /** identifier of this IModel */
- public static final String ID = "ExternalStereotypeApplicationModel";
-
- /** list of resources for stereotype applications */
- protected List<Resource> profileApplicationResources = new ArrayList<Resource>();
-
- /** stores the root URI that was used to load all the manage resources */
- protected URI rootURI;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getIdentifier() {
- return ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createModel(IPath fullPath) {
- // throw new UnsupportedOperationException("CreateModel_IPath is not supported for " + getClass().getCanonicalName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createModel(URI uri) {
- // throw new UnsupportedOperationException("CreateModel_URI is not supported for " + getClass().getCanonicalName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void loadModel(IPath path) {
- loadModel(getPlatformURI(path));
- }
-
- /**
- * Returns a platform resource URI of the given path
- *
- * @param path
- * the path
- * @return the uri
- */
- protected URI getPlatformURI(IPath path) {
- return URI.createPlatformResourceURI(path.toString(), true);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void loadModel(URI uri) {
- rootURI = uri;
- List<Resource> resources = getResources(true);
- for(Resource resource : resources) {
- try {
- if(!resource.isLoaded()) {
- resource.load(null);
- }
- configureResource(resource);
- profileApplicationResources.add(resource);
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
- // call registered snippets
- snippets.performStart(this);
- }
-
- /**
- * Returns the dynamically computed list of resources in which stereotype applications should be located
- *
- * @return the list of resources in which stereotype applications should be located
- */
- protected List<Resource> getResources(boolean loadOnDemand) {
- List<Resource> resources = new ArrayList<Resource>();
- // get all profile applications resource to load from the strategy. do not care of the URI ?
- UmlModel umlModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID);
-
- // should retrieve ALL uml files that contains elements that are owned directly or indirectly by the main model
- try {
- if(umlModel != null && umlModel.lookupRoot() != null) {
- EObject root = umlModel.lookupRoot();
- IStereotypeApplicationLocationStrategy strategy = PapyrusStereotypeApplicationHelper.getCurrentLocationStrategy(root);
- if(strategy != null) {
- Set<URI> profileApplicationResourceURIs = strategy.getProfileApplicationResourceURIs(root);
- for(URI resourceURI : profileApplicationResourceURIs) {
- Resource resource = ModelUtils.getOrCreateResource(modelSet, loadOnDemand, resourceURI, UMLResource.UML_CONTENT_TYPE_IDENTIFIER);
- resources.add(resource);
- }
- }
- }
- } catch (NotFoundException e) {
- Activator.log.debug(e.getMessage());
- return Collections.emptyList();
- }
- return resources;
- }
-
- protected void configureResource(Resource resource) {
- if(resource instanceof XMIResource) {
- ((XMIResource)resource).getDefaultSaveOptions().putAll(getSaveOptions());
- ((XMIResource)resource).setEncoding(AbstractBaseModel.ENCODING);
- }
- }
-
- protected Map<Object, Object> getSaveOptions() {
- Map<Object, Object> saveOptions = new HashMap<Object, Object>();
- // default save options.
- saveOptions.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_PROCESS_DANGLING_HREF, XMIResource.OPTION_PROCESS_DANGLING_HREF_DISCARD);
- saveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_SKIP_ESCAPE_URI, Boolean.FALSE);
- saveOptions.put(XMIResource.OPTION_ENCODING, "UTF-8");
- //see bug 397987: [Core][Save] The referenced plugin models are saved using relative path
- saveOptions.put(XMIResource.OPTION_URI_HANDLER, new org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl.PlatformSchemeAware());
- return saveOptions;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void importModel(IPath path) {
- throw new UnsupportedOperationException("ImportModel_IPath is not supported for " + getClass().getCanonicalName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void importModel(URI uri) {
- throw new UnsupportedOperationException("ImportModel_URI is not supported for " + getClass().getCanonicalName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void saveModel() throws IOException {
- List<Resource> resources = getResources(true);
- for(Resource resource : resources) {
- if(!getModelManager().getTransactionalEditingDomain().isReadOnly(resource) && !ModelUtils.resourceFailedOnLoad(resource)) {
- resource.save(getSaveOptions());
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void changeModelPath(IPath fullPath) {
- throw new UnsupportedOperationException("changeModelPath is not supported for " + getClass().getCanonicalName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setModelURI(URI uri) {
- List<Resource> resources = getResources(true);
- for(Resource resource : resources) {
- if(!ModelUtils.resourceFailedOnLoad(resource)) {
- String fileExtension = resource.getURI().fileExtension();
- URI newURI = uri.appendFileExtension(fileExtension);
- resource.setURI(newURI);
- }
- }
- rootURI = uri;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void unload() {
- // call registered snippets
- snippets.performDispose(this);
- List<Resource> resources = getResources(false);
- for(Resource resource : resources) {
- resource.unload();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addModelSnippet(IModelSnippet snippet) {
- snippets.add(snippet);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<URI> getModifiedURIs() {
- return Collections.emptySet();
- }
-}

Back to the top