Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2011-03-22 10:38:30 +0000
committerptessier2011-03-22 10:38:30 +0000
commit75ca25bf4aedd1497257ed7841160b7f8bdfe4fe (patch)
tree1869ab1c92e1f289eb18b082a9506228a537136f /incoming
parent4b2f66bb7de4e74eff653f64b7f4e13690b090b7 (diff)
downloadorg.eclipse.papyrus-75ca25bf4aedd1497257ed7841160b7f8bdfe4fe.tar.gz
org.eclipse.papyrus-75ca25bf4aedd1497257ed7841160b7f8bdfe4fe.tar.xz
org.eclipse.papyrus-75ca25bf4aedd1497257ed7841160b7f8bdfe4fe.zip
340430: [Widget] creation of dialog box based on the model explorer
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340430
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.classpath7
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.project28
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF14
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/build.properties4
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/plugin.properties2
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/Activator.java68
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java38
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java32
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLElementMEBContentProvider.java87
-rw-r--r--incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLTreeSelectorDialog.java165
11 files changed, 453 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.classpath b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.project b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.project
new file mode 100644
index 00000000000..15c8fb9cf9e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.modelexplorer.widgets</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.settings/org.eclipse.jdt.core.prefs b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..860c4429723
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Mar 21 10:59:51 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ae60fdd7e38
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.uml.modelexplorer.widgets
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.modelexplorer.widgets.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.modelexplorer.widgets;bundle-version="0.8.0";visibility:=reexport,
+ org.eclipse.uml2.uml;bundle-version="3.2.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Export-Package: org.eclipse.papyrus.uml.modelexplorer.widgets
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/build.properties b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/plugin.properties b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/plugin.properties
new file mode 100644
index 00000000000..3f6cedf3e6d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=org.eclipse.papyrus.uml.modelexplorer.widgets (Incubation)
+providerName=Eclipse Modeling Project \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/Activator.java b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/Activator.java
new file mode 100644
index 00000000000..acfa7ecc3eb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/Activator.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.widgets;
+
+import org.eclipse.papyrus.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.modelexplorer.widgets"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+ /** Logging helper */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(plugin);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ log = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java
new file mode 100644
index 00000000000..6af8b03c8f5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.widgets;
+
+import java.util.Comparator;
+
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * comparator UML NamedElement by taking in account their names
+ *
+ */
+public class NamedElementComparator implements Comparator<Object>{
+
+ public int compare(Object namedElement0, Object namedElement1) {
+ if(namedElement0 instanceof NamedElement && namedElement1 instanceof NamedElement){
+ String emp1Name = ((NamedElement)namedElement0).getName();
+ String emp2Name = ((NamedElement)namedElement1).getName();
+ //uses compareTo method of String class to compare names of the Eclasses
+ return emp1Name.compareTo(emp2Name);
+ }
+ else{return 0;}
+ }
+
+
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java
new file mode 100644
index 00000000000..fe76d32edc2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.widgets;
+
+import org.eclipse.papyrus.modelexplorer.widgets.MetaclassLabelProvider;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * display the name of Eclass or stereotypes
+ *
+ */
+public class StereotypeMetaclassLabelProvider extends MetaclassLabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof Stereotype){
+ return ((Stereotype)element).getName();
+ }
+ return super.getText(element);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLElementMEBContentProvider.java b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLElementMEBContentProvider.java
new file mode 100644
index 00000000000..f928b22bfab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLElementMEBContentProvider.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.widgets;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.modelexplorer.widgets.EclassModelExplorerBasedContentProvider;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+
+/**
+ *this content provider is specific for UML, it specifies getvalidValue by taking in account stereotypes
+ *
+ */
+public class UMLElementMEBContentProvider extends EclassModelExplorerBasedContentProvider {
+
+ public UMLElementMEBContentProvider(EObject semanticRoot) {
+ super(semanticRoot);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.modelexplorer.widgets.EclassModelExplorerBasedContentProvider#isValidValue(java.lang.Object)
+ *
+ */
+ public boolean isValidValue(Object element) {
+
+ if(metaClassWanted!=null){
+ EObject semanticObject=null;
+ if(element instanceof IAdaptable){
+ semanticObject=(EObject)brige.getSemanticElement(element);
+ }
+ if(element instanceof EObject){
+ semanticObject=(EObject)element;
+ }
+ //return ok for Ereference
+ if(element instanceof EReference||semanticObject instanceof EReference){
+ return true;
+ }
+
+ //this is a Eclass
+ if(semanticObject!=null){
+ if(metaClassWanted instanceof EClass){
+ if(((EClass)metaClassWanted).isSuperTypeOf(semanticObject.eClass())){
+ if(metaClassNotWantedList.size()>0){
+ Iterator<Object> iternotwanted= metaClassNotWantedList.iterator();
+ while( iternotwanted.hasNext()){
+ Object notWanted=iternotwanted.next();
+ if(notWanted instanceof EClass)
+ if(((EClass)notWanted).isSuperTypeOf(semanticObject.eClass())){
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ }
+ //this is a stereotype
+ if(metaClassWanted instanceof Stereotype){
+ if(semanticObject instanceof Element){
+ Element selectedUMLelement= (Element) semanticObject;
+ return selectedUMLelement.getAppliedStereotypes().contains((Stereotype)metaClassWanted);
+ }
+ }
+ }
+ return false;
+ }
+
+ return super.isValidValue(element);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLTreeSelectorDialog.java b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLTreeSelectorDialog.java
new file mode 100644
index 00000000000..32968e14ef1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/UMLTreeSelectorDialog.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.widgets;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.modelexplorer.widgets.AdvancedMETreeDialog;
+import org.eclipse.papyrus.modelexplorer.widgets.EclassComparator;
+import org.eclipse.papyrus.modelexplorer.widgets.MetaclassLabelProvider;
+import org.eclipse.papyrus.resource.ModelSet;
+import org.eclipse.papyrus.resource.ModelUtils;
+import org.eclipse.papyrus.resource.uml.UmlModel;
+import org.eclipse.papyrus.resource.uml.UmlUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * this dialog box display a Tree dialog by using the model explorer and propose to filter by taking in account metaclasses of UML, or
+ * stereotypes of applied profiles
+ *
+ */
+public class UMLTreeSelectorDialog extends AdvancedMETreeDialog {
+
+ //display of UML domain model
+ protected static final String UML = "UML";
+ //the list of applied profiles
+ protected HashSet<Profile> appliedProfiles=null;
+ //the combo that show metamodels and profiles
+ protected Combo comboMetamodel;
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell a shell
+ * @param root the root element that can be display at the top of the tree, can be null
+ * @param wantedEClass the object use to filter in the tree all object that are instance of wantedEclasse
+ * it can be stereotype of Eclass (can be null)
+ *
+ * @param metaClassNotWanted list of not wanted metaclass or stereotypes (can be null)
+ */
+ public UMLTreeSelectorDialog(Shell parentShell, EObject root, EClass wantedEClass, List<Object> metaClassNotWanted) {
+ super(parentShell, root, wantedEClass, metaClassNotWanted, UMLPackage.eINSTANCE);
+ contentProvider = new UMLElementMEBContentProvider(root);
+ contentProvider.setMetaClassWanted(wantedEClass);
+ contentProvider.setMetaClassNotWanted(metaClassNotWanted);
+ appliedProfiles=getAppliedProfile();
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ //create the label
+ Label metamodelLabel= new Label(getDialogArea(), SWT.WRAP);
+ metamodelLabel.setText("Metamodel:");
+ //create the combo
+ comboMetamodel = new Combo(getDialogArea(), SWT.NONE);
+ comboMetamodel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ //fill the combo for domain model
+ final ArrayList<Profile> profiles= new ArrayList<Profile>();
+ profiles.addAll(appliedProfiles);
+ Collections.sort(profiles, new NamedElementComparator());
+ for(Iterator<Profile> iterator = profiles.iterator(); iterator.hasNext();) {
+ Profile profile = (Profile)iterator.next();
+ comboMetamodel.add(profile.getQualifiedName());
+ }
+ comboMetamodel.add(UML);
+
+ comboMetamodel.addSelectionListener(new SelectionListener() {
+ //creation of inner class for the selection
+ public void widgetSelected(SelectionEvent e) {
+ // a metamodel has been choosen, we have to update the list of metaclass or stereotypes
+ int index=comboMetamodel.getSelectionIndex();
+ //in the case of UML this is management by using EClass
+ if( comboMetamodel.getItem(index).equals(UML)){
+ fillmetaclassList(UMLPackage.eINSTANCE);
+ setMetaclassLabelProvider( new MetaclassLabelProvider());
+ fillMetaclassCombo(metaclasses, new EclassComparator());
+ }
+ else{
+ //in the case of profile, this a uml specific management due to stereotypes
+ Profile selectedProfile= profiles.get(index);
+ ArrayList<Object> stereotypesList= new ArrayList<Object>(selectedProfile.getOwnedStereotypes());
+ setMetaclassLabelProvider(new StereotypeMetaclassLabelProvider());
+ fillMetaclassCombo(stereotypesList, new NamedElementComparator());
+
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ });
+ getShell().pack();
+
+
+ }
+
+ /**
+ *
+ * @return all profile without doublon. it is never null
+ *
+ * @throws ServiceException
+ */
+ protected HashSet<Profile> getAppliedProfile() {
+ HashSet<Profile> profileList= new HashSet<Profile>();
+ //a root has been given.
+ if( root!=null && root instanceof Package){
+ profileList.addAll(((Package)root).getAllAppliedProfiles());
+ return profileList;
+
+ }
+ //look for from contentprovider
+ ServicesRegistry servicesRegistry = (ServicesRegistry)EditorUtils.getMultiDiagramEditor().getServicesRegistry();
+ if( servicesRegistry!=null){
+ UmlModel umlModel=null;
+ try {
+ ModelSet modelSet = ModelUtils.getModelSetChecked(servicesRegistry);
+ umlModel = (UmlUtils.getUmlModel(modelSet));
+
+ } catch (Exception e) {
+ Activator.log.error("Cannot succeed to access to modelSet by using service Registry", e);
+ }
+ if( umlModel == null)
+ return profileList;
+ EList<EObject> contents = umlModel.getResource().getContents();
+ Iterator<EObject> iterator = contents.iterator();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if (eObject instanceof Package){
+ profileList.addAll(((Package)eObject).getAllAppliedProfiles());
+ }
+ }
+ }
+ return profileList;
+ }
+
+}

Back to the top