summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Akehurst2014-05-15 13:29:21 (EDT)
committerDavid Akehurst2014-05-17 03:20:48 (EDT)
commitec345753c29cf2f9acf9b765be0a54b3e3f9a81f (patch)
tree7e29f174304c5e2c458f2b32c5f1945fe3d69799
parente39e50efd845db6b228ec79e197cf0780506fce7 (diff)
downloadorg.eclipse.papyrus-ec345753c29cf2f9acf9b765be0a54b3e3f9a81f.zip
org.eclipse.papyrus-ec345753c29cf2f9acf9b765be0a54b3e3f9a81f.tar.gz
org.eclipse.papyrus-ec345753c29cf2f9acf9b765be0a54b3e3f9a81f.tar.bz2
[434594] Enable Model (Library/Metamodel/Profile) Registrations to berefs/changes/93/26693/6
added to via code Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=43459 Change-Id: Ib4eb7db3f1e82664a8c15a0c2ea2c06797d4b39e Signed-off-by: David Akehurst <dave@akehurst.net>
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java14
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/IRegisteredItem.java34
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/Registry.java92
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/IRegisteredLibrary.java17
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrary.java32
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java25
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java27
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/IRegisteredMetamodel.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodel.java42
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java25
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/IRegisteredProfile.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/RegisteredProfile.java50
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java33
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java23
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesBlock.java19
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesDialog.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchPackageImportDialog.java21
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchResourceDialog.java21
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/wizard/UMLModelWithProfileWizard.java29
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java11
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java8
23 files changed, 387 insertions, 187 deletions
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
index bad809b..16b905b 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
@@ -78,7 +78,7 @@ import org.eclipse.papyrus.uml.alf.validation.typing.TypeFacade;
import org.eclipse.papyrus.uml.alf.validation.typing.TypeFacadeFactory;
import org.eclipse.papyrus.uml.alf.validation.typing.TypeUtils;
import org.eclipse.papyrus.uml.alf.validation.typing.VoidFacade;
-import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.Class;
@@ -152,9 +152,9 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
String question = "The context model " + contextClassifier.getModel().getName() + " does not import the standard Alf library. This import is required for static validation of Alf expressions and statements. \n\n Do you want to generate this import?";
boolean doGenerateImport = MessageDialog.openQuestion(new Shell(), "Alf editor", question);
if(doGenerateImport) {
- RegisteredLibrary[] libraries = RegisteredLibrary.getRegisteredLibraries();
- RegisteredLibrary alfLibrary = null;
- for(RegisteredLibrary l : libraries) {
+ List<IRegisteredLibrary> libraries = org.eclipse.papyrus.uml.extensionpoints.Registry.getRegisteredLibraries();
+ IRegisteredLibrary alfLibrary = null;
+ for(IRegisteredLibrary l : libraries) {
if(l.getName().equals("AlfLibrary")) {
alfLibrary = l;
}
@@ -184,7 +184,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
private Model model;
- private RegisteredLibrary library;
+ private IRegisteredLibrary library;
/*
* (non-Javadoc)
@@ -195,7 +195,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
- URI libraryUri = library.uri;
+ URI libraryUri = library.getUri();
ResourceSet resourceSet = Util.getResourceSet(contextClassifier);
Resource libraryResource = resourceSet.getResource(libraryUri, true);
Package libraryObject = (Package)libraryResource.getContents().get(0);
@@ -203,7 +203,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
return CommandResult.newOKCommandResult(model);
}
- public UpdateImportCommand(Model model, RegisteredLibrary library) {
+ public UpdateImportCommand(Model model, IRegisteredLibrary library) {
super(getTransactionalEditingDomain(model), "Model Update", getWorkspaceFiles(model));
this.model = model;
this.library = library;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/IRegisteredItem.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/IRegisteredItem.java
new file mode 100644
index 0000000..a2911ab
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/IRegisteredItem.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * Dr. David H. Akehurst - enable programmatic registration
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.extensionpoints;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.swt.graphics.Image;
+
+public interface IRegisteredItem {
+
+ /** Name of the registered item */
+ String getName();
+
+ /** URI to the file that is the registered item */
+ URI getUri();
+
+ /** Path of the file that implements the registered element */
+ String getPath();
+
+ /** Identifier for the provider of this item */
+ String getProvider();
+
+ /** Long description of the registered item */
+ String getDescription();
+
+ Image getImage();
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/Registry.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/Registry.java
new file mode 100644
index 0000000..9120f04
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/Registry.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * Dr. David H. Akehurst - enable programmatic registration
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.extensionpoints;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.metamodel.IRegisteredMetamodel;
+import org.eclipse.papyrus.uml.extensionpoints.metamodel.RegisteredMetamodel;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+
+public class Registry {
+
+ /** attribute that acts as a cache for the list of registered libraries */
+ private static List<IRegisteredLibrary> registeredLibraries;
+
+ public static List<IRegisteredLibrary> getRegisteredLibraries() {
+ if(null == registeredLibraries) {
+ registeredLibraries = RegisteredLibrary.getRegisteredLibraries();
+ }
+ return registeredLibraries;
+ }
+
+ public static void addRegisteredLibrary(IRegisteredLibrary lib) {
+ if(null == registeredLibraries) {
+ registeredLibraries = RegisteredLibrary.getRegisteredLibraries();
+ }
+ registeredLibraries.add(lib);
+ }
+
+ /** attribute that acts as a cache for the list of registered metamodels */
+ private static List<IRegisteredMetamodel> registeredMetamodels;
+
+ public static List<IRegisteredMetamodel> getRegisteredMetamodels() {
+ if(null == registeredMetamodels) {
+ registeredMetamodels = RegisteredMetamodel.getRegisteredMetamodels();
+ }
+ return registeredMetamodels;
+ }
+
+ public static void addRegisteredMetamodel(IRegisteredMetamodel lib) {
+ if(null == registeredMetamodels) {
+ registeredMetamodels = RegisteredMetamodel.getRegisteredMetamodels();
+ }
+ registeredMetamodels.add(lib);
+ }
+
+ /** attribute that acts as a cache for the list of registered profiles */
+ private static List<IRegisteredProfile> registeredProfiles;
+
+ public static List<IRegisteredProfile> getRegisteredProfiles() {
+ if(null == registeredProfiles) {
+ registeredProfiles = RegisteredProfile.getRegisteredProfiles();
+ }
+ return registeredProfiles;
+ }
+ public static IRegisteredProfile getRegisteredProfile(String name, String path) {
+ Assert.isNotNull(name);
+ List<IRegisteredProfile> profiles = Registry.getRegisteredProfiles();
+ for(int i = 0; i < profiles.size(); i++) {
+ IRegisteredProfile profile = profiles.get(i);
+
+ // name corresponds. is path equal?
+ if(name.equals(profile.getName())) {
+ // no path indicated => first name that corresponds => profile returned
+ if(path == null) {
+ return profile;
+ } else if(path.equals(profile.getPath())) {
+ return profile;
+ }
+ }
+ }
+ return null;
+ }
+ public static void addRegisteredProfile(IRegisteredProfile lib) {
+ if(null == registeredProfiles) {
+ registeredProfiles = RegisteredProfile.getRegisteredProfiles();
+ }
+ registeredProfiles.add(lib);
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/IRegisteredLibrary.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/IRegisteredLibrary.java
new file mode 100644
index 0000000..125ddcc
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/IRegisteredLibrary.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * Dr. David H. Akehurst
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.extensionpoints.library;
+
+import org.eclipse.papyrus.uml.extensionpoints.IRegisteredItem;
+
+public interface IRegisteredLibrary extends IRegisteredItem {
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrary.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrary.java
index ad44c0d..8b881e7 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrary.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrary.java
@@ -7,6 +7,7 @@
*
* Contributors:
* CEA List - initial API and implementation
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.library;
@@ -15,6 +16,7 @@ import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionIds;
import org.eclipse.papyrus.uml.extensionpoints.standard.RegisteredElementExtensionPoint;
@@ -22,14 +24,11 @@ import org.eclipse.papyrus.uml.extensionpoints.standard.RegisteredElementExtensi
/**
* Class that manages registered library extension point
*/
-public class RegisteredLibrary extends RegisteredElementExtensionPoint {
+public class RegisteredLibrary extends RegisteredElementExtensionPoint implements IRegisteredLibrary {
/** name of the extension point (main element name) in the DTD */
private static final String TAG_LIBRARY = "library";
- /** attribute that acts as a cache for the list of registered libraries */
- private static RegisteredLibrary[] RegisteredLibraries;
-
/**
* Main constructor.
*
@@ -42,20 +41,22 @@ public class RegisteredLibrary extends RegisteredElementExtensionPoint {
super(configElt, ordinal);
}
+ public URI getUri() {
+ return super.uri;
+ }
+
+ public String getPath() {
+ return super.path;
+ }
+
/**
* Returns the list of registered libraries in the platform, using the Papyrus extension point.
*
* @return the list of registered libraries in the platform
*/
- public static RegisteredLibrary[] getRegisteredLibraries() {
-
- // if the list was already computed, returns it (like a cache)
- if(RegisteredLibraries != null) {
- return RegisteredLibraries;
- }
+ public static List<IRegisteredLibrary> getRegisteredLibraries() {
- // the list of libraries was not already computed. Read configuration elements
- List<RegisteredLibrary> libraries = new ArrayList<RegisteredLibrary>();
+ List<IRegisteredLibrary> libraries = new ArrayList<IRegisteredLibrary>();
// // Default elements : UML, Ecore, Java, XML PrimitiveTypes model library
// RegisteredLibrary UmlPrimitiveTypes
@@ -81,15 +82,14 @@ public class RegisteredLibrary extends RegisteredElementExtensionPoint {
// Read configuration elements for the current extension
for(int j = 0; j < configElements.length; j++) {
- RegisteredLibrary proxy = parseLibraryExtension(configElements[j], libraries.size());
+ IRegisteredLibrary proxy = parseLibraryExtension(configElements[j], libraries.size());
if(proxy != null) {
libraries.add(proxy);
}
} // end of configElements loop
- RegisteredLibraries = libraries.toArray(new RegisteredLibrary[libraries.size()]);
- return RegisteredLibraries;
+ return libraries;
}
/**
@@ -99,7 +99,7 @@ public class RegisteredLibrary extends RegisteredElementExtensionPoint {
* @param configElt
* @return
*/
- private static RegisteredLibrary parseLibraryExtension(IConfigurationElement configElt, int ordinal) {
+ private static IRegisteredLibrary parseLibraryExtension(IConfigurationElement configElt, int ordinal) {
if(!TAG_LIBRARY.equals(configElt.getName())) {
return null;
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java
index 1483cc3..821b724 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA List - initial API and implementation
- * Christian W. Damus (CEA) - bug 422257
- *
+ * CEA List - initial API and implementation
+ * Christian W. Damus (CEA) - bug 422257
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.library;
@@ -22,6 +22,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.uml2.uml.Element;
@@ -47,7 +48,7 @@ public class RegisteredLibrarySelectionDialog extends ElementListSelectionDialog
/**
*
*/
- private RegisteredLibrary[] regLibraries;
+ private IRegisteredLibrary[] regLibraries;
/**
*
@@ -68,7 +69,7 @@ public class RegisteredLibrarySelectionDialog extends ElementListSelectionDialog
importedLibrariesNames = getImportedLibraryNames(importedLibraries);
// Retrieve registered Libraries
- regLibraries = RegisteredLibrary.getRegisteredLibraries();
+ regLibraries = Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]);
// remove already applied Libraries from the list
regLibraries = removeAlreadyImportededFromSelection();
@@ -110,20 +111,20 @@ public class RegisteredLibrarySelectionDialog extends ElementListSelectionDialog
*
* @return
*/
- private RegisteredLibrary[] removeAlreadyImportededFromSelection() {
+ private IRegisteredLibrary[] removeAlreadyImportededFromSelection() {
- List<RegisteredLibrary> Libraries = new ArrayList<RegisteredLibrary>();
+ List<IRegisteredLibrary> Libraries = new ArrayList<IRegisteredLibrary>();
for(int i = 0; i < regLibraries.length; i++) {
- String currentName = regLibraries[i].name;
+ String currentName = regLibraries[i].getName();
if(!importedLibrariesNames.contains(currentName)) {
Libraries.add(regLibraries[i]);
}
}
- RegisteredLibrary[] cleandList;
- cleandList = Libraries.toArray(new RegisteredLibrary[Libraries.size()]);
+ IRegisteredLibrary[] cleandList;
+ cleandList = Libraries.toArray(new IRegisteredLibrary[Libraries.size()]);
return cleandList;
}
@@ -141,8 +142,8 @@ public class RegisteredLibrarySelectionDialog extends ElementListSelectionDialog
}
for(int i = 0; i < selection.length; i++) {
- RegisteredLibrary currentLibrary = (RegisteredLibrary)(selection[i]);
- URI modelUri = currentLibrary.uri;
+ IRegisteredLibrary currentLibrary = (IRegisteredLibrary)(selection[i]);
+ URI modelUri = currentLibrary.getUri();
addModelLibraryImportFromURI(currentModel, modelUri);
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java
index bf210a9..a85148c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA List - initial API and implementation
- * Christian W. Damus (CEA) - bug 422257
- *
+ * CEA List - initial API and implementation
+ * Christian W. Damus (CEA) - bug 422257
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.library;
@@ -24,7 +24,8 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
@@ -51,7 +52,7 @@ public class RegisteredProfileAsLibrarySelectionDialog extends ElementListSelect
/**
*
*/
- private RegisteredProfile[] regProfiles;
+ private IRegisteredProfile[] regProfiles;
/**
*
@@ -72,7 +73,7 @@ public class RegisteredProfileAsLibrarySelectionDialog extends ElementListSelect
importedProfilesNames = getImportedProfileNames(importedProfiles);
// Retrieve registered profiles
- regProfiles = RegisteredProfile.getRegisteredProfiles();
+ regProfiles = Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]);
// remove already applied profiles from the list
regProfiles = removeAlreadyImportedFromSelection();
@@ -116,20 +117,20 @@ public class RegisteredProfileAsLibrarySelectionDialog extends ElementListSelect
*
* @return
*/
- private RegisteredProfile[] removeAlreadyImportedFromSelection() {
+ private IRegisteredProfile[] removeAlreadyImportedFromSelection() {
- List<RegisteredProfile> profiles = new ArrayList<RegisteredProfile>();
+ List<IRegisteredProfile> profiles = new ArrayList<IRegisteredProfile>();
for(int i = 0; i < regProfiles.length; i++) {
- String currentName = regProfiles[i].name;
+ String currentName = regProfiles[i].getName();
if(!importedProfilesNames.contains(currentName)) {
profiles.add(regProfiles[i]);
}
}
- RegisteredProfile[] cleandList;
- cleandList = profiles.toArray(new RegisteredProfile[profiles.size()]);
+ IRegisteredProfile[] cleandList;
+ cleandList = profiles.toArray(new IRegisteredProfile[profiles.size()]);
return cleandList;
}
@@ -151,8 +152,8 @@ public class RegisteredProfileAsLibrarySelectionDialog extends ElementListSelect
for(int i = 0; i < selection.length; i++) {
- RegisteredProfile currentProfile = (RegisteredProfile)(selection[i]);
- URI modelUri = currentProfile.uri;
+ IRegisteredProfile currentProfile = (IRegisteredProfile)(selection[i]);
+ URI modelUri = currentProfile.getUri();
PackageImport pi = getModelLibraryImportFromURI(modelUri);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/IRegisteredMetamodel.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/IRegisteredMetamodel.java
new file mode 100644
index 0000000..f5ee021
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/IRegisteredMetamodel.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * Dr. David H. Akehurst - enable programmatic registration
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.extensionpoints.metamodel;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.uml.extensionpoints.IRegisteredItem;
+
+public interface IRegisteredMetamodel extends IRegisteredItem {
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodel.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodel.java
index 1fef4e1..bd78db7 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodel.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodel.java
@@ -7,6 +7,7 @@
*
* Contributors:
* CEA List - initial API and implementation
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.metamodel;
@@ -16,6 +17,7 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionIds;
import org.eclipse.papyrus.uml.extensionpoints.standard.RegisteredElementExtensionPoint;
@@ -23,14 +25,11 @@ import org.eclipse.papyrus.uml.extensionpoints.standard.RegisteredElementExtensi
/**
* Class that manages registered metamodel extension point
*/
-public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
+public class RegisteredMetamodel extends RegisteredElementExtensionPoint implements IRegisteredMetamodel {
/** name of the extension point (main element name) in the DTD */
private static final String TAG_METAMODEL = "metamodel";
- /** list of registered metamodels (Cache) */
- private static RegisteredMetamodel[] RegisteredMetamodels;
-
/**
* Creates a new RegisteredMetamodel.
*
@@ -41,23 +40,27 @@ public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
super(configElt, ordinal);
}
+ public URI getUri() {
+ return super.uri;
+ }
+
+ public String getPath() {
+ return super.path;
+ }
+
/**
* Returns the list of registered metamodels in the platform, using the Papyrus extension point.
*
* @return the list of registered metamodels in the platform
*/
- public static RegisteredMetamodel[] getRegisteredMetamodels() {
- // list was already computed, returns it.
- if(RegisteredMetamodels != null) {
- return RegisteredMetamodels;
- }
- List<RegisteredMetamodel> metamodels = new ArrayList<RegisteredMetamodel>();
+ public static List<IRegisteredMetamodel> getRegisteredMetamodels() {
+ List<IRegisteredMetamodel> metamodels = new ArrayList<IRegisteredMetamodel>();
IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(
ExtensionIds.METAMODEL_EXTENSION_ID);
// Read configuration elements for the current extension
for(int j = 0; j < configElements.length; j++) {
- RegisteredMetamodel proxy = parseMetamodelExtension(configElements[j], metamodels.size());
+ IRegisteredMetamodel proxy = parseMetamodelExtension(configElements[j], metamodels.size());
if(proxy != null) {
metamodels.add(proxy);
@@ -71,8 +74,7 @@ public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
// = new RegisteredMetamodel("ecore", URI.createURI(UMLResource.ECORE_METAMODEL_URI));
// metamodels.add(EcoreMetamodel);
- RegisteredMetamodels = metamodels.toArray(new RegisteredMetamodel[metamodels.size()]);
- return RegisteredMetamodels;
+ return metamodels;
}
/**
@@ -84,7 +86,7 @@ public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
* @return the RegisteredMetamodel with given name or <code>null</code> if no metamodel was
* found.
*/
- public static RegisteredMetamodel getRegisteredMetamodel(String name) {
+ public static IRegisteredMetamodel getRegisteredMetamodel(String name) {
return getRegisteredMetamodel(name, null);
}
@@ -99,18 +101,18 @@ public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
* @return the RegisteredMetamodel with given name or <code>null</code> if no metamodel was
* found.
*/
- public static RegisteredMetamodel getRegisteredMetamodel(String name, String path) {
+ public static IRegisteredMetamodel getRegisteredMetamodel(String name, String path) {
Assert.isNotNull(name);
- RegisteredMetamodel[] metamodels = getRegisteredMetamodels();
+ IRegisteredMetamodel[] metamodels = getRegisteredMetamodels().toArray(new IRegisteredMetamodel[0]);
for(int i = 0; i < metamodels.length; i++) {
- RegisteredMetamodel metamodel = metamodels[i];
+ IRegisteredMetamodel metamodel = metamodels[i];
// name corresponds. is path equal?
- if(name.equals(metamodel.name)) {
+ if(name.equals(metamodel.getName())) {
// no path indicated => first name that corresponds => profile returned
if(path == null) {
return metamodel;
- } else if(path.equals(metamodel.path)) {
+ } else if(path.equals(metamodel.getPath())) {
return metamodel;
}
}
@@ -127,7 +129,7 @@ public class RegisteredMetamodel extends RegisteredElementExtensionPoint {
* the configuration element from which to retrieve the registered profile
* @return the registered profile
*/
- private static RegisteredMetamodel parseMetamodelExtension(IConfigurationElement configElt, int ordinal) {
+ private static IRegisteredMetamodel parseMetamodelExtension(IConfigurationElement configElt, int ordinal) {
if(!TAG_METAMODEL.equals(configElt.getName())) {
return null;
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java
index b659b3f..5927d90 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA List - initial API and implementation
- * Christian W. Damus (CEA) - bug 422257
- *
+ * CEA List - initial API and implementation
+ * Christian W. Damus (CEA) - bug 422257
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.metamodel;
@@ -21,6 +21,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
@@ -47,7 +48,7 @@ public class RegisteredMetamodelSelectionDialog extends ElementListSelectionDial
/**
*
*/
- private RegisteredMetamodel[] regMetamodels;
+ private IRegisteredMetamodel[] regMetamodels;
/**
*
@@ -68,7 +69,7 @@ public class RegisteredMetamodelSelectionDialog extends ElementListSelectionDial
importedMetamodelsNames = getImportedMetamodelsNames(importedMetamodels);
// Retrieve registered Libraries
- regMetamodels = RegisteredMetamodel.getRegisteredMetamodels();
+ regMetamodels = Registry.getRegisteredMetamodels().toArray(new IRegisteredMetamodel[0]);
// remove already applied Libraries from the list
regMetamodels = removeAlreadyImportedFromSelection();
@@ -110,20 +111,20 @@ public class RegisteredMetamodelSelectionDialog extends ElementListSelectionDial
*
* @return
*/
- private RegisteredMetamodel[] removeAlreadyImportedFromSelection() {
+ private IRegisteredMetamodel[] removeAlreadyImportedFromSelection() {
- List<RegisteredMetamodel> Metamodels = new ArrayList<RegisteredMetamodel>();
+ List<IRegisteredMetamodel> Metamodels = new ArrayList<IRegisteredMetamodel>();
for(int i = 0; i < regMetamodels.length; i++) {
- String currentName = regMetamodels[i].name;
+ String currentName = regMetamodels[i].getName();
if(!importedMetamodelsNames.contains(currentName)) {
Metamodels.add(regMetamodels[i]);
}
}
- RegisteredMetamodel[] cleanedList;
- cleanedList = Metamodels.toArray(new RegisteredMetamodel[Metamodels.size()]);
+ IRegisteredMetamodel[] cleanedList;
+ cleanedList = Metamodels.toArray(new IRegisteredMetamodel[Metamodels.size()]);
return cleanedList;
}
@@ -141,8 +142,8 @@ public class RegisteredMetamodelSelectionDialog extends ElementListSelectionDial
}
for(int i = 0; i < selection.length; i++) {
- RegisteredMetamodel currentLibrary = (RegisteredMetamodel)(selection[i]);
- URI modelUri = currentLibrary.uri;
+ IRegisteredMetamodel currentLibrary = (IRegisteredMetamodel)(selection[i]);
+ URI modelUri = currentLibrary.getUri();
addModelImportFromURI(currentModel, modelUri);
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/IRegisteredProfile.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/IRegisteredProfile.java
new file mode 100644
index 0000000..f761231
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/IRegisteredProfile.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * Dr. David H. Akehurst - enable programmatic registration
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.extensionpoints.profile;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.uml.extensionpoints.IRegisteredItem;
+
+public interface IRegisteredProfile extends IRegisteredItem {
+ String getQualifiedNames();
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/RegisteredProfile.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/RegisteredProfile.java
index 8399888..207388b 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/RegisteredProfile.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/profile/RegisteredProfile.java
@@ -7,6 +7,7 @@
*
* Contributors:
* CEA List - initial API and implementation
+ * Dr. David H. Akehurst - enable programmatic registration
*******************************************************************************/
package org.eclipse.papyrus.uml.extensionpoints.profile;
@@ -16,21 +17,21 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionIds;
import org.eclipse.papyrus.uml.extensionpoints.standard.RegisteredElementExtensionPoint;
+import org.eclipse.swt.graphics.Image;
/**
* Class that manages registered profile extension point
*/
-public class RegisteredProfile extends RegisteredElementExtensionPoint {
+public class RegisteredProfile extends RegisteredElementExtensionPoint implements IRegisteredProfile {
/** name of the extension point (main element name) in the DTD */
private static final String TAG_PROFILE = "profile";
- /** List of registered profiles in the platform */
- private static RegisteredProfile[] registeredProfiles;
-
/** name of the <code>qualified name</code>attribute in the DTD */
private static final String ATT_QUALIFIED_NAMES = "qualifiednames";
@@ -45,6 +46,19 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
qualifiednames = getAttribute(configElt, ATT_QUALIFIED_NAMES, "", false);
}
+ public URI getUri() {
+ return super.uri;
+ }
+
+ public String getPath() {
+ return super.path;
+ }
+
+ public String getQualifiedNames() {
+ //?should this field really be defined on the superclass? is it not specific to profiles?
+ return super.qualifiednames;
+ }
+
// /**
// * Creates a new RegisteredProfile.
// * @param name the name displayed to users
@@ -87,7 +101,7 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
* the name of the profile to find
* @return the RegistredProfile with given name or <code>null</code> if no profile was found.
*/
- public static RegisteredProfile getRegisteredProfile(String name) {
+ public static IRegisteredProfile getRegisteredProfile(String name) {
return getRegisteredProfile(name, null);
}
@@ -101,18 +115,18 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
* the path of the profile file
* @return the RegistredProfile with given name or <code>null</code> if no profile was found.
*/
- public static RegisteredProfile getRegisteredProfile(String name, String path) {
+ public static IRegisteredProfile getRegisteredProfile(String name, String path) {
Assert.isNotNull(name);
- RegisteredProfile[] profiles = getRegisteredProfiles();
+ IRegisteredProfile[] profiles = Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]);
for(int i = 0; i < profiles.length; i++) {
- RegisteredProfile profile = profiles[i];
+ IRegisteredProfile profile = profiles[i];
// name corresponds. is path equal?
- if(name.equals(profile.name)) {
+ if(name.equals(profile.getName())) {
// no path indicated => first name that corresponds => profile returned
if(path == null) {
return profile;
- } else if(path.equals(profile.path)) {
+ } else if(path.equals(profile.getPath())) {
return profile;
}
}
@@ -125,15 +139,10 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
*
* @return the list of registred profiles in the platform
*/
- public static RegisteredProfile[] getRegisteredProfiles() {
-
- // if the list is already known, returns it (cache)
- if(registeredProfiles != null) {
- return registeredProfiles;
- }
+ public static List<IRegisteredProfile> getRegisteredProfiles() {
// the list has not been already built. Creates a new one and fill it.
- List<RegisteredProfile> profiles = new ArrayList<RegisteredProfile>();
+ List<IRegisteredProfile> profiles = new ArrayList<IRegisteredProfile>();
// // At least two element : Standard uml profile and Ecore uml profile
// RegisteredProfile UmlStdProfile = new RegisteredProfile("Standard",
@@ -151,15 +160,14 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
// Read configuration elements for the current extension
for(int j = 0; j < configElements.length; j++) {
- RegisteredProfile proxy = parseProfileExtension(configElements[j], profiles.size());
+ IRegisteredProfile proxy = parseProfileExtension(configElements[j], profiles.size());
if(proxy != null) {
profiles.add(proxy);
}
} // end of configElements loop
- registeredProfiles = profiles.toArray(new RegisteredProfile[profiles.size()]);
- return registeredProfiles;
+ return profiles;
}
/**
@@ -171,7 +179,7 @@ public class RegisteredProfile extends RegisteredElementExtensionPoint {
* the configuration element from which to retrieve the registered profile
* @return the registered profile
*/
- private static RegisteredProfile parseProfileExtension(IConfigurationElement configElt, int ordinal) {
+ private static IRegisteredProfile parseProfileExtension(IConfigurationElement configElt, int ordinal) {
if(!TAG_PROFILE.equals(configElt.getName())) {
return null;
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
index 8f734ea..829200f 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
@@ -11,7 +11,7 @@
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
* Christian W. Damus (CEA) - bug 323802
* Christian W. Damus (CEA) - bug 422257
- *
+ * Dr. David H. Akehurst - enable programmatic registration
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
@@ -27,8 +27,9 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
import org.eclipse.papyrus.uml.extensionpoints.library.FilteredRegisteredLibrariesSelectionDialog;
-import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.papyrus.uml.importt.ui.PackageImportDialog;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDialog.ImportSpec;
@@ -51,14 +52,14 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
* @param librariesToImport
* the array of Libraries to import
*/
- protected void importLibraries(RegisteredLibrary[] librariesToImport) {
+ protected void importLibraries(IRegisteredLibrary[] librariesToImport) {
// create a temporary resource set. Be sure to unload it so that we don't leak models in the CacheAdapter!
ResourceSet resourceSet = Util.createTemporaryResourceSet();
try {
for(int i = 0; i < librariesToImport.length; i++) {
- RegisteredLibrary currentLibrary = (librariesToImport[i]);
- URI modelUri = currentLibrary.uri;
+ IRegisteredLibrary currentLibrary = (librariesToImport[i]);
+ URI modelUri = currentLibrary.getUri();
Resource modelResource = resourceSet.getResource(modelUri, true);
PackageImportDialog dialog = new PackageImportDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ((Package)modelResource.getContents().get(0)));
@@ -95,17 +96,17 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
*
* @return the array of available libraries for the currently selected package
*/
- protected RegisteredLibrary[] getAvailableLibraries() {
- List<RegisteredLibrary> libraries = new ArrayList<RegisteredLibrary>();
- RegisteredLibrary[] allLibraries = RegisteredLibrary.getRegisteredLibraries();
+ protected IRegisteredLibrary[] getAvailableLibraries() {
+ List<IRegisteredLibrary> libraries = new ArrayList<IRegisteredLibrary>();
+ IRegisteredLibrary[] allLibraries = Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]);
for(int i = 0; i < allLibraries.length; i++) {
- RegisteredLibrary registeredLibrary = allLibraries[i];
+ IRegisteredLibrary registeredLibrary = allLibraries[i];
List<String> importedPackageNames = PackageUtil.getImportedPackagesNames((Package)getSelectedElement());
if(!(importedPackageNames.contains(registeredLibrary.getName()))) {
libraries.add(registeredLibrary);
}
}
- return libraries.toArray(new RegisteredLibrary[libraries.size()]);
+ return libraries.toArray(new IRegisteredLibrary[libraries.size()]);
}
/**
@@ -116,11 +117,11 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
*
* @return the array of already selected libraries for the currently selected package
*/
- protected Collection<RegisteredLibrary> getImportedLibraries() {
- List<RegisteredLibrary> libraries = new ArrayList<RegisteredLibrary>();
- RegisteredLibrary[] allLibraries = RegisteredLibrary.getRegisteredLibraries();
+ protected Collection<IRegisteredLibrary> getImportedLibraries() {
+ List<IRegisteredLibrary> libraries = new ArrayList<IRegisteredLibrary>();
+ IRegisteredLibrary[] allLibraries = Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]);
for(int i = 0; i < allLibraries.length; i++) {
- RegisteredLibrary registeredLibrary = allLibraries[i];
+ IRegisteredLibrary registeredLibrary = allLibraries[i];
List<String> importedPackageNames = PackageUtil.getImportedPackagesNames((Package)getSelectedElement());
// problem: name of library might be different from name of top-level package
if(importedPackageNames.contains(registeredLibrary.getName())) {
@@ -155,7 +156,7 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
// get the set of registered libraries available
- RegisteredLibrary[] allLibraries = RegisteredLibrary.getRegisteredLibraries();
+ IRegisteredLibrary[] allLibraries = Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]);
// Open Registered ModelLibrary selection dialog
FilteredRegisteredLibrariesSelectionDialog dialog = new FilteredRegisteredLibrariesSelectionDialog(shell, true, allLibraries, getImportedLibraries());
@@ -163,7 +164,7 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
if(Dialog.OK == dialog.getReturnCode()) {
// get the result, which is the set of libraries to import
List<Object> librariesToImport = Arrays.asList(dialog.getResult());
- importLibraries(librariesToImport.toArray(new RegisteredLibrary[librariesToImport.size()]));
+ importLibraries(librariesToImport.toArray(new IRegisteredLibrary[librariesToImport.size()]));
}
}
}, "Import Libraries", "Import Libraries from Repository"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
index a3ee992..f007be7 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
@@ -10,7 +10,7 @@
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
* Christian W. Damus (CEA) - bug 323802
- *
+ * Dr. David H. Akehurst - enable programmatic registration
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
@@ -27,8 +27,9 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
import org.eclipse.papyrus.uml.extensionpoints.profile.FilteredRegisteredProfilesAsLibrarySelectionDialog;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDialog.ImportSpec;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
@@ -72,7 +73,7 @@ public class ImportRegisteredProfileHandler extends AbstractImportHandler {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
// get the set of registered libraries available
- RegisteredProfile[] allProfiles = RegisteredProfile.getRegisteredProfiles();
+ IRegisteredProfile[] allProfiles = Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]);
// Open Registered ModelLibrary selection dialog
FilteredRegisteredProfilesAsLibrarySelectionDialog dialog = new FilteredRegisteredProfilesAsLibrarySelectionDialog(shell, true, allProfiles, getImportedProfiles());
@@ -80,7 +81,7 @@ public class ImportRegisteredProfileHandler extends AbstractImportHandler {
if(Dialog.OK == dialog.getReturnCode()) {
// get the result, which is the set of libraries to import
List<Object> profilesToImport = Arrays.asList(dialog.getResult());
- importProfiles(profilesToImport.toArray(new RegisteredProfile[profilesToImport.size()]));
+ importProfiles(profilesToImport.toArray(new IRegisteredProfile[profilesToImport.size()]));
}
}
}, "Import Profile", "Import Profile from Registred Profiles"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -93,14 +94,14 @@ public class ImportRegisteredProfileHandler extends AbstractImportHandler {
* @param profilesToImport
* the profiles to import
*/
- protected void importProfiles(RegisteredProfile[] profilesToImport) {
+ protected void importProfiles(IRegisteredProfile[] profilesToImport) {
// create a temporary resource set. Be sure to unload it so that we don't leak models in the CacheAdapter!
ResourceSet resourceSet = Util.createTemporaryResourceSet();
try {
for(int i = 0; i < profilesToImport.length; i++) {
- RegisteredProfile currentLibrary = (profilesToImport[i]);
- URI modelUri = currentLibrary.uri;
+ IRegisteredProfile currentLibrary = (profilesToImport[i]);
+ URI modelUri = currentLibrary.getUri();
Resource modelResource = resourceSet.getResource(modelUri, true);
// PackageImportTreeSelectionDialog dialog = new PackageImportTreeSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ((Package)modelResource.getContents().get(0)));
@@ -134,11 +135,11 @@ public class ImportRegisteredProfileHandler extends AbstractImportHandler {
* @return
* the list of the profiles which are already imported
*/
- protected Collection<RegisteredProfile> getImportedProfiles() {
- List<RegisteredProfile> profiles = new ArrayList<RegisteredProfile>();
- RegisteredProfile[] allLibraries = RegisteredProfile.getRegisteredProfiles();
+ protected Collection<IRegisteredProfile> getImportedProfiles() {
+ List<IRegisteredProfile> profiles = new ArrayList<IRegisteredProfile>();
+ IRegisteredProfile[] allLibraries = Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]);
for(int i = 0; i < allLibraries.length; i++) {
- RegisteredProfile registeredProfile = allLibraries[i];
+ IRegisteredProfile registeredProfile = allLibraries[i];
List<String> importedPackageNames = PackageUtil.getImportedPackagesNames((Package)getSelectedElement());
// problem: name of library might be different from name of top-level package
if(importedPackageNames.contains(registeredProfile.getName())) {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesBlock.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesBlock.java
index eea5855..c78b736 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesBlock.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesBlock.java
@@ -24,7 +24,8 @@ import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.modelrepair.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -169,13 +170,13 @@ public class BrowseProfilesBlock {
TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
dialog.setTitle("Browse Registered Profiles");
dialog.setDescription("Select one of the registered profiles below.");
- dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(RegisteredProfile.getRegisteredProfiles())));
+ dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]))));
dialog.setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
- if(element instanceof RegisteredProfile) {
- RegisteredProfile profile = (RegisteredProfile)element;
+ if(element instanceof IRegisteredProfile) {
+ IRegisteredProfile profile = (IRegisteredProfile)element;
return profile.getImage();
}
return super.getImage(element);
@@ -183,9 +184,9 @@ public class BrowseProfilesBlock {
@Override
public String getText(Object element) {
- if(element instanceof RegisteredProfile) {
- RegisteredProfile profile = (RegisteredProfile)element;
- return profile.name;
+ if(element instanceof IRegisteredProfile) {
+ IRegisteredProfile profile = (IRegisteredProfile)element;
+ return profile.getName();
}
return super.getText(element);
@@ -199,8 +200,8 @@ public class BrowseProfilesBlock {
}
Object selectedElement = result[0];
- if(selectedElement instanceof RegisteredProfile) {
- bus.post((RegisteredProfile)selectedElement);
+ if(selectedElement instanceof IRegisteredProfile) {
+ bus.post((IRegisteredProfile)selectedElement);
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesDialog.java
index aae7186..1348f1c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/BrowseProfilesDialog.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.SameShellProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -102,8 +102,8 @@ public class BrowseProfilesDialog extends TrayDialog {
}
@Subscribe
- public void registeredProfileSelected(RegisteredProfile profile) {
- setSelectedProfileURI(profile.uri);
+ public void registeredProfileSelected(IRegisteredProfile profile) {
+ setSelectedProfileURI(profile.getUri());
}
});
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchPackageImportDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchPackageImportDialog.java
index 525d063..06a89ef 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchPackageImportDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchPackageImportDialog.java
@@ -68,7 +68,8 @@ import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
-import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
import org.eclipse.papyrus.uml.modelrepair.Activator;
import org.eclipse.papyrus.uml.tools.util.LibraryHelper;
import org.eclipse.swt.SWT;
@@ -513,13 +514,13 @@ public class SwitchPackageImportDialog extends SelectionDialog {
TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
dialog.setTitle("Browse Registered Libraries");
dialog.setDescription("Select one of the registered libraries below.");
- dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(RegisteredLibrary.getRegisteredLibraries())));
+ dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]))));
dialog.setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
- if(element instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)element;
+ if(element instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)element;
return library.getImage();
}
return super.getImage(element);
@@ -527,9 +528,9 @@ public class SwitchPackageImportDialog extends SelectionDialog {
@Override
public String getText(Object element) {
- if(element instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)element;
- return library.name;
+ if(element instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)element;
+ return library.getName();
}
return super.getText(element);
@@ -543,10 +544,10 @@ public class SwitchPackageImportDialog extends SelectionDialog {
}
Object selectedElement = result[0];
- if(selectedElement instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)selectedElement;
+ if(selectedElement instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)selectedElement;
- replaceSelectionWith(library.uri);
+ replaceSelectionWith(library.getUri());
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java
index 4d714ed..e09a84d 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchProfileDialog.java
@@ -62,7 +62,7 @@ import org.eclipse.papyrus.infra.emf.resource.Replacement;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialog;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.modelrepair.Activator;
import org.eclipse.papyrus.uml.tools.util.ProfileHelper;
import org.eclipse.swt.SWT;
@@ -155,8 +155,8 @@ public class SwitchProfileDialog extends SelectionDialog {
}
@Subscribe
- public void registeredProfileSelected(RegisteredProfile profile) {
- replaceSelectionWith(profile.uri);
+ public void registeredProfileSelected(IRegisteredProfile profile) {
+ replaceSelectionWith(profile.getUri());
}
});
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchResourceDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchResourceDialog.java
index 01211e2..4ed7f48 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchResourceDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/SwitchResourceDialog.java
@@ -68,7 +68,8 @@ import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
-import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
import org.eclipse.papyrus.uml.modelrepair.Activator;
import org.eclipse.papyrus.uml.tools.util.LibraryHelper;
import org.eclipse.swt.SWT;
@@ -513,13 +514,13 @@ public class SwitchResourceDialog extends SelectionDialog {
TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
dialog.setTitle("Browse Registered Libraries");
dialog.setDescription("Select one of the registered libraries below.");
- dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(RegisteredLibrary.getRegisteredLibraries())));
+ dialog.setContentProvider(new EncapsulatedContentProvider(new StaticContentProvider(Registry.getRegisteredLibraries().toArray(new IRegisteredLibrary[0]))));
dialog.setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
- if(element instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)element;
+ if(element instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)element;
return library.getImage();
}
return super.getImage(element);
@@ -527,9 +528,9 @@ public class SwitchResourceDialog extends SelectionDialog {
@Override
public String getText(Object element) {
- if(element instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)element;
- return library.name;
+ if(element instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)element;
+ return library.getName();
}
return super.getText(element);
@@ -543,10 +544,10 @@ public class SwitchResourceDialog extends SelectionDialog {
}
Object selectedElement = result[0];
- if(selectedElement instanceof RegisteredLibrary) {
- RegisteredLibrary library = (RegisteredLibrary)selectedElement;
+ if(selectedElement instanceof IRegisteredLibrary) {
+ IRegisteredLibrary library = (IRegisteredLibrary)selectedElement;
- replaceSelectionWith(library.uri);
+ replaceSelectionWith(library.getUri());
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/wizard/UMLModelWithProfileWizard.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/wizard/UMLModelWithProfileWizard.java
index dcde8f3..96f2510 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/wizard/UMLModelWithProfileWizard.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/wizard/UMLModelWithProfileWizard.java
@@ -31,7 +31,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -55,7 +56,7 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
protected IWizardPage profilePage;
/** list of registered profiles to be applied */
- protected Collection<RegisteredProfile> rProfilesToApply = new HashSet<RegisteredProfile>();
+ protected Collection<IRegisteredProfile> rProfilesToApply = new HashSet<IRegisteredProfile>();
/**
* Creates a new UMLModelWithProfileWizard.
@@ -111,10 +112,10 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
* the list of profiles to apply
* @return the number of applied profiles
*/
- protected int applySelectedProfiles(EObject root, Collection<RegisteredProfile> rProfilesToApply) {
+ protected int applySelectedProfiles(EObject root, Collection<IRegisteredProfile> rProfilesToApply) {
// number of applied profiles
int num = 0;
- Iterator<RegisteredProfile> it = rProfilesToApply.iterator();
+ Iterator<IRegisteredProfile> it = rProfilesToApply.iterator();
while(it.hasNext()) {
num += applySelectedProfile(root, it.next());
}
@@ -130,22 +131,22 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
* the profile to apply
* @return the number of applied profiles
*/
- protected int applySelectedProfile(EObject root, RegisteredProfile rProfile) {
+ protected int applySelectedProfile(EObject root, IRegisteredProfile rProfile) {
// number of applied profiles
int num = 0;
if(root instanceof org.eclipse.uml2.uml.Package) {
- URI modelUri = rProfile.uri;
+ URI modelUri = rProfile.getUri();
Resource modelResource = EMFHelper.getResourceSet(root).getResource(modelUri, true);
if(modelResource.getContents().get(0) instanceof Profile) {
// two case : qualified names is equal to "" => whole profile must be applied
// not equal to "" => specific profiles must be applied
- if("".equals(rProfile.qualifiednames)) {
+ if("".equals(rProfile.getQualifiedNames())) {
PackageUtil.applyProfile((org.eclipse.uml2.uml.Package)root, (Profile)modelResource.getContents().get(0), true);
num++;
} else {
// apply subprofiles corresponding to the qualified names selected
// try to parse the qualified names
- String[] profiles = rProfile.qualifiednames.split(",");
+ String[] profiles = rProfile.getQualifiedNames().split(",");
List<String> subprofilesList = new ArrayList<String>();
// make a collection with String with no space
for(int j = 0; j < profiles.length; j++) {
@@ -271,9 +272,9 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
TableItem item = (TableItem)e.item;
// 2. get data associated to this item = Registered profile
- RegisteredProfile rProfile = null;
+ IRegisteredProfile rProfile = null;
if(item != null) {
- rProfile = (RegisteredProfile)item.getData();
+ rProfile = (IRegisteredProfile)item.getData();
}
// 3. if not null, check if the profiel must be applied or not
@@ -301,12 +302,12 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
*/
private void fillTable() {
// for each profile, proposes a line with a selection box.
- RegisteredProfile[] rProfiles = RegisteredProfile.getRegisteredProfiles();
+ IRegisteredProfile[] rProfiles = Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]);
for(int i = 0; i < rProfiles.length; i++) {
TableItem item = new TableItem(table, SWT.CHECK);
- RegisteredProfile rProfile = rProfiles[i];
+ IRegisteredProfile rProfile = rProfiles[i];
item.setData(rProfile);
- item.setText(rProfile.name);
+ item.setText(rProfile.getName());
item.setChecked(rProfilesToApply.contains(rProfile));
}
}
@@ -317,7 +318,7 @@ public class UMLModelWithProfileWizard extends UMLModelWizard {
}
protected void addProfile(String name, String path, String qualifiedNames) {
- RegisteredProfile profile = RegisteredProfile.getRegisteredProfile(name, path);
+ IRegisteredProfile profile = Registry.getRegisteredProfile(name, path);
if(profile != null) {
// get the profiles to be applied
// retrieve sub profiles in the profile => should explore the profile and add elements that match the qualified names
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
index 3690d33..64061eb 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
@@ -26,7 +26,8 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.extensionpoints.standard.FilteredRegisteredElementsSelectionDialog;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDialog.ImportSpec;
@@ -52,7 +53,7 @@ public class RegisteredProfileSelectionDialog extends FilteredRegisteredElements
* @param parent
*/
public RegisteredProfileSelectionDialog(Composite parent, Package umlPackage) {
- super(parent.getShell(), true, RegisteredProfile.getRegisteredProfiles(), new ArrayList<Object>(), "Apply profiles from Papyrus repository :", "");
+ super(parent.getShell(), true, Registry.getRegisteredProfiles().toArray(new IRegisteredProfile[0]), new ArrayList<Object>(), "Apply profiles from Papyrus repository :", "");
currentPackage = umlPackage;
}
@@ -115,12 +116,12 @@ public class RegisteredProfileSelectionDialog extends FilteredRegisteredElements
List<String> subprofilesList = new ArrayList<String>();
for(int i = 0; i < selection.length; i++) {
- RegisteredProfile currentProfile = (RegisteredProfile)(selection[i]);
- URI modelUri = currentProfile.uri;
+ IRegisteredProfile currentProfile = (IRegisteredProfile)(selection[i]);
+ URI modelUri = currentProfile.getUri();
Resource modelResource = resourceSet.getResource(modelUri, true);
// retrieve registered sub-profiles to be selected
- String qualifiedNames = currentProfile.qualifiednames;
+ String qualifiedNames = currentProfile.getQualifiedNames();
// try to parse the qualified names
String[] profiles = qualifiedNames.split(",");
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
index d6b07dc..6a04a40 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.gef;bundle-version="3.9.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.service.validation;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.service.validation;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.0.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-Version: 1.0.0.qualifier
Bundle-Name: GMF Xtext Integration (Incubation)
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
index ffa78d9..8a22883 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
@@ -17,7 +17,8 @@ import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.Registry;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
@@ -105,9 +106,8 @@ public class InvalidStringUtil {
*/
public static boolean isActionLanguageProfileApplied(Element element) {
if (actionLanguageProfile == null) {
- RegisteredProfile registeredActionLanguageProfile = RegisteredProfile
- .getRegisteredProfile(ACTION_LANGUAGE_PROFILE_NAME);
- URI modelUri = registeredActionLanguageProfile.uri;
+ IRegisteredProfile registeredActionLanguageProfile = Registry.getRegisteredProfile(ACTION_LANGUAGE_PROFILE_NAME, null);
+ URI modelUri = registeredActionLanguageProfile.getUri();
Package root = PackageUtil.getRootPackage(element);
Resource modelResource = root.eResource().getResourceSet()