Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF3
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElement.java62
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElementFactory.java62
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/observables/SwitchOrientationObservableValue.java232
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/tabbedproperties/appearance/SwitchSegmentDirectionSection.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationEditor.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationWidget.java197
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/Environment.xmi6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/activity.ctx39
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleForkNode.xwt19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleJoinNode.xwt19
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/pom.xml2
15 files changed, 697 insertions, 17 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
index 5333f1ebcc2..0b071ff83ad 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
@@ -1,5 +1,6 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.extension,
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.constraint,
+ org.eclipse.papyrus.infra.gmfdiag.properties.extension,
org.eclipse.papyrus.infra.gmfdiag.properties.modelelement
Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.core.databinding.beans;bundle-version="[1.3.0,2.0.0)",
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
index 284591eb7cd..db587ea56f3 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
@@ -85,10 +85,11 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili
org.eclipse.gef,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="[4.0.0,5.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.activity; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties
index aa6f973f18e..44b23de49f6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties
@@ -12,7 +12,9 @@ bin.includes = .,\
custom-messages.properties,\
model/activityDiagram.elementtypesconfigurations,\
css/,\
- model/PapyrusUMLActivityDiagram.paletteconfiguration
+ model/PapyrusUMLActivityDiagram.paletteconfiguration,\
+ model/properties/,\
+ model/Environment.xmi
jars.compile.order=.
src.includes = about.html
source.. = src-gen/,\
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElement.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElement.java
new file mode 100644
index 00000000000..579cce91711
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElement.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.activity.modelelement;
+
+import java.util.Collections;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElement;
+import org.eclipse.papyrus.uml.diagram.activity.observables.SwitchOrientationObservableValue;
+
+/**
+ * This allows to define the model element for the activity notation.
+ *
+ * @since 3.2
+ */
+public class ActivityNotationModelElement extends AbstractModelElement {
+ TransactionalEditingDomain domain;
+ EditPart editPart;
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The editing domain.
+ * @param source
+ * The source edit part.
+ */
+ public ActivityNotationModelElement(final TransactionalEditingDomain domain, final EditPart source) {
+ super();
+
+ this.domain = domain;
+ this.editPart = source;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElement#doGetObservable(java.lang.String)
+ */
+ @Override
+ protected IObservable doGetObservable(final String propertyPath) {
+ IObservable result = null;
+
+ if (propertyPath.endsWith("switchOrientation")) { //$NON-NLS-1$
+ result = new SwitchOrientationObservableValue(domain, Collections.singleton(editPart));
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElementFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElementFactory.java
new file mode 100644
index 00000000000..b7cf3aab490
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/modelelement/ActivityNotationModelElementFactory.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.activity.modelelement;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
+import org.eclipse.papyrus.infra.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElementFactory;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+
+/**
+ * A factory for handling the GMF Notation Activity elements.
+ *
+ * @since 3.2
+ */
+public class ActivityNotationModelElementFactory extends AbstractModelElementFactory<ActivityNotationModelElement> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElementFactory#doCreateFromSource(java.lang.Object, org.eclipse.papyrus.infra.properties.contexts.DataContextElement)
+ */
+ @Override
+ protected ActivityNotationModelElement doCreateFromSource(final Object sourceElement, final DataContextElement context) {
+ ActivityNotationModelElement result = null;
+ final IGraphicalEditPart editPart = AdapterUtils.adapt(sourceElement, IGraphicalEditPart.class, null);
+
+ if (editPart == null) {
+ Activator.log.warn("The selected element cannot be resolved to a GEF EditPart"); //$NON-NLS-1$
+ } else {
+ result = new ActivityNotationModelElement(editPart.getEditingDomain(), editPart);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElementFactory#updateModelElement(org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElement, java.lang.Object)
+ */
+ @Override
+ protected void updateModelElement(final ActivityNotationModelElement modelElement, final Object newSourceElement) {
+ final IGraphicalEditPart editPart = AdapterUtils.adapt(newSourceElement, IGraphicalEditPart.class, null);
+ if (editPart == null) {
+ throw new IllegalArgumentException("Cannot resolve EditPart selection: " + newSourceElement); //$NON-NLS-1$
+ }
+
+ modelElement.domain = editPart.getEditingDomain();
+ modelElement.editPart = editPart;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/observables/SwitchOrientationObservableValue.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/observables/SwitchOrientationObservableValue.java
new file mode 100644
index 00000000000..a632f2732bf
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/observables/SwitchOrientationObservableValue.java
@@ -0,0 +1,232 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.observables;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ForkNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.part.CustomMessages;
+
+/**
+ * The observable value for the switch observable action.
+ *
+ * @since 3.2
+ */
+public class SwitchOrientationObservableValue extends AbstractObservableValue<Boolean> {
+
+ /**
+ * The transactional editing domain.
+ */
+ private TransactionalEditingDomain editingDomain;
+
+ /**
+ * The activity nodes edit parts to modify.
+ */
+ private List<EditPart> activityNodesEP;
+
+ /**
+ * Constructor.
+ *
+ * @param editingDomain
+ * The transactional editing domain.
+ * @param activityNodesEP
+ * The activity nodes edit parts to modify.
+ */
+ public SwitchOrientationObservableValue(final TransactionalEditingDomain editingDomain, final Collection<EditPart> activityNodesEP) {
+ this.activityNodesEP = new ArrayList<EditPart>(activityNodesEP.size());
+ this.activityNodesEP.addAll(activityNodesEP);
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected Boolean doGetValue() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ */
+ @Override
+ protected void doSetValue(final Boolean value) {
+ CompositeCommand globalCommand = new CompositeCommand(CustomMessages.ForkJoinSegmentSwitchOrientation_actionLabel);
+ for (Object part : this.activityNodesEP) {
+ Object view = null;
+ Figure figure = null;
+ if (part instanceof JoinNodeEditPart) {
+ view = ((JoinNodeEditPart) part).getModel();
+ figure = ((JoinNodeEditPart) part).getPrimaryShape();
+ } else if (part instanceof ForkNodeEditPart) {
+ view = ((ForkNodeEditPart) part).getModel();
+ figure = ((ForkNodeEditPart) part).getPrimaryShape();
+ }
+ // append a command for selected part only if correct configuration
+ if (view instanceof View && figure != null) {
+ SwitchSegmentOrientation switchCom = new SwitchSegmentOrientation(editingDomain, figure, (View) view);
+ globalCommand.add(switchCom);
+ }
+ }
+ // execute the command for all parts
+ if (!globalCommand.isEmpty() && globalCommand.canExecute()) {
+ editingDomain.getCommandStack().execute(GEFtoEMFCommandWrapper.wrap(new ICommandProxy(globalCommand)));
+ }
+ }
+
+ /**
+ * This class is a command which switches the orientation of a figure. The figure's width and height are switched, rotating the figure on its center. (center location kept)
+ */
+ private class SwitchSegmentOrientation extends AbstractTransactionalCommand {
+
+ /** The figure to switch */
+ private Figure selectedFigure = null;
+
+ /** The model view for the figure to switch */
+ private View selectedView = null;
+
+ /**
+ * Construct a switch orientation command.
+ *
+ * @param domain
+ * The transactional editing domain.
+ * @param figure
+ * The figure to rotate.
+ * @param view
+ * The view which is the model of the figure.
+ */
+ SwitchSegmentOrientation(final TransactionalEditingDomain domain, final Figure figure, final View view) {
+ super(domain, CustomMessages.ForkJoinSegmentSwitchOrientation_actionLabel, null);
+ selectedFigure = figure;
+ selectedView = view;
+ }
+
+ /**
+ * Execute the command, rotating the figure.
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ *
+ * @param monitor
+ * The progress monitor.
+ * @param info
+ * The adapter for information.
+ * @return The result of the command.
+ * @throws ExecutionException
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ if (selectedFigure == null || selectedView == null) {
+ return CommandResult.newCancelledCommandResult();
+ }
+ Dimension newSize = selectedFigure.getSize().getTransposed();
+ Point newLocation = selectedFigure.getLocation().getCopy();
+ newLocation.translate((newSize.height - newSize.width) / 2, (newSize.width - newSize.height) / 2);
+ ViewUtil.setStructuralFeatureValue(selectedView, NotationPackage.eINSTANCE.getLocation_X(), newLocation.x);
+ ViewUtil.setStructuralFeatureValue(selectedView, NotationPackage.eINSTANCE.getLocation_Y(), newLocation.y);
+ ViewUtil.setStructuralFeatureValue(selectedView, NotationPackage.eINSTANCE.getSize_Width(), newSize.width);
+ ViewUtil.setStructuralFeatureValue(selectedView, NotationPackage.eINSTANCE.getSize_Height(), newSize.height);
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @see org.eclipse.emf.workspace.AbstractEMFOperation#canUndo()
+ * @return true if command can undo.
+ */
+ @Override
+ public boolean canUndo() {
+ return selectedFigure != null && selectedView != null;
+ }
+
+ /**
+ * @see org.eclipse.emf.workspace.AbstractEMFOperation#canRedo()
+ * @return true if command can redo.
+ */
+ @Override
+ public boolean canRedo() {
+ return selectedFigure != null && selectedView != null;
+ }
+
+ /**
+ * Undo the switch (by switching again).
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doUndo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ *
+ * @param monitor
+ * The progress monitor.
+ * @param info
+ * The adapter for information.
+ * @return The result of the command.
+ * @throws ExecutionException
+ */
+ @Override
+ protected IStatus doUndo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ return doExecute(monitor, info);
+ }
+
+ /**
+ * Redo the switch (by switching again).
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doRedo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ *
+ * @param monitor
+ * The progress monitor.
+ * @param info
+ * The adapter for information.
+ * @return The result of the command.
+ * @throws ExecutionException
+ */
+ @Override
+ protected IStatus doRedo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ return doExecute(monitor, info);
+ }
+ }
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/tabbedproperties/appearance/SwitchSegmentDirectionSection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/tabbedproperties/appearance/SwitchSegmentDirectionSection.java
index 58057774e76..0fd679c1923 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/tabbedproperties/appearance/SwitchSegmentDirectionSection.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/tabbedproperties/appearance/SwitchSegmentDirectionSection.java
@@ -55,6 +55,8 @@ import org.eclipse.ui.forms.widgets.ImageHyperlink;
/**
* Section to use in the properties view. This section enables to switch the
* direction of a segment representation (for fork or join).
+ *
+ * @deprecated since 3.2
*/
public class SwitchSegmentDirectionSection extends AbstractNotationPropertiesSection {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationEditor.java
new file mode 100644
index 00000000000..a5c36e2a4d6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationEditor.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.widgets;
+
+import org.eclipse.papyrus.infra.properties.ui.widgets.AbstractPropertyEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The switch orientation editor.
+ *
+ * @since 3.2
+ */
+public class SwitchOrientationEditor extends AbstractPropertyEditor {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed
+ * @param style
+ * The style for the widget
+ */
+ public SwitchOrientationEditor(final Composite parent, final int style) {
+ super(new SwitchOrientationWidget(parent, style));
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationWidget.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationWidget.java
new file mode 100644
index 00000000000..e1afb46d1c0
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/widgets/SwitchOrientationWidget.java
@@ -0,0 +1,197 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.widgets;
+
+import java.io.IOException;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.uml.diagram.activity.part.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.common.ui.helper.HelpComponentFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+/**
+ * The switch orientation widget with a simple button and a help button.
+ *
+ * @since 3.2
+ */
+public class SwitchOrientationWidget extends AbstractValueEditor {
+
+ /** The path to the switch icon. */
+ private static final String ICON_PATH = "icons/switchSegmentOrientation.gif";
+
+ /** The switch image. */
+ public static Image switchImage = null;
+
+ /** Load the switch icon once. */
+ static {
+ try {
+ switchImage = new Image(Display.getDefault(), UMLDiagramEditorPlugin.getInstance().getBundle().getResource(ICON_PATH).openStream());
+ } catch (IOException e) {
+ UMLDiagramEditorPlugin.getInstance().logError(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * The button to use.
+ */
+ private Button button;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor should be displayed.
+ * @param style
+ * The style for this editor's text box.
+ */
+ public SwitchOrientationWidget(final Composite parent, final int style) {
+ this(parent, style, null); //$NON-NLS-1$
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor should be displayed.
+ * @param style
+ * The style for this editor's text box.
+ * @param label
+ * The label to be displayed.
+ */
+ public SwitchOrientationWidget(final Composite parent, final int style, final String label) {
+ super(parent, label);
+
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, true));
+ composite.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true));
+
+ button = new Button(composite, SWT.PUSH);
+ button.setImage(switchImage);
+ GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true);
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (null != widgetObservable) {
+ widgetObservable.setValue(true);
+ }
+ }
+ });
+
+ // create help
+ final ImageHyperlink help = HelpComponentFactory.createHelpComponent(composite, new FormToolkit(parent.getDisplay()), CustomMessages.ForkJoinSegmentSwitchOrientation_helpMessage);
+ gd = new GridData(SWT.RIGHT, SWT.CENTER, false, true);
+ help.setLayoutData(gd);
+ help.setBackground(parent.getBackground());
+
+ pack();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#setLabel(java.lang.String)
+ */
+ @Override
+ public void setLabel(final String label) {
+ // Don't display label
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#setModelObservable(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void setModelObservable(final IObservableValue modelProperty) {
+ IObservableValue newWidgetObservable = modelProperty;
+
+ if (this.widgetObservable != null) {
+ this.widgetObservable.dispose();
+ }
+
+ setWidgetObservable(newWidgetObservable, true);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#getValue()
+ */
+ @Override
+ public Object getValue() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#getEditableType()
+ */
+ @Override
+ public Object getEditableType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#setReadOnly(boolean)
+ */
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ button.setEnabled(!readOnly);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return !button.isEnabled();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/Environment.xmi b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/Environment.xmi
new file mode 100644
index 00000000000..cfdc8d5fdeb
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/Environment.xmi
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <modelElementFactories name="GMF Notation Activity Factory" factoryClass="org.eclipse.papyrus.uml.diagram.activity.modelelement.ActivityNotationModelElementFactory"/>
+ <propertyEditorTypes label="SwitchOrientationEditor" widgetClass="org.eclipse.papyrus.uml.diagram.activity.widgets.SwitchOrientationEditor" namespace="//@namespaces.0" type="Boolean"/>
+ <namespaces name="ppean" value="org.eclipse.papyrus.uml.diagram.activity.widgets"/>
+</environment:Environment>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/activity.ctx b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/activity.ctx
new file mode 100644
index 00000000000..b796b89314f
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/activity.ctx
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ASCII"?>
+<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" xmi:id="_Lf718JLDEeWbp4A9_-WIrQ" name="activity" label="Activity Diagram Appearance">
+ <tabs xmi:id="_KNIYoG7fEeizb_hXYwUHaw" label="Appearance" id="appearance" category="org.eclipse.papyrus" priority="75">
+ <sections xmi:id="_LY07kG_jEeigTI7x32JvNg" name="Multiple ForkNode" sectionFile="ui/MultipleForkNode.xwt"/>
+ <sections xmi:id="_S5gewG_jEeigTI7x32JvNg" name="Multiple JoinNode" sectionFile="ui/MultipleJoinNode.xwt"/>
+ </tabs>
+ <views xmi:id="_WuQiwG_jEeigTI7x32JvNg" elementMultiplicity="-1" name="MultipleForkNode" sections="_LY07kG_jEeigTI7x32JvNg" automaticContext="true" datacontexts="_1FeasG7kEeizb_hXYwUHaw">
+ <constraints xsi:type="constraints:CompositeConstraint" xmi:id="_WuQiwW_jEeigTI7x32JvNg">
+ <constraints xmi:id="_WuQiwm_jEeigTI7x32JvNg" name="isMultipleView">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_WuQiw2_jEeigTI7x32JvNg" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_WuQixG_jEeigTI7x32JvNg" name="className" value="View"/>
+ </constraints>
+ <constraints xmi:id="_WuQixW_jEeigTI7x32JvNg" name="isMultipleForkNode">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_WuQixm_jEeigTI7x32JvNg" name="umlClassName" value="ForkNode"/>
+ </constraints>
+ </constraints>
+ </views>
+ <views xmi:id="_aH-3oG_jEeigTI7x32JvNg" elementMultiplicity="-1" name="MultipleJoinNode" sections="_S5gewG_jEeigTI7x32JvNg" automaticContext="true" datacontexts="_1FeasG7kEeizb_hXYwUHaw">
+ <constraints xsi:type="constraints:CompositeConstraint" xmi:id="_aH-3oW_jEeigTI7x32JvNg">
+ <constraints xmi:id="_aH-3om_jEeigTI7x32JvNg" name="isMultipleView">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_aH-3o2_jEeigTI7x32JvNg" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_aH-3pG_jEeigTI7x32JvNg" name="className" value="View"/>
+ </constraints>
+ <constraints xmi:id="_aH-3pW_jEeigTI7x32JvNg" name="isMultipleJoinNode">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_aH-3pm_jEeigTI7x32JvNg" name="umlClassName" value="JoinNode"/>
+ </constraints>
+ </constraints>
+ </views>
+ <dataContexts xmi:id="_wv0wcG7hEeizb_hXYwUHaw" name="ActivityNotation" label="Activity Notation">
+ <elements xmi:id="_1FeasG7kEeizb_hXYwUHaw" name="ActivityNode">
+ <properties xsi:type="contexts:UnknownProperty" xmi:id="_3F2-EG7kEeizb_hXYwUHaw" name="switchOrientation" label="Switch Orientation" type="Boolean" description="This allows to define if this is needed to switch the orientation of the figure."/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.activity/model/Environment.xmi#//@modelElementFactories.0"/>
+ </dataContexts>
+</contexts:Context>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleForkNode.xwt b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleForkNode.xwt
new file mode 100644
index 00000000000..02532b6f9db
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleForkNode.xwt
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets.layout"
+ xmlns:ppean="clr-namespace:org.eclipse.papyrus.uml.diagram.activity.widgets"
+ xmlns:x="http://www.eclipse.org/xwt"
+ xmlns="http://www.eclipse.org/xwt/presentation"
+ text="Switch Orientation">
+ <Composite.layout>
+ <GridLayout></GridLayout>
+ </Composite.layout>
+ <Group text="Switch Orientation">
+ <Group.layout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
+ </Group.layout>
+ <ppean:SwitchOrientationEditor input="{Binding}"
+ property="ActivityNotation:ActivityNode:switchOrientation"></ppean:SwitchOrientationEditor>
+ </Group>
+</Composite> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleJoinNode.xwt b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleJoinNode.xwt
new file mode 100644
index 00000000000..02532b6f9db
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/properties/ui/MultipleJoinNode.xwt
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets.layout"
+ xmlns:ppean="clr-namespace:org.eclipse.papyrus.uml.diagram.activity.widgets"
+ xmlns:x="http://www.eclipse.org/xwt"
+ xmlns="http://www.eclipse.org/xwt/presentation"
+ text="Switch Orientation">
+ <Composite.layout>
+ <GridLayout></GridLayout>
+ </Composite.layout>
+ <Group text="Switch Orientation">
+ <Group.layout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
+ </Group.layout>
+ <ppean:SwitchOrientationEditor input="{Binding}"
+ property="ActivityNotation:ActivityNode:switchOrientation"></ppean:SwitchOrientationEditor>
+ </Group>
+</Composite> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
index b5eac85b2af..35810099266 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
@@ -1433,18 +1433,6 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]>
</extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertySections">
- <propertySections
- contributorId="TreeOutlinePage">
- <propertySection
- class="org.eclipse.papyrus.uml.diagram.activity.tabbedproperties.appearance.SwitchSegmentDirectionSection"
- filter="org.eclipse.papyrus.uml.diagram.activity.tabbedproperties.appearance.SwitchSegmentDirectionSectionFilter"
- id="org.eclipse.papyrus.tabbedproperties.appearance.switchSegmentDirectionSection"
- tab="org.eclipse.papyrus.tabbedproperties.appearance.appearancetab">
- </propertySection>
- </propertySections>
- </extension>
<!--
<extension
point="org.eclipse.papyrus.uml.diagram.common.groups.groupcontainment"
@@ -2100,6 +2088,18 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]>
<?gmfgen generated="false"?>
<initializer class="org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.AutomatedModelCompletionPreferencesInitializer"/>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.properties.environments">
+ <environment
+ environmentModel="model/Environment.xmi">
+ </environment>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.properties.contexts">
+ <context
+ contextModel="model/properties/activity.ctx">
+ </context>
+</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/pom.xml
index 4cfc42b4419..4304d4a2672 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/pom.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.diagram.activity</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file

Back to the top