Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremie Tatibouet2014-06-20 09:00:24 +0000
committerJeremie Tatibouet2014-06-20 15:02:34 +0000
commit134c4548813ff5dac64c0601cef1d258d4744428 (patch)
tree71b75b2f72ce42292d0eac9b177db2fcf0ad4f15 /extraplugins
parent38c918747e9f296d6cb58ac27083b02a6cd5b983 (diff)
downloadorg.eclipse.papyrus-134c4548813ff5dac64c0601cef1d258d4744428.tar.gz
org.eclipse.papyrus-134c4548813ff5dac64c0601cef1d258d4744428.tar.xz
org.eclipse.papyrus-134c4548813ff5dac64c0601cef1d258d4744428.zip
405391: [Moka] Moka shall provide an implementation of the fUML
Execution Model https://bugs.eclipse.org/bugs/show_bug.cgi?id=405391 - Add missing headers for classes located into oepm.composites.utils Change-Id: Ie2ab9515409ab44bf489a350c943df7a5903aee3 Signed-off-by: Jeremie Tatibouet <jeremie.tatibouet@cea.fr>
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/Activator.java19
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/AbstractCompositeUtilsHandler.java37
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateConstructorUsingFieldsHandler.java24
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateFactoryHandler.java22
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/Utils.java156
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/ui/GenerateConstructorUsingFieldsDialog.java17
6 files changed, 175 insertions, 100 deletions
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/Activator.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/Activator.java
index 0eb25f0c5ff..9f19e3402db 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/Activator.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/Activator.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils;
import org.eclipse.ui.IStartup;
@@ -7,14 +18,14 @@ import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin implements IStartup{
+public class Activator extends AbstractUIPlugin implements IStartup {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.papyrus.moka.composites.utils"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
-
+
/**
* The constructor
*/
@@ -23,6 +34,7 @@ public class Activator extends AbstractUIPlugin implements IStartup{
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
@@ -32,6 +44,7 @@ public class Activator extends AbstractUIPlugin implements IStartup{
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -51,7 +64,7 @@ public class Activator extends AbstractUIPlugin implements IStartup{
@Override
public void earlyStartup() {
// TODO Auto-generated method stub
-
+
}
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/AbstractCompositeUtilsHandler.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/AbstractCompositeUtilsHandler.java
index 1754f06b4ee..6dcc26ee241 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/AbstractCompositeUtilsHandler.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/AbstractCompositeUtilsHandler.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.handlers;
import org.eclipse.core.commands.AbstractHandler;
@@ -18,17 +29,18 @@ import org.eclipse.uml2.uml.NamedElement;
public abstract class AbstractCompositeUtilsHandler extends AbstractHandler {
-
+
/**
* Moka Modeling Utils menu are enable only if selected object refer as a Class
- *
+ *
* (non-Javadoc)
+ *
* @see org.eclipse.core.commands.AbstractHandler#isEnabled()
*/
@Override
public boolean isEnabled() {
Element selectedElement = Utils.getSelection();
- if (selectedElement != null) {
+ if(selectedElement != null) {
return selectedElement instanceof Class && !(selectedElement instanceof Behavior);
}
return false;
@@ -37,7 +49,7 @@ public abstract class AbstractCompositeUtilsHandler extends AbstractHandler {
/**
* Return the class associated with the selection object or null whether
* no class could have been found
- *
+ *
* @param selected
* @return Class
*/
@@ -53,7 +65,8 @@ public abstract class AbstractCompositeUtilsHandler extends AbstractHandler {
return nElem instanceof Class ? (Class)nElem : null;
}
}
-
+
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Class context = null;
context = this.getClassFromSelection(HandlerUtil.getCurrentSelection(event));
@@ -62,17 +75,19 @@ public abstract class AbstractCompositeUtilsHandler extends AbstractHandler {
}
return null;
}
-
+
/**
* Launch the ConstructorBehaviorCreationCompiler
- * @param myClass which is the class who need to create the constructor
- *
+ *
+ * @param myClass
+ * which is the class who need to create the constructor
+ *
*/
public void start(Class myClass) {
- TransactionalEditingDomain domain = (TransactionalEditingDomain)EMFHelper.resolveEditingDomain(myClass) ;
+ TransactionalEditingDomain domain = (TransactionalEditingDomain)EMFHelper.resolveEditingDomain(myClass);
RecordingCommand updateCommand = this.getUpdateCommand(myClass, domain);
- domain.getCommandStack().execute(updateCommand) ;
+ domain.getCommandStack().execute(updateCommand);
}
-
+
public abstract RecordingCommand getUpdateCommand(Class myClass, TransactionalEditingDomain domain);
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateConstructorUsingFieldsHandler.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateConstructorUsingFieldsHandler.java
index 58553d626ae..af4883b4783 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateConstructorUsingFieldsHandler.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateConstructorUsingFieldsHandler.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.handlers;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -8,7 +19,7 @@ import org.eclipse.uml2.uml.Class;
public class GenerateConstructorUsingFieldsHandler extends AbstractCompositeUtilsHandler {
-
+
@Override
public RecordingCommand getUpdateCommand(Class context, TransactionalEditingDomain domain) {
return new GenerateConstructorUsingFieldsCommand(context, domain);
@@ -16,21 +27,22 @@ public class GenerateConstructorUsingFieldsHandler extends AbstractCompositeUtil
/**
* A command that generates a Constructor for a Class, from a dialog box.
+ *
* @see GenerateConstructorUsingFieldsDialog
*
*/
protected class GenerateConstructorUsingFieldsCommand extends RecordingCommand {
- protected Class context ;
-
+ protected Class context;
+
public GenerateConstructorUsingFieldsCommand(Class context, TransactionalEditingDomain domain) {
- super(domain) ;
- this.context = context ;
+ super(domain);
+ this.context = context;
}
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor
* , org.eclipse.core.runtime.IAdaptable)
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateFactoryHandler.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateFactoryHandler.java
index 7a215050bde..a9a16e219cb 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateFactoryHandler.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/GenerateFactoryHandler.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.handlers;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -6,7 +17,7 @@ import org.eclipse.uml2.uml.Class;
public class GenerateFactoryHandler extends AbstractCompositeUtilsHandler {
-
+
@Override
public RecordingCommand getUpdateCommand(Class context, TransactionalEditingDomain domain) {
return new GenerateFactoryCommand(context, domain);
@@ -14,20 +25,21 @@ public class GenerateFactoryHandler extends AbstractCompositeUtilsHandler {
/**
* Command that generate factory for a given class.
+ *
* @see Utils.getFactory
*/
protected class GenerateFactoryCommand extends RecordingCommand {
- protected Class context ;
+ protected Class context;
public GenerateFactoryCommand(Class context, TransactionalEditingDomain domain) {
- super(domain) ;
- this.context = context ;
+ super(domain);
+ this.context = context;
}
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor
* , org.eclipse.core.runtime.IAdaptable)
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/Utils.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/Utils.java
index 8db14700343..8feda53c21f 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/Utils.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/handlers/Utils.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.handlers;
import java.util.Iterator;
@@ -47,83 +58,82 @@ public class Utils {
/**
* Generates (or retrieve) a factory Activity for the given context Class.
* A factory Activity consists in a CreateObjectAction for the given context Class,
- * followed by a CallOperationAction for the default constructor of this class.
- *
- * @param context The class for which a Factory is requested
+ * followed by a CallOperationAction for the default constructor of this class.
+ *
+ * @param context
+ * The class for which a Factory is requested
* @return A factory Activity for the given context Class
*/
public static Activity getFactory(Class context) {
// First try to retrieve the factory
// Retrieval is based on name.
- Activity factory = null ;
- String contextName = context.getName() == null ? "" : context.getName() ;
- for (Iterator<Behavior> i = context.getOwnedBehaviors().iterator() ; i.hasNext() && factory == null ; ) {
- Behavior cddFactory = i.next() ;
- String cddName = cddFactory.getName() == null ? "" : cddFactory.getName() ;
- if (cddFactory instanceof Activity && cddName.equals(contextName + "_Factory")) {
- factory = (Activity)cddFactory ;
+ Activity factory = null;
+ String contextName = context.getName() == null ? "" : context.getName();
+ for(Iterator<Behavior> i = context.getOwnedBehaviors().iterator(); i.hasNext() && factory == null;) {
+ Behavior cddFactory = i.next();
+ String cddName = cddFactory.getName() == null ? "" : cddFactory.getName();
+ if(cddFactory instanceof Activity && cddName.equals(contextName + "_Factory")) {
+ factory = (Activity)cddFactory;
}
}
- Parameter returnParam = null ;
+ Parameter returnParam = null;
// if the factory does not exist, then creates it, otherwise "cleans" it
- if (factory == null) {
- factory = (Activity)context.createOwnedBehavior(context.getName() + "_Factory", UMLPackage.eINSTANCE.getActivity()) ;
- returnParam = factory.createOwnedParameter("result", context) ;
- returnParam.setDirection(ParameterDirectionKind.RETURN_LITERAL) ;
- }
- else {
+ if(factory == null) {
+ factory = (Activity)context.createOwnedBehavior(context.getName() + "_Factory", UMLPackage.eINSTANCE.getActivity());
+ returnParam = factory.createOwnedParameter("result", context);
+ returnParam.setDirection(ParameterDirectionKind.RETURN_LITERAL);
+ } else {
factory.getNodes().clear();
factory.getEdges().clear();
- for (Iterator<Parameter> i = factory.getOwnedParameters().iterator() ; i.hasNext() && returnParam == null ; ) {
- Parameter cddReturn = i.next() ;
- if (cddReturn.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
- returnParam = cddReturn ;
+ for(Iterator<Parameter> i = factory.getOwnedParameters().iterator(); i.hasNext() && returnParam == null;) {
+ Parameter cddReturn = i.next();
+ if(cddReturn.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
+ returnParam = cddReturn;
}
}
- if (returnParam == null) {
- returnParam = factory.createOwnedParameter("result", context) ;
- returnParam.setDirection(ParameterDirectionKind.RETURN_LITERAL) ;
+ if(returnParam == null) {
+ returnParam = factory.createOwnedParameter("result", context);
+ returnParam.setDirection(ParameterDirectionKind.RETURN_LITERAL);
}
}
- ActivityParameterNode returnParamNode = (ActivityParameterNode)factory.createOwnedNode("resultParameterNode", UMLPackage.eINSTANCE.getActivityParameterNode()) ;
- returnParamNode.setParameter(returnParam) ;
- returnParamNode.setType(context) ;
+ ActivityParameterNode returnParamNode = (ActivityParameterNode)factory.createOwnedNode("resultParameterNode", UMLPackage.eINSTANCE.getActivityParameterNode());
+ returnParamNode.setParameter(returnParam);
+ returnParamNode.setType(context);
// Retrieves the default constructor of context
- Operation defaultConstructor = getDefaultConstructor(context) ;
-
- CreateObjectAction createObject = (CreateObjectAction)factory.createOwnedNode("createObject", UMLPackage.eINSTANCE.getCreateObjectAction()) ;
- OutputPin createObjectResultPin = createObject.createResult("result", context) ;
- createObject.setClassifier(context) ;
-
- CallOperationAction callConstructor = (CallOperationAction)factory.createOwnedNode("callConstructor", UMLPackage.eINSTANCE.getCallOperationAction()) ;
- callConstructor.setOperation(defaultConstructor) ;
- InputPin callConstructorTargetPin = callConstructor.createTarget("target", context) ;
- OutputPin callConstructorResultPin = callConstructor.createResult("result", context) ;
-
- ObjectFlow createObjectAction_callConstructor = (ObjectFlow)factory.createEdge("createObjectAction to callConstructor", UMLPackage.eINSTANCE.getObjectFlow()) ;
- createObjectAction_callConstructor.setSource(createObjectResultPin) ;
- createObjectAction_callConstructor.setTarget(callConstructorTargetPin) ;
-
- ObjectFlow toReturnParamNode = (ObjectFlow)factory.createEdge("callConstructor to returnParamNode", UMLPackage.eINSTANCE.getObjectFlow()) ;
- toReturnParamNode.setTarget(returnParamNode) ;
- if (! context.isActive()) {
- toReturnParamNode.setSource(callConstructorResultPin) ;
- }
- else {
- StartObjectBehaviorAction startBehavior = (StartObjectBehaviorAction)factory.createOwnedNode("start classifier behavior", UMLPackage.eINSTANCE.getStartObjectBehaviorAction()) ;
- InputPin startBehaviorInputPin = startBehavior.createObject("object", context) ;
- OutputPin startBehaviorResultPin = startBehavior.createResult("result", context) ;
- toReturnParamNode.setSource(startBehaviorResultPin) ;
- ObjectFlow callConstructor_startBehavior = (ObjectFlow)factory.createEdge("callConstructor to startBehavior", UMLPackage.eINSTANCE.getObjectFlow()) ;
- callConstructor_startBehavior.setSource(callConstructorResultPin) ;
- callConstructor_startBehavior.setTarget(startBehaviorInputPin) ;
+ Operation defaultConstructor = getDefaultConstructor(context);
+
+ CreateObjectAction createObject = (CreateObjectAction)factory.createOwnedNode("createObject", UMLPackage.eINSTANCE.getCreateObjectAction());
+ OutputPin createObjectResultPin = createObject.createResult("result", context);
+ createObject.setClassifier(context);
+
+ CallOperationAction callConstructor = (CallOperationAction)factory.createOwnedNode("callConstructor", UMLPackage.eINSTANCE.getCallOperationAction());
+ callConstructor.setOperation(defaultConstructor);
+ InputPin callConstructorTargetPin = callConstructor.createTarget("target", context);
+ OutputPin callConstructorResultPin = callConstructor.createResult("result", context);
+
+ ObjectFlow createObjectAction_callConstructor = (ObjectFlow)factory.createEdge("createObjectAction to callConstructor", UMLPackage.eINSTANCE.getObjectFlow());
+ createObjectAction_callConstructor.setSource(createObjectResultPin);
+ createObjectAction_callConstructor.setTarget(callConstructorTargetPin);
+
+ ObjectFlow toReturnParamNode = (ObjectFlow)factory.createEdge("callConstructor to returnParamNode", UMLPackage.eINSTANCE.getObjectFlow());
+ toReturnParamNode.setTarget(returnParamNode);
+ if(!context.isActive()) {
+ toReturnParamNode.setSource(callConstructorResultPin);
+ } else {
+ StartObjectBehaviorAction startBehavior = (StartObjectBehaviorAction)factory.createOwnedNode("start classifier behavior", UMLPackage.eINSTANCE.getStartObjectBehaviorAction());
+ InputPin startBehaviorInputPin = startBehavior.createObject("object", context);
+ OutputPin startBehaviorResultPin = startBehavior.createResult("result", context);
+ toReturnParamNode.setSource(startBehaviorResultPin);
+ ObjectFlow callConstructor_startBehavior = (ObjectFlow)factory.createEdge("callConstructor to startBehavior", UMLPackage.eINSTANCE.getObjectFlow());
+ callConstructor_startBehavior.setSource(callConstructorResultPin);
+ callConstructor_startBehavior.setTarget(startBehaviorInputPin);
}
- return factory ;
+ return factory;
}
/**
@@ -134,8 +144,9 @@ public class Utils {
* A default constructor for a given context Class is a UML Operation with:
* - constructor.name == context.name
* - a single parameter p such that: p.direction == Return and p.type = context
- *
- * @param context A UML Class
+ *
+ * @param context
+ * A UML Class
* @return the default constructor Operation for the given context Class
*/
public static Operation getDefaultConstructor(Class context) {
@@ -149,11 +160,11 @@ public class Utils {
for(int j = 0; j < cddOperation.getAppliedStereotypes().size(); j++) {
Stereotype createStereotype = cddOperation.getAppliedStereotypes().get(j);
if(createStereotype.getName().equals("Create")) {
- if (cddOperation.getName().equals(context.getName())) {
- if (cddOperation.getOwnedParameters().size() == 1) {
+ if(cddOperation.getName().equals(context.getName())) {
+ if(cddOperation.getOwnedParameters().size() == 1) {
Parameter returnParameter = cddOperation.getOwnedParameters().get(0);
- if (returnParameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
- if (returnParameter.getType().getName().equals(context.getName())) {
+ if(returnParameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
+ if(returnParameter.getType().getName().equals(context.getName())) {
createdOp = cddOperation;
}
}
@@ -167,8 +178,8 @@ public class Utils {
// No operation with "Create" Stereotype found : => Creation of the operation.
if(createdOp == null) {
Stereotype appliedStereotype = null;
- if (!isStandardProfileApplied(context)) {
- PackageUtil.applyProfile((org.eclipse.uml2.uml.Package)context.getModel(), standardProfile, true);
+ if(!isStandardProfileApplied(context)) {
+ PackageUtil.applyProfile(context.getModel(), standardProfile, true);
}
createdOp = UMLFactory.eINSTANCE.createOperation();
@@ -198,8 +209,9 @@ public class Utils {
/**
* Returns true if the Standard profile is applied on the Model containing the given element
- *
- * @param element A UML model element
+ *
+ * @param element
+ * A UML model element
* @return true if the Standard profile is applied on the Model containing the given element
*/
public static boolean isStandardProfileApplied(Element element) {
@@ -219,10 +231,11 @@ public class Utils {
/**
* Duplicated from SequoiaAbstractHandler. @author Patrick Tessier (CEA).
* getSelected element in the diagram or in hte model explorer
+ *
* @return Element or null
*/
- public static Element getSelection(){
- Element selectedElement =null;
+ public static Element getSelection() {
+ Element selectedElement = null;
ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService.getSelection();
@@ -233,11 +246,10 @@ public class Utils {
if((graphicalElement instanceof View) && ((View)graphicalElement).getElement() instanceof org.eclipse.uml2.uml.Element) {
selectedElement = (org.eclipse.uml2.uml.Element)((View)graphicalElement).getElement();
}
- }
- else if(selectedobject instanceof IAdaptable) {
+ } else if(selectedobject instanceof IAdaptable) {
EObject selectedEObject = (EObject)((IAdaptable)selectedobject).getAdapter(EObject.class);
- if (selectedEObject instanceof org.eclipse.uml2.uml.Element){
- selectedElement=(Element)selectedEObject;
+ if(selectedEObject instanceof org.eclipse.uml2.uml.Element) {
+ selectedElement = (Element)selectedEObject;
}
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/ui/GenerateConstructorUsingFieldsDialog.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/ui/GenerateConstructorUsingFieldsDialog.java
index 2a904ed0f70..cf7bb11d0c3 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/ui/GenerateConstructorUsingFieldsDialog.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites.utils/src/org/eclipse/papyrus/moka/composites/utils/ui/GenerateConstructorUsingFieldsDialog.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.ui;
import java.util.ArrayList;
@@ -366,15 +377,15 @@ public class GenerateConstructorUsingFieldsDialog extends TrayDialog {
@Override
protected void okPressed() {
//System.err.println("Ok pressed");
-
+
// Check if the right profile is applied.
//List<Profile> appliedProfiles = context.getModel().getAppliedProfiles();
//for(int i = 0; i < appliedProfiles.size(); i++) {
- //System.out.println(appliedProfiles.get(i).getQualifiedName());
+ //System.out.println(appliedProfiles.get(i).getQualifiedName());
//}
if(!Utils.isStandardProfileApplied(context)) {
- PackageUtil.applyProfile((org.eclipse.uml2.uml.Package)context.getModel(), Utils.standardProfile, true);
+ PackageUtil.applyProfile(context.getModel(), Utils.standardProfile, true);
}
// Creating operation and method with "Create" stereotype

Back to the top