diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java index 7f7d0e5c0f9..c7d53076968 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/InputPinStartObjectBehaviorActionEditHelperAdvice.java @@ -1,67 +1,67 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.edit.advices;
-
-/**
- *
- * Pins of StartObjectBehaviorAction should be create and update automatically
- *
- */
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.uml.diagram.activity.edit.commands.util.PinUpdateCommand;
-import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.IPinUpdater;
-import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.StartObjectBehaviorActionPinUpdater;
-import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.AutomatedModelCompletionPreferencesInitializer;
-import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.IAutomatedModelCompletionPreferencesConstants;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.uml2.uml.InputPin;
-import org.eclipse.uml2.uml.StartObjectBehaviorAction;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Edit helper advice for {@link StartObjectBehaviorAction}
- * @since 3.0
- */
-public class InputPinStartObjectBehaviorActionEditHelperAdvice extends AbstractEditHelperAdvice {
-
- /**
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected ICommand getAfterSetCommand(SetRequest request) {
- // 1] check if the setFeature is type
- if (request.getFeature().equals(UMLPackage.eINSTANCE.getTypedElement_Type())) {
- // 2] get the preference for StartObjectBehaviorAction
- final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
- boolean synchronizePin = (prefStore.getString(IAutomatedModelCompletionPreferencesConstants.START_OBJECT_BEHAVIOR_ACTION).equals(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION));
- // 3] check preference
- if (synchronizePin) {
- if (request.getElementToEdit() instanceof InputPin) {
- InputPin inputPin = (InputPin) request.getElementToEdit();
- if (inputPin.getOwner() instanceof StartObjectBehaviorAction) {
- // 4] call the command for the StartObjectBehaviorAction which owned the current input pin
- IPinUpdater<StartObjectBehaviorAction> updater = new StartObjectBehaviorActionPinUpdater();
- return new PinUpdateCommand<StartObjectBehaviorAction>("Update start object behavior action pins", updater, (StartObjectBehaviorAction) inputPin.getOwner());
- }
- }
- }
- }
- return super.getAfterSetCommand(request);
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.edit.advices; + +/** + * + * Pins of StartObjectBehaviorAction should be create and update automatically + * + */ +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.util.PinUpdateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.IPinUpdater; +import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.StartObjectBehaviorActionPinUpdater; +import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.AutomatedModelCompletionPreferencesInitializer; +import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.IAutomatedModelCompletionPreferencesConstants; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Edit helper advice for {@link StartObjectBehaviorAction} + * @since 3.0 + */ +public class InputPinStartObjectBehaviorActionEditHelperAdvice extends AbstractEditHelperAdvice { + + /** + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) + * + * @param request + * @return + */ + @Override + protected ICommand getAfterSetCommand(SetRequest request) { + // 1] check if the setFeature is type + if (request.getFeature().equals(UMLPackage.eINSTANCE.getTypedElement_Type())) { + // 2] get the preference for StartObjectBehaviorAction + final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore(); + boolean synchronizePin = (prefStore.getString(IAutomatedModelCompletionPreferencesConstants.START_OBJECT_BEHAVIOR_ACTION).equals(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION)); + // 3] check preference + if (synchronizePin) { + if (request.getElementToEdit() instanceof InputPin) { + InputPin inputPin = (InputPin) request.getElementToEdit(); + if (inputPin.getOwner() instanceof StartObjectBehaviorAction) { + // 4] call the command for the StartObjectBehaviorAction which owned the current input pin + IPinUpdater<StartObjectBehaviorAction> updater = new StartObjectBehaviorActionPinUpdater(); + return new PinUpdateCommand<StartObjectBehaviorAction>("Update start object behavior action pins", updater, (StartObjectBehaviorAction) inputPin.getOwner()); + } + } + } + } + return super.getAfterSetCommand(request); + } +} |