diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom')
23 files changed, 1549 insertions, 1549 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsAction.java index 7bd3279cf4e..1c9e4ed0ce4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsAction.java @@ -1,84 +1,84 @@ -/*****************************************************************************
- * Copyright (c) 2009-2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.actions;
-
-import org.eclipse.papyrus.uml.diagram.common.actions.ShowHideContentsAction;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.messages.Messages;
-
-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();
- // setEditorLabelProvider(new EditorLabelProvider());
- // this.representations = new ArrayList<AbstractShowHideAction.EditPartRepresentation>();
- //
- // for(EditPart current : this.selectedElements) {
- // //the selected elements which aren't Classifier are ignored
- // EObject element = ((View)current.getModel()).getElement();
- // if(element instanceof Property) {
- // Type type = ((Property)element).getType();
- // if(type instanceof Classifier) {
- // this.representations.add(new CustomEditPartRepresentation(current, (Classifier)type));
- // }
- // }
- // }
- // this.setEditorLabelProvider(new CustomEditorLabelProvider());
- // this.setContentProvider(new CustomContentProvider());
- //
- // }
- //
- // protected class CustomContentProvider extends ShowHideContentsAction.ContentProvider {
- //
- // /**
- // *
- // * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- // *
- // * @param element
- // * @return
- // */
- // @Override
- // public Object getParent(Object element) {
- // if(!(element instanceof EditPartRepresentation)) {
- // EditPartRepresentation rep = findEditPartRepresentation(element);
- // if(rep != null) {
- // //element can be owned by the class (rep), or by a superclass (ClassifierRepresentation)
- // List<ClassifierRepresentation> classes = ((CustomEditPartRepresentation)rep).getSuperClasses();
- // for(ClassifierRepresentation classifierRepresentation : classes) {
- // if(classifierRepresentation.getRepresentedClassifier().getOwnedMembers().contains(element)) {
- // return classifierRepresentation;
- // }
- // }
- // }
- // return rep;
- // }
- // return null;
- // }
- // }
-}
+/***************************************************************************** + * Copyright (c) 2009-2010 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.actions; + +import org.eclipse.papyrus.uml.diagram.common.actions.ShowHideContentsAction; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.messages.Messages; + +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(); + // setEditorLabelProvider(new EditorLabelProvider()); + // this.representations = new ArrayList<AbstractShowHideAction.EditPartRepresentation>(); + // + // for(EditPart current : this.selectedElements) { + // //the selected elements which aren't Classifier are ignored + // EObject element = ((View)current.getModel()).getElement(); + // if(element instanceof Property) { + // Type type = ((Property)element).getType(); + // if(type instanceof Classifier) { + // this.representations.add(new CustomEditPartRepresentation(current, (Classifier)type)); + // } + // } + // } + // this.setEditorLabelProvider(new CustomEditorLabelProvider()); + // this.setContentProvider(new CustomContentProvider()); + // + // } + // + // protected class CustomContentProvider extends ShowHideContentsAction.ContentProvider { + // + // /** + // * + // * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) + // * + // * @param element + // * @return + // */ + // @Override + // public Object getParent(Object element) { + // if(!(element instanceof EditPartRepresentation)) { + // EditPartRepresentation rep = findEditPartRepresentation(element); + // if(rep != null) { + // //element can be owned by the class (rep), or by a superclass (ClassifierRepresentation) + // List<ClassifierRepresentation> classes = ((CustomEditPartRepresentation)rep).getSuperClasses(); + // for(ClassifierRepresentation classifierRepresentation : classes) { + // if(classifierRepresentation.getRepresentedClassifier().getOwnedMembers().contains(element)) { + // return classifierRepresentation; + // } + // } + // } + // return rep; + // } + // return null; + // } + // } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsHandler.java index 821bcd69eef..7e3ed77467a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/actions/ShowHideRelatedContentsHandler.java @@ -1,30 +1,30 @@ -/*****************************************************************************
- * Copyright (c) 2009-2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.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-2010 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.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.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java index d75eb839720..88a675e444d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java @@ -1,145 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.core.commands.ExecutionException;
-/**
- * because of the nature of this relation the test about can execute has to be change
- *
- */
-public class BranchDependenctReorientCommand extends EditElementCommand {
-
- private EObject oldNamedElementEnd;
-
- private EObject newNamedElementEnd;
-
- private final int reorientDirection;
-
- public BranchDependenctReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldNamedElementEnd = request.getOldRelationshipEnd();
- newNamedElementEnd = request.getNewRelationshipEnd();
- }
-
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Dependency) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- protected boolean canReorientSource() {
- if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) {
- return false;
- }
- // modification from the generated code
- if (getLink().getSuppliers().size() < 1) {
- return false;
- }
- NamedElement target = getLink().getSuppliers().get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), getNewSource(), target);
-
- }
-
- protected boolean canReorientTarget() {
- if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) {
- return false;
- }
- // modification from the generated code
- if (getLink().getClients().size() < 1) {
- return false;
- }
- NamedElement source = getLink().getClients().get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), source, getNewTarget());
-
- }
-
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients()
- .remove(getOldSource());
- getLink().getClients()
- .add(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers()
- .remove(getOldTarget());
- getLink().getSuppliers()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- protected Dependency getLink() {
- return (Dependency) getElementToEdit();
- }
-
- protected NamedElement getOldSource() {
- return (NamedElement) oldNamedElementEnd;
- }
-
- protected NamedElement getNewSource() {
- return (NamedElement) newNamedElementEnd;
- }
-
- protected NamedElement getOldTarget() {
- return (NamedElement) oldNamedElementEnd;
- }
-
- protected NamedElement getNewTarget() {
- return (NamedElement) newNamedElementEnd;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy; +import org.eclipse.uml2.uml.Dependency; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Package; +import org.eclipse.core.commands.ExecutionException; +/** + * because of the nature of this relation the test about can execute has to be change + * + */ +public class BranchDependenctReorientCommand extends EditElementCommand { + + private EObject oldNamedElementEnd; + + private EObject newNamedElementEnd; + + private final int reorientDirection; + + public BranchDependenctReorientCommand(ReorientRelationshipRequest request) { + super(request.getLabel(), request.getRelationship(), request); + reorientDirection = request.getDirection(); + oldNamedElementEnd = request.getOldRelationshipEnd(); + newNamedElementEnd = request.getNewRelationshipEnd(); + } + + @Override + public boolean canExecute() { + if (false == getElementToEdit() instanceof Dependency) { + return false; + } + if (reorientDirection == ReorientRequest.REORIENT_SOURCE) { + return canReorientSource(); + } + if (reorientDirection == ReorientRequest.REORIENT_TARGET) { + return canReorientTarget(); + } + return false; + } + + protected boolean canReorientSource() { + if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) { + return false; + } + // modification from the generated code + if (getLink().getSuppliers().size() < 1) { + return false; + } + NamedElement target = getLink().getSuppliers().get(0); + if (!(getLink().eContainer() instanceof Package)) { + return false; + } + Package container = (Package) getLink().eContainer(); + return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), getNewSource(), target); + + } + + protected boolean canReorientTarget() { + if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) { + return false; + } + // modification from the generated code + if (getLink().getClients().size() < 1) { + return false; + } + NamedElement source = getLink().getClients().get(0); + if (!(getLink().eContainer() instanceof Package)) { + return false; + } + Package container = (Package) getLink().eContainer(); + return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), source, getNewTarget()); + + } + + protected CommandResult reorientSource() throws ExecutionException { + getLink().getClients() + .remove(getOldSource()); + getLink().getClients() + .add(getNewSource()); + return CommandResult.newOKCommandResult(getLink()); + } + + protected CommandResult reorientTarget() throws ExecutionException { + getLink().getSuppliers() + .remove(getOldTarget()); + getLink().getSuppliers() + .add(getNewTarget()); + return CommandResult.newOKCommandResult(getLink()); + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (!canExecute()) { + throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$ + } + if (reorientDirection == ReorientRequest.REORIENT_SOURCE) { + return reorientSource(); + } + if (reorientDirection == ReorientRequest.REORIENT_TARGET) { + return reorientTarget(); + } + throw new IllegalStateException(); + } + + protected Dependency getLink() { + return (Dependency) getElementToEdit(); + } + + protected NamedElement getOldSource() { + return (NamedElement) oldNamedElementEnd; + } + + protected NamedElement getNewSource() { + return (NamedElement) newNamedElementEnd; + } + + protected NamedElement getOldTarget() { + return (NamedElement) oldNamedElementEnd; + } + + protected NamedElement getNewTarget() { + return (NamedElement) newNamedElementEnd; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/CreateViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/CreateViewCommand.java index 9efd71e42d7..31ec89f9579 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/CreateViewCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/CreateViewCommand.java @@ -1,32 +1,32 @@ -/*****************************************************************************
- * Copyright (c) 2010 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.deployment.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 {
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) {
- super(editingDomain, viewDescriptor, containerView);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 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.deployment.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 { + + @Override + public boolean canExecute() { + return true; + } + + public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) { + super(editingDomain, viewDescriptor, containerView); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/ElementToStereotypedShape.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/ElementToStereotypedShape.java index 94c77046761..7db6b606e4b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/ElementToStereotypedShape.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/ElementToStereotypedShape.java @@ -1,67 +1,67 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLViewProvider;
-
-/**
- * this is the specific command in charge to transform an element editpart into a shape_namedElement Editpart
- *
- */
-public class ElementToStereotypedShape extends RecordingCommand {
-
- protected GraphicalEditPart elementEditPart;
-
- /**
- *
- * Constructor of this command
- *
- * @param domain
- * the transactional editing domain to execute transaction
- * @param classView
- * the editpart that will be transformed
- */
- public ElementToStereotypedShape(TransactionalEditingDomain domain, GraphicalEditPart classView) {
- super(domain);
- this.elementEditPart = classView;
- }
-
- @Override
- protected void doExecute() {
-
- // creation of the node
- UMLViewProvider umlViewProvider = new UMLViewProvider();
- Node packageview = umlViewProvider.createNamedElement_DefaultShape(elementEditPart.resolveSemanticElement(), (View) elementEditPart.getNotationView().eContainer(), -1, true, elementEditPart.getDiagramPreferencesHint());
- packageview.setLayoutConstraint(((Node) elementEditPart.getNotationView()).getLayoutConstraint());
-
- // copy of all eannotations
- Iterator<EAnnotation> iter = elementEditPart.getNotationView().getEAnnotations().iterator();
- while (iter.hasNext()) {
- EAnnotation annotation = EcoreUtil.copy(iter.next());
- packageview.getEAnnotations().add(annotation);
-
- }
-
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLViewProvider; + +/** + * this is the specific command in charge to transform an element editpart into a shape_namedElement Editpart + * + */ +public class ElementToStereotypedShape extends RecordingCommand { + + protected GraphicalEditPart elementEditPart; + + /** + * + * Constructor of this command + * + * @param domain + * the transactional editing domain to execute transaction + * @param classView + * the editpart that will be transformed + */ + public ElementToStereotypedShape(TransactionalEditingDomain domain, GraphicalEditPart classView) { + super(domain); + this.elementEditPart = classView; + } + + @Override + protected void doExecute() { + + // creation of the node + UMLViewProvider umlViewProvider = new UMLViewProvider(); + Node packageview = umlViewProvider.createNamedElement_DefaultShape(elementEditPart.resolveSemanticElement(), (View) elementEditPart.getNotationView().eContainer(), -1, true, elementEditPart.getDiagramPreferencesHint()); + packageview.setLayoutConstraint(((Node) elementEditPart.getNotationView()).getLayoutConstraint()); + + // copy of all eannotations + Iterator<EAnnotation> iter = elementEditPart.getNotationView().getEAnnotations().iterator(); + while (iter.hasNext()) { + EAnnotation annotation = EcoreUtil.copy(iter.next()); + packageview.getEAnnotations().add(annotation); + + } + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/DeploymentLinkMappingHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/DeploymentLinkMappingHelper.java index 730be68268c..e1ce1ed37fe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/DeploymentLinkMappingHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/DeploymentLinkMappingHelper.java @@ -1,81 +1,81 @@ -package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers;
-
-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 DeploymentLinkMappingHelper implements ILinkMappingHelper {
-
- /**
- * Singleton management
- */
- private static class SingletonHolder {
-
- /**
- * Singleton instance
- */
- private final static DeploymentLinkMappingHelper instance = new DeploymentLinkMappingHelper();
- }
-
- /**
- * Get singleton instance
- *
- * @return the instance
- */
- public static DeploymentLinkMappingHelper getInstance() {
- return SingletonHolder.instance;
- }
-
- /**
- * private constructor
- */
- private DeploymentLinkMappingHelper() {
- // 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();
- };
- });
- }
-
-}
+package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers; + +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 DeploymentLinkMappingHelper implements ILinkMappingHelper { + + /** + * Singleton management + */ + private static class SingletonHolder { + + /** + * Singleton instance + */ + private final static DeploymentLinkMappingHelper instance = new DeploymentLinkMappingHelper(); + } + + /** + * Get singleton instance + * + * @return the instance + */ + public static DeploymentLinkMappingHelper getInstance() { + return SingletonHolder.instance; + } + + /** + * private constructor + */ + private DeploymentLinkMappingHelper() { + // 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.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyBranchEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyBranchEditPart.java index 351b197793c..64f18e82108 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyBranchEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyBranchEditPart.java @@ -1,38 +1,38 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-
-/**
- * this a specific editpart used to overload the method createNodePlate
- */
-public class CustomDependencyBranchEditPart extends DependencyBranchEditPart {
-
- public CustomDependencyBranchEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void refreshVisuals() {
- if (getTarget() instanceof DependencyNodeEditPart) {
- if (getPrimaryShape() instanceof DashedEdgeFigure) {
- getPrimaryShape().setArrow(false);
- }
- super.refreshVisuals();
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part; + +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart; + +/** + * this a specific editpart used to overload the method createNodePlate + */ +public class CustomDependencyBranchEditPart extends DependencyBranchEditPart { + + public CustomDependencyBranchEditPart(View view) { + super(view); + } + + @Override + protected void refreshVisuals() { + if (getTarget() instanceof DependencyNodeEditPart) { + if (getPrimaryShape() instanceof DashedEdgeFigure) { + getPrimaryShape().setArrow(false); + } + super.refreshVisuals(); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyNodeEditPart.java index cd966cb6678..f7cb3370678 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyNodeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomDependencyNodeEditPart.java @@ -1,41 +1,41 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part;
-
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.AssociationNodeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-
-/**
- * this a specific editpart used to overload the method createNodePlate
- */
-public class CustomDependencyNodeEditPart extends DependencyNodeEditPart {
-
- public CustomDependencyNodeEditPart(View view) {
- super(view);
- }
-
- /**
- *
- * @return
- */
- @Override
- protected NodeFigure createNodePlate() {
-
- DefaultSizeNodeFigure result = new AssociationNodeFigure(10, 10);
-
- return result;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part; + +import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AssociationNodeFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart; + +/** + * this a specific editpart used to overload the method createNodePlate + */ +public class CustomDependencyNodeEditPart extends DependencyNodeEditPart { + + public CustomDependencyNodeEditPart(View view) { + super(view); + } + + /** + * + * @return + */ + @Override + protected NodeFigure createNodePlate() { + + DefaultSizeNodeFigure result = new AssociationNodeFigure(10, 10); + + return result; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPart.java index cc716ef7734..f6b9e816c0b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPart.java @@ -1,42 +1,42 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-
-/**
- * this a specific editpart used to overload the method createNodePlate
- */
-public class CustomModelEditPart extends ModelEditPart {
-
- protected static final String ICONS_PATH = "icons/Triangle.gif"; //$NON-NLS-1$
-
- public CustomModelEditPart(View view) {
- super(view);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new PackageFigure();
- ((PackageFigure) primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH));
- return primaryShape;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart; + +/** + * this a specific editpart used to overload the method createNodePlate + */ +public class CustomModelEditPart extends ModelEditPart { + + protected static final String ICONS_PATH = "icons/Triangle.gif"; //$NON-NLS-1$ + + public CustomModelEditPart(View view) { + super(view); + } + + + /** + * {@inheritDoc} + */ + @Override + protected IFigure createNodeShape() { + primaryShape = new PackageFigure(); + ((PackageFigure) primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH)); + return primaryShape; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPartCN.java index e4975c4b340..38f09e544b8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/part/CustomModelEditPartCN.java @@ -1,42 +1,42 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-
-/**
- * this a specific editpart used to overload the method createNodePlate
- */
-public class CustomModelEditPartCN extends ModelEditPartCN {
-
- protected static final String ICONS_PATH = "icons/Triangle.gif"; //$NON-NLS-1$
-
- public CustomModelEditPartCN(View view) {
- super(view);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new PackageFigure();
- ((PackageFigure) primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH));
- return primaryShape;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN; + +/** + * this a specific editpart used to overload the method createNodePlate + */ +public class CustomModelEditPartCN extends ModelEditPartCN { + + protected static final String ICONS_PATH = "icons/Triangle.gif"; //$NON-NLS-1$ + + public CustomModelEditPartCN(View view) { + super(view); + } + + + /** + * {@inheritDoc} + */ + @Override + protected IFigure createNodeShape() { + primaryShape = new PackageFigure(); + ((PackageFigure) primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH)); + return primaryShape; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomGraphicalNodeEditPolicy.java index 7fbe6d12696..80d5775980f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomGraphicalNodeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomGraphicalNodeEditPolicy.java @@ -1,74 +1,74 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers.MultiDependencyHelper;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * This class is used to launch command to create associationClass
- *
- * @author Patrick Tessier
- */
-public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public Command getCommand(Request request) {
-
- // we have to distinguish the case where this is an association class
- if (REQ_CONNECTION_END.equals(request.getType())) {
- if (request instanceof CreateConnectionViewAndElementRequest) {
- // default behavior
- Command c = getConnectionAndRelationshipCompleteCommand((CreateConnectionViewAndElementRequest) request);
-
- // case of associationClass
- CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) request).getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
- CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
-
- if (UMLElementTypes.Dependency_BranchEdge.equals(createElementRequest.getElementType())) {
- MultiDependencyHelper multiDependencyHelper = new MultiDependencyHelper(getEditingDomain());
- return multiDependencyHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
-
- } else {
- return c;
- }
- } else if (request instanceof CreateUnspecifiedTypeConnectionRequest) {
- return getUnspecifiedConnectionCompleteCommand((CreateUnspecifiedTypeConnectionRequest) request);
- }
- }
-
- return super.getCommand(request);
- }
-
- /**
- * used to obtain the transactional edit domain
- *
- * @return the current transactional edit domain
- */
- private TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers.MultiDependencyHelper; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; + +/** + * This class is used to launch command to create associationClass + * + * @author Patrick Tessier + */ +public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy { + + /** + * + * {@inheritDoc} + */ + @Override + public Command getCommand(Request request) { + + // we have to distinguish the case where this is an association class + if (REQ_CONNECTION_END.equals(request.getType())) { + if (request instanceof CreateConnectionViewAndElementRequest) { + // default behavior + Command c = getConnectionAndRelationshipCompleteCommand((CreateConnectionViewAndElementRequest) request); + + // case of associationClass + CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) request).getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter(); + CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class); + + if (UMLElementTypes.Dependency_BranchEdge.equals(createElementRequest.getElementType())) { + MultiDependencyHelper multiDependencyHelper = new MultiDependencyHelper(getEditingDomain()); + return multiDependencyHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c); + + } else { + return c; + } + } else if (request instanceof CreateUnspecifiedTypeConnectionRequest) { + return getUnspecifiedConnectionCompleteCommand((CreateUnspecifiedTypeConnectionRequest) request); + } + } + + return super.getCommand(request); + } + + /** + * used to obtain the transactional edit domain + * + * @return the current transactional edit domain + */ + private TransactionalEditingDomain getEditingDomain() { + return ((IGraphicalEditPart) getHost()).getEditingDomain(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/DeploymentDiagramChangeStereotypedShapeEditpolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/DeploymentDiagramChangeStereotypedShapeEditpolicy.java index 658127c5aae..70d58161138 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/DeploymentDiagramChangeStereotypedShapeEditpolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/DeploymentDiagramChangeStereotypedShapeEditpolicy.java @@ -1,105 +1,105 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies;
-
-import java.util.ArrayList;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.ElementToStereotypedShape;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * the goal of this class is to allow changing the aspect of an element by taking in account its stereotype
- *
- */
-public class DeploymentDiagramChangeStereotypedShapeEditpolicy extends ChangeStereotypedShapeEditPolicy {
-
- @Override
- public void transformIntoShape(final EditPart part) {
- try {
- ((IGraphicalEditPart) getHost()).getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
-
- Display.getCurrent().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (part instanceof GraphicalEditPart) {
-
- GraphicalEditPart gmfpart = (GraphicalEditPart) part;
- ElementToStereotypedShape command = new ElementToStereotypedShape(gmfpart.getEditingDomain(), gmfpart);
- gmfpart.getEditingDomain().getCommandStack().execute(command);
- Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
- Command deleteCommand = gmfpart.getCommand(deleteViewRequest);
- gmfpart.getDiagramEditDomain().getDiagramCommandStack().execute(deleteCommand);
- }
-
- }
- });
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void transformIntoNormalShape(final EditPart part) {
- try {
- ((IGraphicalEditPart) getHost()).getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
-
- Display.getCurrent().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (part instanceof GraphicalEditPart) {
-
- GraphicalEditPart gmfpart = (GraphicalEditPart) part;
- DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<EObject> list = new ArrayList<EObject>();
- list.add(gmfpart.resolveSemanticElement());
- dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(gmfpart.getFigure().getBounds().getLocation());
- Command command = gmfpart.getParent().getCommand(dropObjectsRequest);
- gmfpart.getEditingDomain().getCommandStack().execute(new GEFtoEMFCommandWrapper(command));
- Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
- Command deleteCommand = gmfpart.getCommand(deleteViewRequest);
- gmfpart.getDiagramEditDomain().getDiagramCommandStack().execute(deleteCommand);
- }
-
- }
- });
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies; + +import java.util.ArrayList; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.requests.GroupRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; +import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.ElementToStereotypedShape; +import org.eclipse.swt.widgets.Display; + +/** + * the goal of this class is to allow changing the aspect of an element by taking in account its stereotype + * + */ +public class DeploymentDiagramChangeStereotypedShapeEditpolicy extends ChangeStereotypedShapeEditPolicy { + + @Override + public void transformIntoShape(final EditPart part) { + try { + ((IGraphicalEditPart) getHost()).getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + + Display.getCurrent().asyncExec(new Runnable() { + + @Override + public void run() { + if (part instanceof GraphicalEditPart) { + + GraphicalEditPart gmfpart = (GraphicalEditPart) part; + ElementToStereotypedShape command = new ElementToStereotypedShape(gmfpart.getEditingDomain(), gmfpart); + gmfpart.getEditingDomain().getCommandStack().execute(command); + Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE); + Command deleteCommand = gmfpart.getCommand(deleteViewRequest); + gmfpart.getDiagramEditDomain().getDiagramCommandStack().execute(deleteCommand); + } + + } + }); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public void transformIntoNormalShape(final EditPart part) { + try { + ((IGraphicalEditPart) getHost()).getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + + Display.getCurrent().asyncExec(new Runnable() { + + @Override + public void run() { + if (part instanceof GraphicalEditPart) { + + GraphicalEditPart gmfpart = (GraphicalEditPart) part; + DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); + ArrayList<EObject> list = new ArrayList<EObject>(); + list.add(gmfpart.resolveSemanticElement()); + dropObjectsRequest.setObjects(list); + dropObjectsRequest.setLocation(gmfpart.getFigure().getBounds().getLocation()); + Command command = gmfpart.getParent().getCommand(dropObjectsRequest); + gmfpart.getEditingDomain().getCommandStack().execute(new GEFtoEMFCommandWrapper(command)); + Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE); + Command deleteCommand = gmfpart.getCommand(deleteViewRequest); + gmfpart.getDiagramEditDomain().getDiagramCommandStack().execute(deleteCommand); + } + + } + }); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/RemoveOrphanViewPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/RemoveOrphanViewPolicy.java index 62edc7b9b11..f5877a73b9a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/RemoveOrphanViewPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/RemoveOrphanViewPolicy.java @@ -1,46 +1,46 @@ -/*****************************************************************************
- * Copyright (c) 2009 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:
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Adaptation for Composite Diagram
-
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies;
-
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy;
-
-/**
- * <pre>
- * This policy is used to suppress orphan node view in GMF view.
- * The policy to remove orphan connection is more complex.
- *
- * See RemoveOrphanViewPolicy in Class Diagram
- * </pre>
- */
-public class RemoveOrphanViewPolicy extends OrphanViewPolicy {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy#isOrphaned(org.eclipse.gmf.runtime.notation.View)
- * @param view
- * @return true is the view is Orphaned
- */
- @Override
- protected boolean isOrphaned(View view) {
- // Always treat Compartment and Decoration as not orphaned nodes
- if ((view instanceof BasicCompartment) || (view instanceof DecorationNode)) {
- return false;
- }
- return !view.isSetElement();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 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: + * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Adaptation for Composite Diagram + + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies; + +import org.eclipse.gmf.runtime.notation.BasicCompartment; +import org.eclipse.gmf.runtime.notation.DecorationNode; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy; + +/** + * <pre> + * This policy is used to suppress orphan node view in GMF view. + * The policy to remove orphan connection is more complex. + * + * See RemoveOrphanViewPolicy in Class Diagram + * </pre> + */ +public class RemoveOrphanViewPolicy extends OrphanViewPolicy { + + /** + * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy#isOrphaned(org.eclipse.gmf.runtime.notation.View) + * @param view + * @return true is the view is Orphaned + */ + @Override + protected boolean isOrphaned(View view) { + // Always treat Compartment and Decoration as not orphaned nodes + if ((view instanceof BasicCompartment) || (view instanceof DecorationNode)) { + return false; + } + return !view.isSetElement(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java index 6b912fdfdf8..f9f299bb927 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java @@ -1,45 +1,45 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.commands.wrappers.GMFtoGEFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.BranchDependenctReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-
-/**
- * this class has been specialized in order to manage reconnection of multidependency
- *
- */
-public class CustomDefaultNamedElementItemSemanticEditPolicy extends DefaultSemanticEditPolicy {
-
- public static final String VISUAL_ID_KEY = "visual_id";
-
- @Override
- protected Command getSemanticCommand(IEditCommandRequest request) {
- if (request instanceof ReorientRelationshipRequest) {
- if (DependencyBranchEditPart.VISUAL_ID == getVisualID(request)) {
- return new GMFtoGEFCommandWrapper(new BranchDependenctReorientCommand((ReorientRelationshipRequest)request));
- }
- }
- return super.getSemanticCommand(request);
- }
-
- protected String getVisualID(IEditCommandRequest request) {
- return (String) request.getParameter(VISUAL_ID_KEY);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.commands.wrappers.GMFtoGEFCommandWrapper; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.BranchDependenctReorientCommand; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart; + +/** + * this class has been specialized in order to manage reconnection of multidependency + * + */ +public class CustomDefaultNamedElementItemSemanticEditPolicy extends DefaultSemanticEditPolicy { + + public static final String VISUAL_ID_KEY = "visual_id"; + + @Override + protected Command getSemanticCommand(IEditCommandRequest request) { + if (request instanceof ReorientRelationshipRequest) { + if (DependencyBranchEditPart.VISUAL_ID == getVisualID(request)) { + return new GMFtoGEFCommandWrapper(new BranchDependenctReorientCommand((ReorientRelationshipRequest)request)); + } + } + return super.getSemanticCommand(request); + } + + protected String getVisualID(IEditCommandRequest request) { + return (String) request.getParameter(VISUAL_ID_KEY); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java index aaabe83fb62..2b8d87e31f3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java @@ -1,41 +1,41 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-
-/**
- * this class is used to forbid the creation of a dependency branch on a dependency branch.
- *
- */
-public class CustomDependencyBranchSemanticEditPolicy extends DefaultSemanticEditPolicy {
-
- @Override
- protected Command getSemanticCommand(IEditCommandRequest request) {
- if (request instanceof CreateRelationshipRequest) {
- IElementType type = ((CreateRelationshipRequest) request).getElementType();
- if (UMLElementTypes.Dependency_BranchEdge == type) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getSemanticCommand(request);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; + + +/** + * this class is used to forbid the creation of a dependency branch on a dependency branch. + * + */ +public class CustomDependencyBranchSemanticEditPolicy extends DefaultSemanticEditPolicy { + + @Override + protected Command getSemanticCommand(IEditCommandRequest request) { + if (request instanceof CreateRelationshipRequest) { + IElementType type = ((CreateRelationshipRequest) request).getElementType(); + if (UMLElementTypes.Dependency_BranchEdge == type) { + return UnexecutableCommand.INSTANCE; + } + } + return super.getSemanticCommand(request); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/factory/CustomUMLeditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/factory/CustomUMLeditPartFactory.java index ee4dd9d9651..adeac7160e8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/factory/CustomUMLeditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/factory/CustomUMLeditPartFactory.java @@ -1,53 +1,53 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.factory;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomDependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomDependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-
-
-public class CustomUMLeditPartFactory extends UMLEditPartFactory {
-
- @Override
- public EditPart createEditPart(EditPart context, Object model) {
- if (model instanceof View) {
- View view = (View) model;
- String visualID = UMLVisualIDRegistry.getVisualID(view);
- if(visualID != null) {
- switch (visualID) {
- // redefined classes to modify the method createNodePlate
-
- case ModelEditPart.VISUAL_ID:
- return new CustomModelEditPart(view);
- case ModelEditPartCN.VISUAL_ID:
- return new CustomModelEditPartCN(view);
- case DependencyNodeEditPart.VISUAL_ID:
- return new CustomDependencyNodeEditPart(view);
- case DependencyBranchEditPart.VISUAL_ID:
- return new CustomDependencyBranchEditPart(view);
- }
- }
- }
- return super.createEditPart(context, model);
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.factory; + +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomDependencyBranchEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomDependencyNodeEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomModelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part.CustomModelEditPartCN; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.UMLEditPartFactory; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; + + +public class CustomUMLeditPartFactory extends UMLEditPartFactory { + + @Override + public EditPart createEditPart(EditPart context, Object model) { + if (model instanceof View) { + View view = (View) model; + String visualID = UMLVisualIDRegistry.getVisualID(view); + if(visualID != null) { + switch (visualID) { + // redefined classes to modify the method createNodePlate + + case ModelEditPart.VISUAL_ID: + return new CustomModelEditPart(view); + case ModelEditPartCN.VISUAL_ID: + return new CustomModelEditPartCN(view); + case DependencyNodeEditPart.VISUAL_ID: + return new CustomDependencyNodeEditPart(view); + case DependencyBranchEditPart.VISUAL_ID: + return new CustomDependencyBranchEditPart(view); + } + } + } + return super.createEditPart(context, model); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/ArtifactFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/ArtifactFigure.java index e71d704e987..5cb4b63f7ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/ArtifactFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/ArtifactFigure.java @@ -1,71 +1,71 @@ -/*****************************************************************************
- * Copyright (c) 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:
- * Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * The Class ArtifactFigure.
- */
-public class ArtifactFigure extends RoundedCompartmentFigure {
-
- /** The Internal Structure Compartment. */
- private final static String COMPOSITE_COMPARTMENT = "compositeCompartment";
-
- /** The List of Compartment. */
- private final static List<String> COMPARTMENT = new ArrayList<String>() {
-
- private static final long serialVersionUID = 1L;
- {
- add(COMPOSITE_COMPARTMENT);
- }
- };
-
- /**
- * Instantiates a new artifact figure.
- */
- public ArtifactFigure() {
- this("artifact");
- }
-
- /**
- * Instantiates a new artifact figure.
- *
- * @param tagvalue
- * the tagvalue
- */
- public ArtifactFigure(String tagvalue) {
- super(COMPARTMENT, tagvalue);
- Image img = Activator.getPluginIconImage(UMLDiagramEditorPlugin.ID, "icons/obj16/ArtifactIcon.gif");
- setAppliedStereotypeIcon(img, PositionConstants.RIGHT);
- }
-
- /**
- * Gets the composite compartment figure.
- *
- * @return the composite compartment figure
- */
- public IFigure getCompositeCompartmentFigure() {
- return getCompartment(COMPOSITE_COMPARTMENT);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 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: + * Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; + + +/** + * The Class ArtifactFigure. + */ +public class ArtifactFigure extends RoundedCompartmentFigure { + + /** The Internal Structure Compartment. */ + private final static String COMPOSITE_COMPARTMENT = "compositeCompartment"; + + /** The List of Compartment. */ + private final static List<String> COMPARTMENT = new ArrayList<String>() { + + private static final long serialVersionUID = 1L; + { + add(COMPOSITE_COMPARTMENT); + } + }; + + /** + * Instantiates a new artifact figure. + */ + public ArtifactFigure() { + this("artifact"); + } + + /** + * Instantiates a new artifact figure. + * + * @param tagvalue + * the tagvalue + */ + public ArtifactFigure(String tagvalue) { + super(COMPARTMENT, tagvalue); + Image img = Activator.getPluginIconImage(UMLDiagramEditorPlugin.ID, "icons/obj16/ArtifactIcon.gif"); + setAppliedStereotypeIcon(img, PositionConstants.RIGHT); + } + + /** + * Gets the composite compartment figure. + * + * @return the composite compartment figure + */ + public IFigure getCompositeCompartmentFigure() { + return getCompartment(COMPOSITE_COMPARTMENT); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/Messages.java index 514d9f85197..c3429321a22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/Messages.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/Messages.java @@ -1,51 +1,51 @@ -/*****************************************************************************
- * Copyright (c) 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:
- * Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * The Class Messages.
- */
-public class Messages extends NLS {
-
- /** The Constant BUNDLE_NAME. */
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.diagram.deployment.custom.messages.messages"; //$NON-NLS-1$
-
- /** The Create uml element dialog_ new_ element_ name. */
- public static String CreateUmlElementDialog_New_Element_Name;
-
- /** The Selection validated. */
- public static String SelectionValidated;
-
- /** The Show hide related contents action_ message. */
- public static String ShowHideRelatedContentsAction_Message;
-
- /** The Show hide related contents action_ title. */
- public static String ShowHideRelatedContentsAction_Title;
-
- /** The No selection found. */
- public static String NoSelectionFound;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * Instantiates a new messages.
- */
- private Messages() {
- }
-}
+/***************************************************************************** + * Copyright (c) 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: + * Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.messages; + +import org.eclipse.osgi.util.NLS; + + +/** + * The Class Messages. + */ +public class Messages extends NLS { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.diagram.deployment.custom.messages.messages"; //$NON-NLS-1$ + + /** The Create uml element dialog_ new_ element_ name. */ + public static String CreateUmlElementDialog_New_Element_Name; + + /** The Selection validated. */ + public static String SelectionValidated; + + /** The Show hide related contents action_ message. */ + public static String ShowHideRelatedContentsAction_Message; + + /** The Show hide related contents action_ title. */ + public static String ShowHideRelatedContentsAction_Title; + + /** The No selection found. */ + public static String NoSelectionFound; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Instantiates a new messages. + */ + private Messages() { + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/messages.properties index 52ea38c5976..64e6f71b9f1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/messages.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/messages/messages.properties @@ -1,18 +1,18 @@ -###############################################################################
-# Copyright (c) 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:
-# Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr
-###############################################################################
-CreateUmlElementDialog_New_Element_Name=New Element Name
-SelectionValidated=Selection validated.
-ShowHideRelatedContentsAction_Message=Choose the elements to show
-ShowHideRelatedContentsAction_Title=Show/Hide Related Contents
-ShowHideRelatedContentsAction_Message=Choose the elements to show
-ShowHideRelatedContentsAction_Title=Show/Hide Related Contents
+############################################################################### +# Copyright (c) 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: +# Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr +############################################################################### +CreateUmlElementDialog_New_Element_Name=New Element Name +SelectionValidated=Selection validated. +ShowHideRelatedContentsAction_Message=Choose the elements to show +ShowHideRelatedContentsAction_Title=Show/Hide Related Contents +ShowHideRelatedContentsAction_Message=Choose the elements to show +ShowHideRelatedContentsAction_Title=Show/Hide Related Contents NoSelectionFound=No selection found.
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_2_0.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_2_0.java index ec049ffc20a..3f7a017f40b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_2_0.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_2_0.java @@ -1,287 +1,287 @@ -/*****************************************************************************
- * 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.deployment.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;
-
-/**
- * Deployment Diagram Reconciler from 1.1.0 to 1.2.0
- * @since 3.0
- */
-public class DeploymentReconciler_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_DeploymentDiagram";
- case "49":
- return "Model_Shape_CN";
- case "50":
- return "Model_NameLabel_CN";
- case "36":
- return "Package_Shape_CN";
- case "37":
- return "Package_NameLabel_CN";
- case "16":
- return "Device_Shape_CCN";
- case "20":
- return "Device_NameLabel_CCN";
- case "44":
- return "Device_Shape_CN";
- case "45":
- return "Device_NameLabel_CN";
- case "21":
- return "ExecutionEnvironment_Shape_CCN";
- case "22":
- return "ExecutionEnvironment_NameLabel_CCN";
- case "46":
- return "ExecutionEnvironment_Shape_CN";
- case "47":
- return "ExecutionEnvironment_NameLabel_CN";
- case "23":
- return "Node_Shape_CCN";
- case "24":
- return "Node_NameLabel_CCN";
- case "42":
- return "Node_Shape_CN";
- case "43":
- return "Node_NameLabel_CN";
- case "25":
- return "Artifact_Shape_CCN";
- case "27":
- return "Artifact_NameLabel_CCN";
- case "59":
- return "Artifact_FloatingNameLabel_CCN";
- case "28":
- return "Artifact_Shape_ACN";
- case "29":
- return "Artifact_NameLabel_ACN";
- case "60":
- return "Artifact_FloatingNameLabel_ACN";
- case "40":
- return "Artifact_Shape_CN";
- case "41":
- return "Artifact_NameLabel_CN";
- case "54":
- return "Comment_Shape_CN";
- case "55":
- return "Comment_BodyLabel_CN";
- case "56":
- return "Constraint_Shape_CN";
- case "57":
- return "Constraint_NameLabel_CN";
- case "58":
- return "Constraint_BodyLabel_CN";
- case "2014":
- return "DeploymentSpecification_Shape_CCN";
- case "64":
- return "DeploymentSpecification_NameLabel_CCN";
- case "65":
- return "DeploymentSpecification_FloatingNameLabel_CCN";
- case "2015":
- return "DeploymentSpecification_Shape_CN";
- case "66":
- return "DeploymentSpecification_NameLabel_CN";
- case "67":
- return "DeploymentSpecification_FloatingNameLabel_CN";
- case "2016":
- return "DeploymentSpecification_Shape_ACN";
- case "68":
- return "DeploymentSpecification_NameLabel_ACN";
- case "69":
- return "DeploymentSpecification_FloatingNameLabel_ACN";
- case "2011":
- return "Dependency_Shape";
- case "7":
- return "Dependency_MultiNameLabel";
- case "2010":
- return "Model_Shape";
- case "48":
- return "Model_NameLabel";
- case "2009":
- return "Package_Shape";
- case "35":
- return "Package_NameLabel";
- case "2005":
- return "Constraint_Shape";
- case "2":
- return "Constraint_NameLabel";
- case "3":
- return "Constraint_BodyLabel";
- case "2001":
- return "Comment_Shape";
- case "1":
- return "Comment_BodyLabel";
- case "2002":
- return "ExecutionEnvironment_Shape";
- case "5":
- return "ExecutionEnvironment_NameLabel";
- case "2003":
- return "Device_Shape";
- case "6":
- return "Device_NameLabel";
- case "2006":
- return "Artifact_Shape";
- case "8":
- return "Artifact_NameLabel";
- case "61":
- return "Artifact_FloatingNameLabel";
- case "2008":
- return "Node_Shape";
- case "9":
- return "Node_NameLabel";
- case "2012":
- return "NamedElement_DefaultShape";
- case "53":
- return "NamedElement_NameLabel";
- case "2013":
- return "DeploymentSpecification_Shape";
- case "62":
- return "DeploymentSpecification_NameLabel";
- case "63":
- return "DeploymentSpecification_FloatingNameLabel";
- case "4005":
- return "Link_DescriptorEdge";
- case "4008":
- return "Comment_AnnotatedElementEdge";
- case "4009":
- return "Constraint_ConstrainedElementEdge";
- case "4001":
- return "Deployment_Edge";
- case "13":
- return "Deployment_NameLabel";
- case "14":
- return "Deployment_StereotypeLabel";
- case "4002":
- return "Manifestation_Edge";
- case "10":
- return "Manifestation_NameLabel";
- case "11":
- return "Manifestation_StereotypeLabel";
- case "4003":
- return "Generalization_Edge";
- case "4":
- return "Generalization_StereotypeLabel";
- case "4004":
- return "Dependency_Edge";
- case "12":
- return "Dependency_NameLabel";
- case "15":
- return "Dependency_StereotypeLabel";
- case "4010":
- return "Dependency_BranchEdge";
- case "4011":
- return "CommunicationPath_Edge";
- case "6001":
- return "CommunicationPath_NameLabel";
- case "6002":
- return "CommunicationPath_StereotypeLabel";
- case "51":
- return "Model_PackagedElementCompartment";
- case "38":
- return "Package_PackagedElementCompartment";
- case "17":
- return "Device_NestedNodeCompartment";
- case "18":
- return "ExecutionEnvironment_NestedNodeCompartment";
- case "19":
- return "Node_NestedNodeCompartment";
- case "26":
- return "Artifact_NestedArtifactCompartment";
- case "52":
- return "Model_PackagedElementCompartment_CN";
- case "39":
- return "Package_PackagedElementCompartment_CN";
- case "30":
- return "Device_NestedNodeCompartment_CN";
- case "31":
- return "ExecutionEnvironment_NestedNodeCompartment_CN";
- case "32":
- return "Node_NestedNodeCompartment_CN";
- case "33":
- return "Artifact_NestedArtifactCompartment_CCN";
- case "34":
- return "Artifact_NestedArtifactCompartment_ACN";
- 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.deployment.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; + +/** + * Deployment Diagram Reconciler from 1.1.0 to 1.2.0 + * @since 3.0 + */ +public class DeploymentReconciler_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_DeploymentDiagram"; + case "49": + return "Model_Shape_CN"; + case "50": + return "Model_NameLabel_CN"; + case "36": + return "Package_Shape_CN"; + case "37": + return "Package_NameLabel_CN"; + case "16": + return "Device_Shape_CCN"; + case "20": + return "Device_NameLabel_CCN"; + case "44": + return "Device_Shape_CN"; + case "45": + return "Device_NameLabel_CN"; + case "21": + return "ExecutionEnvironment_Shape_CCN"; + case "22": + return "ExecutionEnvironment_NameLabel_CCN"; + case "46": + return "ExecutionEnvironment_Shape_CN"; + case "47": + return "ExecutionEnvironment_NameLabel_CN"; + case "23": + return "Node_Shape_CCN"; + case "24": + return "Node_NameLabel_CCN"; + case "42": + return "Node_Shape_CN"; + case "43": + return "Node_NameLabel_CN"; + case "25": + return "Artifact_Shape_CCN"; + case "27": + return "Artifact_NameLabel_CCN"; + case "59": + return "Artifact_FloatingNameLabel_CCN"; + case "28": + return "Artifact_Shape_ACN"; + case "29": + return "Artifact_NameLabel_ACN"; + case "60": + return "Artifact_FloatingNameLabel_ACN"; + case "40": + return "Artifact_Shape_CN"; + case "41": + return "Artifact_NameLabel_CN"; + case "54": + return "Comment_Shape_CN"; + case "55": + return "Comment_BodyLabel_CN"; + case "56": + return "Constraint_Shape_CN"; + case "57": + return "Constraint_NameLabel_CN"; + case "58": + return "Constraint_BodyLabel_CN"; + case "2014": + return "DeploymentSpecification_Shape_CCN"; + case "64": + return "DeploymentSpecification_NameLabel_CCN"; + case "65": + return "DeploymentSpecification_FloatingNameLabel_CCN"; + case "2015": + return "DeploymentSpecification_Shape_CN"; + case "66": + return "DeploymentSpecification_NameLabel_CN"; + case "67": + return "DeploymentSpecification_FloatingNameLabel_CN"; + case "2016": + return "DeploymentSpecification_Shape_ACN"; + case "68": + return "DeploymentSpecification_NameLabel_ACN"; + case "69": + return "DeploymentSpecification_FloatingNameLabel_ACN"; + case "2011": + return "Dependency_Shape"; + case "7": + return "Dependency_MultiNameLabel"; + case "2010": + return "Model_Shape"; + case "48": + return "Model_NameLabel"; + case "2009": + return "Package_Shape"; + case "35": + return "Package_NameLabel"; + case "2005": + return "Constraint_Shape"; + case "2": + return "Constraint_NameLabel"; + case "3": + return "Constraint_BodyLabel"; + case "2001": + return "Comment_Shape"; + case "1": + return "Comment_BodyLabel"; + case "2002": + return "ExecutionEnvironment_Shape"; + case "5": + return "ExecutionEnvironment_NameLabel"; + case "2003": + return "Device_Shape"; + case "6": + return "Device_NameLabel"; + case "2006": + return "Artifact_Shape"; + case "8": + return "Artifact_NameLabel"; + case "61": + return "Artifact_FloatingNameLabel"; + case "2008": + return "Node_Shape"; + case "9": + return "Node_NameLabel"; + case "2012": + return "NamedElement_DefaultShape"; + case "53": + return "NamedElement_NameLabel"; + case "2013": + return "DeploymentSpecification_Shape"; + case "62": + return "DeploymentSpecification_NameLabel"; + case "63": + return "DeploymentSpecification_FloatingNameLabel"; + case "4005": + return "Link_DescriptorEdge"; + case "4008": + return "Comment_AnnotatedElementEdge"; + case "4009": + return "Constraint_ConstrainedElementEdge"; + case "4001": + return "Deployment_Edge"; + case "13": + return "Deployment_NameLabel"; + case "14": + return "Deployment_StereotypeLabel"; + case "4002": + return "Manifestation_Edge"; + case "10": + return "Manifestation_NameLabel"; + case "11": + return "Manifestation_StereotypeLabel"; + case "4003": + return "Generalization_Edge"; + case "4": + return "Generalization_StereotypeLabel"; + case "4004": + return "Dependency_Edge"; + case "12": + return "Dependency_NameLabel"; + case "15": + return "Dependency_StereotypeLabel"; + case "4010": + return "Dependency_BranchEdge"; + case "4011": + return "CommunicationPath_Edge"; + case "6001": + return "CommunicationPath_NameLabel"; + case "6002": + return "CommunicationPath_StereotypeLabel"; + case "51": + return "Model_PackagedElementCompartment"; + case "38": + return "Package_PackagedElementCompartment"; + case "17": + return "Device_NestedNodeCompartment"; + case "18": + return "ExecutionEnvironment_NestedNodeCompartment"; + case "19": + return "Node_NestedNodeCompartment"; + case "26": + return "Artifact_NestedArtifactCompartment"; + case "52": + return "Model_PackagedElementCompartment_CN"; + case "39": + return "Package_PackagedElementCompartment_CN"; + case "30": + return "Device_NestedNodeCompartment_CN"; + case "31": + return "ExecutionEnvironment_NestedNodeCompartment_CN"; + case "32": + return "Node_NestedNodeCompartment_CN"; + case "33": + return "Artifact_NestedArtifactCompartment_CCN"; + case "34": + return "Artifact_NestedArtifactCompartment_ACN"; + default: + return defaultGetNewVisualID(oldVisualID); + } + } + + private static String defaultGetNewVisualID(String oldVisualID) { + return oldVisualID; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/ActionStateSourceProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/ActionStateSourceProvider.java index a43aa6b8ec1..30b452bd6d8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/ActionStateSourceProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/ActionStateSourceProvider.java @@ -1,81 +1,81 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.providers;
-
-import org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider;
-import org.eclipse.papyrus.uml.diagram.deployment.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) 2010 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.providers; + +import org.eclipse.papyrus.uml.diagram.common.providers.AbstractActionStateSourceProvider; +import org.eclipse.papyrus.uml.diagram.deployment.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.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLEditPartProvider.java index e0826370f97..5b5a732a969 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLEditPartProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLEditPartProvider.java @@ -1,26 +1,26 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.providers;
-
-import org.eclipse.papyrus.uml.diagram.deployment.custom.factory.CustomUMLeditPartFactory;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLEditPartProvider;
-
-
-public class CustomUMLEditPartProvider extends UMLEditPartProvider {
-
- public CustomUMLEditPartProvider() {
- setFactory(new CustomUMLeditPartFactory());
- setAllowCaching(true);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.providers; + +import org.eclipse.papyrus.uml.diagram.deployment.custom.factory.CustomUMLeditPartFactory; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLEditPartProvider; + + +public class CustomUMLEditPartProvider extends UMLEditPartProvider { + + public CustomUMLEditPartProvider() { + setFactory(new CustomUMLeditPartFactory()); + setAllowCaching(true); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java index 960c2413358..b5f0d6c64a2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java @@ -1,51 +1,51 @@ -/*****************************************************************************
- * Copyright (c) 2015, 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.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.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-
-public class CustomUMLParserProvider extends UMLParserProvider {
-
- public CustomUMLParserProvider() {
- 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 DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.DEPLOY);
- case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedKeywordParser(KeywordLabel.MANIFEST);
- }
- return super.getParser(visualID);
- }
+/***************************************************************************** + * Copyright (c) 2015, 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.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.deployment.edit.parts.DeploymentAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; + +public class CustomUMLParserProvider extends UMLParserProvider { + + public CustomUMLParserProvider() { + 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 DeploymentAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.DEPLOY); + case ManifestationAppliedStereotypeEditPart.VISUAL_ID: + return getAppliedKeywordParser(KeywordLabel.MANIFEST); + } + return super.getParser(visualID); + } }
\ No newline at end of file |