diff options
Diffstat (limited to 'extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml')
24 files changed, 1494 insertions, 0 deletions
diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java new file mode 100755 index 00000000000..d6a4e567c78 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java @@ -0,0 +1,76 @@ +/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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.sysml.propertylifecycle;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.propertylifecycle"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** Logging helper */
+ public static LogHelper log;
+
+ /** The tag to identify the trace when activating the messages in the .options file */
+ public static String PLCSTRATEGY_TRACE = "PLCStrategy_SYSMLproperty";
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ log = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java new file mode 100755 index 00000000000..7a5b96740e4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ActorPartPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ActorPartPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("actorPart", element.eContainer().eContents()); //$NON-NLS-1$ + LifecycleSetCommand setCommand = new LifecycleSetCommand("ActorPartProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java new file mode 100755 index 00000000000..d0cb3974167 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.allocations.AllocationsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class AllocateProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public AllocateProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(AllocationsPackage.eINSTANCE.getAllocate().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Allocate_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java new file mode 100755 index 00000000000..d5a6f362f11 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class BlockProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public BlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getBlock().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Block_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java new file mode 100755 index 00000000000..b5ed7f98409 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConformProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConformProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getConform().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Conform_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java new file mode 100755 index 00000000000..40275d05319 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintBlockParameterProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintBlockParameterProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("parameter", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintBlockParameter_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java new file mode 100755 index 00000000000..af48c7914cb --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintBlockProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintBlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ConstraintsPackage.eINSTANCE.getConstraintBlock().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintBlock_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java new file mode 100755 index 00000000000..0e428f51989 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ConstraintsPackage.eINSTANCE.getConstraintProperty().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java new file mode 100755 index 00000000000..524b97cf174 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class CopyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public CopyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getCopy().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Copy_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java new file mode 100755 index 00000000000..90464ba4a24 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class DimensionProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public DimensionProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getDimension().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Dimension_ConfR", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java new file mode 100755 index 00000000000..776c0bcd66b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowPortProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowPortProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowPort().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowPort_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java new file mode 100755 index 00000000000..6026500a4fc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowProperty().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java new file mode 100755 index 00000000000..bfc47f6cf8b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowSpecificationprocessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowSpecificationprocessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowSpecification().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowSpecification_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java new file mode 100755 index 00000000000..06ab7963676 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ItemFlowProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ItemFlowProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getItemFlow().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ItemFlow_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java new file mode 100755 index 00000000000..0970ea6b0c4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class PartPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public PartPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("part", element.eContainer().eContents()); //$NON-NLS-1$ + LifecycleSetCommand setCommand = new LifecycleSetCommand("PartProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java new file mode 100755 index 00000000000..91ad8adb0d0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ReferencePropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ReferencePropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("reference", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ReferenceProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java new file mode 100755 index 00000000000..6115c79a3fc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class RequirementProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public RequirementProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getRequirement().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Requirement_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java new file mode 100755 index 00000000000..33f7a0aebe2 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class SatisfyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public SatisfyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (!(request instanceof ConfigureRequest)) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + // Initialize the element name based on the created IElementType + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getSatisfy().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Satisfy_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java new file mode 100755 index 00000000000..1d1c88082da --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class UnitProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public UnitProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + // Initialize the element name based on the created IElementType + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getUnit().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("UnitProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java new file mode 100755 index 00000000000..1e69fdb51f1 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ValuePropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ValuePropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("value", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ValueProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java new file mode 100755 index 00000000000..2161e56752b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ValueTypeProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ValueTypeProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getValueType().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ValueType_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java new file mode 100755 index 00000000000..213579ac754 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class VerifyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public VerifyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getVerify().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("VerifyProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java new file mode 100755 index 00000000000..412da66abd0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ViewPointProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ViewPointProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getViewPoint().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ViewPointProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java new file mode 100755 index 00000000000..4bebed37eb8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ViewProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ViewProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getView().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ViewProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} |