diff options
author | Quentin Le Menez | 2018-01-09 10:09:46 +0000 |
---|---|---|
committer | Quentin Le Menez | 2018-01-09 13:18:15 +0000 |
commit | d98116b5b376f18b6cf626ba4158a35fe9a4a64e (patch) | |
tree | 4458c9c5ada0a216b385813a56ea9a9b8c7b6509 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src | |
parent | 453e99bc2dcbd5fabad100f9d0d5f682013c3b19 (diff) | |
download | org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.gz org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.xz org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.zip |
Bug 515367 - [releng] Uniformization of the end of lines to Unix standard
- Format the EOL of all the files matched by: grep -rIUs . | xargs -Ifile dos2unix -k 'file'
Change-Id: I5c41d540a9a67b50de9b912ab35e16cc9a912961
Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src')
64 files changed, 4619 insertions, 4619 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java index 74cff6c1a40..e95b30b81dd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java @@ -1,34 +1,34 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence;
-
-/**
- * CompositeDiagramCreationCondition class allows to check if a Composite diagram can be added to the
- * selected element.
- */
-public class CompositeDiagramCreationCondition extends PerspectiveContextDependence {
-
- /**
- * @return whether the diagram can be created.
- */
- @Override
- public boolean create(EObject selectedElement) {
- return false;
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence; + +/** + * CompositeDiagramCreationCondition class allows to check if a Composite diagram can be added to the + * selected element. + */ +public class CompositeDiagramCreationCondition extends PerspectiveContextDependence { + + /** + * @return whether the diagram can be created. + */ + @Override + public boolean create(EObject selectedElement) { + return false; + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramEditorFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramEditorFactory.java index 71fd4438f1b..760b63160ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramEditorFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramEditorFactory.java @@ -1,24 +1,24 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite;
-
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
-
-public class CompositeDiagramEditorFactory extends GmfEditorFactory {
-
- public CompositeDiagramEditorFactory() {
- super(UmlCompositeDiagramForMultiEditor.class, CompositeStructureDiagramEditPart.MODEL_ID);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite; + +import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; + +public class CompositeDiagramEditorFactory extends GmfEditorFactory { + + public CompositeDiagramEditorFactory() { + super(UmlCompositeDiagramForMultiEditor.class, CompositeStructureDiagramEditPart.MODEL_ID); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsAction.java index 8a6e15567d6..b39122ed8f3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsAction.java @@ -1,51 +1,51 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.actions;
-
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.actions.ShowHideContentsAction;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Property;
-
-public class ShowHideRelatedContentsAction extends ShowHideContentsAction {
-
- /**
- * Constructor.
- */
- public ShowHideRelatedContentsAction() {
- super(Messages.ShowHideRelatedContentsAction_Title, Messages.ShowHideRelatedContentsAction_Message, ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.diagram.common.actions.AbstractShowHideAction#initAction()
- *
- */
- @Override
- protected void initAction() {
- super.initAction();
- for (IGraphicalEditPart current : this.selectedElements) {
- // the selected elements which aren't Classifier are ignored
- if (((View) current.getModel()).getElement() instanceof Property) {
- Property property = (Property) ((View) current.getModel()).getElement();
- if (property.getType() instanceof Classifier) {
- this.representations.add(new RootEditPartRepresentation(current, (Classifier) property.getType()));
- }
- }
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.actions; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.actions.ShowHideContentsAction; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; +import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Property; + +public class ShowHideRelatedContentsAction extends ShowHideContentsAction { + + /** + * Constructor. + */ + public ShowHideRelatedContentsAction() { + super(Messages.ShowHideRelatedContentsAction_Title, Messages.ShowHideRelatedContentsAction_Message, ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY); + } + + /** + * + * @see org.eclipse.papyrus.diagram.common.actions.AbstractShowHideAction#initAction() + * + */ + @Override + protected void initAction() { + super.initAction(); + for (IGraphicalEditPart current : this.selectedElements) { + // the selected elements which aren't Classifier are ignored + if (((View) current.getModel()).getElement() instanceof Property) { + Property property = (Property) ((View) current.getModel()).getElement(); + if (property.getType() instanceof Classifier) { + this.representations.add(new RootEditPartRepresentation(current, (Classifier) property.getType())); + } + } + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsHandler.java index 684b66cf614..d5ed7e30014 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ShowHideRelatedContentsHandler.java @@ -1,35 +1,35 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.actions;
-
-import org.eclipse.papyrus.uml.diagram.common.actions.handlers.AbstractShowHideHandler;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy;
-
-
-/**
- *
- * Handler for the {@link ShowHideRelatedContentsAction}
- *
- */
-public class ShowHideRelatedContentsHandler extends AbstractShowHideHandler {
-
- /**
- *
- * Constructor.
- *
- */
- public ShowHideRelatedContentsHandler() {
- super(new ShowHideRelatedContentsAction(), ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.actions; + +import org.eclipse.papyrus.uml.diagram.common.actions.handlers.AbstractShowHideHandler; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; + + +/** + * + * Handler for the {@link ShowHideRelatedContentsAction} + * + */ +public class ShowHideRelatedContentsHandler extends AbstractShowHideHandler { + + /** + * + * Constructor. + * + */ + public ShowHideRelatedContentsHandler() { + super(new ShowHideRelatedContentsAction(), ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CreateViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CreateViewCommand.java index 6deda4e3ec0..0aef7905e88 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CreateViewCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CreateViewCommand.java @@ -1,33 +1,33 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.notation.View;
-
-public class CreateViewCommand extends CreateCommand {
-
- public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) {
- super(editingDomain, viewDescriptor, containerView);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; +import org.eclipse.gmf.runtime.notation.View; + +public class CreateViewCommand extends CreateCommand { + + public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) { + super(editingDomain, viewDescriptor, containerView); + } + + @Override + public boolean canExecute() { + return true; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/SetTypeWithDialogCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/SetTypeWithDialogCommand.java index c292c6ca42f..237cc1ac819 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/SetTypeWithDialogCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/SetTypeWithDialogCommand.java @@ -1,64 +1,64 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This command set the type of a typed element with the dropped type. A confirmation dialog opens in case the TypedElement is already typed.
- */
-public class SetTypeWithDialogCommand extends SetValueCommand {
-
- protected SetRequest request;
-
- public SetTypeWithDialogCommand(SetRequest request) {
- super(request);
- this.request = request;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- CommandResult result;
- Object currentValue = getElementToEdit().eGet(request.getFeature());
- if (currentValue != null) {
- String[] labels = new String[2];
- labels[0] = "OK";
- labels[1] = "Cancel";
- MessageDialog dialog = new MessageDialog(new Shell(), "Confirm changes", null, "Do you want to replace current type ?", MessageDialog.QUESTION_WITH_CANCEL, labels, 0);
- dialog.open();
- switch (dialog.getReturnCode()) {
- case Window.OK:
- result = super.doExecuteWithResult(monitor, info);
- break;
- default:
- result = CommandResult.newOKCommandResult();
- break;
- }
- } else {
- result = super.doExecuteWithResult(monitor, info);
- }
- return result;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; + +/** + * This command set the type of a typed element with the dropped type. A confirmation dialog opens in case the TypedElement is already typed. + */ +public class SetTypeWithDialogCommand extends SetValueCommand { + + protected SetRequest request; + + public SetTypeWithDialogCommand(SetRequest request) { + super(request); + this.request = request; + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + CommandResult result; + Object currentValue = getElementToEdit().eGet(request.getFeature()); + if (currentValue != null) { + String[] labels = new String[2]; + labels[0] = "OK"; + labels[1] = "Cancel"; + MessageDialog dialog = new MessageDialog(new Shell(), "Confirm changes", null, "Do you want to replace current type ?", MessageDialog.QUESTION_WITH_CANCEL, labels, 0); + dialog.open(); + switch (dialog.getReturnCode()) { + case Window.OK: + result = super.doExecuteWithResult(monitor, info); + break; + default: + result = CommandResult.newOKCommandResult(); + break; + } + } else { + result = super.doExecuteWithResult(monitor, info); + } + return result; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/AbstractObservationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/AbstractObservationEditPart.java index 7017491d498..028b51ee617 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/AbstractObservationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/AbstractObservationEditPart.java @@ -1,67 +1,67 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editparts.IUMLNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-
-/**
- *
- *
- */
-public abstract class AbstractObservationEditPart extends NamedElementEditPart implements IUMLNamedElementEditPart {
-
- public AbstractObservationEditPart(View view) {
- super(view);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- protected void refreshBounds() {
-
- int width = 20;
- int height = 20;
- Dimension size = new Dimension(width, height);
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
-
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
- // set the figure active when the feature of the of a class is true
- if (resolveSemanticElement() != null) {
- refreshFontColor();
-
- // To adapt the display of the container to the icon!
- refreshBounds();
- }
-
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts; + +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.editparts.IUMLNamedElementEditPart; +import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart; + +/** + * + * + */ +public abstract class AbstractObservationEditPart extends NamedElementEditPart implements IUMLNamedElementEditPart { + + public AbstractObservationEditPart(View view) { + super(view); + } + + /** + * + * {@inheritDoc} + */ + @Override + protected void refreshBounds() { + + int width = 20; + int height = 20; + Dimension size = new Dimension(width, height); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + Point loc = new Point(x, y); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + + } + + @Override + protected void handleNotificationEvent(Notification event) { + super.handleNotificationEvent(event); + // set the figure active when the feature of the of a class is true + if (resolveSemanticElement() != null) { + refreshFontColor(); + + // To adapt the display of the container to the icon! + refreshBounds(); + } + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedNamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedNamedElementEditPart.java index c0272b61d2e..749ee43b528 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedNamedElementEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedNamedElementEditPart.java @@ -1,41 +1,41 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-
-/**
- * this class was used to remove scrollbar
- * Now it is not used (but can be when this functionality will be operational)
- *
- */
-public abstract class ConstrainedNamedElementEditPart extends NamedElementEditPart {
-
- public ConstrainedNamedElementEditPart(View view) {
- super(view);
- }
-
- /**
- * the drag tracker has been specialized in order to constraint mvt inside its container without
- * scroll bar {@inheritDoc}
- */
- @Override
- public DragTracker getDragTracker(Request request) {
- return new NoScrollDragEditPartsTrackerEx(this);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts; + +import org.eclipse.gef.DragTracker; +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx; +import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart; + +/** + * this class was used to remove scrollbar + * Now it is not used (but can be when this functionality will be operational) + * + */ +public abstract class ConstrainedNamedElementEditPart extends NamedElementEditPart { + + public ConstrainedNamedElementEditPart(View view) { + super(view); + } + + /** + * the drag tracker has been specialized in order to constraint mvt inside its container without + * scroll bar {@inheritDoc} + */ + @Override + public DragTracker getDragTracker(Request request) { + return new NoScrollDragEditPartsTrackerEx(this); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedShapeNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedShapeNodeEditPart.java index 6b9e1afba1c..393b2d735c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedShapeNodeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/ConstrainedShapeNodeEditPart.java @@ -1,41 +1,41 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
-
-/**
- * this class was used to remove scrollbar
- * Now it is not used (but can be when this fucntionality will operational)
- *
- */
-public abstract class ConstrainedShapeNodeEditPart extends ShapeNodeEditPart {
-
- public ConstrainedShapeNodeEditPart(View view) {
- super(view);
- }
-
- /**
- * the drag tracker has been specialized in order to constraint mvt inside its container without
- * scroll bar {@inheritDoc}
- */
- @Override
- public DragTracker getDragTracker(Request request) {
- return new NoScrollDragEditPartsTrackerEx(this);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts; + +import org.eclipse.gef.DragTracker; +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx; + +/** + * this class was used to remove scrollbar + * Now it is not used (but can be when this fucntionality will operational) + * + */ +public abstract class ConstrainedShapeNodeEditPart extends ShapeNodeEditPart { + + public ConstrainedShapeNodeEditPart(View view) { + super(view); + } + + /** + * the drag tracker has been specialized in order to constraint mvt inside its container without + * scroll bar {@inheritDoc} + */ + @Override + public DragTracker getDragTracker(Request request) { + return new NoScrollDragEditPartsTrackerEx(this); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/AbstractCustomLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/AbstractCustomLabelEditPolicy.java index 3c2e1bfacbf..a807ea3fea4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/AbstractCustomLabelEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/AbstractCustomLabelEditPolicy.java @@ -1,140 +1,140 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Edit policy for specific Label
- */
-public abstract class AbstractCustomLabelEditPolicy extends GraphicalEditPolicy implements IPapyrusListener, NotificationListener {
-
- /** constant for this edit policy role */
- public final static String SPECIFIC_NAME_LABEL_POLICY = "SpecificNameLabelEditPolicy"; //$NON-NLS-1$
-
- /**
- * Creates a new Specific Name display edit policy
- */
- public AbstractCustomLabelEditPolicy() {
- super();
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void activate() {
- // retrieve the view and the element managed by the edit part
- View view = getView();
- if (view == null) {
- return;
- }
- Element element = getUMLElement();
- if (getUMLElement() != null) {
- // adds a listener on the view and the element controlled by the editpart
- getDiagramEventBroker().addNotificationListener(view, this);
- getDiagramEventBroker().addNotificationListener(element, this);
-
- addAdditionalListeners();
-
- refreshDisplay();
- }
- }
-
- /**
- * Adds more listeners upon activation
- */
- protected void addAdditionalListeners() {
- // default implementation does nothing
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void deactivate() {
- // retrieve the view and the element managed by the edit part
- View view = getView();
- if (view == null) {
- return;
- }
- Element element = getUMLElement();
-
- // remove notification on element and view
- getDiagramEventBroker().removeNotificationListener(view, this);
-
- if (element == null) {
- return;
- }
- getDiagramEventBroker().removeNotificationListener(element, this);
-
- removeAdditionalListeners();
-
- }
-
- /**
- * Remove the others listeners
- *
- */
- protected void removeAdditionalListeners() {
- // default implementation does nothing
- }
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (theEditingDomain != null) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
- /**
- * Returns the uml element controlled by the host edit part
- *
- * @return the uml element controlled by the host edit part
- */
- protected Element getUMLElement() {
- return (Element) getView().getElement();
- }
-
- /**
- * Returns the view controlled by the host edit part
- *
- * @return the view controlled by the host edit part
- */
- protected View getView() {
- return (View) getHost().getModel();
- }
-
- /**
- * Refreshes the display for the element controlled by the edit part with this edit policies
- */
- public abstract void refreshDisplay();
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.editpolicies.GraphicalEditPolicy; +import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; +import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener; +import org.eclipse.uml2.uml.Element; + +/** + * Edit policy for specific Label + */ +public abstract class AbstractCustomLabelEditPolicy extends GraphicalEditPolicy implements IPapyrusListener, NotificationListener { + + /** constant for this edit policy role */ + public final static String SPECIFIC_NAME_LABEL_POLICY = "SpecificNameLabelEditPolicy"; //$NON-NLS-1$ + + /** + * Creates a new Specific Name display edit policy + */ + public AbstractCustomLabelEditPolicy() { + super(); + } + + /** + * + * {@inheritDoc} + */ + @Override + public void activate() { + // retrieve the view and the element managed by the edit part + View view = getView(); + if (view == null) { + return; + } + Element element = getUMLElement(); + if (getUMLElement() != null) { + // adds a listener on the view and the element controlled by the editpart + getDiagramEventBroker().addNotificationListener(view, this); + getDiagramEventBroker().addNotificationListener(element, this); + + addAdditionalListeners(); + + refreshDisplay(); + } + } + + /** + * Adds more listeners upon activation + */ + protected void addAdditionalListeners() { + // default implementation does nothing + } + + /** + * + * {@inheritDoc} + */ + @Override + public void deactivate() { + // retrieve the view and the element managed by the edit part + View view = getView(); + if (view == null) { + return; + } + Element element = getUMLElement(); + + // remove notification on element and view + getDiagramEventBroker().removeNotificationListener(view, this); + + if (element == null) { + return; + } + getDiagramEventBroker().removeNotificationListener(element, this); + + removeAdditionalListeners(); + + } + + /** + * Remove the others listeners + * + */ + protected void removeAdditionalListeners() { + // default implementation does nothing + } + + /** + * Gets the diagram event broker from the editing domain. + * + * @return the diagram event broker + */ + protected DiagramEventBroker getDiagramEventBroker() { + TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); + if (theEditingDomain != null) { + return DiagramEventBroker.getInstance(theEditingDomain); + } + return null; + } + + /** + * Returns the uml element controlled by the host edit part + * + * @return the uml element controlled by the host edit part + */ + protected Element getUMLElement() { + return (Element) getView().getElement(); + } + + /** + * Returns the view controlled by the host edit part + * + * @return the view controlled by the host edit part + */ + protected View getView() { + return (View) getHost().getModel(); + } + + /** + * Refreshes the display for the element controlled by the edit part with this edit policies + */ + public abstract void refreshDisplay(); + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorLayoutEditPolicy.java index 72ff18c3192..88a3731369e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorLayoutEditPolicy.java @@ -1,51 +1,51 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ActivityCompositeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for Behavior(s).
- * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Parameter (or Port)
- * in order to locate it at the cursor position.
- * An example of code generated by GMF can be found in {@link ActivityCompositeEditPart#createLayoutEditPolicy()}.
- */
-public class BehaviorLayoutEditPolicy extends StructuredClassifierLayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case PortEditPart.VISUAL_ID:
- case ParameterEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ActivityCompositeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; + +/** + * This edit policy replaces the GMF generated edit policy for Behavior(s). + * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Parameter (or Port) + * in order to locate it at the cursor position. + * An example of code generated by GMF can be found in {@link ActivityCompositeEditPart#createLayoutEditPolicy()}. + */ +public class BehaviorLayoutEditPolicy extends StructuredClassifierLayoutEditPolicy { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case PortEditPart.VISUAL_ID: + case ParameterEditPart.VISUAL_ID: + + return new BorderItemResizableEditPolicy(); + + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorResizableShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorResizableShapeEditPolicy.java index ad3b5ba0d1e..2bab5161c23 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorResizableShapeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorResizableShapeEditPolicy.java @@ -1,25 +1,25 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-/**
- * <pre>
- * Parameters are located with the same locator as Port in this diagram, as
- * a result the edit policy does not currently require further adaptation
- * over {@link EncapsulatedClassifierResizableShapeEditPolicy}.
- * </pre>
- */
-public class BehaviorResizableShapeEditPolicy extends EncapsulatedClassifierResizableShapeEditPolicy {
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +/** + * <pre> + * Parameters are located with the same locator as Port in this diagram, as + * a result the edit policy does not currently require further adaptation + * over {@link EncapsulatedClassifierResizableShapeEditPolicy}. + * </pre> + */ +public class BehaviorResizableShapeEditPolicy extends EncapsulatedClassifierResizableShapeEditPolicy { + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationRoleItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationRoleItemSemanticEditPolicy.java index 9660fba892d..e92677473ac 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationRoleItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationRoleItemSemanticEditPolicy.java @@ -1,68 +1,68 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.uml2.uml.Collaboration;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * <pre>
- * This class provides a custom edit policy used to replace the SEMANTIC_ROLE
- * generated for the CollaborationUse element (when used in CompositeStructure Diagram)
- * </pre>
- */
-public class CollaborationRoleItemSemanticEditPolicy extends DefaultSemanticEditPolicy {
-
- /**
- * <pre>
- * This method retrieves a Destroy Reference command instead of Destroy Element.
- * </pre>
- *
- * @see org.eclipse.papyrus.uml.diagram.composite.edit.policies.CollaborationRoleItemSemanticEditPolicyCN#getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest)
- *
- * @param req
- * the destroy element request
- * @return the destroy element command
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
-
- GraphicalEditPart graphicalParent = (GraphicalEditPart) getHost().getParent();
- Collaboration collaboration = (Collaboration) graphicalParent.resolveSemanticElement();
-
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(collaboration);
- if (provider != null) {
-
- // Retrieve delete command from the Element Edit service
- DestroyReferenceRequest setRequest = new DestroyReferenceRequest(collaboration, UMLPackage.eINSTANCE.getCollaboration_CollaborationRole(), req.getElementToDestroy(), false);
-
- ICommand setCommand = provider.getEditCommand(setRequest);
-
- if (setCommand != null) {
- return new ICommandProxy(setCommand.reduce());
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * <pre> + * This class provides a custom edit policy used to replace the SEMANTIC_ROLE + * generated for the CollaborationUse element (when used in CompositeStructure Diagram) + * </pre> + */ +public class CollaborationRoleItemSemanticEditPolicy extends DefaultSemanticEditPolicy { + + /** + * <pre> + * This method retrieves a Destroy Reference command instead of Destroy Element. + * </pre> + * + * @see org.eclipse.papyrus.uml.diagram.composite.edit.policies.CollaborationRoleItemSemanticEditPolicyCN#getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) + * + * @param req + * the destroy element request + * @return the destroy element command + */ + @Override + protected Command getDestroyElementCommand(DestroyElementRequest req) { + + GraphicalEditPart graphicalParent = (GraphicalEditPart) getHost().getParent(); + Collaboration collaboration = (Collaboration) graphicalParent.resolveSemanticElement(); + + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(collaboration); + if (provider != null) { + + // Retrieve delete command from the Element Edit service + DestroyReferenceRequest setRequest = new DestroyReferenceRequest(collaboration, UMLPackage.eINSTANCE.getCollaboration_CollaborationRole(), req.getElementToDestroy(), false); + + ICommand setCommand = provider.getEditCommand(setRequest); + + if (setCommand != null) { + return new ICommandProxy(setCommand.reduce()); + } + } + return UnexecutableCommand.INSTANCE; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/EncapsulatedClassifierResizableShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/EncapsulatedClassifierResizableShapeEditPolicy.java index 53e26667a9b..cc35a169162 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/EncapsulatedClassifierResizableShapeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/EncapsulatedClassifierResizableShapeEditPolicy.java @@ -1,110 +1,110 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusResizableShapeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.commands.FixPortLocationCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.UpdatePortLocationCommand;
-
-/**
- * <pre>
- * This class modifies EncapsulatedClassifier default resize command in order to move
- * any Port IBorderItem possibly attached.
- * See. bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814
- * Could not find a more general way to do this without making any assumption about
- * the kind of attached IBorderItem and that would only rely on its IBorderItemLocator.
- * </pre>
- */
-public class EncapsulatedClassifierResizableShapeEditPolicy extends PapyrusResizableShapeEditPolicy {
-
- /**
- * <pre>
- * {@inheritDoc}
- *
- * Extends the default resize command by :
- * - fixing possible Port location issues before resizing parent
- * - make the default parent resize
- * - update the Port location after resize (uses the side of the parent where the Port is attached before resize)
- * </pre>
- */
- @Override
- protected Command getResizeCommand(ChangeBoundsRequest request) {
-
- // Prepare command to move the affixed children as well (and an optional fix command)
- CompoundCommand updatePortLocationsCommand = new CompoundCommand("Update border items location"); //$NON-NLS-1$
- CompoundCommand fixPortLocationsCommand = new CompoundCommand("Fix border items location"); //$NON-NLS-1$
-
- Iterator<?> it = getHost().getChildren().iterator();
- while (it.hasNext()) {
- Object tmp = it.next();
- if (!(tmp instanceof IBorderItemEditPart)) {
- continue;
- }
-
- IBorderItemEditPart borderItem = (IBorderItemEditPart) tmp;
- Shape borderItemView = (Shape) borderItem.getNotationView();
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(borderItemView);
-
- // Fix possible location issue in BorderItem bounds in notation model
- ICommand fixPortLocationCommand = new FixPortLocationCommand(editingDomain, borderItem, (GraphicalEditPart) getHost());
- if (fixPortLocationCommand.canExecute()) {
- fixPortLocationsCommand.add(new ICommandProxy(fixPortLocationCommand));
- }
-
- ICommand updatePortLocationCommand = new UpdatePortLocationCommand(editingDomain, request, (GraphicalEditPart) getHost(), borderItem, borderItem.getBorderItemLocator().getCurrentSideOfParent());
- if (updatePortLocationCommand.canExecute()) {
- updatePortLocationsCommand.add(new ICommandProxy(updatePortLocationCommand));
- }
- }
-
-
- // Create the complete resize command
- CompoundCommand resizeCommand = new CompoundCommand("Resize command"); //$NON-NLS-1$
-
- // Add command to fix border item locations.
- // The role of this command is to make sure that the Port is correctly located (here this means
- // that the figure and the view have the same location) before resizing its parent.
- // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
- if (!fixPortLocationsCommand.isEmpty()) {
- resizeCommand.add(fixPortLocationsCommand);
- }
-
- // Add command to update locations
- resizeCommand.add(super.getResizeCommand(request));
-
- // Add command to update border item locations.
- // This command uses the border side of the border item before the resize action, and thus
- // requires that the Port location is correct. Previous versions did not move the IBorderItem, this is the reason
- // why a fix on the fly may be required.
- // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
- if (!updatePortLocationsCommand.isEmpty()) {
- resizeCommand.add(updatePortLocationsCommand);
- }
-
- return resizeCommand;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import java.util.Iterator; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.CompoundCommand; +import org.eclipse.gef.requests.ChangeBoundsRequest; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.notation.Shape; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusResizableShapeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.commands.FixPortLocationCommand; +import org.eclipse.papyrus.uml.diagram.common.commands.UpdatePortLocationCommand; + +/** + * <pre> + * This class modifies EncapsulatedClassifier default resize command in order to move + * any Port IBorderItem possibly attached. + * See. bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814 + * Could not find a more general way to do this without making any assumption about + * the kind of attached IBorderItem and that would only rely on its IBorderItemLocator. + * </pre> + */ +public class EncapsulatedClassifierResizableShapeEditPolicy extends PapyrusResizableShapeEditPolicy { + + /** + * <pre> + * {@inheritDoc} + * + * Extends the default resize command by : + * - fixing possible Port location issues before resizing parent + * - make the default parent resize + * - update the Port location after resize (uses the side of the parent where the Port is attached before resize) + * </pre> + */ + @Override + protected Command getResizeCommand(ChangeBoundsRequest request) { + + // Prepare command to move the affixed children as well (and an optional fix command) + CompoundCommand updatePortLocationsCommand = new CompoundCommand("Update border items location"); //$NON-NLS-1$ + CompoundCommand fixPortLocationsCommand = new CompoundCommand("Fix border items location"); //$NON-NLS-1$ + + Iterator<?> it = getHost().getChildren().iterator(); + while (it.hasNext()) { + Object tmp = it.next(); + if (!(tmp instanceof IBorderItemEditPart)) { + continue; + } + + IBorderItemEditPart borderItem = (IBorderItemEditPart) tmp; + Shape borderItemView = (Shape) borderItem.getNotationView(); + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(borderItemView); + + // Fix possible location issue in BorderItem bounds in notation model + ICommand fixPortLocationCommand = new FixPortLocationCommand(editingDomain, borderItem, (GraphicalEditPart) getHost()); + if (fixPortLocationCommand.canExecute()) { + fixPortLocationsCommand.add(new ICommandProxy(fixPortLocationCommand)); + } + + ICommand updatePortLocationCommand = new UpdatePortLocationCommand(editingDomain, request, (GraphicalEditPart) getHost(), borderItem, borderItem.getBorderItemLocator().getCurrentSideOfParent()); + if (updatePortLocationCommand.canExecute()) { + updatePortLocationsCommand.add(new ICommandProxy(updatePortLocationCommand)); + } + } + + + // Create the complete resize command + CompoundCommand resizeCommand = new CompoundCommand("Resize command"); //$NON-NLS-1$ + + // Add command to fix border item locations. + // The role of this command is to make sure that the Port is correctly located (here this means + // that the figure and the view have the same location) before resizing its parent. + // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814. + if (!fixPortLocationsCommand.isEmpty()) { + resizeCommand.add(fixPortLocationsCommand); + } + + // Add command to update locations + resizeCommand.add(super.getResizeCommand(request)); + + // Add command to update border item locations. + // This command uses the border side of the border item before the resize action, and thus + // requires that the Port location is correct. Previous versions did not move the IBorderItem, this is the reason + // why a fix on the fly may be required. + // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814. + if (!updatePortLocationsCommand.isEmpty()) { + resizeCommand.add(updatePortLocationsCommand); + } + + return resizeCommand; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoConnectableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoConnectableEditPolicy.java index 79d9f785c65..97534bd0c23 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoConnectableEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoConnectableEditPolicy.java @@ -1,24 +1,24 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.editpolicies.AbstractEditPolicy;
-
-/**
- * this editpolicy is used to prevent to reconnect a link
- *
- */
-
-public class NoConnectableEditPolicy extends AbstractEditPolicy {
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.editpolicies.AbstractEditPolicy; + +/** + * this editpolicy is used to prevent to reconnect a link + * + */ + +public class NoConnectableEditPolicy extends AbstractEditPolicy { +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoDeleteFromDiagramEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoDeleteFromDiagramEditPolicy.java index ff888dfeffe..89dc1906527 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoDeleteFromDiagramEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoDeleteFromDiagramEditPolicy.java @@ -1,30 +1,30 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy;
-
-/**
- * this editpolicy is used to prevent deletion from the diagram
- *
- */
-public class NoDeleteFromDiagramEditPolicy extends ViewComponentEditPolicy {
- @Override
- protected Command getDeleteCommand(GroupRequest request) {
- return UnexecutableCommand.INSTANCE;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gef.requests.GroupRequest; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy; + +/** + * this editpolicy is used to prevent deletion from the diagram + * + */ +public class NoDeleteFromDiagramEditPolicy extends ViewComponentEditPolicy { + @Override + protected Command getDeleteCommand(GroupRequest request) { + return UnexecutableCommand.INSTANCE; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollBehaviorResizableShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollBehaviorResizableShapeEditPolicy.java index 2c1921fef78..88d30751d53 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollBehaviorResizableShapeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollBehaviorResizableShapeEditPolicy.java @@ -1,47 +1,47 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-import org.eclipse.gef.tools.ResizeTracker;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollResizeTracker;
-
-/**
- * this editppolicy is used to constraint the move of one figure into its container without scroll bars
- *
- * this class was used to remove scrollbar
- * Now it is not used (but can be when this functionality will be operational)
- *
- */
-public class NoScrollBehaviorResizableShapeEditPolicy extends BehaviorResizableShapeEditPolicy {
-
- /**
- * this code has been overloaded in order to constraint the resize into its container without scroll bars {@inheritDoc}
- */
-
- @Override
- protected ResizeTracker getResizeTracker(int direction) {
- return new NoScrollResizeTracker((GraphicalEditPart) getHost(), direction);
- }
-
- /**
- * this code has been overloaded in order to constraint the move into its container without scroll bars {@inheritDoc}
- */
- @Override
- protected DragEditPartsTracker getDragTracker() {
- return new NoScrollDragEditPartsTrackerEx(getHost());
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.tools.DragEditPartsTracker; +import org.eclipse.gef.tools.ResizeTracker; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollResizeTracker; + +/** + * this editppolicy is used to constraint the move of one figure into its container without scroll bars + * + * this class was used to remove scrollbar + * Now it is not used (but can be when this functionality will be operational) + * + */ +public class NoScrollBehaviorResizableShapeEditPolicy extends BehaviorResizableShapeEditPolicy { + + /** + * this code has been overloaded in order to constraint the resize into its container without scroll bars {@inheritDoc} + */ + + @Override + protected ResizeTracker getResizeTracker(int direction) { + return new NoScrollResizeTracker((GraphicalEditPart) getHost(), direction); + } + + /** + * this code has been overloaded in order to constraint the move into its container without scroll bars {@inheritDoc} + */ + @Override + protected DragEditPartsTracker getDragTracker() { + return new NoScrollDragEditPartsTrackerEx(getHost()); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollClassifierResizableShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollClassifierResizableShapeEditPolicy.java index 1c075da9b06..58a795a9002 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollClassifierResizableShapeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/NoScrollClassifierResizableShapeEditPolicy.java @@ -1,46 +1,46 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-import org.eclipse.gef.tools.ResizeTracker;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollResizeTracker;
-
-/**
- * this editppolicy is used to constraint the move of one figure into its container without scroll bars
- *
- * this class was used to remove scrollbar
- * Now it is not used (but can be when this functionality will be operational)
- */
-public class NoScrollClassifierResizableShapeEditPolicy extends EncapsulatedClassifierResizableShapeEditPolicy {
-
- /**
- * this code has been overloaded in order to constraint the resize into its container without scroll bars {@inheritDoc}
- */
-
- @Override
- protected ResizeTracker getResizeTracker(int direction) {
- return new NoScrollResizeTracker((GraphicalEditPart) getHost(), direction);
- }
-
- /**
- * this code has been overloaded in order to constraint the move into its container without scroll bars {@inheritDoc}
- */
- @Override
- protected DragEditPartsTracker getDragTracker() {
- return new NoScrollDragEditPartsTrackerEx(getHost());
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.tools.DragEditPartsTracker; +import org.eclipse.gef.tools.ResizeTracker; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx; +import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollResizeTracker; + +/** + * this editppolicy is used to constraint the move of one figure into its container without scroll bars + * + * this class was used to remove scrollbar + * Now it is not used (but can be when this functionality will be operational) + */ +public class NoScrollClassifierResizableShapeEditPolicy extends EncapsulatedClassifierResizableShapeEditPolicy { + + /** + * this code has been overloaded in order to constraint the resize into its container without scroll bars {@inheritDoc} + */ + + @Override + protected ResizeTracker getResizeTracker(int direction) { + return new NoScrollResizeTracker((GraphicalEditPart) getHost(), direction); + } + + /** + * this code has been overloaded in order to constraint the move into its container without scroll bars {@inheritDoc} + */ + @Override + protected DragEditPartsTracker getDragTracker() { + return new NoScrollDragEditPartsTrackerEx(getHost()); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ObservationLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ObservationLayoutEditPolicy.java index 5bd92166d34..dd8e6ac3dcd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ObservationLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ObservationLayoutEditPolicy.java @@ -1,65 +1,65 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationStereotypeLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationStereotypeLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for Observations.
- * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on
- * children that are external label.
- * The code generated by GMF can be found in {@link TimeObservationEditPart#createLayoutEditPolicy()}.
- */
-public class ObservationLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case DurationObservationNameEditPart.VISUAL_ID:
- case DurationObservationStereotypeLabelEditPart.VISUAL_ID:
- case TimeObservationNameEditPart.VISUAL_ID:
- case TimeObservationStereotypeLabelEditPart.VISUAL_ID:
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationNameEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationStereotypeLabelEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationNameEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationStereotypeLabelEditPart; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; + +/** + * This edit policy replaces the GMF generated edit policy for Observations. + * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on + * children that are external label. + * The code generated by GMF can be found in {@link TimeObservationEditPart#createLayoutEditPolicy()}. + */ +public class ObservationLayoutEditPolicy extends LayoutEditPolicy { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case DurationObservationNameEditPart.VISUAL_ID: + case DurationObservationStereotypeLabelEditPart.VISUAL_ID: + case TimeObservationNameEditPart.VISUAL_ID: + case TimeObservationStereotypeLabelEditPart.VISUAL_ID: + return new ExternalLabelPrimaryDragRoleEditPolicy(); + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java index 48f68827dc9..86302dc7508 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java @@ -1,238 +1,238 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy;
-import org.eclipse.papyrus.uml.diagram.composite.custom.helper.ParameterLabelHelper;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Specific edit policy for label displaying stereotypes and their properties for edges representing
- * UML elements.
- */
-public class ParameterLabelEditPolicy extends AbstractMaskManagedEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addAdditionalListeners() {
- super.addAdditionalListeners();
- Parameter parameter = getUMLElement();
- if (parameter == null) {
- // check semantic element is not null and this is really an instance of Parameter
- return;
- }
- // adds a listener to the element itself, and to linked elements, like Type
- if (parameter.getType() != null) {
- getDiagramEventBroker().addNotificationListener(parameter.getType(), this);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getDefaultDisplayValue() {
- return ICustomAppearance.DEFAULT_UML_PARAMETER;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<String, String> getMasks() {
- return ParameterLabelHelper.getInstance().getMasks();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Parameter getUMLElement() {
- return (Parameter) super.getUMLElement();
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- public void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- // change the label of the figure managed by the host edit part (managed by the parent edit
- // part in general...)
- // it must be changed only if:
- // - the annotation corresponding to the display of the stereotype changes
- // - the stereotype application list has changed
- Object object = notification.getNotifier();
- Parameter parameter = (Parameter) hostSemanticElement;
-
- if ((object == null) || (hostSemanticElement == null)) {
- return;
- }
-
- if (object.equals(parameter)) {
- notifyParameterChanged(parameter, notification);
- } else if (object.equals(parameter.getType())) {
- notifyParameterTypeChanged(parameter.getType(), notification);
- }
-
- if (isMaskManagedAnnotation(object)) {
- refreshDisplay();
- }
-
- if (isRemovedMaskManagedLabelAnnotation(object, notification)) {
- refreshDisplay();
- }
-
- }
-
- /**
- * notifies that the the parameter has changed.
- *
- * @param parameter
- * the parameter that has changed
- * @param notification
- * the notification send when the element has been changed
- */
- protected void notifyParameterChanged(Parameter parameter, Notification notification) {
- switch (notification.getFeatureID(Parameter.class)) {
- case UMLPackage.PARAMETER__NAME:
- case UMLPackage.PARAMETER__VISIBILITY:
- case UMLPackage.PARAMETER__DIRECTION:
- case UMLPackage.PARAMETER__LOWER:
- case UMLPackage.PARAMETER__LOWER_VALUE:
- case UMLPackage.PARAMETER__UPPER:
- case UMLPackage.PARAMETER__UPPER_VALUE:
- case UMLPackage.PARAMETER__DEFAULT_VALUE:
- case UMLPackage.PARAMETER__EFFECT:
- case UMLPackage.PARAMETER__IS_ORDERED:
- case UMLPackage.PARAMETER__IS_UNIQUE:
- case UMLPackage.PARAMETER__IS_EXCEPTION:
- case UMLPackage.PARAMETER__IS_STREAM:
- refreshDisplay();
- break;
- case UMLPackage.PARAMETER__TYPE:
-
- switch (notification.getEventType()) {
- // if it is added => adds listener to the type element
- case Notification.ADD:
- getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this);
- refreshDisplay();
- // if it is removed => removes listener from the type element
- break;
- case Notification.ADD_MANY: // should never happen
- if (notification.getNewValue() instanceof List<?>) {
- List<?> addedElements = (List<?>) notification.getNewValue();
- for (Object addedElement : addedElements) {
- if (addedElement instanceof EObject) {
- getDiagramEventBroker().addNotificationListener((EObject) addedElement, this);
- }
- }
- }
- refreshDisplay();
- break;
- case Notification.REMOVE:
- getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this);
- refreshDisplay();
- break;
- case Notification.REMOVE_MANY: // should never happen
- if (notification.getOldValue() instanceof List<?>) {
- List<?> removedElements = (List<?>) notification.getOldValue();
- for (Object removedElement : removedElements) {
- if (removedElement instanceof EObject) {
- getDiagramEventBroker().removeNotificationListener((EObject) removedElement, this);
- }
- }
- }
- refreshDisplay();
- break;
- // if it is set, remove the old one and adds the new one. this is the method use when
- // the type is set or removed...
- case Notification.SET:
- if (notification.getNewValue() != null) {
- getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this);
- }
- if (notification.getOldValue() != null) {
- getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this);
- }
- refreshDisplay();
-
- default:
- break;
-
- }
-
- break;
- default:
- // does nothing in other cases
- break;
- }
- }
-
- /**
- * notifies that the type of the parameter has changed.
- *
- * @param type
- * the type of the parameter that has changed
- * @param notification
- * the notification send when the element has been changed
- */
- protected void notifyParameterTypeChanged(Type type, Notification notification) {
- switch (notification.getFeatureID(Parameter.class)) {
- case UMLPackage.TYPE__NAME:
- refreshDisplay(); // type name has changed => refresh the parameter display
- break;
- default:
- // does nothing by default
- break;
- }
- }
-
- /**
- * Refreshes the display of the edit part
- */
- @Override
- public void refreshDisplay() {
- // calls the helper for this edit Part
- ParameterLabelHelper.getInstance().refreshEditPartDisplay((GraphicalEditPart) getHost());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void removeAdditionalListeners() {
- super.removeAdditionalListeners();
- Parameter parameter = getUMLElement();
- if (parameter == null) {
- // check semantic element is not null and this is really an instance of Parameter
- return;
- }
- if (parameter.getType() != null) {
- getDiagramEventBroker().removeNotificationListener(parameter.getType(), this);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy; +import org.eclipse.papyrus.uml.diagram.composite.custom.helper.ParameterLabelHelper; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Specific edit policy for label displaying stereotypes and their properties for edges representing + * UML elements. + */ +public class ParameterLabelEditPolicy extends AbstractMaskManagedEditPolicy { + + /** + * {@inheritDoc} + */ + @Override + public void addAdditionalListeners() { + super.addAdditionalListeners(); + Parameter parameter = getUMLElement(); + if (parameter == null) { + // check semantic element is not null and this is really an instance of Parameter + return; + } + // adds a listener to the element itself, and to linked elements, like Type + if (parameter.getType() != null) { + getDiagramEventBroker().addNotificationListener(parameter.getType(), this); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Collection<String> getDefaultDisplayValue() { + return ICustomAppearance.DEFAULT_UML_PARAMETER; + } + + /** + * {@inheritDoc} + */ + @Override + public Map<String, String> getMasks() { + return ParameterLabelHelper.getInstance().getMasks(); + } + + /** + * {@inheritDoc} + */ + @Override + public Parameter getUMLElement() { + return (Parameter) super.getUMLElement(); + } + + /** + * {@inheritedDoc} + */ + @Override + public void notifyChanged(Notification notification) { + super.notifyChanged(notification); + // change the label of the figure managed by the host edit part (managed by the parent edit + // part in general...) + // it must be changed only if: + // - the annotation corresponding to the display of the stereotype changes + // - the stereotype application list has changed + Object object = notification.getNotifier(); + Parameter parameter = (Parameter) hostSemanticElement; + + if ((object == null) || (hostSemanticElement == null)) { + return; + } + + if (object.equals(parameter)) { + notifyParameterChanged(parameter, notification); + } else if (object.equals(parameter.getType())) { + notifyParameterTypeChanged(parameter.getType(), notification); + } + + if (isMaskManagedAnnotation(object)) { + refreshDisplay(); + } + + if (isRemovedMaskManagedLabelAnnotation(object, notification)) { + refreshDisplay(); + } + + } + + /** + * notifies that the the parameter has changed. + * + * @param parameter + * the parameter that has changed + * @param notification + * the notification send when the element has been changed + */ + protected void notifyParameterChanged(Parameter parameter, Notification notification) { + switch (notification.getFeatureID(Parameter.class)) { + case UMLPackage.PARAMETER__NAME: + case UMLPackage.PARAMETER__VISIBILITY: + case UMLPackage.PARAMETER__DIRECTION: + case UMLPackage.PARAMETER__LOWER: + case UMLPackage.PARAMETER__LOWER_VALUE: + case UMLPackage.PARAMETER__UPPER: + case UMLPackage.PARAMETER__UPPER_VALUE: + case UMLPackage.PARAMETER__DEFAULT_VALUE: + case UMLPackage.PARAMETER__EFFECT: + case UMLPackage.PARAMETER__IS_ORDERED: + case UMLPackage.PARAMETER__IS_UNIQUE: + case UMLPackage.PARAMETER__IS_EXCEPTION: + case UMLPackage.PARAMETER__IS_STREAM: + refreshDisplay(); + break; + case UMLPackage.PARAMETER__TYPE: + + switch (notification.getEventType()) { + // if it is added => adds listener to the type element + case Notification.ADD: + getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this); + refreshDisplay(); + // if it is removed => removes listener from the type element + break; + case Notification.ADD_MANY: // should never happen + if (notification.getNewValue() instanceof List<?>) { + List<?> addedElements = (List<?>) notification.getNewValue(); + for (Object addedElement : addedElements) { + if (addedElement instanceof EObject) { + getDiagramEventBroker().addNotificationListener((EObject) addedElement, this); + } + } + } + refreshDisplay(); + break; + case Notification.REMOVE: + getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this); + refreshDisplay(); + break; + case Notification.REMOVE_MANY: // should never happen + if (notification.getOldValue() instanceof List<?>) { + List<?> removedElements = (List<?>) notification.getOldValue(); + for (Object removedElement : removedElements) { + if (removedElement instanceof EObject) { + getDiagramEventBroker().removeNotificationListener((EObject) removedElement, this); + } + } + } + refreshDisplay(); + break; + // if it is set, remove the old one and adds the new one. this is the method use when + // the type is set or removed... + case Notification.SET: + if (notification.getNewValue() != null) { + getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this); + } + if (notification.getOldValue() != null) { + getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this); + } + refreshDisplay(); + + default: + break; + + } + + break; + default: + // does nothing in other cases + break; + } + } + + /** + * notifies that the type of the parameter has changed. + * + * @param type + * the type of the parameter that has changed + * @param notification + * the notification send when the element has been changed + */ + protected void notifyParameterTypeChanged(Type type, Notification notification) { + switch (notification.getFeatureID(Parameter.class)) { + case UMLPackage.TYPE__NAME: + refreshDisplay(); // type name has changed => refresh the parameter display + break; + default: + // does nothing by default + break; + } + } + + /** + * Refreshes the display of the edit part + */ + @Override + public void refreshDisplay() { + // calls the helper for this edit Part + ParameterLabelHelper.getInstance().refreshEditPartDisplay((GraphicalEditPart) getHost()); + } + + /** + * {@inheritDoc} + */ + @Override + protected void removeAdditionalListeners() { + super.removeAdditionalListeners(); + Parameter parameter = getUMLElement(); + if (parameter == null) { + // check semantic element is not null and this is really an instance of Parameter + return; + } + if (parameter.getType() != null) { + getDiagramEventBroker().removeNotificationListener(parameter.getType(), this); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLayoutEditPolicy.java index 50dc7c2d166..1b8f22fbf20 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLayoutEditPolicy.java @@ -1,62 +1,62 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterNameEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for Parameter.
- * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on
- * children that are external label.
- * The code generated by GMF can be found in {@link ParameterEditPart#createLayoutEditPolicy()}.
- */
-public class ParameterLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case ParameterNameEditPart.VISUAL_ID:
- case ParameterAppliedStereotypeEditPart.VISUAL_ID:
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterNameEditPart; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; + +/** + * This edit policy replaces the GMF generated edit policy for Parameter. + * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on + * children that are external label. + * The code generated by GMF can be found in {@link ParameterEditPart#createLayoutEditPolicy()}. + */ +public class ParameterLayoutEditPolicy extends LayoutEditPolicy { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ParameterNameEditPart.VISUAL_ID: + case ParameterAppliedStereotypeEditPart.VISUAL_ID: + return new ExternalLabelPrimaryDragRoleEditPolicy(); + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLayoutEditPolicy.java index 9a2a1882411..ae6dc590bb0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLayoutEditPolicy.java @@ -1,61 +1,61 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for Port.
- * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on
- * children that are external label.
- * The code generated by GMF can be found in {@link PortEditPart#createLayoutEditPolicy()}.
- */
-public class PortLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case PortNameEditPart.VISUAL_ID:
- case PortAppliedStereotypeEditPart.VISUAL_ID:
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; + +/** + * This edit policy replaces the GMF generated edit policy for Port. + * In particular it installs {@link ExternalLabelPrimaryDragRoleEditPolicy} on + * children that are external label. + * The code generated by GMF can be found in {@link PortEditPart#createLayoutEditPolicy()}. + */ +public class PortLayoutEditPolicy extends LayoutEditPolicy { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case PortNameEditPart.VISUAL_ID: + case PortAppliedStereotypeEditPart.VISUAL_ID: + return new ExternalLabelPrimaryDragRoleEditPolicy(); + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/StructuredClassifierLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/StructuredClassifierLayoutEditPolicy.java index 9ddd4ee5c1a..a07ada999ff 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/StructuredClassifierLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/StructuredClassifierLayoutEditPolicy.java @@ -1,113 +1,113 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for StructuredClassifier(s).
- * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Port
- * in order to locate it at the cursor position.
- * An example of code generated by GMF can be found in {@link ClassCompositeEditPart#createLayoutEditPolicy()}.
- */
-public class StructuredClassifierLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case PortEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- if (request instanceof CreateViewAndElementRequest) {
-
- CreateViewAndElementRequest req = (CreateViewAndElementRequest) request;
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
-
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- Iterator<?> iter = req.getViewDescriptors().iterator();
-
- // Retrieve parent location
- Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();
-
- // Compute relative creation location
- Point requestedLocation = request.getLocation().getCopy();
- getHostFigure().translateToRelative(requestedLocation);
-
- // Create proposed creation bounds and use the locator to find the expected position
- PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE);
- Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
- Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
- // Convert the calculated preferred bounds as relative to parent location
- Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
-
- while (iter.hasNext()) {
-
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor) iter.next();
- cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, creationBounds));
- }
-
- if (cc.reduce() == null) {
- return null;
- }
-
- return new ICommandProxy(cc.reduce());
- }
- return null;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; + +import java.util.Iterator; + +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; + +/** + * This edit policy replaces the GMF generated edit policy for StructuredClassifier(s). + * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Port + * in order to locate it at the cursor position. + * An example of code generated by GMF can be found in {@link ClassCompositeEditPart#createLayoutEditPolicy()}. + */ +public class StructuredClassifierLayoutEditPolicy extends LayoutEditPolicy { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case PortEditPart.VISUAL_ID: + + return new BorderItemResizableEditPolicy(); + + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + if (request instanceof CreateViewAndElementRequest) { + + CreateViewAndElementRequest req = (CreateViewAndElementRequest) request; + + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); + + CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label); + Iterator<?> iter = req.getViewDescriptors().iterator(); + + // Retrieve parent location + Point parentLoc = getHostFigure().getBounds().getLocation().getCopy(); + + // Compute relative creation location + Point requestedLocation = request.getLocation().getCopy(); + getHostFigure().translateToRelative(requestedLocation); + + // Create proposed creation bounds and use the locator to find the expected position + PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE); + Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20)); + Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds); + + // Convert the calculated preferred bounds as relative to parent location + Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated()); + + while (iter.hasNext()) { + + CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor) iter.next(); + cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, creationBounds)); + } + + if (cc.reduce() == null) { + return null; + } + + return new ICommandProxy(cc.reduce()); + } + return null; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ActivityCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ActivityCompositeFigure.java index 6df84110c49..9feed465f5f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ActivityCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ActivityCompositeFigure.java @@ -1,26 +1,26 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Activity.
- */
-public class ActivityCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Activity"; //$NON-NLS-1$
-
- public ActivityCompositeFigure() {
- super(TAG_LABEL);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Activity. + */ +public class ActivityCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Activity"; //$NON-NLS-1$ + + public ActivityCompositeFigure() { + super(TAG_LABEL); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ClassCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ClassCompositeFigure.java index b899004b692..c4e1a22cfff 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ClassCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ClassCompositeFigure.java @@ -1,21 +1,21 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Class.
- */
-public class ClassCompositeFigure extends CompositeFigure {
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Class. + */ +public class ClassCompositeFigure extends CompositeFigure { + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/CollaborationCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/CollaborationCompositeFigure.java index e072a6ed697..6348d4e3334 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/CollaborationCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/CollaborationCompositeFigure.java @@ -1,38 +1,38 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-
-/**
- * Figure for Composite representation of Collaboration.
- */
-public class CollaborationCompositeFigure extends CompositeFigure {
-
- /**
- * Value of the textual tag added to the figure.
- */
- private static String TAG_LABEL = "Collaboration"; //$NON-NLS-1$
-
- /**
- * Creates a new CollaborationCompositeFigure.
- */
- public CollaborationCompositeFigure() {
- super(TAG_LABEL);
-
- // Use custom dashed borders for Collaboration
- setCustomDash(DEFAULT_CUSTOM_DASH);
- setLineStyle(Graphics.LINE_CUSTOM);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.draw2d.Graphics; + +/** + * Figure for Composite representation of Collaboration. + */ +public class CollaborationCompositeFigure extends CompositeFigure { + + /** + * Value of the textual tag added to the figure. + */ + private static String TAG_LABEL = "Collaboration"; //$NON-NLS-1$ + + /** + * Creates a new CollaborationCompositeFigure. + */ + public CollaborationCompositeFigure() { + super(TAG_LABEL); + + // Use custom dashed borders for Collaboration + setCustomDash(DEFAULT_CUSTOM_DASH); + setLineStyle(Graphics.LINE_CUSTOM); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ComponentCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ComponentCompositeFigure.java index f108eaf1a80..f8ef063f6d3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ComponentCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ComponentCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Component.
- */
-public class ComponentCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Component"; //$NON-NLS-1$
-
- public ComponentCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Component. + */ +public class ComponentCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Component"; //$NON-NLS-1$ + + public ComponentCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ConnectorFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ConnectorFigure.java index 4881f68fe94..cd3446de304 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ConnectorFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ConnectorFigure.java @@ -1,112 +1,112 @@ -/*****************************************************************************
- * Copyright (c) 2009-2017 CEA LIST, ALL4TEC 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:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 515661
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
-
-/**
- * Figure for Connector representation.
- */
-public class ConnectorFigure extends UMLEdgeFigure {
-
- /** Owned label for Connector Name **/
- private WrappingLabel fNameLabel;
-
- /** Owned label for Connector source multiplicity **/
- private WrappingLabel fMultiplicitySourceLabel;
-
- /** Owned label for Connector target multiplicity **/
- private WrappingLabel fMultiplicityTargetLabel;
-
- /**
- * Default constructor
- */
- public ConnectorFigure() {
- super();
- createContents();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createContents() {
- super.createContents();
-
- fNameLabel = new WrappingLabel();
- // fNameLabel.setText(""); //$NON-NLS-1$
-
- this.add(fNameLabel);
-
- fMultiplicitySourceLabel = new PapyrusWrappingLabel();
- // fMultiplicitySourceLabel.setText(""); //$NON-NLS-1$
-
- this.add(fMultiplicitySourceLabel);
-
- fMultiplicityTargetLabel = new PapyrusWrappingLabel();
- // fMultiplicityTargetLabel.setText(""); //$NON-NLS-1$
-
- this.add(fMultiplicityTargetLabel);
- }
-
- /**
- * Gets the applied stereotype association label.
- *
- * @return the applied stereotype association label
- */
- public WrappingLabel getAppliedStereotypeAssociationLabel() {
- return appliedStereotypeLabel;
- }
-
- /**
- * Gets the Connector name label.
- *
- * @return the Connector name label
- */
- public WrappingLabel getNameLabel() {
- return fNameLabel;
- }
-
- /**
- * Gets the multiplicity source label.
- *
- * @return the multiplicity source label
- */
- public WrappingLabel getMultiplicitySourceLabel() {
- return fMultiplicitySourceLabel;
- }
-
- /**
- * Gets the multiplicity target label.
- *
- * @return the multiplicity target label
- */
- public WrappingLabel getMultiplicityTargetLabel() {
- return fMultiplicityTargetLabel;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.common.figure.edge.PapyrusEdgeFigure#resetStyle()
- */
- @Override
- public void resetStyle() {
- super.resetStyle();
- setSourceDecoration(null);
- setTargetDecoration(null);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2017 CEA LIST, ALL4TEC 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: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 515661 + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure; + +/** + * Figure for Connector representation. + */ +public class ConnectorFigure extends UMLEdgeFigure { + + /** Owned label for Connector Name **/ + private WrappingLabel fNameLabel; + + /** Owned label for Connector source multiplicity **/ + private WrappingLabel fMultiplicitySourceLabel; + + /** Owned label for Connector target multiplicity **/ + private WrappingLabel fMultiplicityTargetLabel; + + /** + * Default constructor + */ + public ConnectorFigure() { + super(); + createContents(); + } + + /** + * {@inheritDoc} + */ + @Override + protected void createContents() { + super.createContents(); + + fNameLabel = new WrappingLabel(); + // fNameLabel.setText(""); //$NON-NLS-1$ + + this.add(fNameLabel); + + fMultiplicitySourceLabel = new PapyrusWrappingLabel(); + // fMultiplicitySourceLabel.setText(""); //$NON-NLS-1$ + + this.add(fMultiplicitySourceLabel); + + fMultiplicityTargetLabel = new PapyrusWrappingLabel(); + // fMultiplicityTargetLabel.setText(""); //$NON-NLS-1$ + + this.add(fMultiplicityTargetLabel); + } + + /** + * Gets the applied stereotype association label. + * + * @return the applied stereotype association label + */ + public WrappingLabel getAppliedStereotypeAssociationLabel() { + return appliedStereotypeLabel; + } + + /** + * Gets the Connector name label. + * + * @return the Connector name label + */ + public WrappingLabel getNameLabel() { + return fNameLabel; + } + + /** + * Gets the multiplicity source label. + * + * @return the multiplicity source label + */ + public WrappingLabel getMultiplicitySourceLabel() { + return fMultiplicitySourceLabel; + } + + /** + * Gets the multiplicity target label. + * + * @return the multiplicity target label + */ + public WrappingLabel getMultiplicityTargetLabel() { + return fMultiplicityTargetLabel; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.figure.edge.PapyrusEdgeFigure#resetStyle() + */ + @Override + public void resetStyle() { + super.resetStyle(); + setSourceDecoration(null); + setTargetDecoration(null); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DeviceCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DeviceCompositeFigure.java index 297e8529d0c..178e86de5c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DeviceCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DeviceCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Device.
- */
-public class DeviceCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Device"; //$NON-NLS-1$
-
- public DeviceCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Device. + */ +public class DeviceCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Device"; //$NON-NLS-1$ + + public DeviceCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DurationObservationNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DurationObservationNodeFigure.java index a89a73a96e4..b1027ddff85 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DurationObservationNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/DurationObservationNodeFigure.java @@ -1,37 +1,37 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Figure for DurationObservation
- */
-// to delete
-public class DurationObservationNodeFigure extends AbstractObservationNodeFigure {
-
- public static final String IMAGE_DURATION = "DurationObservation.gif"; //$NON-NLS-1$
-
- @Override
- public void setAppliedStereotypeIcon(Image image) {
- if (image == null) {
- setIcon(Activator.getPluginIconImage(ID, PATH + IMAGE_DURATION));
- } else {
- setIcon(image);
- }
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.swt.graphics.Image; + +/** + * Figure for DurationObservation + */ +// to delete +public class DurationObservationNodeFigure extends AbstractObservationNodeFigure { + + public static final String IMAGE_DURATION = "DurationObservation.gif"; //$NON-NLS-1$ + + @Override + public void setAppliedStereotypeIcon(Image image) { + if (image == null) { + setIcon(Activator.getPluginIconImage(ID, PATH + IMAGE_DURATION)); + } else { + setIcon(image); + } + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ExecutionEnvironmentCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ExecutionEnvironmentCompositeFigure.java index dcb44e6f1a8..ab7a80eeb61 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ExecutionEnvironmentCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ExecutionEnvironmentCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of ExecutionEnvironment.
- */
-public class ExecutionEnvironmentCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "ExecutionEnvironment"; //$NON-NLS-1$
-
- public ExecutionEnvironmentCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of ExecutionEnvironment. + */ +public class ExecutionEnvironmentCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "ExecutionEnvironment"; //$NON-NLS-1$ + + public ExecutionEnvironmentCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/FunctionBehaviorCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/FunctionBehaviorCompositeFigure.java index 79c550bf2e4..c4564fdc5b7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/FunctionBehaviorCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/FunctionBehaviorCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of FunctionBehavior.
- */
-public class FunctionBehaviorCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "FunctionBehavior"; //$NON-NLS-1$
-
- public FunctionBehaviorCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of FunctionBehavior. + */ +public class FunctionBehaviorCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "FunctionBehavior"; //$NON-NLS-1$ + + public FunctionBehaviorCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationFlowFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationFlowFigure.java index da76d3d8c06..f539dc6ef90 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationFlowFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationFlowFigure.java @@ -1,43 +1,43 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-
-/**
- * Create an {@link InformationFlowFigure} with the tag <code>« flow »</code>
- *
- */
-public class InformationFlowFigure extends DashedEdgeFigure {
-
- /** Label displaying conveyed information */
- private WrappingLabel conveyedLabel;
-
- /** Get the label for conveyed information */
- public WrappingLabel getConveyedLabel() {
- return conveyedLabel;
- }
-
- @Override
- protected void createContents() {
- super.createContents();
- conveyedLabel = new WrappingLabel();
- conveyedLabel.setOpaque(false);
- conveyedLabel.setForegroundColor(getNameLabel().getForegroundColor());
- conveyedLabel.setFont(getNameLabel().getFont());
- add(conveyedLabel, 0);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; + +/** + * Create an {@link InformationFlowFigure} with the tag <code>« flow »</code> + * + */ +public class InformationFlowFigure extends DashedEdgeFigure { + + /** Label displaying conveyed information */ + private WrappingLabel conveyedLabel; + + /** Get the label for conveyed information */ + public WrappingLabel getConveyedLabel() { + return conveyedLabel; + } + + @Override + protected void createContents() { + super.createContents(); + conveyedLabel = new WrappingLabel(); + conveyedLabel.setOpaque(false); + conveyedLabel.setForegroundColor(getNameLabel().getForegroundColor()); + conveyedLabel.setFont(getNameLabel().getFont()); + add(conveyedLabel, 0); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationItemFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationItemFigure.java index 25f8e25fa20..ea9fab7e59f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationItemFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InformationItemFigure.java @@ -1,38 +1,38 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
-
-/**
- * Figure for Composite representation of InformationItem.
- */
-public class InformationItemFigure extends RoundedCompartmentFigure {
-
- /** Value of the textual tag added to the figure. */
- private static String TAG_LABEL = "Information"; //$NON-NLS-1$
-
- /** The List of Compartment */
- private final static List<String> NO_COMPARTMENT = new ArrayList<String>();
-
- /**
- * Creates a new InformationItemFigure.
- */
- public InformationItemFigure() {
- super(NO_COMPARTMENT, TAG_LABEL);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure; + +/** + * Figure for Composite representation of InformationItem. + */ +public class InformationItemFigure extends RoundedCompartmentFigure { + + /** Value of the textual tag added to the figure. */ + private static String TAG_LABEL = "Information"; //$NON-NLS-1$ + + /** The List of Compartment */ + private final static List<String> NO_COMPARTMENT = new ArrayList<String>(); + + /** + * Creates a new InformationItemFigure. + */ + public InformationItemFigure() { + super(NO_COMPARTMENT, TAG_LABEL); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InteractionCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InteractionCompositeFigure.java index a56f628075a..5df309f13f1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InteractionCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InteractionCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Interaction.
- */
-public class InteractionCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Interaction"; //$NON-NLS-1$
-
- public InteractionCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Interaction. + */ +public class InteractionCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Interaction"; //$NON-NLS-1$ + + public InteractionCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InterfaceCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InterfaceCompositeFigure.java index a4c4b5a819f..c38bf09dfc4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InterfaceCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/InterfaceCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Class.
- */
-public class InterfaceCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Interface"; //$NON-NLS-1$
-
- public InterfaceCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Class. + */ +public class InterfaceCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Interface"; //$NON-NLS-1$ + + public InterfaceCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/NodeCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/NodeCompositeFigure.java index 4c4c49e415a..ccf5d2b3da9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/NodeCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/NodeCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of Node.
- */
-public class NodeCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "Node"; //$NON-NLS-1$
-
- public NodeCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of Node. + */ +public class NodeCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "Node"; //$NON-NLS-1$ + + public NodeCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/OpaqueBehaviorCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/OpaqueBehaviorCompositeFigure.java index aa33d0809d6..3d308956d04 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/OpaqueBehaviorCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/OpaqueBehaviorCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of OpaqueBehavior.
- */
-public class OpaqueBehaviorCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "OpaqueBehavior"; //$NON-NLS-1$
-
- public OpaqueBehaviorCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of OpaqueBehavior. + */ +public class OpaqueBehaviorCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "OpaqueBehavior"; //$NON-NLS-1$ + + public OpaqueBehaviorCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PropertyPartFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PropertyPartFigure.java index 5163cba329f..b9082c9066b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PropertyPartFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PropertyPartFigure.java @@ -1,21 +1,21 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Part (in Composite) representation of Property.
- */
-public class PropertyPartFigure extends CompositeFigure {
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Part (in Composite) representation of Property. + */ +public class PropertyPartFigure extends CompositeFigure { + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ProtocolStateMachineCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ProtocolStateMachineCompositeFigure.java index 86ca305fd69..241cd342c38 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ProtocolStateMachineCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/ProtocolStateMachineCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of ProtocolStateMachine.
- */
-public class ProtocolStateMachineCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "ProtocolStateMachine"; //$NON-NLS-1$
-
- public ProtocolStateMachineCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of ProtocolStateMachine. + */ +public class ProtocolStateMachineCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "ProtocolStateMachine"; //$NON-NLS-1$ + + public ProtocolStateMachineCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RepresentationFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RepresentationFigure.java index 16ca7abbfa1..481527c59e8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RepresentationFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RepresentationFigure.java @@ -1,66 +1,66 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-
-/**
- * Create an {@link RepresentationFigure} with the tag <code>« representation »</code>
- *
- * This figure represents the representation link between an InformationItem and the possible
- * elements (Signal, Class, Actor, InformationItem, Interface, Component.
- *
- */
-public class RepresentationFigure extends DashedEdgeFigure {
-
- /** Label for the tag display */
- private WrappingLabel tagLabel;
-
- /** Get the tag label */
- public WrappingLabel getTagLabel() {
- return tagLabel;
- }
-
- /** Value of the textual tag added to the figure. */
- private static String TAG_LABEL = "representation"; //$NON-NLS-1$
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createContents() {
- super.createContents();
- initTagLabel(TAG_LABEL);
- }
-
- /**
- * Create the tag label in the figure. The tag label is created if value is not null.
- *
- * @param value
- * the value to use
- */
- protected void initTagLabel(String value) {
- if (value != null && value.length() > 0) {
- tagLabel = new WrappingLabel();
- String textToDisplay = Activator.ST_LEFT + value + Activator.ST_RIGHT;
- tagLabel.setText(textToDisplay);
- tagLabel.setOpaque(false);
- tagLabel.setForegroundColor(getNameLabel().getForegroundColor());
- tagLabel.setFont(getNameLabel().getFont());
- add(tagLabel, 0);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; + +/** + * Create an {@link RepresentationFigure} with the tag <code>« representation »</code> + * + * This figure represents the representation link between an InformationItem and the possible + * elements (Signal, Class, Actor, InformationItem, Interface, Component. + * + */ +public class RepresentationFigure extends DashedEdgeFigure { + + /** Label for the tag display */ + private WrappingLabel tagLabel; + + /** Get the tag label */ + public WrappingLabel getTagLabel() { + return tagLabel; + } + + /** Value of the textual tag added to the figure. */ + private static String TAG_LABEL = "representation"; //$NON-NLS-1$ + + /** + * {@inheritDoc} + */ + @Override + protected void createContents() { + super.createContents(); + initTagLabel(TAG_LABEL); + } + + /** + * Create the tag label in the figure. The tag label is created if value is not null. + * + * @param value + * the value to use + */ + protected void initTagLabel(String value) { + if (value != null && value.length() > 0) { + tagLabel = new WrappingLabel(); + String textToDisplay = Activator.ST_LEFT + value + Activator.ST_RIGHT; + tagLabel.setText(textToDisplay); + tagLabel.setOpaque(false); + tagLabel.setForegroundColor(getNameLabel().getForegroundColor()); + tagLabel.setFont(getNameLabel().getFont()); + add(tagLabel, 0); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RoleBindingFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RoleBindingFigure.java index 8e0c80316eb..a8ce68f23c1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RoleBindingFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/RoleBindingFigure.java @@ -1,57 +1,57 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-
-/**
- * Figure for RoleBinding representation. This element is a dependency used to bind roles from the
- * type of a CollaborationUse to ConnectableElement(s) owned by the Structured.
- */
-public class RoleBindingFigure extends DashedEdgeFigure {
-
- /** Owned label for RoleBinding Role **/
- protected WrappingLabel roleLabel;
-
- /**
- * Default constructor
- */
- public RoleBindingFigure() {
- super(false);
- createContents();
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- protected void createContents() {
- super.createContents();
-
- roleLabel = new WrappingLabel();
- roleLabel.setTextWrap(true);
- this.add(roleLabel);
- }
-
- /**
- * Gets the RoleBinding role label.
- *
- * @return the RoleBinding role label
- */
- public WrappingLabel getRoleLabel() {
- return roleLabel;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; + +/** + * Figure for RoleBinding representation. This element is a dependency used to bind roles from the + * type of a CollaborationUse to ConnectableElement(s) owned by the Structured. + */ +public class RoleBindingFigure extends DashedEdgeFigure { + + /** Owned label for RoleBinding Role **/ + protected WrappingLabel roleLabel; + + /** + * Default constructor + */ + public RoleBindingFigure() { + super(false); + createContents(); + } + + /** + * + * {@inheritDoc} + */ + @Override + protected void createContents() { + super.createContents(); + + roleLabel = new WrappingLabel(); + roleLabel.setTextWrap(true); + this.add(roleLabel); + } + + /** + * Gets the RoleBinding role label. + * + * @return the RoleBinding role label + */ + public WrappingLabel getRoleLabel() { + return roleLabel; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/StateMachineCompositeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/StateMachineCompositeFigure.java index 9068734b320..d4f48c945c9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/StateMachineCompositeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/StateMachineCompositeFigure.java @@ -1,27 +1,27 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-/**
- * Figure for Composite representation of StateMachine.
- */
-public class StateMachineCompositeFigure extends CompositeFigure {
-
- private static String TAG_LABEL = "StateMachine"; //$NON-NLS-1$
-
- public StateMachineCompositeFigure() {
- super(TAG_LABEL);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +/** + * Figure for Composite representation of StateMachine. + */ +public class StateMachineCompositeFigure extends CompositeFigure { + + private static String TAG_LABEL = "StateMachine"; //$NON-NLS-1$ + + public StateMachineCompositeFigure() { + super(TAG_LABEL); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/TimeObservationNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/TimeObservationNodeFigure.java index 500a6e6f302..be0f680c747 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/TimeObservationNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/TimeObservationNodeFigure.java @@ -1,38 +1,38 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
-
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Figure for TimeObservation
- */
-// To delete
-public class TimeObservationNodeFigure extends AbstractObservationNodeFigure {
-
- public static final String IMAGE_OBSERVATION = "TimeObservation.gif"; //$NON-NLS-1$
-
- @Override
- public void setAppliedStereotypeIcon(Image image) {
- if (image == null) {
- setIcon(Activator.getPluginIconImage(ID, PATH + IMAGE_OBSERVATION));
- } else {
- setIcon(image);
- }
-
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.figures; + +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.swt.graphics.Image; + +/** + * Figure for TimeObservation + */ +// To delete +public class TimeObservationNodeFigure extends AbstractObservationNodeFigure { + + public static final String IMAGE_OBSERVATION = "TimeObservation.gif"; //$NON-NLS-1$ + + @Override + public void setAppliedStereotypeIcon(Image image) { + if (image == null) { + setIcon(Activator.getPluginIconImage(ID, PATH + IMAGE_OBSERVATION)); + } else { + setIcon(image); + } + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CompositeLinkMappingHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CompositeLinkMappingHelper.java index d13a5b645e8..05ac2104c8b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CompositeLinkMappingHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CompositeLinkMappingHelper.java @@ -1,94 +1,94 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.helper;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonSourceUMLSwitch;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonTargetUMLSwitch;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * This helper is used to retrieve Link ends for use in drag and drop behavior
- */
-public class CompositeLinkMappingHelper implements ILinkMappingHelper {
-
- /**
- * Singleton management
- */
- private static class SingletonHolder {
-
- /**
- * Singleton instance
- */
- private final static CompositeLinkMappingHelper instance = new CompositeLinkMappingHelper();
- }
-
- /**
- * Get singleton instance
- *
- * @return the instance
- */
- public static CompositeLinkMappingHelper getInstance() {
- return SingletonHolder.instance;
- }
-
- /**
- * private constructor
- */
- private CompositeLinkMappingHelper() {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<?> getSource(Element link) {
- return LinkMappingHelper.getSource(link, new CommonSourceUMLSwitch() {
-
- @Override
- public java.util.Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
- return object.getSources();
- };
-
- @Override
- public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) {
- return object.getEnds();
- };
- });
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<?> getTarget(Element link) {
- return LinkMappingHelper.getTarget(link, new CommonTargetUMLSwitch() {
-
- @Override
- public java.util.Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
- return object.getTargets();
- };
-
- @Override
- public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) {
- return object.getEnds();
- };
- });
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.helper; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper; +import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper; +import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonSourceUMLSwitch; +import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonTargetUMLSwitch; +import org.eclipse.uml2.uml.Element; + +/** + * This helper is used to retrieve Link ends for use in drag and drop behavior + */ +public class CompositeLinkMappingHelper implements ILinkMappingHelper { + + /** + * Singleton management + */ + private static class SingletonHolder { + + /** + * Singleton instance + */ + private final static CompositeLinkMappingHelper instance = new CompositeLinkMappingHelper(); + } + + /** + * Get singleton instance + * + * @return the instance + */ + public static CompositeLinkMappingHelper getInstance() { + return SingletonHolder.instance; + } + + /** + * private constructor + */ + private CompositeLinkMappingHelper() { + // do nothing + } + + /** + * {@inheritDoc} + */ + @Override + public Collection<?> getSource(Element link) { + return LinkMappingHelper.getSource(link, new CommonSourceUMLSwitch() { + + @Override + public java.util.Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) { + return object.getSources(); + }; + + @Override + public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) { + return object.getEnds(); + }; + }); + } + + /** + * {@inheritDoc} + */ + @Override + public Collection<?> getTarget(Element link) { + return LinkMappingHelper.getTarget(link, new CommonTargetUMLSwitch() { + + @Override + public java.util.Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) { + return object.getTargets(); + }; + + @Override + public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) { + return object.getEnds(); + }; + }); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java index 9e9800d08cd..566b4c03b10 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java @@ -1,101 +1,101 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.helper;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.ParameterUtil;
-import org.eclipse.uml2.uml.Parameter;
-
-/**
- * Helper for labels displaying {@link Parameter} in Composite Diagram
- */
-public class ParameterLabelHelper extends StereotypedElementLabelHelper {
-
- /** Single instance */
- private static ParameterLabelHelper labelHelper;
-
- /** Single instance getter */
- public static ParameterLabelHelper getInstance() {
- if (labelHelper == null) {
- labelHelper = new ParameterLabelHelper();
- }
- return labelHelper;
- }
-
- /** Map for masks */
- protected final Map<String, String> masks = new HashMap<String, String>();
-
- /**
- * Returns the collection of mask names
- *
- * @return the collection of mask names
- */
- public Collection<String> getMaskLabels() {
- return masks.values();
- }
-
- /**
- * Returns the map of masks used to display a {@link Parameter}
- *
- * @return the {@link Map} of masks used to display a {@link Parameter}
- */
- public Map<String, String> getMasks() {
- return masks;
- }
-
- /** Disable constructor (private) */
- protected ParameterLabelHelper() {
- super();
- // initialize the map
- masks.clear();
- masks.put(ICustomAppearance.DISP_DIRECTION, "Direction");
- masks.put(ICustomAppearance.DISP_NAME, "Name");
- masks.put(ICustomAppearance.DISP_TYPE, "Type");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String elementLabel(GraphicalEditPart editPart) {
- Collection<String> displayValue = ICustomAppearance.DEFAULT_UML_PARAMETER;
-
- IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (policy != null) {
- displayValue = policy.getCurrentDisplayValue();
- }
- Parameter elem = getUMLElement(editPart);
- if (elem != null) {
- return ParameterUtil.getCustomLabel(elem, displayValue);
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Parameter getUMLElement(GraphicalEditPart editPart) {
- return (Parameter) ((View) editPart.getModel()).getElement();
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.helper; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.ParameterUtil; +import org.eclipse.uml2.uml.Parameter; + +/** + * Helper for labels displaying {@link Parameter} in Composite Diagram + */ +public class ParameterLabelHelper extends StereotypedElementLabelHelper { + + /** Single instance */ + private static ParameterLabelHelper labelHelper; + + /** Single instance getter */ + public static ParameterLabelHelper getInstance() { + if (labelHelper == null) { + labelHelper = new ParameterLabelHelper(); + } + return labelHelper; + } + + /** Map for masks */ + protected final Map<String, String> masks = new HashMap<String, String>(); + + /** + * Returns the collection of mask names + * + * @return the collection of mask names + */ + public Collection<String> getMaskLabels() { + return masks.values(); + } + + /** + * Returns the map of masks used to display a {@link Parameter} + * + * @return the {@link Map} of masks used to display a {@link Parameter} + */ + public Map<String, String> getMasks() { + return masks; + } + + /** Disable constructor (private) */ + protected ParameterLabelHelper() { + super(); + // initialize the map + masks.clear(); + masks.put(ICustomAppearance.DISP_DIRECTION, "Direction"); + masks.put(ICustomAppearance.DISP_NAME, "Name"); + masks.put(ICustomAppearance.DISP_TYPE, "Type"); + } + + /** + * {@inheritDoc} + */ + @Override + protected String elementLabel(GraphicalEditPart editPart) { + Collection<String> displayValue = ICustomAppearance.DEFAULT_UML_PARAMETER; + + IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (policy != null) { + displayValue = policy.getCurrentDisplayValue(); + } + Parameter elem = getUMLElement(editPart); + if (elem != null) { + return ParameterUtil.getCustomLabel(elem, displayValue); + } + return ""; + } + + /** + * {@inheritDoc} + */ + @Override + public Parameter getUMLElement(GraphicalEditPart editPart) { + return (Parameter) ((View) editPart.getModel()).getElement(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/CollaborationHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/CollaborationHelperAdvice.java index 434b090b073..330d5cedb35 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/CollaborationHelperAdvice.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/CollaborationHelperAdvice.java @@ -1,144 +1,144 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Collaboration;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- *
- * This advice is used to remove the view of the Collaboration roles
- *
- */
-public class CollaborationHelperAdvice extends AbstractEditHelperAdvice {
-
-
- @Override
- protected ICommand getBeforeDestroyReferenceCommand(DestroyReferenceRequest request) {
-
- EObject elementToEdit = request.getContainer();
- Set<View> viewsToDelete = new HashSet<View>();
-
- // Test if current destroy reference is removing a Property from Collaboration role
- if ((elementToEdit instanceof Collaboration) && (request.getContainingFeature() == UMLPackage.eINSTANCE.getCollaboration_CollaborationRole())) {
-
- // Removed referenced ConnectableElement from roles
- ConnectableElement refRole = (ConnectableElement) request.getReferencedObject();
- Collaboration collaborationToEdit = (Collaboration) elementToEdit;
-
- viewsToDelete.addAll(getViewsForRole(refRole, collaborationToEdit));
- }
-
- if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) {
- DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false);
- req.setClientContext(request.getClientContext());
- req.addParameters(request.getParameters());
- return req.getDestroyDependentsCommand(viewsToDelete);
- }
-
- return null;
- }
-
- @Override
- protected ICommand getBeforeSetCommand(SetRequest request) {
-
- EObject elementToEdit = request.getElementToEdit();
- Set<View> viewsToDelete = new HashSet<View>();
-
- if ((elementToEdit instanceof Collaboration) && (request.getFeature() == UMLPackage.eINSTANCE.getCollaboration_CollaborationRole())) {
-
- Collaboration collaborationToEdit = (Collaboration) elementToEdit;
-
- // Get the list of roles currently removed
- Set<ConnectableElement> removedRoles = new HashSet<ConnectableElement>();
- removedRoles.addAll(collaborationToEdit.getRoles());
- if (request.getValue() instanceof ConnectableElement) {
- removedRoles.remove(request.getValue());
- } else if (request.getValue() instanceof List<?>) {
- removedRoles.removeAll((List<?>) request.getValue());
- }
-
- // Parse removed roles and find views to delete
- Iterator<ConnectableElement> it = removedRoles.iterator();
- while (it.hasNext()) {
- ConnectableElement currentRole = it.next();
- viewsToDelete.addAll(getViewsForRole(currentRole, collaborationToEdit));
- }
-
- }
-
- if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) {
- DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false);
- req.setClientContext(request.getClientContext());
- req.addParameters(request.getParameters());
- return req.getDestroyDependentsCommand(viewsToDelete);
- }
-
- return null;
- }
-
- /**
- * <pre>
- * This method retrieves all views (only in Composite Structure Diagrams) that are representing the role.
- * </pre>
- *
- * @param role
- * the {@link ConnectableElement} currently removed from role list
- * @param modifiedCollaboration
- * the {@link Collaboration} currently modified
- * @return the views that should be deleted
- */
- private Set<View> getViewsForRole(ConnectableElement role, Collaboration modifiedCollaboration) {
-
- Set<View> viewsToDelete = new HashSet<View>();
-
- // Get all view for the role in Composite Structure Diagrams
- Set<View> collaborationToEditViews = CrossReferencerUtil.getCrossReferencingViews(modifiedCollaboration, CompositeStructureDiagramEditPart.MODEL_ID);
-
- // Parse views of the edited Collaboration
- for (View currentCollaborationView : collaborationToEditViews) {
-
- Iterator<EObject> it = currentCollaborationView.eAllContents();
- while (it.hasNext()) {
- EObject currentChildObject = it.next();
- if (currentChildObject instanceof View) {
- View currentChildView = (View) currentChildObject;
-
- if ((((IHintedType) UMLElementTypes.ConnectableElement_CollaborationRoleShape).getSemanticHint().equals(currentChildView.getType())) && (currentChildView.getElement() == role)) {
- viewsToDelete.add(currentChildView);
- }
- }
- }
- }
-
- return viewsToDelete;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IHintedType; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; +import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.ConnectableElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * + * This advice is used to remove the view of the Collaboration roles + * + */ +public class CollaborationHelperAdvice extends AbstractEditHelperAdvice { + + + @Override + protected ICommand getBeforeDestroyReferenceCommand(DestroyReferenceRequest request) { + + EObject elementToEdit = request.getContainer(); + Set<View> viewsToDelete = new HashSet<View>(); + + // Test if current destroy reference is removing a Property from Collaboration role + if ((elementToEdit instanceof Collaboration) && (request.getContainingFeature() == UMLPackage.eINSTANCE.getCollaboration_CollaborationRole())) { + + // Removed referenced ConnectableElement from roles + ConnectableElement refRole = (ConnectableElement) request.getReferencedObject(); + Collaboration collaborationToEdit = (Collaboration) elementToEdit; + + viewsToDelete.addAll(getViewsForRole(refRole, collaborationToEdit)); + } + + if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) { + DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false); + req.setClientContext(request.getClientContext()); + req.addParameters(request.getParameters()); + return req.getDestroyDependentsCommand(viewsToDelete); + } + + return null; + } + + @Override + protected ICommand getBeforeSetCommand(SetRequest request) { + + EObject elementToEdit = request.getElementToEdit(); + Set<View> viewsToDelete = new HashSet<View>(); + + if ((elementToEdit instanceof Collaboration) && (request.getFeature() == UMLPackage.eINSTANCE.getCollaboration_CollaborationRole())) { + + Collaboration collaborationToEdit = (Collaboration) elementToEdit; + + // Get the list of roles currently removed + Set<ConnectableElement> removedRoles = new HashSet<ConnectableElement>(); + removedRoles.addAll(collaborationToEdit.getRoles()); + if (request.getValue() instanceof ConnectableElement) { + removedRoles.remove(request.getValue()); + } else if (request.getValue() instanceof List<?>) { + removedRoles.removeAll((List<?>) request.getValue()); + } + + // Parse removed roles and find views to delete + Iterator<ConnectableElement> it = removedRoles.iterator(); + while (it.hasNext()) { + ConnectableElement currentRole = it.next(); + viewsToDelete.addAll(getViewsForRole(currentRole, collaborationToEdit)); + } + + } + + if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) { + DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false); + req.setClientContext(request.getClientContext()); + req.addParameters(request.getParameters()); + return req.getDestroyDependentsCommand(viewsToDelete); + } + + return null; + } + + /** + * <pre> + * This method retrieves all views (only in Composite Structure Diagrams) that are representing the role. + * </pre> + * + * @param role + * the {@link ConnectableElement} currently removed from role list + * @param modifiedCollaboration + * the {@link Collaboration} currently modified + * @return the views that should be deleted + */ + private Set<View> getViewsForRole(ConnectableElement role, Collaboration modifiedCollaboration) { + + Set<View> viewsToDelete = new HashSet<View>(); + + // Get all view for the role in Composite Structure Diagrams + Set<View> collaborationToEditViews = CrossReferencerUtil.getCrossReferencingViews(modifiedCollaboration, CompositeStructureDiagramEditPart.MODEL_ID); + + // Parse views of the edited Collaboration + for (View currentCollaborationView : collaborationToEditViews) { + + Iterator<EObject> it = currentCollaborationView.eAllContents(); + while (it.hasNext()) { + EObject currentChildObject = it.next(); + if (currentChildObject instanceof View) { + View currentChildView = (View) currentChildObject; + + if ((((IHintedType) UMLElementTypes.ConnectableElement_CollaborationRoleShape).getSemanticHint().equals(currentChildView.getType())) && (currentChildView.getElement() == role)) { + viewsToDelete.add(currentChildView); + } + } + } + } + + return viewsToDelete; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/GeneralizationHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/GeneralizationHelperAdvice.java index fef91686742..72910941d29 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/GeneralizationHelperAdvice.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/GeneralizationHelperAdvice.java @@ -1,117 +1,117 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-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.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.composite.custom.utils.GeneralizationUtil;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * <pre>
- * This HelperAdvice completes {@link Generalization} edit commands with diagram specific
- * commands in order to remove inconsistent views (e.g. inherited Port or Property
- * in case a {@link Generalization} is deleted or re-oriented.
- * </pre>
- */
-public class GeneralizationHelperAdvice extends AbstractEditHelperAdvice {
-
- @Override
- protected ICommand getBeforeReorientRelationshipCommand(ReorientRelationshipRequest request) {
-
- // The list of member views becoming inconsistent after re-orient that should be deleted.
- Set<View> viewsToDestroy = new HashSet<View>();
-
- if (request.getRelationship() instanceof Generalization) {
- viewsToDestroy.addAll(getMemberViewsToDestroy((Generalization) request.getRelationship()));
- }
-
- // return the command to destroy all these views
- if (!viewsToDestroy.isEmpty()) {
-
- DestroyDependentsRequest ddr = new DestroyDependentsRequest(request.getEditingDomain(), request.getRelationship(), false);
- ddr.setClientContext(request.getClientContext());
- ddr.addParameters(request.getParameters());
- return ddr.getDestroyDependentsCommand(viewsToDestroy);
-
- }
- return null;
- }
-
- @Override
- protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
-
- EObject destructee = request.getElementToDestroy();
-
- Set<View> viewsToDestroy = new HashSet<View>();
-
- if (destructee instanceof Generalization) {
- viewsToDestroy = getMemberViewsToDestroy((Generalization) destructee);
- }
-
- // return the command to destroy all these views
- if (!viewsToDestroy.isEmpty()) {
- return request.getDestroyDependentsCommand(viewsToDestroy);
- }
- return null;
- }
-
- /**
- * This methods looks for inconsistent views to delete in case the generalization is deleted or
- * re-oriented.
- *
- * @param generalization
- * the modified generalization
- * @return the list of {@link View} to delete
- */
- protected Set<View> getMemberViewsToDestroy(Generalization generalization) {
- Set<View> viewsToDestroy = new HashSet<View>();
-
- Classifier general = generalization.getGeneral();
- if (general != null) {
-
- // Parse members
- EList<NamedElement> members = general.getMembers();
- for (NamedElement member : members) {
-
- // Find Views in Composite Structure Diagram that are referencing current member
- Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(member, CompositeStructureDiagramEditPart.MODEL_ID).iterator();
- while (viewIt.hasNext()) {
- View view = viewIt.next();
-
- // Test if current view (member) is concerned by the deletion (re-orientation) of the generalization
- GeneralizationUtil util = new GeneralizationUtil();
- if (util.isConcernedByGeneralizationChanges(generalization, view)) {
- viewsToDestroy.add(view);
- }
- }
- }
- }
-
- return viewsToDestroy;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +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.DestroyDependentsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; +import org.eclipse.papyrus.uml.diagram.composite.custom.utils.GeneralizationUtil; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Generalization; +import org.eclipse.uml2.uml.NamedElement; + +/** + * <pre> + * This HelperAdvice completes {@link Generalization} edit commands with diagram specific + * commands in order to remove inconsistent views (e.g. inherited Port or Property + * in case a {@link Generalization} is deleted or re-oriented. + * </pre> + */ +public class GeneralizationHelperAdvice extends AbstractEditHelperAdvice { + + @Override + protected ICommand getBeforeReorientRelationshipCommand(ReorientRelationshipRequest request) { + + // The list of member views becoming inconsistent after re-orient that should be deleted. + Set<View> viewsToDestroy = new HashSet<View>(); + + if (request.getRelationship() instanceof Generalization) { + viewsToDestroy.addAll(getMemberViewsToDestroy((Generalization) request.getRelationship())); + } + + // return the command to destroy all these views + if (!viewsToDestroy.isEmpty()) { + + DestroyDependentsRequest ddr = new DestroyDependentsRequest(request.getEditingDomain(), request.getRelationship(), false); + ddr.setClientContext(request.getClientContext()); + ddr.addParameters(request.getParameters()); + return ddr.getDestroyDependentsCommand(viewsToDestroy); + + } + return null; + } + + @Override + protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) { + + EObject destructee = request.getElementToDestroy(); + + Set<View> viewsToDestroy = new HashSet<View>(); + + if (destructee instanceof Generalization) { + viewsToDestroy = getMemberViewsToDestroy((Generalization) destructee); + } + + // return the command to destroy all these views + if (!viewsToDestroy.isEmpty()) { + return request.getDestroyDependentsCommand(viewsToDestroy); + } + return null; + } + + /** + * This methods looks for inconsistent views to delete in case the generalization is deleted or + * re-oriented. + * + * @param generalization + * the modified generalization + * @return the list of {@link View} to delete + */ + protected Set<View> getMemberViewsToDestroy(Generalization generalization) { + Set<View> viewsToDestroy = new HashSet<View>(); + + Classifier general = generalization.getGeneral(); + if (general != null) { + + // Parse members + EList<NamedElement> members = general.getMembers(); + for (NamedElement member : members) { + + // Find Views in Composite Structure Diagram that are referencing current member + Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(member, CompositeStructureDiagramEditPart.MODEL_ID).iterator(); + while (viewIt.hasNext()) { + View view = viewIt.next(); + + // Test if current view (member) is concerned by the deletion (re-orientation) of the generalization + GeneralizationUtil util = new GeneralizationUtil(); + if (util.isConcernedByGeneralizationChanges(generalization, view)) { + viewsToDestroy.add(view); + } + } + } + } + + return viewsToDestroy; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/PropertyHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/PropertyHelperAdvice.java index 2df128b16c5..2f2a1c8dd7b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/PropertyHelperAdvice.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/advice/PropertyHelperAdvice.java @@ -1,177 +1,177 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.GetEditContextCommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- *
- * This advice is used to remove the view of the parts which become inconsistent when we change the type of the property
- *
- */
-public class PropertyHelperAdvice extends AbstractEditHelperAdvice {
-
- /**
- * Returns the command to destroy the views of the parts which are not owned by the new type
- *
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest)
- *
- * @param request
- * the request to modify the model
- * @return
- * the command to destroy the views of the parts which are not owned by the new type
- *
- */
- @Override
- protected ICommand getBeforeSetCommand(SetRequest request) {
- Type oldType = null;
- Type newType = null;
-
- EObject elementToEdit = request.getElementToEdit();
- Set<View> viewsToDelete = new HashSet<View>();
- if ((elementToEdit instanceof Property) && (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type()) && ((request.getValue() == null) || (request.getValue() instanceof Type))) {
-
- Property propertyToEdit = (Property) elementToEdit;
-
- oldType = propertyToEdit.getType();
- newType = (Type) request.getValue();
-
- if ((oldType != null) && (oldType instanceof Classifier) && ((request.getValue() == null) || (newType instanceof Classifier))) {
-
- EList<NamedElement> newTypeMembers = (newType != null) ? ((Classifier) newType).getMembers() : new BasicEList<NamedElement>();
- EList<NamedElement> oldTypeMembers = ((Classifier) oldType).getMembers();
-
- // Remove members of the new type from the list.
- // oldTypeMembers now contains the list of members for which views will become
- // inconsistent (if shown in the propertyToEdit) after setting the new type.
- List<NamedElement> possiblyInconsistentMembers = new ArrayList<NamedElement>();
- possiblyInconsistentMembers.addAll(oldTypeMembers);
- possiblyInconsistentMembers.removeAll(newTypeMembers);
-
- if (!possiblyInconsistentMembers.isEmpty()) {
-
- Set<View> propertyToEditViews = null;
-
- // Parse the list of possibly inconsistent members
- for (NamedElement possiblyInconsistentMember : possiblyInconsistentMembers) {
-
- // Retrieve views of the current possiblyInconsistentMember
- Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(possiblyInconsistentMember, CompositeStructureDiagramEditPart.MODEL_ID).iterator();
- while (viewIt.hasNext()) {
- if (propertyToEditViews == null) {
- propertyToEditViews = CrossReferencerUtil.getCrossReferencingViews(propertyToEdit, CompositeStructureDiagramEditPart.MODEL_ID);
- }
-
- View possiblyInconsistentMemberView = viewIt.next();
- if (isConcerned(possiblyInconsistentMemberView, propertyToEditViews)) {
- viewsToDelete.add(possiblyInconsistentMemberView);
- }
- }
- }
- }
- }
- }
-
- if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) {
- DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false);
- req.setClientContext(request.getClientContext());
- req.addParameters(request.getParameters());
- return req.getDestroyDependentsCommand(viewsToDelete);
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected ICommand getBeforeEditContextCommand(GetEditContextRequest request) {
- if (request.getEditCommandRequest() instanceof CreateElementRequest) {
- // check the element to create is a sub kind of UML PORT
- CreateElementRequest createElementRequest = ((CreateElementRequest) request.getEditCommandRequest());
- // retrieve element type from this request and check if this is a kind of UML PORT
- IElementType type = createElementRequest.getElementType();
- List<IElementType> types = new ArrayList<IElementType>(Arrays.asList(type.getAllSuperTypes()));
- types.add(type);
- if (types.contains(UMLElementTypes.PROPERTY) && (!UMLPackage.eINSTANCE.getProperty_Qualifier().equals(createElementRequest.getContainmentFeature()))) {
- GetEditContextCommand command = new GetEditContextCommand(request);
- if (request.getEditContext() instanceof Property) {
- // this line is very important
- // change the context ok, but the feature must be change ifn order to create a port inside the class
- createElementRequest.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
-
- Property p = (Property) request.getEditContext();
- if (p.getType() != null) {
- command.setEditContext(p.getType());
- return command;
- }
-
- }
- }
- }
-
- return super.getBeforeEditContextCommand(request);
- }
-
- /**
- * Tests if the view must be deleted
- *
- * @param view
- * the view to test
- * @param list
- * the list of the property view
- * @return
- * <code>true</code> if the view need to be removed <code>false</code> if not
- */
- protected boolean isConcerned(View view, Set<View> propertyViews) {
-
- EObject parentView = view.eContainer();
- if (parentView instanceof DecorationNode) {
- parentView = parentView.eContainer();
- }
- return propertyViews.contains(parentView);
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.helper.advice; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.GetEditContextCommand; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.gmf.runtime.notation.DecorationNode; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; +import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * + * This advice is used to remove the view of the parts which become inconsistent when we change the type of the property + * + */ +public class PropertyHelperAdvice extends AbstractEditHelperAdvice { + + /** + * Returns the command to destroy the views of the parts which are not owned by the new type + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) + * + * @param request + * the request to modify the model + * @return + * the command to destroy the views of the parts which are not owned by the new type + * + */ + @Override + protected ICommand getBeforeSetCommand(SetRequest request) { + Type oldType = null; + Type newType = null; + + EObject elementToEdit = request.getElementToEdit(); + Set<View> viewsToDelete = new HashSet<View>(); + if ((elementToEdit instanceof Property) && (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type()) && ((request.getValue() == null) || (request.getValue() instanceof Type))) { + + Property propertyToEdit = (Property) elementToEdit; + + oldType = propertyToEdit.getType(); + newType = (Type) request.getValue(); + + if ((oldType != null) && (oldType instanceof Classifier) && ((request.getValue() == null) || (newType instanceof Classifier))) { + + EList<NamedElement> newTypeMembers = (newType != null) ? ((Classifier) newType).getMembers() : new BasicEList<NamedElement>(); + EList<NamedElement> oldTypeMembers = ((Classifier) oldType).getMembers(); + + // Remove members of the new type from the list. + // oldTypeMembers now contains the list of members for which views will become + // inconsistent (if shown in the propertyToEdit) after setting the new type. + List<NamedElement> possiblyInconsistentMembers = new ArrayList<NamedElement>(); + possiblyInconsistentMembers.addAll(oldTypeMembers); + possiblyInconsistentMembers.removeAll(newTypeMembers); + + if (!possiblyInconsistentMembers.isEmpty()) { + + Set<View> propertyToEditViews = null; + + // Parse the list of possibly inconsistent members + for (NamedElement possiblyInconsistentMember : possiblyInconsistentMembers) { + + // Retrieve views of the current possiblyInconsistentMember + Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(possiblyInconsistentMember, CompositeStructureDiagramEditPart.MODEL_ID).iterator(); + while (viewIt.hasNext()) { + if (propertyToEditViews == null) { + propertyToEditViews = CrossReferencerUtil.getCrossReferencingViews(propertyToEdit, CompositeStructureDiagramEditPart.MODEL_ID); + } + + View possiblyInconsistentMemberView = viewIt.next(); + if (isConcerned(possiblyInconsistentMemberView, propertyToEditViews)) { + viewsToDelete.add(possiblyInconsistentMemberView); + } + } + } + } + } + } + + if ((viewsToDelete != null) && !(viewsToDelete.isEmpty())) { + DestroyDependentsRequest req = new DestroyDependentsRequest(request.getEditingDomain(), elementToEdit, false); + req.setClientContext(request.getClientContext()); + req.addParameters(request.getParameters()); + return req.getDestroyDependentsCommand(viewsToDelete); + } + + return null; + } + + /** + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) + * + * @param request + * @return + */ + @Override + protected ICommand getBeforeEditContextCommand(GetEditContextRequest request) { + if (request.getEditCommandRequest() instanceof CreateElementRequest) { + // check the element to create is a sub kind of UML PORT + CreateElementRequest createElementRequest = ((CreateElementRequest) request.getEditCommandRequest()); + // retrieve element type from this request and check if this is a kind of UML PORT + IElementType type = createElementRequest.getElementType(); + List<IElementType> types = new ArrayList<IElementType>(Arrays.asList(type.getAllSuperTypes())); + types.add(type); + if (types.contains(UMLElementTypes.PROPERTY) && (!UMLPackage.eINSTANCE.getProperty_Qualifier().equals(createElementRequest.getContainmentFeature()))) { + GetEditContextCommand command = new GetEditContextCommand(request); + if (request.getEditContext() instanceof Property) { + // this line is very important + // change the context ok, but the feature must be change ifn order to create a port inside the class + createElementRequest.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute()); + + Property p = (Property) request.getEditContext(); + if (p.getType() != null) { + command.setEditContext(p.getType()); + return command; + } + + } + } + } + + return super.getBeforeEditContextCommand(request); + } + + /** + * Tests if the view must be deleted + * + * @param view + * the view to test + * @param list + * the list of the property view + * @return + * <code>true</code> if the view need to be removed <code>false</code> if not + */ + protected boolean isConcerned(View view, Set<View> propertyViews) { + + EObject parentView = view.eContainer(); + if (parentView instanceof DecorationNode) { + parentView = parentView.eContainer(); + } + return propertyViews.contains(parentView); + + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPortLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPortLocator.java index a23ca15a526..5fcb2d74f0a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPortLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPortLocator.java @@ -1,101 +1,101 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.locators;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
-
-/**
- * used to place the symbol behavior at the good place (inside the composite).
- *
- */
-public class BehaviorPortLocator extends PortPositionLocator {
-
-
- /**
- * Constructor.
- *
- * @param parentFigure
- * @since 3.0
- */
- public BehaviorPortLocator(IFigure parentFigure) {
- super(parentFigure);
- }
-
-
- @Deprecated
- public BehaviorPortLocator(IFigure parentFigure, int preferredSide) {
- super(parentFigure, preferredSide);
- }
-
-
- /**
- *
- * @param proposedLocation
- * the proposed location
- * @return a possible location on parent figure border
- */
- @Override
- public Rectangle getPreferredLocation(Rectangle proposedLocation) {
-
- // Initialize port location with proposed location
- // and resolve the bounds of it graphical parent
- Rectangle realLocation = new Rectangle(proposedLocation);
-
- Rectangle parentRec = getParentFigure().getBounds().getCopy();
-
- // Calculate Max position around the graphical parent (1/2 size or the port around
- // the graphical parent bounds.
- // this is an intra rectangle
- int xMin = parentRec.x + borderItemOffset;
- int xMax = parentRec.x - borderItemOffset + parentRec.width;
- int yMin = parentRec.y + borderItemOffset;
- int yMax = parentRec.y - borderItemOffset + parentRec.height;
-
- // Modify Port location if MAX X or Y are exceeded
- if (realLocation.x < xMin) {
- realLocation.x = xMin;
- }
-
- if (realLocation.x > xMax) {
- realLocation.x = xMax;
- }
-
- if (realLocation.y < yMin) {
- realLocation.y = yMin;
- }
-
- if (realLocation.y > yMax) {
- realLocation.y = yMax;
- }
-
- // Ensure the port is positioned on its parent borders and not in the middle.
- // Modify position if needed.
- if ((realLocation.y != yMin) && (realLocation.y != yMax)) {
- if ((realLocation.x != xMin) && (realLocation.x != xMax)) {
-
- if (realLocation.x <= (xMin + (parentRec.width / 2))) {
- realLocation.x = xMin;
- } else {
- realLocation.x = xMax;
- }
- }
- }
-
- // Return constrained location
- return realLocation;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.locators; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; + +/** + * used to place the symbol behavior at the good place (inside the composite). + * + */ +public class BehaviorPortLocator extends PortPositionLocator { + + + /** + * Constructor. + * + * @param parentFigure + * @since 3.0 + */ + public BehaviorPortLocator(IFigure parentFigure) { + super(parentFigure); + } + + + @Deprecated + public BehaviorPortLocator(IFigure parentFigure, int preferredSide) { + super(parentFigure, preferredSide); + } + + + /** + * + * @param proposedLocation + * the proposed location + * @return a possible location on parent figure border + */ + @Override + public Rectangle getPreferredLocation(Rectangle proposedLocation) { + + // Initialize port location with proposed location + // and resolve the bounds of it graphical parent + Rectangle realLocation = new Rectangle(proposedLocation); + + Rectangle parentRec = getParentFigure().getBounds().getCopy(); + + // Calculate Max position around the graphical parent (1/2 size or the port around + // the graphical parent bounds. + // this is an intra rectangle + int xMin = parentRec.x + borderItemOffset; + int xMax = parentRec.x - borderItemOffset + parentRec.width; + int yMin = parentRec.y + borderItemOffset; + int yMax = parentRec.y - borderItemOffset + parentRec.height; + + // Modify Port location if MAX X or Y are exceeded + if (realLocation.x < xMin) { + realLocation.x = xMin; + } + + if (realLocation.x > xMax) { + realLocation.x = xMax; + } + + if (realLocation.y < yMin) { + realLocation.y = yMin; + } + + if (realLocation.y > yMax) { + realLocation.y = yMax; + } + + // Ensure the port is positioned on its parent borders and not in the middle. + // Modify position if needed. + if ((realLocation.y != yMin) && (realLocation.y != yMax)) { + if ((realLocation.x != xMin) && (realLocation.x != xMax)) { + + if (realLocation.x <= (xMin + (parentRec.width / 2))) { + realLocation.x = xMin; + } else { + realLocation.x = xMax; + } + } + } + + // Return constrained location + return realLocation; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/InternalPortPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/InternalPortPositionLocator.java index bfb7d6be56a..aeb78ed8674 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/InternalPortPositionLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/InternalPortPositionLocator.java @@ -1,92 +1,92 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.locators;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
-
-
-public class InternalPortPositionLocator extends PortPositionLocator {
-
- /**
- * @since 3.0
- */
- public InternalPortPositionLocator(IFigure parentFigure) {
- super(parentFigure);
- }
-
- @Deprecated
- public InternalPortPositionLocator(IFigure parentFigure, int preferredSide) {
- super(parentFigure, preferredSide);
- }
-
-
- /**
- *
- * @param proposedLocation
- * the proposed location
- * @return a possible location on parent figure border
- */
- @Override
- public Rectangle getPreferredLocation(Rectangle proposedLocation) {
-
- // Initialize port location with proposed location
- // and resolve the bounds of it graphical parent
- Rectangle realLocation = new Rectangle(proposedLocation);
-
- Rectangle parentRec = getParentFigure().getBounds().getCopy();
-
- // Calculate Max position around the graphical parent (1/2 size or the port around
- // the graphical parent bounds.
- // this is an intra rectangle
- int xMin = parentRec.x;
- int xMax = parentRec.x - (2 * borderItemOffset) + parentRec.width;
- int yMin = parentRec.y;
- int yMax = parentRec.y - (2 * borderItemOffset) + parentRec.height;
-
- // Modify Port location if MAX X or Y are exceeded
- if (realLocation.x < xMin) {
- realLocation.x = xMin;
- }
-
- if (realLocation.x > xMax) {
- realLocation.x = xMax;
- }
-
- if (realLocation.y < yMin) {
- realLocation.y = yMin;
- }
-
- if (realLocation.y > yMax) {
- realLocation.y = yMax;
- }
-
- // Ensure the port is positioned on its parent borders and not in the middle.
- // Modify position if needed.
- if ((realLocation.y != yMin) && (realLocation.y != yMax)) {
- if ((realLocation.x != xMin) && (realLocation.x != xMax)) {
-
- if (realLocation.x <= (xMin + (parentRec.width / 2))) {
- realLocation.x = xMin;
- } else {
- realLocation.x = xMax;
- }
- }
- }
-
- // Return constrained location
- return realLocation;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.locators; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; + + +public class InternalPortPositionLocator extends PortPositionLocator { + + /** + * @since 3.0 + */ + public InternalPortPositionLocator(IFigure parentFigure) { + super(parentFigure); + } + + @Deprecated + public InternalPortPositionLocator(IFigure parentFigure, int preferredSide) { + super(parentFigure, preferredSide); + } + + + /** + * + * @param proposedLocation + * the proposed location + * @return a possible location on parent figure border + */ + @Override + public Rectangle getPreferredLocation(Rectangle proposedLocation) { + + // Initialize port location with proposed location + // and resolve the bounds of it graphical parent + Rectangle realLocation = new Rectangle(proposedLocation); + + Rectangle parentRec = getParentFigure().getBounds().getCopy(); + + // Calculate Max position around the graphical parent (1/2 size or the port around + // the graphical parent bounds. + // this is an intra rectangle + int xMin = parentRec.x; + int xMax = parentRec.x - (2 * borderItemOffset) + parentRec.width; + int yMin = parentRec.y; + int yMax = parentRec.y - (2 * borderItemOffset) + parentRec.height; + + // Modify Port location if MAX X or Y are exceeded + if (realLocation.x < xMin) { + realLocation.x = xMin; + } + + if (realLocation.x > xMax) { + realLocation.x = xMax; + } + + if (realLocation.y < yMin) { + realLocation.y = yMin; + } + + if (realLocation.y > yMax) { + realLocation.y = yMax; + } + + // Ensure the port is positioned on its parent borders and not in the middle. + // Modify position if needed. + if ((realLocation.y != yMin) && (realLocation.y != yMax)) { + if ((realLocation.x != xMin) && (realLocation.x != xMax)) { + + if (realLocation.x <= (xMin + (parentRec.width / 2))) { + realLocation.x = xMin; + } else { + realLocation.x = xMax; + } + } + } + + // Return constrained location + return realLocation; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/log/Log.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/log/Log.java index 8e4e3deaf04..b11c1ac600e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/log/Log.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/log/Log.java @@ -1,44 +1,44 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.log;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
-
-/** Log singleton class for CSD */
-public class Log extends LogHelper {
-
- /** Singleton instance */
- private static Log instance;
-
- /** Access restriction on constructors */
- private Log(Plugin activator) {
- super(activator);
- }
-
- /** Access restriction on constructors */
- private Log() {
- super(UMLDiagramEditorPlugin.getInstance());
- }
-
- /** Singleton access */
- public static synchronized Log getInstance() {
-
- if (instance == null) {
- instance = new Log();
- }
- return instance;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.log; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; + +/** Log singleton class for CSD */ +public class Log extends LogHelper { + + /** Singleton instance */ + private static Log instance; + + /** Access restriction on constructors */ + private Log(Plugin activator) { + super(activator); + } + + /** Access restriction on constructors */ + private Log() { + super(UMLDiagramEditorPlugin.getInstance()); + } + + /** Singleton access */ + public static synchronized Log getInstance() { + + if (instance == null) { + instance = new Log(); + } + return instance; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_2_0.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_2_0.java index 62cebe3cf93..7b854462e1c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_2_0.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_2_0.java @@ -1,754 +1,754 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 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:
- * Florian Noyrit (CEA) florian.noyrit@cea.fr - Initial API and Implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - reconciler to add floating label
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.migration;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Composite Structure Diagram Reconciler from 1.1.0 to 1.2.0
- */
-public class CompositeReconciler_1_2_0 extends DiagramReconciler {
-
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- CompositeCommand cc = new CompositeCommand("Migrate diagram from 1.1.0 to 1.2.0");
- cc.add(new ChangeVisualIDsCommand(diagram));
- return cc;
- }
-
- protected class ChangeVisualIDsCommand extends AbstractCommand {
-
- protected final Diagram diagram;
-
- public ChangeVisualIDsCommand(Diagram diagram) {
- super("Change the diagram's visual ids from 1.1.0 to 1.2.0");
- this.diagram = diagram;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- TreeIterator<EObject> allContentIterator = diagram.eAllContents();
-
- while (allContentIterator.hasNext()) {
- EObject eObject = allContentIterator.next();
- if (eObject instanceof View) {
- View view = (View) eObject;
- view.setType(getNewVisualID(view.getType()));
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- public boolean canUndo() {
- return false;
- }
-
- @Override
- public boolean canRedo() {
- return false;
- }
-
- @Override
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- throw new ExecutionException("Should not be called, canRedo false");
- }
-
- @Override
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- throw new ExecutionException("Should not be called, canUndo false");
- }
- }
-
- public static String getNewVisualID(String oldVisualID) {
- switch (oldVisualID) {
- case "1000":
- return "Package_CompositeStructureDiagram";
- case "3121":
- return "Port_BehaviorShape";
- case "6053":
- return "Port_BehaviorFloatingNameLabel";
- case "3069":
- return "Port_Shape";
- case "5125":
- return "Port_NameLabel";
- case "6029":
- return "Port_StereotypeLabel";
- case "3088":
- return "Parameter_Shape";
- case "6033":
- return "Parameter_NameLabel";
- case "6034":
- return "Parameter_StereotypeLabel";
- case "3070":
- return "Property_Shape";
- case "5126":
- return "Property_NameLabel";
- case "6054":
- return "Property_FloatingNameLabel";
- case "3115":
- return "ConnectableElement_CollaborationRoleShape";
- case "5198":
- return "ConnectableElement_CollaborationRoleNameLabel";
- case "6055":
- return "ConnectableElement_CollaborationRoleFloatingNameLabel";
- case "3071":
- return "CollaborationUse_Shape";
- case "5127":
- return "CollaborationUse_NameLabel";
- case "6056":
- return "CollaborationUse_FloatingNameLabel";
- case "3072":
- return "Activity_Shape_CN";
- case "5128":
- return "Activity_NameLabel_CN";
- case "6057":
- return "Activity_FloatingNameLabel_CN";
- case "3073":
- return "Interaction_Shape_CN";
- case "5129":
- return "Interaction_NameLabel_CN";
- case "6058":
- return "Interaction_FloatingNameLabel_CN";
- case "3074":
- return "ProtocolStateMachine_Shape_CN";
- case "5130":
- return "ProtocolStateMachine_NameLabel_CN";
- case "6059":
- return "ProtocolStateMachine_FloatingNameLabel_CN";
- case "3075":
- return "StateMachine_Shape_CN";
- case "5131":
- return "StateMachine_NameLabel_CN";
- case "6060":
- return "StateMachine_FloatingNameLabel_CN";
- case "3076":
- return "FunctionBehavior_Shape_CN";
- case "5132":
- return "FunctionBehavior_NameLabel_CN";
- case "6061":
- return "FunctionBehavior_FloatingNameLabel_CN";
- case "3077":
- return "OpaqueBehavior_Shape_CN";
- case "5133":
- return "OpaqueBehavior_NameLabel_CN";
- case "6062":
- return "OpaqueBehavior_FloatingNameLabel_CN";
- case "3081":
- return "Component_Shape_CN";
- case "5137":
- return "Component_NameLabel_CN";
- case "6063":
- return "Component_FloatingNameLabel_CN";
- case "3082":
- return "Device_Shape_CN";
- case "5138":
- return "Device_NameLabel_CN";
- case "6064":
- return "Device_FloatingNameLabel_CN";
- case "3083":
- return "ExecutionEnvironment_Shape_CN";
- case "5139":
- return "ExecutionEnvironment_NameLabel_CN";
- case "6065":
- return "ExecutionEnvironment_FloatingNameLabel_CN";
- case "3084":
- return "Node_Shape_CN";
- case "5140":
- return "Node_NameLabel_CN";
- case "6066":
- return "Node_FloatingNameLabel_CN";
- case "3085":
- return "Class_Shape_CN";
- case "5155":
- return "Class_NameLabel_CN";
- case "6067":
- return "Class_FloatingNameLabel_CN";
- case "3086":
- return "Collaboration_Shape_CN";
- case "5141":
- return "Collaboration_NameLabel_CN";
- case "6068":
- return "Collaboration_FloatingNameLabel_CN";
- case "3087":
- return "Interface_Shape_CN";
- case "5154":
- return "Interface_NameLabel_CN";
- case "6069":
- return "Interface_FloatingNameLabel_CN";
- case "3078":
- return "PrimitiveType_Shape_CN";
- case "5134":
- return "PrimitiveType_NameLabel_CN";
- case "6070":
- return "PrimitiveType_FloatingNameLabel_CN";
- case "3079":
- return "Enumeration_Shape_CN";
- case "5135":
- return "Enumeration_NameLabel_CN";
- case "6071":
- return "Enumeration_FloatingNameLabel_CN";
- case "3080":
- return "DataType_Shape_CN";
- case "5136":
- return "DataType_NameLabel_CN";
- case "6072":
- return "DataType_FloatingNameLabel_CN";
- case "3091":
- return "Actor_Shape_CN";
- case "5144":
- return "Actor_NameLabel_CN";
- case "6073":
- return "Actor_FloatingNameLabel_CN";
- case "3092":
- return "DeploymentSpecification_Shape_CN";
- case "5145":
- return "DeploymentSpecification_NameLabel_CN";
- case "6074":
- return "DeploymentSpecification_FloatingNameLabel_CN";
- case "3093":
- return "Artifact_Shape_CN";
- case "5146":
- return "Artifact_NameLabel_CN";
- case "6075":
- return "Artifact_FloatingNameLabel_CN";
- case "3094":
- return "InformationItem_Shape_CN";
- case "5147":
- return "InformationItem_NameLabel_CN";
- case "6076":
- return "InformationItem_FloatingNameLabel_CN";
- case "3095":
- return "Signal_Shape_CN";
- case "5148":
- return "Signal_NameLabel_CN";
- case "6077":
- return "Signal_FloatingNameLabel_CN";
- case "3096":
- return "UseCase_Shape_CN";
- case "5149":
- return "UseCase_NameLabel_CN";
- case "6078":
- return "UseCase_FloatingNameLabel_CN";
- case "3097":
- return "Comment_Shape_CN";
- case "5150":
- return "Comment_BodyLabel_CN";
- case "3116":
- return "DurationConstraint_Shape_CN";
- case "6040":
- return "DurationConstraint_NameLabel_CN";
- case "6041":
- return "DurationConstraint_BodyLabel_CN";
- case "3117":
- return "TimeConstraint_Shape_CN";
- case "6042":
- return "TimeConstraint_NameLabel_CN";
- case "6043":
- return "TimeConstraint_BodyLabel_CN";
- case "3118":
- return "IntervalConstraint_Shape_CN";
- case "6044":
- return "IntervalConstraint_NameLabel_CN";
- case "6045":
- return "IntervalConstraint_BodyLabel_CN";
- case "3119":
- return "InteractionConstraint_Shape_CN";
- case "6046":
- return "InteractionConstraint_NameLabel_CN";
- case "6047":
- return "InteractionConstraint_BodyLabel_CN";
- case "3120":
- return "Constraint_Shape_CN";
- case "6048":
- return "Constraint_NameLabel_CN";
- case "6049":
- return "Constraint_BodyLabel_CN";
- case "3101":
- return "Property_AttributeLabel";
- case "3102":
- return "Operation_OperationLabel";
- case "3066":
- return "EnumerationLiteral_LiteralLabel";
- case "2060":
- return "Activity_Shape";
- case "5112":
- return "Activity_NameLabel";
- case "6079":
- return "Activity_FloatingNameLabel";
- case "2061":
- return "Interaction_Shape";
- case "5113":
- return "Interaction_NameLabel";
- case "6080":
- return "Interaction_FloatingNameLabel";
- case "2062":
- return "ProtocolStateMachine_Shape";
- case "5114":
- return "ProtocolStateMachine_NameLabel";
- case "6081":
- return "ProtocolStateMachine_FloatingNameLabel";
- case "2063":
- return "StateMachine_Shape";
- case "5115":
- return "StateMachine_NameLabel";
- case "6082":
- return "StateMachine_FloatingNameLabel";
- case "2064":
- return "FunctionBehavior_Shape";
- case "5116":
- return "FunctionBehavior_NameLabel";
- case "6083":
- return "FunctionBehavior_FloatingNameLabel";
- case "2065":
- return "OpaqueBehavior_Shape";
- case "5117":
- return "OpaqueBehavior_NameLabel";
- case "6084":
- return "OpaqueBehavior_FloatingNameLabel";
- case "2069":
- return "Component_Shape";
- case "5121":
- return "Component_NameLabel";
- case "6085":
- return "Component_FloatingNameLabel";
- case "2070":
- return "Device_Shape";
- case "5122":
- return "Device_NameLabel";
- case "6086":
- return "Device_FloatingNameLabel";
- case "2071":
- return "ExecutionEnvironment_Shape";
- case "5123":
- return "ExecutionEnvironment_NameLabel";
- case "6087":
- return "ExecutionEnvironment_FloatingNameLabel";
- case "2072":
- return "Node_Shape";
- case "5124":
- return "Node_NameLabel";
- case "6088":
- return "Node_FloatingNameLabel";
- case "2073":
- return "Class_Shape";
- case "5156":
- return "Class_NameLabel";
- case "6089":
- return "Class_FloatingNameLabel";
- case "2075":
- return "Collaboration_Shape";
- case "5158":
- return "Collaboration_NameLabel";
- case "6090":
- return "Collaboration_FloatingNameLabel";
- case "2076":
- return "Interface_Shape";
- case "5159":
- return "Interface_NameLabel";
- case "6091":
- return "Interface_FloatingNameLabel";
- case "2066":
- return "PrimitiveType_Shape";
- case "5118":
- return "PrimitiveType_NameLabel";
- case "6092":
- return "PrimitiveType_FloatingNameLabel";
- case "2067":
- return "Enumeration_Shape";
- case "5119":
- return "Enumeration_NameLabel";
- case "6093":
- return "Enumeration_FloatingNameLabel";
- case "2068":
- return "DataType_Shape";
- case "5120":
- return "DataType_NameLabel";
- case "6094":
- return "DataType_FloatingNameLabel";
- case "2077":
- return "Actor_Shape";
- case "5160":
- return "Actor_NameLabel";
- case "6095":
- return "Actor_FloatingNameLabel";
- case "2078":
- return "DeploymentSpecification_Shape";
- case "5161":
- return "DeploymentSpecification_NameLabel";
- case "6096":
- return "DeploymentSpecification_FloatingNameLabel";
- case "2079":
- return "Artifact_Shape";
- case "5162":
- return "Artifact_NameLabel";
- case "6097":
- return "Artifact_FloatingNameLabel";
- case "2080":
- return "InformationItem_Shape";
- case "5163":
- return "InformationItem_NameLabel";
- case "6098":
- return "InformationItem_FloatingNameLabel";
- case "2081":
- return "Signal_Shape";
- case "5164":
- return "Signal_NameLabel";
- case "6099":
- return "Signal_FloatingNameLabel";
- case "2082":
- return "UseCase_Shape";
- case "5165":
- return "UseCase_NameLabel";
- case "6100":
- return "UseCase_FloatingNameLabel";
- case "2083":
- return "SignalEvent_Shape";
- case "5166":
- return "SignalEvent_NameLabel";
- case "6101":
- return "SignalEvent_FloatingNameLabel";
- case "2084":
- return "CallEvent_Shape";
- case "5167":
- return "CallEvent_NameLabel";
- case "6102":
- return "CallEvent_FloatingNameLabel";
- case "2085":
- return "AnyReceiveEvent_Shape";
- case "5168":
- return "AnyReceiveEvent_NameLabel";
- case "6103":
- return "AnyReceiveEvent_FloatingNameLabel";
- case "2088":
- return "ChangeEvent_Shape";
- case "5171":
- return "ChangeEvent_NameLabel";
- case "6104":
- return "ChangeEvent_FloatingNameLabel";
- case "2089":
- return "TimeEvent_Shape";
- case "5172":
- return "TimeEvent_NameLabel";
- case "6105":
- return "TimeEvent_FloatingNameLabel";
- case "2093":
- return "DurationObservation_Shape";
- case "5151":
- return "DurationObservation_NameLabel";
- case "5152":
- return "DurationObservation_StereotypeLabel";
- case "2094":
- return "TimeObservation_Shape";
- case "5142":
- return "TimeObservation_NameLabel";
- case "5143":
- return "TimeObservation_StereotypeLabel";
- case "2095":
- return "LiteralBoolean_Shape";
- case "5178":
- return "LiteralBoolean_NameLabel";
- case "6106":
- return "LiteralBoolean_FloatingNameLabel";
- case "2096":
- return "LiteralInteger_Shape";
- case "5179":
- return "LiteralInteger_NameLabel";
- case "6107":
- return "LiteralInteger_FloatingNameLabel";
- case "2097":
- return "LiteralNull_Shape";
- case "5180":
- return "LiteralNull_NameLabel";
- case "6108":
- return "LiteralNull_FloatingNameLabel";
- case "2098":
- return "LiteralString_Shape";
- case "5181":
- return "LiteralString_NameLabel";
- case "6109":
- return "LiteralString_FloatingNameLabel";
- case "2099":
- return "LiteralUnlimitedNatural_Shape";
- case "5182":
- return "LiteralUnlimitedNatural_NameLabel";
- case "6110":
- return "LiteralUnlimitedNatural_FloatingNameLabel";
- case "2100":
- return "StringExpression_PackagedElementShape";
- case "5183":
- return "StringExpression_NameLabel";
- case "6111":
- return "StringExpression_FloatingNameLabel";
- case "2101":
- return "OpaqueExpression_Shape";
- case "5184":
- return "OpaqueExpression_NameLabel";
- case "6112":
- return "OpaqueExpression_FloatingNameLabel";
- case "2102":
- return "TimeExpression_Shape";
- case "5185":
- return "TimeExpression_NameLabel";
- case "6113":
- return "TimeExpression_FloatingNameLabel";
- case "2103":
- return "Expression_Shape";
- case "5186":
- return "Expression_NameLabel";
- case "6114":
- return "Expression_FloatingNameLabel";
- case "2104":
- return "Duration_Shape";
- case "5187":
- return "Duration_NameLabel";
- case "6115":
- return "Duration_FloatingNameLabel";
- case "2105":
- return "TimeInterval_Shape";
- case "5188":
- return "TimeInterval_NameLabel";
- case "6116":
- return "TimeInterval_FloatingNameLabel";
- case "2106":
- return "DurationInterval_Shape";
- case "5189":
- return "DurationInterval_NameLabel";
- case "6117":
- return "DurationInterval_FloatingNameLabel";
- case "2107":
- return "Interval_Shape";
- case "5190":
- return "Interval_NameLabel";
- case "6118":
- return "Interval_FloatingNameLabel";
- case "2108":
- return "InstanceValue_Shape";
- case "5191":
- return "InstanceValue_NameLabel";
- case "6119":
- return "InstanceValue_FloatingNameLabel";
- case "2109":
- return "Comment_Shape";
- case "5192":
- return "Comment_BodyLabel";
- case "2110":
- return "DurationConstraint_Shape";
- case "5193":
- return "DurationConstraint_NameLabel";
- case "6035":
- return "DurationConstraint_BodyLabel";
- case "2111":
- return "TimeConstraint_Shape";
- case "5194":
- return "TimeConstraint_NameLabel";
- case "6036":
- return "TimeConstraint_BodyLabel";
- case "2112":
- return "IntervalConstraint_Shape";
- case "5195":
- return "IntervalConstraint_NameLabel";
- case "6037":
- return "IntervalConstraint_BodyLabel";
- case "2113":
- return "InteractionConstraint_Shape";
- case "5196":
- return "InteractionConstraint_NameLabel";
- case "6038":
- return "InteractionConstraint_BodyLabel";
- case "2114":
- return "Constraint_Shape";
- case "5197":
- return "Constraint_NameLabel";
- case "6039":
- return "Constraint_BodyLabel";
- case "4022":
- return "Port_BehaviorEdge";
- case "4001":
- return "Link_DescriptorEdge";
- case "4002":
- return "Comment_AnnotatedElementEdge";
- case "4003":
- return "Constraint_ConstrainedElementEdge";
- case "4004":
- return "ComponentRealization_Edge";
- case "6001":
- return "ComponentRealization_NameLabel";
- case "6015":
- return "ComponentRealization_StereotypeLabel";
- case "4005":
- return "InterfaceRealization_Edge";
- case "6002":
- return "InterfaceRealization_NameLabel";
- case "6016":
- return "InterfaceRealization_StereotypeLabel";
- case "4011":
- return "Substitution_Edge";
- case "6003":
- return "Substitution_NameLabel";
- case "6017":
- return "Substitution_StereotypeLabel";
- case "4006":
- return "Realization_Edge";
- case "6004":
- return "Realization_NameLabel";
- case "6018":
- return "Realization_StereotypeLabel";
- case "4012":
- return "Manifestation_Edge";
- case "6005":
- return "Manifestation_NameLabel";
- case "6019":
- return "Manifestation_StereotypeLabel";
- case "4007":
- return "Abstraction_Edge";
- case "6006":
- return "Abstraction_NameLabel";
- case "6020":
- return "Abstraction_StereotypeLabel";
- case "4008":
- return "Usage_Edge";
- case "6007":
- return "Usage_NameLabel";
- case "6021":
- return "Usage_StereotypeLabel";
- case "4009":
- return "Deployment_Edge";
- case "6008":
- return "Deployment_NameLabel";
- case "6022":
- return "Deployment_StereotypeLabel";
- case "4017":
- return "Dependency_RoleBindingEdge";
- case "6027":
- return "Dependency_RoleBindingNameLabel";
- case "6028":
- return "Dependency_RoleBindingStereotypeLabel";
- case "4010":
- return "Dependency_Edge";
- case "6009":
- return "Dependency_NameLabel";
- case "6023":
- return "Dependency_StereotypeLabel";
- case "4013":
- return "Connector_Edge";
- case "6025":
- return "Connector_StereotypeLabel";
- case "6050":
- return "Connector_NameLabel";
- case "6051":
- return "Connector_SourceMultiplicityLabel";
- case "6052":
- return "Connector_TargetMultiplicityLabel";
- case "4015":
- return "Generalization_Edge";
- case "6024":
- return "Generalization_StereotypeLabel";
- case "4018":
- return "TimeObservation_EventEdge";
- case "4019":
- return "DurationObservation_EventEdge";
- case "4020":
- return "Representation_Edge";
- case "6030":
- return "Representation_KeywordLabel";
- case "4021":
- return "InformationFlow_Edge";
- case "6031":
- return "InformationFlow_ConveyedLabel";
- case "6032":
- return "InformationFlow_StereotypeLabel";
- case "7033":
- return "DataType_AttributeCompartment";
- case "7034":
- return "DataType_OperationCompartment";
- case "7036":
- return "DataType_AttributeCompartment_CN";
- case "7037":
- return "DataType_OperationCompartment_CN";
- case "7048":
- return "Enumeration_LiteralCompartment";
- case "7049":
- return "Enumeration_LiteralCompartment_CN";
- case "7050":
- return "Activity_StructureCompartment_CN";
- case "7051":
- return "Interaction_StructureCompartment_CN";
- case "7052":
- return "ProtocolStateMachine_StructureCompartment_CN";
- case "7053":
- return "StateMachine_StructureCompartment_CN";
- case "7054":
- return "FunctionBehavior_StructureCompartment_CN";
- case "7055":
- return "OpaqueBehavior_StructureCompartment_CN";
- case "7056":
- return "Component_StructureCompartment_CN";
- case "7057":
- return "Device_StructureCompartment_CN";
- case "7058":
- return "ExecutionEnvironment_StructureCompartment_CN";
- case "7059":
- return "Node_StructureCompartment_CN";
- case "7060":
- return "Class_StructureCompartment_CN";
- case "7061":
- return "Collaboration_StructureCompartment_CN";
- case "7063":
- return "Activity_StructureCompartment";
- case "7064":
- return "Interaction_StructureCompartment";
- case "7065":
- return "ProtocolStateMachine_StructureCompartment";
- case "7066":
- return "StateMachine_StructureCompartment";
- case "7067":
- return "FunctionBehavior_StructureCompartment";
- case "7068":
- return "OpaqueBehavior_StructureCompartment";
- case "7069":
- return "Component_StructureCompartment";
- case "7070":
- return "Device_StructureCompartment";
- case "7071":
- return "ExecutionEnvironment_StructureCompartment";
- case "7072":
- return "Node_StructureCompartment";
- case "7073":
- return "Class_StructureCompartment";
- case "7075":
- return "Collaboration_StructureCompartment";
- case "7077":
- return "Property_StructureCompartment";
- default:
- return defaultGetNewVisualID(oldVisualID);
- }
- }
-
- private static String defaultGetNewVisualID(String oldVisualID) {
- return oldVisualID;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 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: + * Florian Noyrit (CEA) florian.noyrit@cea.fr - Initial API and Implementation + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - reconciler to add floating label + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.migration; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.AbstractCommand; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Composite Structure Diagram Reconciler from 1.1.0 to 1.2.0 + */ +public class CompositeReconciler_1_2_0 extends DiagramReconciler { + + @Override + public ICommand getReconcileCommand(Diagram diagram) { + CompositeCommand cc = new CompositeCommand("Migrate diagram from 1.1.0 to 1.2.0"); + cc.add(new ChangeVisualIDsCommand(diagram)); + return cc; + } + + protected class ChangeVisualIDsCommand extends AbstractCommand { + + protected final Diagram diagram; + + public ChangeVisualIDsCommand(Diagram diagram) { + super("Change the diagram's visual ids from 1.1.0 to 1.2.0"); + this.diagram = diagram; + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + TreeIterator<EObject> allContentIterator = diagram.eAllContents(); + + while (allContentIterator.hasNext()) { + EObject eObject = allContentIterator.next(); + if (eObject instanceof View) { + View view = (View) eObject; + view.setType(getNewVisualID(view.getType())); + } + } + + return CommandResult.newOKCommandResult(); + } + + @Override + public boolean canUndo() { + return false; + } + + @Override + public boolean canRedo() { + return false; + } + + @Override + protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + throw new ExecutionException("Should not be called, canRedo false"); + } + + @Override + protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + throw new ExecutionException("Should not be called, canUndo false"); + } + } + + public static String getNewVisualID(String oldVisualID) { + switch (oldVisualID) { + case "1000": + return "Package_CompositeStructureDiagram"; + case "3121": + return "Port_BehaviorShape"; + case "6053": + return "Port_BehaviorFloatingNameLabel"; + case "3069": + return "Port_Shape"; + case "5125": + return "Port_NameLabel"; + case "6029": + return "Port_StereotypeLabel"; + case "3088": + return "Parameter_Shape"; + case "6033": + return "Parameter_NameLabel"; + case "6034": + return "Parameter_StereotypeLabel"; + case "3070": + return "Property_Shape"; + case "5126": + return "Property_NameLabel"; + case "6054": + return "Property_FloatingNameLabel"; + case "3115": + return "ConnectableElement_CollaborationRoleShape"; + case "5198": + return "ConnectableElement_CollaborationRoleNameLabel"; + case "6055": + return "ConnectableElement_CollaborationRoleFloatingNameLabel"; + case "3071": + return "CollaborationUse_Shape"; + case "5127": + return "CollaborationUse_NameLabel"; + case "6056": + return "CollaborationUse_FloatingNameLabel"; + case "3072": + return "Activity_Shape_CN"; + case "5128": + return "Activity_NameLabel_CN"; + case "6057": + return "Activity_FloatingNameLabel_CN"; + case "3073": + return "Interaction_Shape_CN"; + case "5129": + return "Interaction_NameLabel_CN"; + case "6058": + return "Interaction_FloatingNameLabel_CN"; + case "3074": + return "ProtocolStateMachine_Shape_CN"; + case "5130": + return "ProtocolStateMachine_NameLabel_CN"; + case "6059": + return "ProtocolStateMachine_FloatingNameLabel_CN"; + case "3075": + return "StateMachine_Shape_CN"; + case "5131": + return "StateMachine_NameLabel_CN"; + case "6060": + return "StateMachine_FloatingNameLabel_CN"; + case "3076": + return "FunctionBehavior_Shape_CN"; + case "5132": + return "FunctionBehavior_NameLabel_CN"; + case "6061": + return "FunctionBehavior_FloatingNameLabel_CN"; + case "3077": + return "OpaqueBehavior_Shape_CN"; + case "5133": + return "OpaqueBehavior_NameLabel_CN"; + case "6062": + return "OpaqueBehavior_FloatingNameLabel_CN"; + case "3081": + return "Component_Shape_CN"; + case "5137": + return "Component_NameLabel_CN"; + case "6063": + return "Component_FloatingNameLabel_CN"; + case "3082": + return "Device_Shape_CN"; + case "5138": + return "Device_NameLabel_CN"; + case "6064": + return "Device_FloatingNameLabel_CN"; + case "3083": + return "ExecutionEnvironment_Shape_CN"; + case "5139": + return "ExecutionEnvironment_NameLabel_CN"; + case "6065": + return "ExecutionEnvironment_FloatingNameLabel_CN"; + case "3084": + return "Node_Shape_CN"; + case "5140": + return "Node_NameLabel_CN"; + case "6066": + return "Node_FloatingNameLabel_CN"; + case "3085": + return "Class_Shape_CN"; + case "5155": + return "Class_NameLabel_CN"; + case "6067": + return "Class_FloatingNameLabel_CN"; + case "3086": + return "Collaboration_Shape_CN"; + case "5141": + return "Collaboration_NameLabel_CN"; + case "6068": + return "Collaboration_FloatingNameLabel_CN"; + case "3087": + return "Interface_Shape_CN"; + case "5154": + return "Interface_NameLabel_CN"; + case "6069": + return "Interface_FloatingNameLabel_CN"; + case "3078": + return "PrimitiveType_Shape_CN"; + case "5134": + return "PrimitiveType_NameLabel_CN"; + case "6070": + return "PrimitiveType_FloatingNameLabel_CN"; + case "3079": + return "Enumeration_Shape_CN"; + case "5135": + return "Enumeration_NameLabel_CN"; + case "6071": + return "Enumeration_FloatingNameLabel_CN"; + case "3080": + return "DataType_Shape_CN"; + case "5136": + return "DataType_NameLabel_CN"; + case "6072": + return "DataType_FloatingNameLabel_CN"; + case "3091": + return "Actor_Shape_CN"; + case "5144": + return "Actor_NameLabel_CN"; + case "6073": + return "Actor_FloatingNameLabel_CN"; + case "3092": + return "DeploymentSpecification_Shape_CN"; + case "5145": + return "DeploymentSpecification_NameLabel_CN"; + case "6074": + return "DeploymentSpecification_FloatingNameLabel_CN"; + case "3093": + return "Artifact_Shape_CN"; + case "5146": + return "Artifact_NameLabel_CN"; + case "6075": + return "Artifact_FloatingNameLabel_CN"; + case "3094": + return "InformationItem_Shape_CN"; + case "5147": + return "InformationItem_NameLabel_CN"; + case "6076": + return "InformationItem_FloatingNameLabel_CN"; + case "3095": + return "Signal_Shape_CN"; + case "5148": + return "Signal_NameLabel_CN"; + case "6077": + return "Signal_FloatingNameLabel_CN"; + case "3096": + return "UseCase_Shape_CN"; + case "5149": + return "UseCase_NameLabel_CN"; + case "6078": + return "UseCase_FloatingNameLabel_CN"; + case "3097": + return "Comment_Shape_CN"; + case "5150": + return "Comment_BodyLabel_CN"; + case "3116": + return "DurationConstraint_Shape_CN"; + case "6040": + return "DurationConstraint_NameLabel_CN"; + case "6041": + return "DurationConstraint_BodyLabel_CN"; + case "3117": + return "TimeConstraint_Shape_CN"; + case "6042": + return "TimeConstraint_NameLabel_CN"; + case "6043": + return "TimeConstraint_BodyLabel_CN"; + case "3118": + return "IntervalConstraint_Shape_CN"; + case "6044": + return "IntervalConstraint_NameLabel_CN"; + case "6045": + return "IntervalConstraint_BodyLabel_CN"; + case "3119": + return "InteractionConstraint_Shape_CN"; + case "6046": + return "InteractionConstraint_NameLabel_CN"; + case "6047": + return "InteractionConstraint_BodyLabel_CN"; + case "3120": + return "Constraint_Shape_CN"; + case "6048": + return "Constraint_NameLabel_CN"; + case "6049": + return "Constraint_BodyLabel_CN"; + case "3101": + return "Property_AttributeLabel"; + case "3102": + return "Operation_OperationLabel"; + case "3066": + return "EnumerationLiteral_LiteralLabel"; + case "2060": + return "Activity_Shape"; + case "5112": + return "Activity_NameLabel"; + case "6079": + return "Activity_FloatingNameLabel"; + case "2061": + return "Interaction_Shape"; + case "5113": + return "Interaction_NameLabel"; + case "6080": + return "Interaction_FloatingNameLabel"; + case "2062": + return "ProtocolStateMachine_Shape"; + case "5114": + return "ProtocolStateMachine_NameLabel"; + case "6081": + return "ProtocolStateMachine_FloatingNameLabel"; + case "2063": + return "StateMachine_Shape"; + case "5115": + return "StateMachine_NameLabel"; + case "6082": + return "StateMachine_FloatingNameLabel"; + case "2064": + return "FunctionBehavior_Shape"; + case "5116": + return "FunctionBehavior_NameLabel"; + case "6083": + return "FunctionBehavior_FloatingNameLabel"; + case "2065": + return "OpaqueBehavior_Shape"; + case "5117": + return "OpaqueBehavior_NameLabel"; + case "6084": + return "OpaqueBehavior_FloatingNameLabel"; + case "2069": + return "Component_Shape"; + case "5121": + return "Component_NameLabel"; + case "6085": + return "Component_FloatingNameLabel"; + case "2070": + return "Device_Shape"; + case "5122": + return "Device_NameLabel"; + case "6086": + return "Device_FloatingNameLabel"; + case "2071": + return "ExecutionEnvironment_Shape"; + case "5123": + return "ExecutionEnvironment_NameLabel"; + case "6087": + return "ExecutionEnvironment_FloatingNameLabel"; + case "2072": + return "Node_Shape"; + case "5124": + return "Node_NameLabel"; + case "6088": + return "Node_FloatingNameLabel"; + case "2073": + return "Class_Shape"; + case "5156": + return "Class_NameLabel"; + case "6089": + return "Class_FloatingNameLabel"; + case "2075": + return "Collaboration_Shape"; + case "5158": + return "Collaboration_NameLabel"; + case "6090": + return "Collaboration_FloatingNameLabel"; + case "2076": + return "Interface_Shape"; + case "5159": + return "Interface_NameLabel"; + case "6091": + return "Interface_FloatingNameLabel"; + case "2066": + return "PrimitiveType_Shape"; + case "5118": + return "PrimitiveType_NameLabel"; + case "6092": + return "PrimitiveType_FloatingNameLabel"; + case "2067": + return "Enumeration_Shape"; + case "5119": + return "Enumeration_NameLabel"; + case "6093": + return "Enumeration_FloatingNameLabel"; + case "2068": + return "DataType_Shape"; + case "5120": + return "DataType_NameLabel"; + case "6094": + return "DataType_FloatingNameLabel"; + case "2077": + return "Actor_Shape"; + case "5160": + return "Actor_NameLabel"; + case "6095": + return "Actor_FloatingNameLabel"; + case "2078": + return "DeploymentSpecification_Shape"; + case "5161": + return "DeploymentSpecification_NameLabel"; + case "6096": + return "DeploymentSpecification_FloatingNameLabel"; + case "2079": + return "Artifact_Shape"; + case "5162": + return "Artifact_NameLabel"; + case "6097": + return "Artifact_FloatingNameLabel"; + case "2080": + return "InformationItem_Shape"; + case "5163": + return "InformationItem_NameLabel"; + case "6098": + return "InformationItem_FloatingNameLabel"; + case "2081": + return "Signal_Shape"; + case "5164": + return "Signal_NameLabel"; + case "6099": + return "Signal_FloatingNameLabel"; + case "2082": + return "UseCase_Shape"; + case "5165": + return "UseCase_NameLabel"; + case "6100": + return "UseCase_FloatingNameLabel"; + case "2083": + return "SignalEvent_Shape"; + case "5166": + return "SignalEvent_NameLabel"; + case "6101": + return "SignalEvent_FloatingNameLabel"; + case "2084": + return "CallEvent_Shape"; + case "5167": + return "CallEvent_NameLabel"; + case "6102": + return "CallEvent_FloatingNameLabel"; + case "2085": + return "AnyReceiveEvent_Shape"; + case "5168": + return "AnyReceiveEvent_NameLabel"; + case "6103": + return "AnyReceiveEvent_FloatingNameLabel"; + case "2088": + return "ChangeEvent_Shape"; + case "5171": + return "ChangeEvent_NameLabel"; + case "6104": + return "ChangeEvent_FloatingNameLabel"; + case "2089": + return "TimeEvent_Shape"; + case "5172": + return "TimeEvent_NameLabel"; + case "6105": + return "TimeEvent_FloatingNameLabel"; + case "2093": + return "DurationObservation_Shape"; + case "5151": + return "DurationObservation_NameLabel"; + case "5152": + return "DurationObservation_StereotypeLabel"; + case "2094": + return "TimeObservation_Shape"; + case "5142": + return "TimeObservation_NameLabel"; + case "5143": + return "TimeObservation_StereotypeLabel"; + case "2095": + return "LiteralBoolean_Shape"; + case "5178": + return "LiteralBoolean_NameLabel"; + case "6106": + return "LiteralBoolean_FloatingNameLabel"; + case "2096": + return "LiteralInteger_Shape"; + case "5179": + return "LiteralInteger_NameLabel"; + case "6107": + return "LiteralInteger_FloatingNameLabel"; + case "2097": + return "LiteralNull_Shape"; + case "5180": + return "LiteralNull_NameLabel"; + case "6108": + return "LiteralNull_FloatingNameLabel"; + case "2098": + return "LiteralString_Shape"; + case "5181": + return "LiteralString_NameLabel"; + case "6109": + return "LiteralString_FloatingNameLabel"; + case "2099": + return "LiteralUnlimitedNatural_Shape"; + case "5182": + return "LiteralUnlimitedNatural_NameLabel"; + case "6110": + return "LiteralUnlimitedNatural_FloatingNameLabel"; + case "2100": + return "StringExpression_PackagedElementShape"; + case "5183": + return "StringExpression_NameLabel"; + case "6111": + return "StringExpression_FloatingNameLabel"; + case "2101": + return "OpaqueExpression_Shape"; + case "5184": + return "OpaqueExpression_NameLabel"; + case "6112": + return "OpaqueExpression_FloatingNameLabel"; + case "2102": + return "TimeExpression_Shape"; + case "5185": + return "TimeExpression_NameLabel"; + case "6113": + return "TimeExpression_FloatingNameLabel"; + case "2103": + return "Expression_Shape"; + case "5186": + return "Expression_NameLabel"; + case "6114": + return "Expression_FloatingNameLabel"; + case "2104": + return "Duration_Shape"; + case "5187": + return "Duration_NameLabel"; + case "6115": + return "Duration_FloatingNameLabel"; + case "2105": + return "TimeInterval_Shape"; + case "5188": + return "TimeInterval_NameLabel"; + case "6116": + return "TimeInterval_FloatingNameLabel"; + case "2106": + return "DurationInterval_Shape"; + case "5189": + return "DurationInterval_NameLabel"; + case "6117": + return "DurationInterval_FloatingNameLabel"; + case "2107": + return "Interval_Shape"; + case "5190": + return "Interval_NameLabel"; + case "6118": + return "Interval_FloatingNameLabel"; + case "2108": + return "InstanceValue_Shape"; + case "5191": + return "InstanceValue_NameLabel"; + case "6119": + return "InstanceValue_FloatingNameLabel"; + case "2109": + return "Comment_Shape"; + case "5192": + return "Comment_BodyLabel"; + case "2110": + return "DurationConstraint_Shape"; + case "5193": + return "DurationConstraint_NameLabel"; + case "6035": + return "DurationConstraint_BodyLabel"; + case "2111": + return "TimeConstraint_Shape"; + case "5194": + return "TimeConstraint_NameLabel"; + case "6036": + return "TimeConstraint_BodyLabel"; + case "2112": + return "IntervalConstraint_Shape"; + case "5195": + return "IntervalConstraint_NameLabel"; + case "6037": + return "IntervalConstraint_BodyLabel"; + case "2113": + return "InteractionConstraint_Shape"; + case "5196": + return "InteractionConstraint_NameLabel"; + case "6038": + return "InteractionConstraint_BodyLabel"; + case "2114": + return "Constraint_Shape"; + case "5197": + return "Constraint_NameLabel"; + case "6039": + return "Constraint_BodyLabel"; + case "4022": + return "Port_BehaviorEdge"; + case "4001": + return "Link_DescriptorEdge"; + case "4002": + return "Comment_AnnotatedElementEdge"; + case "4003": + return "Constraint_ConstrainedElementEdge"; + case "4004": + return "ComponentRealization_Edge"; + case "6001": + return "ComponentRealization_NameLabel"; + case "6015": + return "ComponentRealization_StereotypeLabel"; + case "4005": + return "InterfaceRealization_Edge"; + case "6002": + return "InterfaceRealization_NameLabel"; + case "6016": + return "InterfaceRealization_StereotypeLabel"; + case "4011": + return "Substitution_Edge"; + case "6003": + return "Substitution_NameLabel"; + case "6017": + return "Substitution_StereotypeLabel"; + case "4006": + return "Realization_Edge"; + case "6004": + return "Realization_NameLabel"; + case "6018": + return "Realization_StereotypeLabel"; + case "4012": + return "Manifestation_Edge"; + case "6005": + return "Manifestation_NameLabel"; + case "6019": + return "Manifestation_StereotypeLabel"; + case "4007": + return "Abstraction_Edge"; + case "6006": + return "Abstraction_NameLabel"; + case "6020": + return "Abstraction_StereotypeLabel"; + case "4008": + return "Usage_Edge"; + case "6007": + return "Usage_NameLabel"; + case "6021": + return "Usage_StereotypeLabel"; + case "4009": + return "Deployment_Edge"; + case "6008": + return "Deployment_NameLabel"; + case "6022": + return "Deployment_StereotypeLabel"; + case "4017": + return "Dependency_RoleBindingEdge"; + case "6027": + return "Dependency_RoleBindingNameLabel"; + case "6028": + return "Dependency_RoleBindingStereotypeLabel"; + case "4010": + return "Dependency_Edge"; + case "6009": + return "Dependency_NameLabel"; + case "6023": + return "Dependency_StereotypeLabel"; + case "4013": + return "Connector_Edge"; + case "6025": + return "Connector_StereotypeLabel"; + case "6050": + return "Connector_NameLabel"; + case "6051": + return "Connector_SourceMultiplicityLabel"; + case "6052": + return "Connector_TargetMultiplicityLabel"; + case "4015": + return "Generalization_Edge"; + case "6024": + return "Generalization_StereotypeLabel"; + case "4018": + return "TimeObservation_EventEdge"; + case "4019": + return "DurationObservation_EventEdge"; + case "4020": + return "Representation_Edge"; + case "6030": + return "Representation_KeywordLabel"; + case "4021": + return "InformationFlow_Edge"; + case "6031": + return "InformationFlow_ConveyedLabel"; + case "6032": + return "InformationFlow_StereotypeLabel"; + case "7033": + return "DataType_AttributeCompartment"; + case "7034": + return "DataType_OperationCompartment"; + case "7036": + return "DataType_AttributeCompartment_CN"; + case "7037": + return "DataType_OperationCompartment_CN"; + case "7048": + return "Enumeration_LiteralCompartment"; + case "7049": + return "Enumeration_LiteralCompartment_CN"; + case "7050": + return "Activity_StructureCompartment_CN"; + case "7051": + return "Interaction_StructureCompartment_CN"; + case "7052": + return "ProtocolStateMachine_StructureCompartment_CN"; + case "7053": + return "StateMachine_StructureCompartment_CN"; + case "7054": + return "FunctionBehavior_StructureCompartment_CN"; + case "7055": + return "OpaqueBehavior_StructureCompartment_CN"; + case "7056": + return "Component_StructureCompartment_CN"; + case "7057": + return "Device_StructureCompartment_CN"; + case "7058": + return "ExecutionEnvironment_StructureCompartment_CN"; + case "7059": + return "Node_StructureCompartment_CN"; + case "7060": + return "Class_StructureCompartment_CN"; + case "7061": + return "Collaboration_StructureCompartment_CN"; + case "7063": + return "Activity_StructureCompartment"; + case "7064": + return "Interaction_StructureCompartment"; + case "7065": + return "ProtocolStateMachine_StructureCompartment"; + case "7066": + return "StateMachine_StructureCompartment"; + case "7067": + return "FunctionBehavior_StructureCompartment"; + case "7068": + return "OpaqueBehavior_StructureCompartment"; + case "7069": + return "Component_StructureCompartment"; + case "7070": + return "Device_StructureCompartment"; + case "7071": + return "ExecutionEnvironment_StructureCompartment"; + case "7072": + return "Node_StructureCompartment"; + case "7073": + return "Class_StructureCompartment"; + case "7075": + return "Collaboration_StructureCompartment"; + case "7077": + return "Property_StructureCompartment"; + default: + return defaultGetNewVisualID(oldVisualID); + } + } + + private static String defaultGetNewVisualID(String oldVisualID) { + return oldVisualID; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusCollaborationUsePreferencesConstant.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusCollaborationUsePreferencesConstant.java index 7f8e4cb0d2a..6914eda80ea 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusCollaborationUsePreferencesConstant.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusCollaborationUsePreferencesConstant.java @@ -1,36 +1,36 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.preferences;
-
-import org.eclipse.uml2.uml.CollaborationUse;
-
-
-
-/**
- * Constants for {@link CollaborationUse} preferences.
- */
-public interface IPapyrusCollaborationUsePreferencesConstant {
-
- /** Preference id for {@link CollaborationUse} display label */
- public String LABEL_DISPLAY_PREFERENCE = "CollaborationUse.label.display"; //$NON-NLS-1$
-
- /** Preference id for {@link CollaborationUse} display label */
- public String PREF_FONT = "CollaborationUse.font"; //$NON-NLS-1$
-
- /** Preference id for {@link CollaborationUse} display label */
- public String PREF_FONT_COLOR = "CollaborationUse.font.color"; //$NON-NLS-1$
-
- /** Preference id for {@link CollaborationUse} display label */
- public String PREF_LINE_COLOR = "CollaborationUse.line.color"; //$NON-NLS-1$
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.preferences; + +import org.eclipse.uml2.uml.CollaborationUse; + + + +/** + * Constants for {@link CollaborationUse} preferences. + */ +public interface IPapyrusCollaborationUsePreferencesConstant { + + /** Preference id for {@link CollaborationUse} display label */ + public String LABEL_DISPLAY_PREFERENCE = "CollaborationUse.label.display"; //$NON-NLS-1$ + + /** Preference id for {@link CollaborationUse} display label */ + public String PREF_FONT = "CollaborationUse.font"; //$NON-NLS-1$ + + /** Preference id for {@link CollaborationUse} display label */ + public String PREF_FONT_COLOR = "CollaborationUse.font.color"; //$NON-NLS-1$ + + /** Preference id for {@link CollaborationUse} display label */ + public String PREF_LINE_COLOR = "CollaborationUse.line.color"; //$NON-NLS-1$ +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusPropertyPreferencesConstant.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusPropertyPreferencesConstant.java index f8921923dcd..5d071ccf676 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusPropertyPreferencesConstant.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IPapyrusPropertyPreferencesConstant.java @@ -1,33 +1,33 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.preferences;
-
-
-/**
- * Constants for {@link Property} preferences.
- */
-public interface IPapyrusPropertyPreferencesConstant {
-
- /** Preference id for {@link Property} display label */
- public String LABEL_DISPLAY_PREFERENCE = "Property.label.display"; //$NON-NLS-1$
-
- /** Preference id for {@link Property} display label */
- public String PREF_FONT = "Property.font"; //$NON-NLS-1$
-
- /** Preference id for {@link Property} display label */
- public String PREF_FONT_COLOR = "Property.font.color"; //$NON-NLS-1$
-
- /** Preference id for {@link Property} display label */
- public String PREF_LINE_COLOR = "Property.line.color"; //$NON-NLS-1$
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.preferences; + + +/** + * Constants for {@link Property} preferences. + */ +public interface IPapyrusPropertyPreferencesConstant { + + /** Preference id for {@link Property} display label */ + public String LABEL_DISPLAY_PREFERENCE = "Property.label.display"; //$NON-NLS-1$ + + /** Preference id for {@link Property} display label */ + public String PREF_FONT = "Property.font"; //$NON-NLS-1$ + + /** Preference id for {@link Property} display label */ + public String PREF_FONT_COLOR = "Property.font.color"; //$NON-NLS-1$ + + /** Preference id for {@link Property} display label */ + public String PREF_LINE_COLOR = "Property.line.color"; //$NON-NLS-1$ +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IParameterPreferencesConstant.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IParameterPreferencesConstant.java index 75b233cb4b9..d6f2c511e64 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IParameterPreferencesConstant.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/IParameterPreferencesConstant.java @@ -1,33 +1,33 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.preferences;
-
-
-/**
- * Constants for {@link Parameter} preferences.
- */
-public interface IParameterPreferencesConstant {
-
- /** Preference id for {@link Parameter} display label */
- public String LABEL_DISPLAY_PREFERENCE = "Parameter.label.display"; //$NON-NLS-1$
-
- /** Preference id for {@link Parameter} display label */
- public String PREF_FONT = "Parameter.font"; //$NON-NLS-1$
-
- /** Preference id for {@link Parameter} display label */
- public String PREF_FONT_COLOR = "Parameter.font.color"; //$NON-NLS-1$
-
- /** Preference id for {@link Parameter} display label */
- public String PREF_LINE_COLOR = "Parameter.line.color"; //$NON-NLS-1$
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.preferences; + + +/** + * Constants for {@link Parameter} preferences. + */ +public interface IParameterPreferencesConstant { + + /** Preference id for {@link Parameter} display label */ + public String LABEL_DISPLAY_PREFERENCE = "Parameter.label.display"; //$NON-NLS-1$ + + /** Preference id for {@link Parameter} display label */ + public String PREF_FONT = "Parameter.font"; //$NON-NLS-1$ + + /** Preference id for {@link Parameter} display label */ + public String PREF_FONT_COLOR = "Parameter.font.color"; //$NON-NLS-1$ + + /** Preference id for {@link Parameter} display label */ + public String PREF_LINE_COLOR = "Parameter.line.color"; //$NON-NLS-1$ +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ActionStateSourceProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ActionStateSourceProvider.java index ffdd04474af..f80f894276e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ActionStateSourceProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ActionStateSourceProvider.java @@ -1,91 +1,91 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
-
-import org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider;
-import org.eclipse.papyrus.uml.diagram.composite.custom.actions.ShowHideRelatedContentsHandler;
-import org.eclipse.ui.ISources;
-
-/**
- * This class provides the state of the actions. It's used to refresh
- * the status of these actions in the menu. (in toolbar and popup, it's not needed)
- *
- * To get the status, we listen the selection service AND the part service!
- * The part service is used to know if the selection is in the Model Explorer or not!
- * When the selection is not in the model explorer, the handlers listening the variable need to be disabled
- */
-public class ActionStateSourceProvider extends AbstractActionStateSourceProvider {
-
- /**
- * The name of the variable to check.
- */
- public static final String SHOW_HIDE_RELATED_CONTENTS = "showHideRelatedContents"; //$NON-NLS-1$
-
- /**
- *
- * Constructor.
- *
- */
- public ActionStateSourceProvider() {
- super();
- currentState.put(SHOW_HIDE_RELATED_CONTENTS, DISABLED);
- }
-
-
- /**
- *
- * @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
- *
- * @return
- */
- @Override
- public String[] getProvidedSourceNames() {
- return new String[] { SHOW_HIDE_RELATED_CONTENTS };
- }
-
-
- /**
- * Refresh the state of the Delete Action
- */
- protected void refreshShowHideRelatedContentsAction() {
- String oldState = currentState.get(SHOW_HIDE_RELATED_CONTENTS);
- String newState = (testShowHideRelatedContents() ? ENABLED : DISABLED);
-
- if (oldState != newState) {
- currentState.put(SHOW_HIDE_RELATED_CONTENTS, newState);
- fireSourceChanged(ISources.WORKBENCH, currentState);
- }
- }
-
- /**
- * Tests if the action DeleteFromDiagram (now called Delete Selected Element can be executed
- *
- * @return
- * <code>true</code> if the action DeleteFromDiagram (now called Delete Selected Element can be executed <code>false</code> if not
- */
- protected boolean testShowHideRelatedContents() {
- ShowHideRelatedContentsHandler handler = new ShowHideRelatedContentsHandler();
- return isSelectionInDiagram() && handler.isEnabled();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider#refreshActions()
- *
- */
- @Override
- protected void refreshActions() {
- refreshShowHideRelatedContentsAction();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.providers; + +import org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider; +import org.eclipse.papyrus.uml.diagram.composite.custom.actions.ShowHideRelatedContentsHandler; +import org.eclipse.ui.ISources; + +/** + * This class provides the state of the actions. It's used to refresh + * the status of these actions in the menu. (in toolbar and popup, it's not needed) + * + * To get the status, we listen the selection service AND the part service! + * The part service is used to know if the selection is in the Model Explorer or not! + * When the selection is not in the model explorer, the handlers listening the variable need to be disabled + */ +public class ActionStateSourceProvider extends AbstractActionStateSourceProvider { + + /** + * The name of the variable to check. + */ + public static final String SHOW_HIDE_RELATED_CONTENTS = "showHideRelatedContents"; //$NON-NLS-1$ + + /** + * + * Constructor. + * + */ + public ActionStateSourceProvider() { + super(); + currentState.put(SHOW_HIDE_RELATED_CONTENTS, DISABLED); + } + + + /** + * + * @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames() + * + * @return + */ + @Override + public String[] getProvidedSourceNames() { + return new String[] { SHOW_HIDE_RELATED_CONTENTS }; + } + + + /** + * Refresh the state of the Delete Action + */ + protected void refreshShowHideRelatedContentsAction() { + String oldState = currentState.get(SHOW_HIDE_RELATED_CONTENTS); + String newState = (testShowHideRelatedContents() ? ENABLED : DISABLED); + + if (oldState != newState) { + currentState.put(SHOW_HIDE_RELATED_CONTENTS, newState); + fireSourceChanged(ISources.WORKBENCH, currentState); + } + } + + /** + * Tests if the action DeleteFromDiagram (now called Delete Selected Element can be executed + * + * @return + * <code>true</code> if the action DeleteFromDiagram (now called Delete Selected Element can be executed <code>false</code> if not + */ + protected boolean testShowHideRelatedContents() { + ShowHideRelatedContentsHandler handler = new ShowHideRelatedContentsHandler(); + return isSelectionInDiagram() && handler.isEnabled(); + } + + /** + * + * @see org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider#refreshActions() + * + */ + @Override + protected void refreshActions() { + refreshShowHideRelatedContentsAction(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomEditPartProvider.java index 7f9c00aeaaa..948f7e07a9a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomEditPartProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomEditPartProvider.java @@ -1,31 +1,31 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
-
-import org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts.CustomEditPartFactory;
-import org.eclipse.papyrus.uml.diagram.composite.providers.UMLEditPartProvider;
-
-/**
- * Replacement EditPart provider.
- */
-public class CustomEditPartProvider extends UMLEditPartProvider {
-
- /**
- * Constructor.
- */
- public CustomEditPartProvider() {
- setFactory(new CustomEditPartFactory());
- setAllowCaching(true);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.providers; + +import org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts.CustomEditPartFactory; +import org.eclipse.papyrus.uml.diagram.composite.providers.UMLEditPartProvider; + +/** + * Replacement EditPart provider. + */ +public class CustomEditPartProvider extends UMLEditPartProvider { + + /** + * Constructor. + */ + public CustomEditPartProvider() { + setFactory(new CustomEditPartFactory()); + setAllowCaching(true); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java index ec7940b390f..c434406596e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java @@ -1,81 +1,81 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011, 2017 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:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
-import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
-import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
-import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.ConnectorLabelParser;
-import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.MultiplicityLabelParser;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.AbstractionAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicitySourceEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicityTargetEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorNameEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DeploymentAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.InformationFlowAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ManifestationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.SubstitutionAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UsageAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.providers.UMLParserProvider;
-
-public class CustomParserProvider extends UMLParserProvider {
-
- public CustomParserProvider() {
- super();
- }
-
- protected IParser getAppliedStereotypeParser(String defaultEditString) {
- return new AppliedStereotypeParser(defaultEditString);
- }
-
- /**
- * @since 3.0
- */
- protected IParser getAppliedKeywordParser(String defaultPrintString) {
- return new AppliedKeywordParser(defaultPrintString);
- }
-
- @Override
- protected IParser getParser(String visualID) {
- switch (visualID) {
- case ConnectorMultiplicitySourceEditPart.VISUAL_ID:
- case ConnectorMultiplicityTargetEditPart.VISUAL_ID:
- return getMultiplicityFormatParser();
- case ConnectorNameEditPart.VISUAL_ID:
- return getConnectorLabelParser();
- case AbstractionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.ABSTRACTION);
- case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.DEPLOY);
- case InformationFlowAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.FLOW);
- case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.MANIFEST);
- case SubstitutionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.SUBSTITUTE);
- case UsageAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.USE);
- }
- return super.getParser(visualID);
- }
-
- private IParser getConnectorLabelParser() {
- return new ConnectorLabelParser();
- }
-
- private IParser getMultiplicityFormatParser() {
- return new MultiplicityLabelParser();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011, 2017 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: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.providers; + +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel; +import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser; +import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser; +import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.ConnectorLabelParser; +import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.MultiplicityLabelParser; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.AbstractionAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicitySourceEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicityTargetEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorNameEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DeploymentAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.InformationFlowAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ManifestationAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.SubstitutionAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UsageAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.providers.UMLParserProvider; + +public class CustomParserProvider extends UMLParserProvider { + + public CustomParserProvider() { + super(); + } + + protected IParser getAppliedStereotypeParser(String defaultEditString) { + return new AppliedStereotypeParser(defaultEditString); + } + + /** + * @since 3.0 + */ + protected IParser getAppliedKeywordParser(String defaultPrintString) { + return new AppliedKeywordParser(defaultPrintString); + } + + @Override + protected IParser getParser(String visualID) { + switch (visualID) { + case ConnectorMultiplicitySourceEditPart.VISUAL_ID: + case ConnectorMultiplicityTargetEditPart.VISUAL_ID: + return getMultiplicityFormatParser(); + case ConnectorNameEditPart.VISUAL_ID: + return getConnectorLabelParser(); + case AbstractionAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.ABSTRACTION); + case DeploymentAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.DEPLOY); + case InformationFlowAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.FLOW); + case ManifestationAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.MANIFEST); + case SubstitutionAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.SUBSTITUTE); + case UsageAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.USE); + } + return super.getParser(visualID); + } + + private IParser getConnectorLabelParser() { + return new ConnectorLabelParser(); + } + + private IParser getMultiplicityFormatParser() { + return new MultiplicityLabelParser(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CollaborationRoleTreeContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CollaborationRoleTreeContentProvider.java index 33c6ddb82c3..dbb4d213a9e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CollaborationRoleTreeContentProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CollaborationRoleTreeContentProvider.java @@ -1,97 +1,97 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.ui;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.uml2.uml.Collaboration;
-import org.eclipse.uml2.uml.CollaborationUse;
-
-/**
- * This class is a basic content provider that assumes a {@link CollaborationUse} is given as the
- * root parent, and that will calculate the possible roles that can be used for binding.
- *
- */
-public class CollaborationRoleTreeContentProvider implements ITreeContentProvider {
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- // no implementation needed.
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- // no implementation needed.
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- // no implementation needed.
- return false;
- }
-
- /**
- * <pre>
- * This method returns the role referenced by the {@link Collaboration} that is
- * the type of the {@link CollaborationUse}.
- *
- * {@inheritDoc}
- * </pre>
- */
- @Override
- public Object[] getElements(Object inputElement) {
- Object[] children = null;
-
- if (inputElement instanceof CollaborationUse) {
- CollaborationUse parentUMLElement = (CollaborationUse) inputElement;
- if (parentUMLElement.getType() != null) {
- children = parentUMLElement.getType().getCollaborationRoles().toArray();
- }
- }
- return children;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // no implementation needed.
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // no implementation needed.
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.ui; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.CollaborationUse; + +/** + * This class is a basic content provider that assumes a {@link CollaborationUse} is given as the + * root parent, and that will calculate the possible roles that can be used for binding. + * + */ +public class CollaborationRoleTreeContentProvider implements ITreeContentProvider { + + /** + * + * {@inheritDoc} + */ + @Override + public Object[] getChildren(Object parentElement) { + // no implementation needed. + return null; + } + + /** + * + * {@inheritDoc} + */ + @Override + public Object getParent(Object element) { + // no implementation needed. + return null; + } + + /** + * + * {@inheritDoc} + */ + @Override + public boolean hasChildren(Object element) { + // no implementation needed. + return false; + } + + /** + * <pre> + * This method returns the role referenced by the {@link Collaboration} that is + * the type of the {@link CollaborationUse}. + * + * {@inheritDoc} + * </pre> + */ + @Override + public Object[] getElements(Object inputElement) { + Object[] children = null; + + if (inputElement instanceof CollaborationUse) { + CollaborationUse parentUMLElement = (CollaborationUse) inputElement; + if (parentUMLElement.getType() != null) { + children = parentUMLElement.getType().getCollaborationRoles().toArray(); + } + } + return children; + } + + /** + * + * {@inheritDoc} + */ + @Override + public void dispose() { + // no implementation needed. + } + + /** + * + * {@inheritDoc} + */ + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // no implementation needed. + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemElementTreeSelectionDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemElementTreeSelectionDialog.java index 12a408f7704..c0485679e79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemElementTreeSelectionDialog.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemElementTreeSelectionDialog.java @@ -1,73 +1,73 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.composite.custom.ui;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-
-/**
- * Add a Button to the super-class {@link ElementTreeSelectionDialog} to create a new
- * InformationItem
- *
- */
-public class InformationItemElementTreeSelectionDialog extends ElementTreeSelectionDialog {
-
- protected Button newInformationItemButton;
-
- public static final int newInformationItemButton_ID = IDialogConstants.CLIENT_ID + 1;
-
- public InformationItemElementTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
- super(parent, labelProvider, contentProvider);
-
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, newInformationItemButton_ID, "New InformationItem", false);
- super.createButtonsForButtonBar(parent);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == newInformationItemButton_ID) {
- newInformationItemButtonPressed();
- } else {
- super.buttonPressed(buttonId);
- }
-
- }
-
- /**
- * Write the ReturnCode and close the window
- *
- */
- protected void newInformationItemButtonPressed() {
- setReturnCode(newInformationItemButton_ID);
- close();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.composite.custom.ui; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; + +/** + * Add a Button to the super-class {@link ElementTreeSelectionDialog} to create a new + * InformationItem + * + */ +public class InformationItemElementTreeSelectionDialog extends ElementTreeSelectionDialog { + + protected Button newInformationItemButton; + + public static final int newInformationItemButton_ID = IDialogConstants.CLIENT_ID + 1; + + public InformationItemElementTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) { + super(parent, labelProvider, contentProvider); + + } + + /** + * + * {@inheritDoc} + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, newInformationItemButton_ID, "New InformationItem", false); + super.createButtonsForButtonBar(parent); + } + + /** + * + * {@inheritDoc} + */ + @Override + protected void buttonPressed(int buttonId) { + if (buttonId == newInformationItemButton_ID) { + newInformationItemButtonPressed(); + } else { + super.buttonPressed(buttonId); + } + + } + + /** + * Write the ReturnCode and close the window + * + */ + protected void newInformationItemButtonPressed() { + setReturnCode(newInformationItemButton_ID); + close(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemValidator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemValidator.java index e2c5d8581b3..c882f83ce70 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemValidator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InformationItemValidator.java @@ -1,58 +1,58 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Component;
-import org.eclipse.uml2.uml.InformationItem;
-import org.eclipse.uml2.uml.Interface;
-import org.eclipse.uml2.uml.Signal;
-
-/**
- * This SelectionStatusValidator validate the selected objects. It is assumed here that the
- * selection allow multiples elements.
- *
- */
-public class InformationItemValidator implements ISelectionStatusValidator {
-
- /**
- * <pre>
- * The selection has to be a {@link Classifier} or an {@link InformationItem} for validation.
- *
- * {@inheritDoc}
- * </pre>
- */
- @Override
- public IStatus validate(Object[] selection) {
-
- IStatus status = new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, Messages.NoSelectionFound);
- if (selection.length >= 1) {
- for (int i = 0; i < selection.length; i++) {
- if (selection[i] instanceof InformationItem || selection[i] instanceof Class || selection[i] instanceof Interface || selection[i] instanceof Signal || selection[i] instanceof Component) {
- status = new Status(IStatus.OK, UMLDiagramEditorPlugin.ID, Messages.SelectionValidated);
- } else {
- status = new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, Messages.InformationFlowSelectInformationItem_ERROR);
- break;
- }
- }
- }
- return status;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.ui; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; +import org.eclipse.ui.dialogs.ISelectionStatusValidator; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.InformationItem; +import org.eclipse.uml2.uml.Interface; +import org.eclipse.uml2.uml.Signal; + +/** + * This SelectionStatusValidator validate the selected objects. It is assumed here that the + * selection allow multiples elements. + * + */ +public class InformationItemValidator implements ISelectionStatusValidator { + + /** + * <pre> + * The selection has to be a {@link Classifier} or an {@link InformationItem} for validation. + * + * {@inheritDoc} + * </pre> + */ + @Override + public IStatus validate(Object[] selection) { + + IStatus status = new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, Messages.NoSelectionFound); + if (selection.length >= 1) { + for (int i = 0; i < selection.length; i++) { + if (selection[i] instanceof InformationItem || selection[i] instanceof Class || selection[i] instanceof Interface || selection[i] instanceof Signal || selection[i] instanceof Component) { + status = new Status(IStatus.OK, UMLDiagramEditorPlugin.ID, Messages.SelectionValidated); + } else { + status = new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, Messages.InformationFlowSelectInformationItem_ERROR); + break; + } + } + } + return status; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/CompositeEditPartUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/CompositeEditPartUtil.java index f2560d58af3..304f64a5e46 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/CompositeEditPartUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/CompositeEditPartUtil.java @@ -1,47 +1,47 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.utils;
-
-import java.util.Iterator;
-
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-
-public class CompositeEditPartUtil {
-
- /**
- * Retrieve the composite compartment edit part (should be the first ShapeCompartmentEditPart)
- *
- * @param initialTarget
- * The original target
- * @return the real expected target edit part (can return null)
- */
- public static IGraphicalEditPart getCompositeCompartmentEditPart(IGraphicalEditPart parent) {
- IGraphicalEditPart compositeCompartmentEditPart = null;
-
- if (!(parent instanceof ShapeCompartmentEditPart)) {
- Iterator<?> it = parent.getChildren().iterator();
- while ((it.hasNext()) && (compositeCompartmentEditPart == null)) {
- Object tmp = it.next();
-
- if (tmp instanceof ShapeCompartmentEditPart) {
- // Compartment found
- compositeCompartmentEditPart = (ShapeCompartmentEditPart) tmp;
- }
- }
- }
-
- return compositeCompartmentEditPart;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.utils; + +import java.util.Iterator; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart; + +public class CompositeEditPartUtil { + + /** + * Retrieve the composite compartment edit part (should be the first ShapeCompartmentEditPart) + * + * @param initialTarget + * The original target + * @return the real expected target edit part (can return null) + */ + public static IGraphicalEditPart getCompositeCompartmentEditPart(IGraphicalEditPart parent) { + IGraphicalEditPart compositeCompartmentEditPart = null; + + if (!(parent instanceof ShapeCompartmentEditPart)) { + Iterator<?> it = parent.getChildren().iterator(); + while ((it.hasNext()) && (compositeCompartmentEditPart == null)) { + Object tmp = it.next(); + + if (tmp instanceof ShapeCompartmentEditPart) { + // Compartment found + compositeCompartmentEditPart = (ShapeCompartmentEditPart) tmp; + } + } + } + + return compositeCompartmentEditPart; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/GeneralizationUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/GeneralizationUtil.java index dd95a159789..ea361c7cb09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/GeneralizationUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/utils/GeneralizationUtil.java @@ -1,178 +1,178 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.utils;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-public class GeneralizationUtil {
-
- /**
- * Tests <code>true</code> if the classifier has this generalization in its inheritance links (directly or indirectly)
- *
- * @param generalization
- * a generalization
- * @param el
- * a {@link Classifier} or a {@link Property}
- * @return
- * <code>true</code> if the classifier has this generalization in its inheritance links (directly or indirectly) <code>false</code> if not
- */
- public boolean isConcernedByGeneralizationChanges(Generalization generalization, View view) {
- boolean isConcerned = false;
- NamedElement graphicalOwner = getGraphicalOwner(view);
-
- // If the View element is owned by its graphical owner bypass the tests
- if ((Element) view.getElement().eContainer() != graphicalOwner) {
-
- if (graphicalOwner instanceof Classifier) {
- if (graphicalOwner != null && generalization != null) {
- isConcerned = getAllGeneralization((Classifier) graphicalOwner, null).contains(generalization);
- }
- } else if (graphicalOwner instanceof Property) {
- Type type = ((Property) graphicalOwner).getType();
- if (type instanceof Classifier) {
- isConcerned = getAllGeneralization((Classifier) type, null).contains(generalization);
- }
- }
-
- if (isConcerned && existsAnotherInheritanceWay((Element) view.getElement(), generalization, graphicalOwner, null)) {
- isConcerned = false;
- }
-
- }
-
- return isConcerned;
- }
-
- /**
- * Tests if the classifier owns another way to inherit of the element
- *
- * @param inheritedElement
- * the inherited element
- * @param forbiddenPath
- * the generalization that we are destroying
- * @param el
- *
- * @return
- * <code>true</code> if another way exists to inherit of this element <code>false</code> if not
- */
- protected boolean existsAnotherInheritanceWay(Element inheritedElement, Generalization forbiddenPath, NamedElement el, Set<Element> ignoredGeneralizations) {
-
- Set<Generalization> generalizations = new HashSet<>();
-
- Classifier _classifier = null;
- if (el instanceof Property) {
- Type type = ((Property) el).getType();
- if (type instanceof Classifier) {
- _classifier = (Classifier) type;
- }
- } else if (el instanceof Classifier) {
- _classifier = (Classifier) el;
- }
-
- // List Generalization that have already been tested to avoid loop issues
- // in case of Generalization cycles (such cycle creation should be avoided)
- Set<Element> ignoredGeneralizationsTmp = new HashSet<Element>();
- if (ignoredGeneralizations != null) {
- ignoredGeneralizationsTmp.addAll(ignoredGeneralizations);
- }
-
- if (el != null) {
- generalizations.addAll(_classifier.getGeneralizations());
-
- for (Generalization generalization : generalizations) {
- if ((generalization != forbiddenPath) && (!ignoredGeneralizationsTmp.contains(generalization))) {
-
- Classifier general = generalization.getGeneral();
- if (general != null) {
- ignoredGeneralizationsTmp.add(generalization);
-
- if (general.getOwnedMembers().contains(inheritedElement)) {
- return true;
-
- } else if (existsAnotherInheritanceWay(inheritedElement, forbiddenPath, general, ignoredGeneralizationsTmp)) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the classifier owning the view
- *
- * @param view
- * a view
- * @return
- * the Element owning this view
- * or <code>null</code> if not found
- */
- protected NamedElement getGraphicalOwner(View view) {
- // the view is in a compartment
- if (view.eContainer() instanceof View) {
- EObject graphicalParent = ((View) view.eContainer()).getElement();
- if (graphicalParent instanceof Classifier || graphicalParent instanceof Property) {
- return (NamedElement) graphicalParent;
- }
- }
- return null;
- }
-
- /**
- * Return all the generalization (direct and indirect) owning by the classifier
- *
- * @param classifier
- * a classifier
- * @return
- * all the generalization (direct and indirect) owning by the classifier
- */
- protected Set<Generalization> getAllGeneralization(Classifier classifier, Set<Classifier> alreadyParsedClassifiers) {
-
- Set<Generalization> generalizations = new HashSet<Generalization>();
-
- // Keep track of already parsed Classifiers to avoid loop in case
- // of Generalization cycle.
- Set<Classifier> parsedClassifiers = new HashSet<Classifier>();
- if (alreadyParsedClassifiers != null) {
- parsedClassifiers.addAll(alreadyParsedClassifiers);
- }
-
- Set<Generalization> generalizationsTmp = new HashSet<Generalization>();
- if (classifier != null) {
- generalizations.addAll(classifier.getGeneralizations());
-
- if (!parsedClassifiers.contains(classifier)) {
- parsedClassifiers.add(classifier);
- for (Generalization generalization : generalizations) {
- generalizationsTmp.addAll(getAllGeneralization(generalization.getGeneral(), parsedClassifiers));
- }
- }
- }
-
- generalizations.addAll(generalizationsTmp);
-
- return generalizations;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.utils; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Generalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Type; + +public class GeneralizationUtil { + + /** + * Tests <code>true</code> if the classifier has this generalization in its inheritance links (directly or indirectly) + * + * @param generalization + * a generalization + * @param el + * a {@link Classifier} or a {@link Property} + * @return + * <code>true</code> if the classifier has this generalization in its inheritance links (directly or indirectly) <code>false</code> if not + */ + public boolean isConcernedByGeneralizationChanges(Generalization generalization, View view) { + boolean isConcerned = false; + NamedElement graphicalOwner = getGraphicalOwner(view); + + // If the View element is owned by its graphical owner bypass the tests + if ((Element) view.getElement().eContainer() != graphicalOwner) { + + if (graphicalOwner instanceof Classifier) { + if (graphicalOwner != null && generalization != null) { + isConcerned = getAllGeneralization((Classifier) graphicalOwner, null).contains(generalization); + } + } else if (graphicalOwner instanceof Property) { + Type type = ((Property) graphicalOwner).getType(); + if (type instanceof Classifier) { + isConcerned = getAllGeneralization((Classifier) type, null).contains(generalization); + } + } + + if (isConcerned && existsAnotherInheritanceWay((Element) view.getElement(), generalization, graphicalOwner, null)) { + isConcerned = false; + } + + } + + return isConcerned; + } + + /** + * Tests if the classifier owns another way to inherit of the element + * + * @param inheritedElement + * the inherited element + * @param forbiddenPath + * the generalization that we are destroying + * @param el + * + * @return + * <code>true</code> if another way exists to inherit of this element <code>false</code> if not + */ + protected boolean existsAnotherInheritanceWay(Element inheritedElement, Generalization forbiddenPath, NamedElement el, Set<Element> ignoredGeneralizations) { + + Set<Generalization> generalizations = new HashSet<>(); + + Classifier _classifier = null; + if (el instanceof Property) { + Type type = ((Property) el).getType(); + if (type instanceof Classifier) { + _classifier = (Classifier) type; + } + } else if (el instanceof Classifier) { + _classifier = (Classifier) el; + } + + // List Generalization that have already been tested to avoid loop issues + // in case of Generalization cycles (such cycle creation should be avoided) + Set<Element> ignoredGeneralizationsTmp = new HashSet<Element>(); + if (ignoredGeneralizations != null) { + ignoredGeneralizationsTmp.addAll(ignoredGeneralizations); + } + + if (el != null) { + generalizations.addAll(_classifier.getGeneralizations()); + + for (Generalization generalization : generalizations) { + if ((generalization != forbiddenPath) && (!ignoredGeneralizationsTmp.contains(generalization))) { + + Classifier general = generalization.getGeneral(); + if (general != null) { + ignoredGeneralizationsTmp.add(generalization); + + if (general.getOwnedMembers().contains(inheritedElement)) { + return true; + + } else if (existsAnotherInheritanceWay(inheritedElement, forbiddenPath, general, ignoredGeneralizationsTmp)) { + return true; + } + } + } + } + } + return false; + } + + /** + * Returns the classifier owning the view + * + * @param view + * a view + * @return + * the Element owning this view + * or <code>null</code> if not found + */ + protected NamedElement getGraphicalOwner(View view) { + // the view is in a compartment + if (view.eContainer() instanceof View) { + EObject graphicalParent = ((View) view.eContainer()).getElement(); + if (graphicalParent instanceof Classifier || graphicalParent instanceof Property) { + return (NamedElement) graphicalParent; + } + } + return null; + } + + /** + * Return all the generalization (direct and indirect) owning by the classifier + * + * @param classifier + * a classifier + * @return + * all the generalization (direct and indirect) owning by the classifier + */ + protected Set<Generalization> getAllGeneralization(Classifier classifier, Set<Classifier> alreadyParsedClassifiers) { + + Set<Generalization> generalizations = new HashSet<Generalization>(); + + // Keep track of already parsed Classifiers to avoid loop in case + // of Generalization cycle. + Set<Classifier> parsedClassifiers = new HashSet<Classifier>(); + if (alreadyParsedClassifiers != null) { + parsedClassifiers.addAll(alreadyParsedClassifiers); + } + + Set<Generalization> generalizationsTmp = new HashSet<Generalization>(); + if (classifier != null) { + generalizations.addAll(classifier.getGeneralizations()); + + if (!parsedClassifiers.contains(classifier)) { + parsedClassifiers.add(classifier); + for (Generalization generalization : generalizations) { + generalizationsTmp.addAll(getAllGeneralization(generalization.getGeneral(), parsedClassifiers)); + } + } + } + + generalizations.addAll(generalizationsTmp); + + return generalizations; + } +} |