diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment')
144 files changed, 12894 insertions, 9661 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/AssociationClassViewCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/AssociationClassViewCreateCommand.java index 57eaa019ed1..b17daae420c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/AssociationClassViewCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/AssociationClassViewCreateCommand.java @@ -106,7 +106,7 @@ public class AssociationClassViewCreateCommand extends AbstractTransactionalComm CreateElementRequestAdapter requestAdapter = createConnectionViewAndElementRequest.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter(); CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class); UMLViewProvider viewProvider = new UMLViewProvider(); - node = viewProvider.createDependency_2011(createElementRequest.getNewElement(), this.containerView, -1, true, preferenceHint); + node = viewProvider.createDependency_Shape(createElementRequest.getNewElement(), this.containerView, -1, true, preferenceHint); // this.node = factory.createView(new // SemanticAdapter(createElementRequest.getNewElement()), // this.containerView, ((IHintedType) 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 f5b2526a2bb..d75eb839720 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 @@ -72,7 +72,7 @@ public class BranchDependenctReorientCommand extends EditElementCommand { return false;
}
Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4010(container, getLink(), getNewSource(), target);
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), getNewSource(), target);
}
@@ -89,7 +89,7 @@ public class BranchDependenctReorientCommand extends EditElementCommand { return false;
}
Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4010(container, getLink(), source, getNewTarget());
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_BranchEdge(container, getLink(), source, getNewTarget());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/DependencyDiamonViewCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/DependencyDiamonViewCreateCommand.java index 5312d355010..054ece9cd59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/DependencyDiamonViewCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/DependencyDiamonViewCreateCommand.java @@ -98,7 +98,7 @@ public class DependencyDiamonViewCreateCommand extends AbstractTransactionalComm // ((IHintedType) UMLElementTypes.Dependency_2014) // .getSemanticHint(), -1, true, preferenceHint); UMLViewProvider viewProvider = new UMLViewProvider(); - node = viewProvider.createDependency_2011(((EObject) semanticApdater.getAdapter(EObject.class)), this.containerView, -1, true, preferenceHint); + node = viewProvider.createDependency_Shape(((EObject) semanticApdater.getAdapter(EObject.class)), this.containerView, -1, true, preferenceHint); // put to the good position Location notationLocation = NotationFactory.eINSTANCE.createLocation(); 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 efc60f18652..94c77046761 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 @@ -51,7 +51,7 @@ public class ElementToStereotypedShape extends RecordingCommand { // creation of the node
UMLViewProvider umlViewProvider = new UMLViewProvider();
- Node packageview = umlViewProvider.createNamedElement_2012(elementEditPart.resolveSemanticElement(), (View) elementEditPart.getNotationView().eContainer(), -1, true, elementEditPart.getDiagramPreferencesHint());
+ 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
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/MultiDependencyHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/MultiDependencyHelper.java index c05e595e258..33d78cb91c3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/MultiDependencyHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/helpers/MultiDependencyHelper.java @@ -111,17 +111,17 @@ public class MultiDependencyHelper extends ElementHelper { } } // descriptor for the branch - ConnectionViewDescriptor viewBranchDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4010, ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), diagramPreferencesHint); + ConnectionViewDescriptor viewBranchDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_BranchEdge, ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), diagramPreferencesHint); // the editpart exist -> only creation of the branch if (sourceEditPart != null) { CustomDeferredCreateConnectionViewCommand aBranchCommand = null; if (constructSource) { - aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), (IAdaptable) nodeCreation + aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), (IAdaptable) nodeCreation .getCommandResult().getReturnValue(), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewBranchDescriptor, null); } else { - aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter(null, + aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter(null, sourceEditPart.getModel()), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewBranchDescriptor, null); } @@ -141,10 +141,10 @@ public class MultiDependencyHelper extends ElementHelper { // Creation of the branch CustomDeferredCreateConnectionViewCommand aBranchCommand = null; if (constructSource) { - aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), (IAdaptable) nodeCreationCommand.getCommandResult().getReturnValue(), + aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), (IAdaptable) nodeCreationCommand.getCommandResult().getReturnValue(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), viewer, diagramPreferencesHint, viewBranchDescriptor, null); } else { - aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), + aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), (IAdaptable) nodeCreationCommand.getCommandResult().getReturnValue(), viewer, diagramPreferencesHint, viewBranchDescriptor, null); } aBranchCommand.setElement(dependency); @@ -202,9 +202,9 @@ public class MultiDependencyHelper extends ElementHelper { } // 0. add the branch graphically - ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4010, ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint()); + ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_BranchEdge, ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint()); - CustomDeferredCreateConnectionViewCommand aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), + CustomDeferredCreateConnectionViewCommand aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), new SemanticAdapter(null, targetEditPart.getModel()), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewDescriptor, null); aBranchCommand.setElement(dependency); command = new CompoundCommand(); @@ -374,16 +374,16 @@ public class MultiDependencyHelper extends ElementHelper { // 4. reconstruction of the old link by taking in account the old // connection - ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4010, ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint()); + ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_BranchEdge, ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint()); // 5. reconstruction of the first branch between old source to node - ICommand firstBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), new SemanticAdapter(null, dependencyViewSource), (IAdaptable) nodeCreation + ICommand firstBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), new SemanticAdapter(null, dependencyViewSource), (IAdaptable) nodeCreation .getCommandResult().getReturnValue(), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewDescriptor, null); ((CustomDeferredCreateConnectionViewCommand) firstBranchCommand).setElement(dependency); ((CompoundCommand) command).add(new ICommandProxy(firstBranchCommand)); // 6. reconstruction of the second branch between node to old target - ICommand secondBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter( + ICommand secondBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter( null, dependencyViewTarget), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewDescriptor, null); ((CustomDeferredCreateConnectionViewCommand) secondBranchCommand).setElement(dependency); ((CompoundCommand) command).add(new ICommandProxy(secondBranchCommand)); @@ -393,11 +393,11 @@ public class MultiDependencyHelper extends ElementHelper { if (dependencyView.equals((sourceEditPart.getModel()))) { // third branch node and target - thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter(null, + thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter(null, targetEditPart.getModel()), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewDescriptor, null); } else { // // third branch source and node - thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4010).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), (IAdaptable) nodeCreation + thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_BranchEdge).getSemanticHint(), new SemanticAdapter(null, sourceEditPart.getModel()), (IAdaptable) nodeCreation .getCommandResult().getReturnValue(), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), viewDescriptor, null); } ((CustomDeferredCreateConnectionViewCommand) thirdBranchCommand).setElement(dependency); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java index f1e3f84000f..be3af457025 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java @@ -260,9 +260,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo */ protected Command dropConstraint(DropObjectsRequest dropRequest, Element semanticLink, String nodeVISUALID) { if(ConstraintEditPart.VISUAL_ID.equals(nodeVISUALID)) { - return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_2005, (IHintedType)UMLElementTypes.ConstraintConstrainedElement_4009); + return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_Shape, (IHintedType)UMLElementTypes.Constraint_ConstrainedElementEdge); } else if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVISUALID)) { - return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_56, (IHintedType)UMLElementTypes.ConstraintConstrainedElement_4009); + return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_Shape_CN, (IHintedType)UMLElementTypes.Constraint_ConstrainedElementEdge); } return UnexecutableCommand.INSTANCE; } @@ -282,9 +282,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo protected Command dropComment(DropObjectsRequest dropRequest, Element semanticLink, String nodeVISUALID) { if(CommentEditPart.VISUAL_ID.equals(nodeVISUALID)) { - return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_2001, (IHintedType)UMLElementTypes.CommentAnnotatedElement_4008); + return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_Shape, (IHintedType)UMLElementTypes.Comment_AnnotatedElementEdge); } else if(CommentEditPartCN.VISUAL_ID.equals(nodeVISUALID)) { - return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_54, (IHintedType)UMLElementTypes.CommentAnnotatedElement_4008); + return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_Shape_CN, (IHintedType)UMLElementTypes.Comment_AnnotatedElementEdge); } return UnexecutableCommand.INSTANCE; } 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 603d0b766e0..7fbe6d12696 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 @@ -48,7 +48,7 @@ public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy { CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) request).getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
- if (UMLElementTypes.Dependency_4010.equals(createElementRequest.getElementType())) {
+ if (UMLElementTypes.Dependency_BranchEdge.equals(createElementRequest.getElementType())) {
MultiDependencyHelper multiDependencyHelper = new MultiDependencyHelper(getEditingDomain());
return multiDependencyHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
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 eba8d8e123a..aaabe83fb62 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 @@ -31,7 +31,7 @@ public class CustomDependencyBranchSemanticEditPolicy extends DefaultSemanticEdi protected Command getSemanticCommand(IEditCommandRequest request) {
if (request instanceof CreateRelationshipRequest) {
IElementType type = ((CreateRelationshipRequest) request).getElementType();
- if (UMLElementTypes.Dependency_4010 == type) {
+ if (UMLElementTypes.Dependency_BranchEdge == type) {
return UnexecutableCommand.INSTANCE;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilier.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler.java index d5863c803de..0b1b8e0051f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilier.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler.java @@ -20,17 +20,18 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
/**
* Deployment Diagram Reconciler from 1.0.0 to 1.1.0
*/
-public class DeploymentReconcilier extends DiagramReconciler {
+public class DeploymentReconciler extends DiagramReconciler {
+
+ private final static String ArtifactEditPart_VISUAL_ID = "2006";
+ private final static String ArtifactFloatingLabelEditPart_VISUAL_ID = "61";
+ private final static String ArtifactEditPartACN_VISUAL_ID = "28";
+ private final static String ArtifactFloatingLabelEditPartACN_VISUAL_ID = "60";
+ private final static String ArtifactEditPartCN_VISUAL_ID = "25";
+ private final static String ArtifactFloatingLabelEditPartCN_VISUAL_ID = "59";
/**
* Gets the reconcile command.
@@ -52,9 +53,9 @@ public class DeploymentReconcilier extends DiagramReconciler { */
private Map<String, String> getFloatingLabelMap() {
Map<String, String> map = new HashMap<String, String>();
- map.put(String.valueOf(ArtifactEditPart.VISUAL_ID), String.valueOf(ArtifactFloatingLabelEditPart.VISUAL_ID));
- map.put(String.valueOf(ArtifactEditPartACN.VISUAL_ID), String.valueOf(ArtifactFloatingLabelEditPartACN.VISUAL_ID));
- map.put(String.valueOf(ArtifactEditPartCN.VISUAL_ID), String.valueOf(ArtifactFloatingLabelEditPartCN.VISUAL_ID));
+ map.put(ArtifactEditPart_VISUAL_ID, ArtifactFloatingLabelEditPart_VISUAL_ID);
+ map.put(ArtifactEditPartACN_VISUAL_ID, ArtifactFloatingLabelEditPartACN_VISUAL_ID);
+ map.put(ArtifactEditPartCN_VISUAL_ID, ArtifactFloatingLabelEditPartCN_VISUAL_ID);
return map;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java index 0387a8a7dfd..56b218a0301 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java @@ -17,40 +17,41 @@ import java.util.Arrays; import java.util.List; import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartment; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN; /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ public class DeploymentReconcilerForCompartment extends ReconcilerForCompartment { + private static final String ModelPackageableElementCompartmentEditPart_VISUAL_ID = "51"; + private static final String PackagePackageableElementCompartmentEditPart_VISUAL_ID = "38"; + private static final String DeviceCompositeCompartmentEditPart_VISUAL_ID = "17"; + private static final String ExecutionEnvironmentCompositeCompartmentEditPart_VISUAL_ID = "18"; + private static final String NodeCompositeCompartmentEditPart_VISUAL_ID = "19"; + private static final String ArtifactCompositeCompartmentEditPart_VISUAL_ID = "26"; + private static final String ModelPackageableElementCompartmentEditPartCN_VISUAL_ID = "52"; + private static final String PackagePackageableElementCompartmentEditPartCN_VISUAL_ID = "39"; + private static final String DeviceCompositeCompartmentEditPartCN_VISUAL_ID = "30"; + private static final String ExecutionEnvironmentCompositeCompartmentEditPartCN_VISUAL_ID = "31"; + private static final String NodeCompositeCompartmentEditPartCN_VISUAL_ID = "32"; + private static final String ArtifactCompositeCompartmentEditPartCN_VISUAL_ID = "33"; + private static final String ArtifactCompositeCompartmentEditPartACN_VISUAL_ID = "34"; + /** The compartments visual id. */ private List<String> compartmentsVisualID = Arrays.asList( - ModelPackageableElementCompartmentEditPart.VISUAL_ID, - PackagePackageableElementCompartmentEditPart.VISUAL_ID, - DeviceCompositeCompartmentEditPart.VISUAL_ID, - ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID, - NodeCompositeCompartmentEditPart.VISUAL_ID, - ArtifactCompositeCompartmentEditPart.VISUAL_ID, - ModelPackageableElementCompartmentEditPartCN.VISUAL_ID, - PackagePackageableElementCompartmentEditPartCN.VISUAL_ID, - DeviceCompositeCompartmentEditPartCN.VISUAL_ID, - ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID, - NodeCompositeCompartmentEditPartCN.VISUAL_ID, - ArtifactCompositeCompartmentEditPartCN.VISUAL_ID, - ArtifactCompositeCompartmentEditPartACN.VISUAL_ID); + ModelPackageableElementCompartmentEditPart_VISUAL_ID, + PackagePackageableElementCompartmentEditPart_VISUAL_ID, + DeviceCompositeCompartmentEditPart_VISUAL_ID, + ExecutionEnvironmentCompositeCompartmentEditPart_VISUAL_ID, + NodeCompositeCompartmentEditPart_VISUAL_ID, + ArtifactCompositeCompartmentEditPart_VISUAL_ID, + ModelPackageableElementCompartmentEditPartCN_VISUAL_ID, + PackagePackageableElementCompartmentEditPartCN_VISUAL_ID, + DeviceCompositeCompartmentEditPartCN_VISUAL_ID, + ExecutionEnvironmentCompositeCompartmentEditPartCN_VISUAL_ID, + NodeCompositeCompartmentEditPartCN_VISUAL_ID, + ArtifactCompositeCompartmentEditPartCN_VISUAL_ID, + ArtifactCompositeCompartmentEditPartACN_VISUAL_ID); /** * Gets the compartments visual id. 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 new file mode 100644 index 00000000000..cac27ff5692 --- /dev/null +++ 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 @@ -0,0 +1,286 @@ +/*****************************************************************************
+ * 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
+ */
+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/model/DeploymentDiagram-notation.elementtypesconfigurations b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations deleted file mode 100644 index f58db1738ab..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="ASCII" standalone="no"?><elementtypesconfigurations:ElementTypeSetConfiguration xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.1" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identifier="org.eclipse.papyrus.uml.diagram.deployment.elementTypeSetNotation" metamodelNsURI="http://www.eclipse.org/gmf/runtime/1.0.2/notation" name="elementTypeSetNotation" xmi:id="_rcmpgv_cEeS2GcUTq58BKg" xmi:version="2.0">
- <elementTypeConfigurations hint="4005" identifier="org.eclipse.papyrus.uml.diagram.deployment.Link_4005" kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType" name="Undefined" xmi:id="_rcnQkP_cEeS2GcUTq58BKg" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <specializedTypesID>org.eclipse.gmf.runtime.emf.type.core.null</specializedTypesID>
- </elementTypeConfigurations>
-</elementtypesconfigurations:ElementTypeSetConfiguration>
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations deleted file mode 100644 index 95ed3116b1e..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="ASCII" standalone="no"?><elementtypesconfigurations:ElementTypeSetConfiguration xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.1" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identifier="org.eclipse.papyrus.uml.diagram.deployment.elementTypeSet" metamodelNsURI="http://www.eclipse.org/uml2/5.0.0/UML" name="PapyrusUMLDeploymentDiagram" xmi:id="_gvIwYP8PEeS2nvlxgM4H8g" xmi:version="2.0">
- <elementTypeConfigurations hint="25" identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25" name="Artifact" xmi:id="_gwBhMP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Artifact.gif" xmi:id="_gwBhMf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="28" identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_28" name="Artifact" xmi:id="_gwCIQP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Artifact.gif" xmi:id="_gwCIQf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="40" identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_40" name="Artifact" xmi:id="_gwCIQv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Artifact.gif" xmi:id="_gwCIQ_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2006" identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006" name="Artifact" xmi:id="_gwGZsv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Artifact.gif" xmi:id="_gwGZs_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="54" identifier="org.eclipse.papyrus.uml.diagram.deployment.Comment_54" name="Comment" xmi:id="_gwCvUP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Comment.gif" xmi:id="_gwCvUf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Comment</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2001" identifier="org.eclipse.papyrus.uml.diagram.deployment.Comment_2001" name="Comment" xmi:id="_gwFLkv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Comment.gif" xmi:id="_gwFLk_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Comment</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4008" identifier="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006" name="Comment Annotated Element" xmi:id="_gwHn0P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <specializedTypesID>org.eclipse.papyrus.uml.Comment.AnnotatedElements</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4011" identifier="org.eclipse.papyrus.uml.diagram.deployment.CommunicationPath_4011" name="CommunicationPath" xmi:id="_8sxJcDSEEeWt899Q4ouxaA" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/CommunicationPath.gif" xmi:id="_MLL_QDSFEeWt899Q4ouxaA"/>
- <specializedTypesID>org.eclipse.papyrus.uml.CommunicationPath</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="56" identifier="org.eclipse.papyrus.uml.diagram.deployment.Constraint_56" name="Constraint" xmi:id="_gwDWYP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Constraint.gif" xmi:id="_gwDWYf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Constraint</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2005" identifier="org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005" name="Constraint" xmi:id="_gwFLkP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Constraint.gif" xmi:id="_gwFLkf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Constraint</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4009" identifier="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007" name="Constraint Constrained Element" xmi:id="_gwHn0f8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <specializedTypesID>org.eclipse.papyrus.uml.Constraint.ConstrainedElements</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2012" identifier="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012" name="Default Named Element" xmi:id="_gwHAwv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/NamedElement.gif" xmi:id="_gwHAw_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.NamedElement</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4010" identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010" name="Dependency Branch Link" xmi:id="_gwI18v8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Dependency.gif" xmi:id="_gwI18_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4004" identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004" name="Dependency Link" xmi:id="_gwI18P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Dependency.gif" xmi:id="_gwI18f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2011" identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011" name="Dependency Node" xmi:id="_gwD9cP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Dependency.gif" xmi:id="_gwD9cf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4001" identifier="org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001" name="Deployment" xmi:id="_gwHn0v8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Deployment.gif" xmi:id="_gwHn0_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Deployment</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2013" identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2013" name="DeploymentSpecification" xmi:id="_H3PAAEvtEeWDlLIkRlZnAA" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/DeploymentSpecification.gif" xmi:id="_NrvVQEvtEeWDlLIkRlZnAA"/>
- <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2014" identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2014" name="DeploymentSpecification" xmi:id="_CafvEEwwEeWwb_6uOhatZA" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/DeploymentSpecification.gif" xmi:id="_bp_zEEyhEeW-zLOt2X96xQ"/>
- <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2015" identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2015" name="DeploymentSpecification" xmi:id="_dGBFIEyhEeW-zLOt2X96xQ" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/DeploymentSpecification.gif" xmi:id="_dGBFIUyhEeW-zLOt2X96xQ"/>
- <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2016" identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2016" name="DeploymentSpecification" xmi:id="_GKvkwEy4EeWcB5wRNPiyyQ" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/DeploymentSpecification.gif" xmi:id="_GKwL0Ey4EeWcB5wRNPiyyQ"/>
- <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="16" identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16" name="Device" xmi:id="_gv-d4P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Device.gif" xmi:id="_gv-d4f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.um.Device_As_UML::Node::nestedNode</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="44" identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_44" name="Device" xmi:id="_gv_E8P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Device.gif" xmi:id="_gv_E8f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Device</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2003" identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_2003" name="Device" xmi:id="_gwGZsP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Device.gif" xmi:id="_gwGZsf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Device</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="21" identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21" name="Execution Environment" xmi:id="_gv_sAP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/ExecutionEnvironment.gif" xmi:id="_gv_sAf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.um.ExecutionEnvironment_As_UML::Node::nestedNode</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="46" identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46" name="Execution Environment" xmi:id="_gv_sAv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/ExecutionEnvironment.gif" xmi:id="_gv_sA_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.ExecutionEnvironment</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2002" identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002" name="Execution Environment" xmi:id="_gwFyoP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/ExecutionEnvironment.gif" xmi:id="_gwFyof8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.ExecutionEnvironment</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4003" identifier="org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003" name="Generalization" xmi:id="_gwIO4P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Generalization.gif" xmi:id="_gwIO4f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Generalization</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="4002" identifier="org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002" name="Manifestation" xmi:id="_gwHn1P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Manifestation.gif" xmi:id="_gwHn1f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Manifestation</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="49" identifier="org.eclipse.papyrus.uml.diagram.deployment.Model_49" name="Model" xmi:id="_gv9PwP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Model.gif" xmi:id="_gv9Pwf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Model</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2010" identifier="org.eclipse.papyrus.uml.diagram.deployment.Model_2010" name="Model" xmi:id="_gwD9cv8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Model.gif" xmi:id="_gwD9c_8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Model</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="23" identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_23" name="Node" xmi:id="_gwATEP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Node.gif" xmi:id="_gwATEf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.um.Node_As_UML::Node::nestedNode</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="42" identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_42" name="Node" xmi:id="_gwA6IP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Node.gif" xmi:id="_gwA6If8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Node</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2008" identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_2008" name="Node" xmi:id="_gwHAwP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Node.gif" xmi:id="_gwHAwf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Node</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="PapyrusUMLDeploymentDiagram" identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_1000" name="Package" xmi:id="_gv0s4P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Package.gif" xmi:id="_gv0s4f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="36" identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_36" name="Package" xmi:id="_gv920P8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Package.gif" xmi:id="_gv920f8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
- </elementTypeConfigurations>
- <elementTypeConfigurations hint="2009" identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_2009" name="Package" xmi:id="_gwEkgP8PEeS2nvlxgM4H8g" xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration">
- <iconEntry bundleId="org.eclipse.uml2.uml.edit" iconPath="/icons/full/obj16/Package.gif" xmi:id="_gwEkgf8PEeS2nvlxgM4H8g"/>
- <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
- </elementTypeConfigurations>
-</elementtypesconfigurations:ElementTypeSetConfiguration>
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen index e8af686a2ec..7747c5c0f77 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen @@ -4,7 +4,8 @@ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel" - xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"> + xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension" + xsi:schemaLocation="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension ../../org.eclipse.papyrus.gmfgenextension/model/papyrusGmfgenExtension.ecore"> <gmfgen:GenEditorGenerator packageNamePrefix="org.eclipse.papyrus.uml.diagram.deployment" modelID="PapyrusUMLDeploymentDiagram" @@ -29,7 +30,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/> <elementType xsi:type="gmfgen:MetamodelType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Package_1000" + uniqueIdentifier="org.eclipse.papyrus.umldi.Package_DeploymentDiagram" displayName="DeploymentDiagram" definedExternally="true" editHelperClassName="ModelEditHelper"/> @@ -59,7 +60,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_49" + uniqueIdentifier="org.eclipse.papyrus.umldi.Model_Shape_CN" displayName="Model" definedExternally="true"/> <viewmap @@ -139,6 +140,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Package_Shape_CN" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -217,7 +219,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16" + uniqueIdentifier="org.eclipse.papyrus.umldi.Device_Shape_CCN" displayName="Device" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/> @@ -309,7 +311,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_44" + uniqueIdentifier="org.eclipse.papyrus.umldi.Device_Shape_CN" displayName="Device" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/> @@ -400,7 +402,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21" + uniqueIdentifier="org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape_CCN" displayName="ExecutionEnvironment" definedExternally="true"/> <viewmap @@ -491,7 +493,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46" + uniqueIdentifier="org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape_CN" displayName="ExecutionEnvironment" definedExternally="true"/> <viewmap @@ -581,6 +583,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Node_Shape_CCN" displayName="Node" definedExternally="true"/> <viewmap @@ -671,6 +674,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Node_Shape_CN" displayName="Node" definedExternally="true"/> <viewmap @@ -761,7 +765,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25" + uniqueIdentifier="org.eclipse.papyrus.umldi.Artifact_Shape_CCN" displayName="Artifact" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/> @@ -884,6 +888,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Artifact_Shape_ACN" displayName="Artifact" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/> @@ -1003,6 +1008,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Artifact_Shape_CN" displayName="Artifact" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/> @@ -1097,6 +1103,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Comment_Shape_CN" definedExternally="true" editHelperClassName="CommentEditHelper"/> <viewmap @@ -1165,6 +1172,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Constraint_Shape_CN" definedExternally="true" editHelperClassName="ConstraintEditHelper"/> <viewmap @@ -1250,6 +1258,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_CCN" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -1354,6 +1363,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_CN" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -1458,6 +1468,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_ACN" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -1563,7 +1574,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011" + uniqueIdentifier="org.eclipse.papyrus.umldi.Dependency_Shape" displayName="DependencyNode" definedExternally="true" editHelperClassName="DependencyEditHelper"/> @@ -1616,7 +1627,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_2010" + uniqueIdentifier="org.eclipse.papyrus.umldi.Model_Shape" displayName="Model" definedExternally="true"/> <viewmap @@ -1695,6 +1706,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Package_Shape" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -1771,6 +1783,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Constraint_Shape" definedExternally="true" editHelperClassName="ConstraintEditHelper"/> <viewmap @@ -1859,6 +1872,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Comment_Shape" definedExternally="true" editHelperClassName="CommentEditHelper"/> <viewmap @@ -1927,6 +1941,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape" definedExternally="true" editHelperClassName="ExecutionEnvironmentEditHelper"/> <viewmap @@ -2016,6 +2031,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Device_Shape" definedExternally="true" editHelperClassName="DeviceEditHelper"/> <viewmap @@ -2105,6 +2121,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Artifact_Shape" definedExternally="true" editHelperClassName="ArtifactEditHelper"/> <viewmap @@ -2220,6 +2237,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Node_Shape" definedExternally="true" editHelperClassName="NodeEditHelper"/> <viewmap @@ -2309,7 +2327,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012" + uniqueIdentifier="org.eclipse.papyrus.umldi.NamedElement_DefaultShape" displayName="DefaultNamedElement" definedExternally="true" editHelperClassName="DefaultNamedElementEditHelper"/> @@ -2375,6 +2393,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.DeploymentSpecification_Shape" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -2480,6 +2499,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:NotationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Link_DescriptorEdge" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -2495,7 +2515,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006" + uniqueIdentifier="org.eclipse.papyrus.umldi.Comment_AnnotatedElementEdge" displayName="CommentAnnotatedElement" definedExternally="true"/> <viewmap @@ -2517,7 +2537,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007" + uniqueIdentifier="org.eclipse.papyrus.umldi.Constraint_ConstrainedElementEdge" displayName="ConstraintConstrainedElement" definedExternally="true"/> <viewmap @@ -2539,6 +2559,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Deployment_Edge" definedExternally="true" editHelperClassName="DeploymentEditHelper"/> <viewmap @@ -2630,6 +2651,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Manifestation_Edge" definedExternally="true" editHelperClassName="ManifestationEditHelper"/> <viewmap @@ -2721,6 +2743,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Generalization_Edge" definedExternally="true" editHelperClassName="GeneralizationEditHelper"/> <viewmap @@ -2783,6 +2806,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:SpecializationType" + uniqueIdentifier="org.eclipse.papyrus.umldi.Dependency_Edge" displayName="DependencyLink" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/> @@ -2880,7 +2904,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010" + uniqueIdentifier="org.eclipse.papyrus.umldi.Dependency_BranchEdge" displayName="DependencyBranchLink" definedExternally="true" metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/> @@ -2920,6 +2944,7 @@ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/> <elementType xsi:type="gmfgen:MetamodelType" + uniqueIdentifier="org.eclipse.papyrus.umldi.CommunicationPath_Edge" definedExternally="true"/> <viewmap xsi:type="gmfgen:FigureViewmap" @@ -3718,4 +3743,322 @@ name="PackageEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart"/> </papyrusgmfgenextension:PapyrusExtensionRootNode> + <papyrusgmfgenextension:VisualIDOverride + genView="/0/@diagram" + visualID="Package_DeploymentDiagram"> + <child + genView="/0/@diagram/@childNodes.0" + visualID="Model_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.0/@labels.0" + visualID="Model_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.1" + visualID="Package_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.1/@labels.0" + visualID="Package_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.2" + visualID="Device_Shape_CCN"> + <child + genView="/0/@diagram/@childNodes.2/@labels.0" + visualID="Device_NameLabel_CCN"/> + </child> + <child + genView="/0/@diagram/@childNodes.3" + visualID="Device_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.3/@labels.0" + visualID="Device_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.4" + visualID="ExecutionEnvironment_Shape_CCN"> + <child + genView="/0/@diagram/@childNodes.4/@labels.0" + visualID="ExecutionEnvironment_NameLabel_CCN"/> + </child> + <child + genView="/0/@diagram/@childNodes.5" + visualID="ExecutionEnvironment_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.5/@labels.0" + visualID="ExecutionEnvironment_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.6" + visualID="Node_Shape_CCN"> + <child + genView="/0/@diagram/@childNodes.6/@labels.0" + visualID="Node_NameLabel_CCN"/> + </child> + <child + genView="/0/@diagram/@childNodes.7" + visualID="Node_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.7/@labels.0" + visualID="Node_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.8" + visualID="Artifact_Shape_CCN"> + <child + genView="/0/@diagram/@childNodes.8/@labels.0" + visualID="Artifact_NameLabel_CCN"/> + <child + genView="/0/@diagram/@childNodes.8/@labels.1" + visualID="Artifact_FloatingNameLabel_CCN"/> + </child> + <child + genView="/0/@diagram/@childNodes.9" + visualID="Artifact_Shape_ACN"> + <child + genView="/0/@diagram/@childNodes.9/@labels.0" + visualID="Artifact_NameLabel_ACN"/> + <child + genView="/0/@diagram/@childNodes.9/@labels.1" + visualID="Artifact_FloatingNameLabel_ACN"/> + </child> + <child + genView="/0/@diagram/@childNodes.10" + visualID="Artifact_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.10/@labels.0" + visualID="Artifact_NameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.11" + visualID="Comment_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.11/@labels.0" + visualID="Comment_BodyLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.12" + visualID="Constraint_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.12/@labels.0" + visualID="Constraint_NameLabel_CN"/> + <child + genView="/0/@diagram/@childNodes.12/@labels.1" + visualID="Constraint_BodyLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.13" + visualID="DeploymentSpecification_Shape_CCN"> + <child + genView="/0/@diagram/@childNodes.13/@labels.0" + visualID="DeploymentSpecification_NameLabel_CCN"/> + <child + genView="/0/@diagram/@childNodes.13/@labels.1" + visualID="DeploymentSpecification_FloatingNameLabel_CCN"/> + </child> + <child + genView="/0/@diagram/@childNodes.14" + visualID="DeploymentSpecification_Shape_CN"> + <child + genView="/0/@diagram/@childNodes.14/@labels.0" + visualID="DeploymentSpecification_NameLabel_CN"/> + <child + genView="/0/@diagram/@childNodes.14/@labels.1" + visualID="DeploymentSpecification_FloatingNameLabel_CN"/> + </child> + <child + genView="/0/@diagram/@childNodes.15" + visualID="DeploymentSpecification_Shape_ACN"> + <child + genView="/0/@diagram/@childNodes.15/@labels.0" + visualID="DeploymentSpecification_NameLabel_ACN"/> + <child + genView="/0/@diagram/@childNodes.15/@labels.1" + visualID="DeploymentSpecification_FloatingNameLabel_ACN"/> + </child> + <child + genView="/0/@diagram/@compartments.0" + visualID="Model_PackagedElementCompartment"/> + <child + genView="/0/@diagram/@compartments.1" + visualID="Package_PackagedElementCompartment"/> + <child + genView="/0/@diagram/@compartments.2" + visualID="Device_NestedNodeCompartment"/> + <child + genView="/0/@diagram/@compartments.3" + visualID="ExecutionEnvironment_NestedNodeCompartment"/> + <child + genView="/0/@diagram/@compartments.4" + visualID="Node_NestedNodeCompartment"/> + <child + genView="/0/@diagram/@compartments.5" + visualID="Artifact_NestedArtifactCompartment"/> + <child + genView="/0/@diagram/@compartments.6" + visualID="Model_PackagedElementCompartment_CN"/> + <child + genView="/0/@diagram/@compartments.7" + visualID="Package_PackagedElementCompartment_CN"/> + <child + genView="/0/@diagram/@compartments.8" + visualID="Device_NestedNodeCompartment_CN"/> + <child + genView="/0/@diagram/@compartments.9" + visualID="ExecutionEnvironment_NestedNodeCompartment_CN"/> + <child + genView="/0/@diagram/@compartments.10" + visualID="Node_NestedNodeCompartment_CN"/> + <child + genView="/0/@diagram/@compartments.11" + visualID="Artifact_NestedArtifactCompartment_CCN"/> + <child + genView="/0/@diagram/@compartments.12" + visualID="Artifact_NestedArtifactCompartment_ACN"/> + <child + genView="/0/@diagram/@topLevelNodes.0" + visualID="Dependency_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.0/@labels.0" + visualID="Dependency_MultiNameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.1" + visualID="Model_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.1/@labels.0" + visualID="Model_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.2" + visualID="Package_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.2/@labels.0" + visualID="Package_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.3" + visualID="Constraint_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.3/@labels.0" + visualID="Constraint_NameLabel"/> + <child + genView="/0/@diagram/@topLevelNodes.3/@labels.1" + visualID="Constraint_BodyLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.4" + visualID="Comment_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.4/@labels.0" + visualID="Comment_BodyLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.5" + visualID="ExecutionEnvironment_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.5/@labels.0" + visualID="ExecutionEnvironment_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.6" + visualID="Device_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.6/@labels.0" + visualID="Device_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.7" + visualID="Artifact_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.7/@labels.0" + visualID="Artifact_NameLabel"/> + <child + genView="/0/@diagram/@topLevelNodes.7/@labels.1" + visualID="Artifact_FloatingNameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.8" + visualID="Node_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.8/@labels.0" + visualID="Node_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.9" + visualID="NamedElement_DefaultShape"> + <child + genView="/0/@diagram/@topLevelNodes.9/@labels.0" + visualID="NamedElement_NameLabel"/> + </child> + <child + genView="/0/@diagram/@topLevelNodes.10" + visualID="DeploymentSpecification_Shape"> + <child + genView="/0/@diagram/@topLevelNodes.10/@labels.0" + visualID="DeploymentSpecification_NameLabel"/> + <child + genView="/0/@diagram/@topLevelNodes.10/@labels.1" + visualID="DeploymentSpecification_FloatingNameLabel"/> + </child> + <child + genView="/0/@diagram/@links.0" + visualID="Link_DescriptorEdge"/> + <child + genView="/0/@diagram/@links.1" + visualID="Comment_AnnotatedElementEdge"/> + <child + genView="/0/@diagram/@links.2" + visualID="Constraint_ConstrainedElementEdge"/> + <child + genView="/0/@diagram/@links.3" + visualID="Deployment_Edge"> + <child + genView="/0/@diagram/@links.3/@labels.0" + visualID="Deployment_NameLabel"/> + <child + genView="/0/@diagram/@links.3/@labels.1" + visualID="Deployment_StereotypeLabel"/> + </child> + <child + genView="/0/@diagram/@links.4" + visualID="Manifestation_Edge"> + <child + genView="/0/@diagram/@links.4/@labels.0" + visualID="Manifestation_NameLabel"/> + <child + genView="/0/@diagram/@links.4/@labels.1" + visualID="Manifestation_StereotypeLabel"/> + </child> + <child + genView="/0/@diagram/@links.5" + visualID="Generalization_Edge"> + <child + genView="/0/@diagram/@links.5/@labels.0" + visualID="Generalization_StereotypeLabel"/> + </child> + <child + genView="/0/@diagram/@links.6" + visualID="Dependency_Edge"> + <child + genView="/0/@diagram/@links.6/@labels.0" + visualID="Dependency_NameLabel"/> + <child + genView="/0/@diagram/@links.6/@labels.1" + visualID="Dependency_StereotypeLabel"/> + </child> + <child + genView="/0/@diagram/@links.7" + visualID="Dependency_BranchEdge"/> + <child + genView="/0/@diagram/@links.8" + visualID="CommunicationPath_Edge"> + <child + genView="/0/@diagram/@links.8/@labels.0" + visualID="CommunicationPath_NameLabel"/> + <child + genView="/0/@diagram/@links.8/@labels.1" + visualID="CommunicationPath_StereotypeLabel"/> + </child> + </papyrusgmfgenextension:VisualIDOverride> </xmi:XMI> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.properties index 7fb05649149..fed93f41291 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.properties @@ -17,39 +17,6 @@ prefpage.org.eclipse.uml2.uml.diagram.appearance=Appearance prefpage.org.eclipse.uml2.uml.diagram.connections=Connections
prefpage.org.eclipse.uml2.uml.diagram.printing=Printing
prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid=Rulers And Grid
-
metatype.name.Model_1000=DeploymentDiagram
-metatype.name.Comment_2001=Comment
-metatype.name.Constraint_2005=Constraint
-metatype.name.ExecutionEnvironment_2002=ExecutionEnvironment
-metatype.name.Device_2003=Device
-metatype.name.Artifact_2006=Artifact
-metatype.name.Node_2008=Node
-metatype.name.Node_23=Node
-metatype.name.Device_16=Device
-metatype.name.ExecutionEnvironment_21=ExecutionEnvironment
-metatype.name.Artifact_25=Artifact
-metatype.name.Artifact_28=Artifact
-metatype.name.Link_4005=Undefined
-metatype.name.CommentAnnotatedElement_4008=CommentAnnotatedElement
-metatype.name.ConstraintConstrainedElement_4009=ConstraintConstrainedElement
-metatype.name.Deployment_4001=Deployment
-metatype.name.Manifestation_4002=Manifestation
-metatype.name.Generalization_4003=Generalization
-metatype.name.Dependency_4004=Dependency
-
cmdcategory.name=PapyrusUMLDeploymentDiagram Editor Commands
-cmdcategory.desc=PapyrusUMLDeploymentDiagram Editor Commands
-metatype.name.Package_1000=DeploymentDiagram
-metatype.name.Dependency_2011=DependencyNode
-metatype.name.Model_2010=Model
-metatype.name.Package_2009=Package
-metatype.name.NamedElement_2012=DefaultNamedElement
-metatype.name.Model_49=Model
-metatype.name.Package_36=Package
-metatype.name.Device_44=Device
-metatype.name.ExecutionEnvironment_46=ExecutionEnvironment
-metatype.name.Node_42=Node
-metatype.name.Artifact_40=Artifact
-metatype.name.Comment_54=Comment
-metatype.name.Constraint_56=Constraint
-metatype.name.Dependency_4010=DependencyBranchLink
+cmdcategory.name=PapyrusUMLDeploymentDiagram Editor Commands
+cmdcategory.desc=PapyrusUMLDeploymentDiagram Editor Commands
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml index 8295be7d945..714a6b43f13 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml @@ -529,8 +529,8 @@ <viewProvider class="org.eclipse.papyrus.uml.diagram.deployment.providers.UMLViewProvider"> <Priority name="Lowest"/> <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLDeploymentDiagram"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,2013,49,36,16,44,21,46,23,42,25,28,40,54,56,2014,2015,2016"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4005,4008,4009,4001,4002,4003,4004,4010,4011"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="Dependency_Shape,Model_Shape,Package_Shape,Constraint_Shape,Comment_Shape,ExecutionEnvironment_Shape,Device_Shape,Artifact_Shape,Node_Shape,NamedElement_DefaultShape,DeploymentSpecification_Shape,Model_Shape_CN,Package_Shape_CN,Device_Shape_CCN,Device_Shape_CN,ExecutionEnvironment_Shape_CCN,ExecutionEnvironment_Shape_CN,Node_Shape_CCN,Node_Shape_CN,Artifact_Shape_CCN,Artifact_Shape_ACN,Artifact_Shape_CN,Comment_Shape_CN,Constraint_Shape_CN,DeploymentSpecification_Shape_CCN,DeploymentSpecification_Shape_CN,DeploymentSpecification_Shape_ACN"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="Link_DescriptorEdge,Comment_AnnotatedElementEdge,Constraint_ConstrainedElementEdge,Deployment_Edge,Manifestation_Edge,Generalization_Edge,Dependency_Edge,Dependency_BranchEdge,CommunicationPath_Edge"/> </viewProvider> </extension> @@ -542,16 +542,16 @@ <method name="getType()" value="PapyrusUMLDeploymentDiagram"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,2013,49,36,16,44,21,46,23,42,25,28,40,54,56,2014,2015,2016"/> + <method name="getType()" value="Dependency_Shape,Model_Shape,Package_Shape,Constraint_Shape,Comment_Shape,ExecutionEnvironment_Shape,Device_Shape,Artifact_Shape,Node_Shape,NamedElement_DefaultShape,DeploymentSpecification_Shape,Model_Shape_CN,Package_Shape_CN,Device_Shape_CCN,Device_Shape_CN,ExecutionEnvironment_Shape_CCN,ExecutionEnvironment_Shape_CN,Node_Shape_CCN,Node_Shape_CN,Artifact_Shape_CCN,Artifact_Shape_ACN,Artifact_Shape_CN,Comment_Shape_CN,Constraint_Shape_CN,DeploymentSpecification_Shape_CCN,DeploymentSpecification_Shape_CN,DeploymentSpecification_Shape_ACN"/> </object> <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> - <method name="getType()" value="4005,4008,4009,4001,4002,4003,4004,4010,4011"/> + <method name="getType()" value="Link_DescriptorEdge,Comment_AnnotatedElementEdge,Constraint_ConstrainedElementEdge,Deployment_Edge,Manifestation_Edge,Generalization_Edge,Dependency_Edge,Dependency_BranchEdge,CommunicationPath_Edge"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="7,48,35,2,3,1,5,6,8,61,9,53,62,63,50,37,20,45,22,47,24,43,27,59,29,60,41,55,57,58,64,65,66,67,68,69"/> + <method name="getType()" value="Dependency_MultiNameLabel,Model_NameLabel,Package_NameLabel,Constraint_NameLabel,Constraint_BodyLabel,Comment_BodyLabel,ExecutionEnvironment_NameLabel,Device_NameLabel,Artifact_NameLabel,Artifact_FloatingNameLabel,Node_NameLabel,NamedElement_NameLabel,DeploymentSpecification_NameLabel,DeploymentSpecification_FloatingNameLabel,Model_NameLabel_CN,Package_NameLabel_CN,Device_NameLabel_CCN,Device_NameLabel_CN,ExecutionEnvironment_NameLabel_CCN,ExecutionEnvironment_NameLabel_CN,Node_NameLabel_CCN,Node_NameLabel_CN,Artifact_NameLabel_CCN,Artifact_FloatingNameLabel_CCN,Artifact_NameLabel_ACN,Artifact_FloatingNameLabel_ACN,Artifact_NameLabel_CN,Comment_BodyLabel_CN,Constraint_NameLabel_CN,Constraint_BodyLabel_CN,DeploymentSpecification_NameLabel_CCN,DeploymentSpecification_FloatingNameLabel_CCN,DeploymentSpecification_NameLabel_CN,DeploymentSpecification_FloatingNameLabel_CN,DeploymentSpecification_NameLabel_ACN,DeploymentSpecification_FloatingNameLabel_ACN"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> - <method name="getType()" value="51,38,17,18,19,26,52,39,30,31,32,33,34"/> + <method name="getType()" value="Model_PackagedElementCompartment,Package_PackagedElementCompartment,Device_NestedNodeCompartment,ExecutionEnvironment_NestedNodeCompartment,Node_NestedNodeCompartment,Artifact_NestedArtifactCompartment,Model_PackagedElementCompartment_CN,Package_PackagedElementCompartment_CN,Device_NestedNodeCompartment_CN,ExecutionEnvironment_NestedNodeCompartment_CN,Node_NestedNodeCompartment_CN,Artifact_NestedArtifactCompartment_CCN,Artifact_NestedArtifactCompartment_ACN"/> </object> <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/> </editpartProvider> @@ -612,111 +612,111 @@ <mapping type="PapyrusUMLDeploymentDiagram" humanReadableType="DeploymentDiagram"/> <mapping humanReadableType="Model" - type="51"> + type="Model_PackagedElementCompartment"> </mapping> <mapping humanReadableType="PackageableElement" - type="38"> + type="Package_PackagedElementCompartment"> </mapping> <mapping humanReadableType="DeviceComposite" - type="17"> + type="Device_NestedNodeCompartment"> </mapping> <mapping humanReadableType="ExecutionEnvironmentComposite" - type="18"> + type="ExecutionEnvironment_NestedNodeCompartment"> </mapping> <mapping humanReadableType="Composite" - type="19"> + type="Node_NestedNodeCompartment"> </mapping> <mapping humanReadableType="ArtifactComposite" - type="26"> + type="Artifact_NestedArtifactCompartment"> </mapping> <mapping humanReadableType="Model" - type="52"> + type="Model_PackagedElementCompartment_CN"> </mapping> <mapping humanReadableType="PackageableElement" - type="39"> + type="Package_PackagedElementCompartment_CN"> </mapping> <mapping humanReadableType="DeviceComposite" - type="30"> + type="Device_NestedNodeCompartment_CN"> </mapping> <mapping humanReadableType="ExecutionEnvironmentComposite" - type="31"> + type="ExecutionEnvironment_NestedNodeCompartment_CN"> </mapping> <mapping humanReadableType="Composite" - type="32"> + type="Node_NestedNodeCompartment_CN"> </mapping> <mapping humanReadableType="ArtifactComposite" - type="33"> + type="Artifact_NestedArtifactCompartment_CCN"> </mapping> <mapping humanReadableType="ArtifactComposite" - type="34"> + type="Artifact_NestedArtifactCompartment_ACN"> </mapping> <mapping humanReadableType="Name" - type="13"> + type="Deployment_NameLabel"> </mapping> <mapping humanReadableType="Stereotype" - type="14"> + type="Deployment_StereotypeLabel"> </mapping> <mapping humanReadableType="Name" - type="10"> + type="Manifestation_NameLabel"> </mapping> <mapping humanReadableType="Stereotype" - type="11"> + type="Manifestation_StereotypeLabel"> </mapping> <mapping humanReadableType="Stereotype" - type="4"> + type="Generalization_StereotypeLabel"> </mapping> <mapping humanReadableType="Name" - type="12"> + type="Dependency_NameLabel"> </mapping> <mapping humanReadableType="Stereotype" - type="15"> + type="Dependency_StereotypeLabel"> </mapping> <mapping humanReadableType="Floating Label" - type="59"> + type="Artifact_FloatingNameLabel_CCN"> </mapping> <mapping humanReadableType="Floating Label" - type="60"> + type="Artifact_FloatingNameLabel_ACN"> </mapping> <mapping humanReadableType="Floating Label" - type="65"> + type="DeploymentSpecification_FloatingNameLabel_CCN"> </mapping> <mapping humanReadableType="Floating Label" - type="67"> + type="DeploymentSpecification_FloatingNameLabel_CN"> </mapping> <mapping humanReadableType="Floating Label" - type="69"> + type="DeploymentSpecification_FloatingNameLabel_ACN"> </mapping> <mapping humanReadableType="Floating Label" - type="61"> + type="Artifact_FloatingNameLabel"> </mapping> <mapping humanReadableType="Floating Label" - type="63"> + type="DeploymentSpecification_FloatingNameLabel"> </mapping> </diagramMappings> </extension> @@ -735,7 +735,7 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLDeploymentDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconcilier" + reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconciler" source="undefined" target="1.1.0"> </diagramReconciler> @@ -745,20 +745,12 @@ source="undefined" target="1.2.0"> </diagramReconciler> -</extension> -<extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/DeploymentDiagram.elementtypesconfigurations"> - </elementTypeSet> -</extension> -<extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/DeploymentDiagram-notation.elementtypesconfigurations"> - </elementTypeSet> + <diagramReconciler + diagramType="PapyrusUMLDeploymentDiagram" + reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconciler_1_2_0" + source="1.1.0" + target="1.2.0"> + </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> <?gmfgen generated="true"?> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java index a6eb383c1e0..ec4d7ce047c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java @@ -42,7 +42,7 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment /** * @generated */ - public static final String VISUAL_ID = "26"; + public static final String VISUAL_ID = "Artifact_NestedArtifactCompartment"; /** * @generated @@ -72,6 +72,7 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -82,7 +83,7 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -92,6 +93,7 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -101,7 +103,10 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -111,13 +116,13 @@ public class ArtifactCompositeCompartmentEditPart extends LinkLFShapeCompartment * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java index 2eabee8af09..07bca9b3c0d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java @@ -42,7 +42,7 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm /** * @generated */ - public static final String VISUAL_ID = "34"; + public static final String VISUAL_ID = "Artifact_NestedArtifactCompartment_ACN"; /** * @generated @@ -72,6 +72,7 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyACN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -82,7 +83,7 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -92,6 +93,7 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -101,7 +103,10 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -111,13 +116,13 @@ public class ArtifactCompositeCompartmentEditPartACN extends LinkLFShapeCompartm * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java index 928b68744ce..21713fb9fc2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java @@ -42,7 +42,7 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme /** * @generated */ - public static final String VISUAL_ID = "33"; + public static final String VISUAL_ID = "Artifact_NestedArtifactCompartment_CCN"; /** * @generated @@ -72,6 +72,7 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -82,7 +83,7 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -92,6 +93,7 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -101,7 +103,10 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -111,13 +116,13 @@ public class ArtifactCompositeCompartmentEditPartCN extends LinkLFShapeCompartme * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java index 4e70b36101f..02c4d92b6f8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java @@ -64,7 +64,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { /** * @generated */ - public static final String VISUAL_ID = "2006"; + public static final String VISUAL_ID = "Artifact_Shape"; /** * @generated @@ -90,13 +90,18 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); @@ -112,16 +117,16 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case ArtifactFloatingLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -129,7 +134,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -159,16 +164,17 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -186,23 +192,25 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override public ArtifactFigure getPrimaryShape() { - return (ArtifactFigure)primaryShape; + return (ArtifactFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPart) { - ((ArtifactNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ArtifactNameEditPart) { + ((ArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPart) { + + if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ArtifactCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.add(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -210,12 +218,12 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPart) { + if (childEditPart instanceof ArtifactNameEditPart) { return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPart) { + if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((ArtifactCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -226,7 +234,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -237,7 +245,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -248,10 +256,10 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ArtifactCompositeCompartmentEditPart) { + if (editPart instanceof ArtifactCompositeCompartmentEditPart) { return getPrimaryShape().getCompositeCompartmentFigure(); } - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -262,7 +270,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof ArtifactFloatingLabelEditPart) { + if (borderItemEditPart instanceof ArtifactFloatingLabelEditPart) { IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { @@ -290,6 +298,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { @Override protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -302,7 +311,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -315,7 +324,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -326,7 +335,7 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -344,8 +353,8 @@ public class ArtifactEditPart extends RoundedCompartmentEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java index a968374e82e..b47ec0804d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java @@ -64,7 +64,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { /** * @generated */ - public static final String VISUAL_ID = "28"; + public static final String VISUAL_ID = "Artifact_Shape_ACN"; /** * @generated @@ -90,13 +90,18 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); @@ -112,16 +117,16 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case ArtifactFloatingLabelEditPartACN.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -129,7 +134,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -159,16 +164,17 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -186,23 +192,25 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override public ArtifactFigure getPrimaryShape() { - return (ArtifactFigure)primaryShape; + return (ArtifactFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPartACN) { - ((ArtifactNameEditPartACN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ArtifactNameEditPartACN) { + ((ArtifactNameEditPartACN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) { + + if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ArtifactCompositeCompartmentEditPartACN)childEditPart).getFigure()); + pane.add(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure()); return true; } + return false; } @@ -210,12 +218,12 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPartACN) { + if (childEditPart instanceof ArtifactNameEditPartACN) { return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) { + if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((ArtifactCompositeCompartmentEditPartACN)childEditPart).getFigure()); + pane.remove(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure()); return true; } return false; @@ -226,7 +234,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -237,7 +245,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -248,10 +256,10 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ArtifactCompositeCompartmentEditPartACN) { + if (editPart instanceof ArtifactCompositeCompartmentEditPartACN) { return getPrimaryShape().getCompositeCompartmentFigure(); } - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -262,7 +270,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof ArtifactFloatingLabelEditPartACN) { + if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartACN) { IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { @@ -290,6 +298,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { @Override protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -302,7 +311,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -315,7 +324,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -326,7 +335,7 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -344,8 +353,8 @@ public class ArtifactEditPartACN extends RoundedCompartmentEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java index 1554df6d783..a97909526e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java @@ -64,7 +64,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { /** * @generated */ - public static final String VISUAL_ID = "25"; + public static final String VISUAL_ID = "Artifact_Shape_CCN"; /** * @generated @@ -90,13 +90,18 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); @@ -112,16 +117,16 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case ArtifactFloatingLabelEditPartCN.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -129,7 +134,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -159,16 +164,17 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -186,23 +192,25 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override public ArtifactFigure getPrimaryShape() { - return (ArtifactFigure)primaryShape; + return (ArtifactFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPartCN) { - ((ArtifactNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ArtifactNameEditPartCN) { + ((ArtifactNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) { + + if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ArtifactCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -210,12 +218,12 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ArtifactNameEditPartCN) { + if (childEditPart instanceof ArtifactNameEditPartCN) { return true; } - if(childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) { + if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((ArtifactCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -226,7 +234,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -237,7 +245,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -248,10 +256,10 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ArtifactCompositeCompartmentEditPartCN) { + if (editPart instanceof ArtifactCompositeCompartmentEditPartCN) { return getPrimaryShape().getCompositeCompartmentFigure(); } - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -262,7 +270,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof ArtifactFloatingLabelEditPartCN) { + if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartCN) { IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { @@ -290,6 +298,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { @Override protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -302,7 +311,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -315,7 +324,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -326,7 +335,7 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -344,8 +353,8 @@ public class ArtifactEditPartCN extends RoundedCompartmentEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java index 9f2d32d0c89..127ee4cbf7a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "61"; + public static final String VISUAL_ID = "Artifact_FloatingNameLabel"; /** * @generated @@ -128,7 +130,10 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -155,9 +160,9 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme @Override public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -167,10 +172,10 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -178,12 +183,12 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -191,12 +196,12 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -204,12 +209,12 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -217,12 +222,12 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -280,10 +285,11 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -296,12 +302,12 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -310,10 +316,11 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -332,22 +339,26 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + ArtifactFloatingLabelEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -359,10 +370,10 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -378,8 +389,8 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -388,8 +399,10 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -418,8 +431,8 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -427,8 +440,8 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -439,46 +452,58 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -500,12 +525,13 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -536,20 +562,20 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -557,15 +583,15 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -574,9 +600,9 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -585,9 +611,10 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -605,11 +632,11 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -621,8 +648,8 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -635,7 +662,7 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -661,13 +688,14 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -679,7 +707,7 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -701,12 +729,15 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -717,10 +748,13 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -739,12 +773,15 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -763,24 +800,27 @@ public class ArtifactFloatingLabelEditPart extends FloatingLabelEditPart impleme @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java index fe18c4def07..cf6681cfde9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "60"; + public static final String VISUAL_ID = "Artifact_FloatingNameLabel_ACN"; /** * @generated @@ -128,7 +130,10 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID), + new Point(0, 0)); } /** @@ -155,9 +160,9 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl @Override public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -167,10 +172,10 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -178,12 +183,12 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -191,12 +196,12 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -204,12 +209,12 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -217,12 +222,12 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -280,10 +285,11 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -296,12 +302,12 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -310,10 +316,11 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -332,22 +339,28 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + ArtifactFloatingLabelEditPartACN.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -359,10 +372,10 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -378,8 +391,8 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape_ACN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -388,8 +401,10 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -418,8 +433,8 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -427,8 +442,8 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -439,46 +454,58 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -500,12 +527,13 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -536,20 +564,20 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -557,15 +585,15 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -574,9 +602,9 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -585,9 +613,10 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -605,11 +634,11 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -621,8 +650,8 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -635,7 +664,7 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -661,13 +690,14 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -679,7 +709,7 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -701,12 +731,15 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -717,10 +750,13 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -739,12 +775,15 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -763,24 +802,27 @@ public class ArtifactFloatingLabelEditPartACN extends FloatingLabelEditPart impl @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java index f8ccdcfec2a..e02615c0b98 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "59"; + public static final String VISUAL_ID = "Artifact_FloatingNameLabel_CCN"; /** * @generated @@ -128,7 +130,10 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID), + new Point(0, 0)); } /** @@ -155,9 +160,9 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple @Override public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -167,10 +172,10 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -178,12 +183,12 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -191,12 +196,12 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -204,12 +209,12 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -217,12 +222,12 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -280,10 +285,11 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -296,12 +302,12 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -310,10 +316,11 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -332,22 +339,26 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + ArtifactFloatingLabelEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -359,10 +370,10 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -378,8 +389,8 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape_CCN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -388,8 +399,10 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -418,8 +431,8 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -427,8 +440,8 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -439,46 +452,58 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -500,12 +525,13 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -536,20 +562,20 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -557,15 +583,15 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -574,9 +600,9 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -585,9 +611,10 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -605,11 +632,11 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -621,8 +648,8 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -635,7 +662,7 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -661,13 +688,14 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -679,7 +707,7 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -701,12 +729,15 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -717,10 +748,13 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -739,12 +773,15 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -763,24 +800,27 @@ public class ArtifactFloatingLabelEditPartCN extends FloatingLabelEditPart imple @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java index 8b473f85c1b..a3e7d62ee22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ArtifactNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "8"; + public static final String VISUAL_ID = "Artifact_NameLabel"; /** * @generated @@ -144,12 +146,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ArtifactNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java index 6d896e0e4f5..24a47ce8e89 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "29"; + public static final String VISUAL_ID = "Artifact_NameLabel_ACN"; /** * @generated @@ -144,12 +146,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ArtifactNameEditPartACN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape_ACN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implemen */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java index d85239e2d2e..7c085e21ee9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "27"; + public static final String VISUAL_ID = "Artifact_NameLabel_CCN"; /** * @generated @@ -144,12 +146,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ArtifactNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape_CCN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implement */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java index 34d89446fcd..797c0bb3393 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java @@ -27,7 +27,7 @@ public class CommentAnnotatedElementEditPart extends UMLConnectionNodeEditPart i /** * @generated */ - public static final String VISUAL_ID = "4008"; + public static final String VISUAL_ID = "Comment_AnnotatedElementEdge"; /** * @generated @@ -63,6 +63,6 @@ public class CommentAnnotatedElementEditPart extends UMLConnectionNodeEditPart i */ @Override public SimpleDashedEdgeFigure getPrimaryShape() { - return (SimpleDashedEdgeFigure)getFigure(); + return (SimpleDashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java index 43ec629dde5..5bdee74088f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class CommentBodyEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "1"; + public static final String VISUAL_ID = "Comment_BodyLabel"; /** * @generated @@ -144,12 +146,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), CommentBodyEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Comment_2001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Comment_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java index 9465b1939eb..8beae8a85c6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "55"; + public static final String VISUAL_ID = "Comment_BodyLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), CommentBodyEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Comment_54, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Comment_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java index c7b91e97c1f..83f1488e07f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java @@ -48,7 +48,7 @@ public class CommentEditPart extends AbstractCommentEditPart { /** * @generated */ - public static final String VISUAL_ID = "2001"; + public static final String VISUAL_ID = "Comment_Shape"; /** * @generated @@ -74,9 +74,12 @@ public class CommentEditPart extends AbstractCommentEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy()); @@ -93,7 +96,7 @@ public class CommentEditPart extends AbstractCommentEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -120,6 +123,7 @@ public class CommentEditPart extends AbstractCommentEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -137,17 +141,18 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override public HTMLCornerBentFigure getPrimaryShape() { - return (HTMLCornerBentFigure)primaryShape; + return (HTMLCornerBentFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommentBodyEditPart) { - ((CommentBodyEditPart)childEditPart).setLabel(getPrimaryShape().getCornerBentFigure()); + if (childEditPart instanceof CommentBodyEditPart) { + ((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure()); return true; } + return false; } @@ -155,7 +160,7 @@ public class CommentEditPart extends AbstractCommentEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommentBodyEditPart) { + if (childEditPart instanceof CommentBodyEditPart) { return true; } return false; @@ -166,7 +171,7 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -177,7 +182,7 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -211,6 +216,7 @@ public class CommentEditPart extends AbstractCommentEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -223,7 +229,7 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -236,7 +242,7 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -247,7 +253,7 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -265,8 +271,8 @@ public class CommentEditPart extends AbstractCommentEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java index e1f6f894528..3532668834b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java @@ -48,7 +48,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { /** * @generated */ - public static final String VISUAL_ID = "54"; + public static final String VISUAL_ID = "Comment_Shape_CN"; /** * @generated @@ -74,9 +74,12 @@ public class CommentEditPartCN extends AbstractCommentEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy()); @@ -93,7 +96,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -120,6 +123,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -137,17 +141,18 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override public HTMLCornerBentFigure getPrimaryShape() { - return (HTMLCornerBentFigure)primaryShape; + return (HTMLCornerBentFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommentBodyEditPartCN) { - ((CommentBodyEditPartCN)childEditPart).setLabel(getPrimaryShape().getCornerBentFigure()); + if (childEditPart instanceof CommentBodyEditPartCN) { + ((CommentBodyEditPartCN) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure()); return true; } + return false; } @@ -155,7 +160,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommentBodyEditPartCN) { + if (childEditPart instanceof CommentBodyEditPartCN) { return true; } return false; @@ -166,7 +171,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -177,7 +182,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -211,6 +216,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -223,7 +229,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -236,7 +242,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -247,7 +253,7 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -265,8 +271,8 @@ public class CommentEditPartCN extends AbstractCommentEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathAppliedStereotypeEditPart.java index 6fb53dfa98b..bc8dee72b7e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathAppliedStereotypeEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -82,12 +83,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "6002"; + public static final String VISUAL_ID = "CommunicationPath_StereotypeLabel"; /** * @generated @@ -124,7 +126,10 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathAppliedStereotypeEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -156,12 +161,12 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -169,12 +174,12 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -182,12 +187,12 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -195,12 +200,12 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -256,10 +261,11 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -271,12 +277,12 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -284,10 +290,11 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -305,22 +312,27 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + CommunicationPathAppliedStereotypeEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -331,10 +343,10 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -348,8 +360,8 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.CommunicationPath_4011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathAppliedStereotypeEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.CommunicationPath_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -358,8 +370,10 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -388,8 +402,8 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -397,8 +411,8 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -408,46 +422,58 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -469,12 +495,13 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -504,20 +531,20 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -525,15 +552,15 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -542,9 +569,9 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -552,9 +579,10 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -570,11 +598,11 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -585,8 +613,8 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -598,7 +626,7 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -624,13 +652,14 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -642,7 +671,7 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -663,12 +692,15 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -678,10 +710,13 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -698,12 +733,15 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -721,30 +759,34 @@ public class CommunicationPathAppliedStereotypeEditPart extends PapyrusLabelEdit */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathEditPart.java index efe01f17bf7..8c9cb191712 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathEditPart.java @@ -30,7 +30,7 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme /** * @generated */ - public static final String VISUAL_ID = "4011"; + public static final String VISUAL_ID = "CommunicationPath_Edge"; /** * @generated @@ -45,7 +45,8 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); } @@ -53,11 +54,12 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommunicationPathNameEditPart) { - ((CommunicationPathNameEditPart)childEditPart).setLabel(getPrimaryShape().getAssociationNameLabel()); + if (childEditPart instanceof CommunicationPathNameEditPart) { + ((CommunicationPathNameEditPart) childEditPart).setLabel(getPrimaryShape().getAssociationNameLabel()); } - if(childEditPart instanceof CommunicationPathAppliedStereotypeEditPart) { - ((CommunicationPathAppliedStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); + if (childEditPart instanceof CommunicationPathAppliedStereotypeEditPart) { + ((CommunicationPathAppliedStereotypeEditPart) childEditPart) + .setLabel(getPrimaryShape().getAppliedStereotypeLabel()); } return false; } @@ -66,7 +68,7 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -76,10 +78,10 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof CommunicationPathNameEditPart) { + if (childEditPart instanceof CommunicationPathNameEditPart) { return true; } - if(childEditPart instanceof CommunicationPathAppliedStereotypeEditPart) { + if (childEditPart instanceof CommunicationPathAppliedStereotypeEditPart) { return true; } return false; @@ -89,7 +91,7 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme * @generated */ protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -111,6 +113,6 @@ public class CommunicationPathEditPart extends UMLConnectionNodeEditPart impleme * @generated */ public AssociationFigure getPrimaryShape() { - return (AssociationFigure)getFigure(); + return (AssociationFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathNameEditPart.java index 31da062671c..13810a8aae2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommunicationPathNameEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -82,12 +83,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class CommunicationPathNameEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "6001"; + public static final String VISUAL_ID = "CommunicationPath_NameLabel"; /** * @generated @@ -124,7 +126,10 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathNameEditPart.VISUAL_ID), new Point(0, 40)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathNameEditPart.VISUAL_ID), + new Point(0, 40)); } /** @@ -156,12 +161,12 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -169,12 +174,12 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -182,12 +187,12 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -195,12 +200,12 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -256,10 +261,11 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -271,12 +277,12 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -284,10 +290,11 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -305,22 +312,26 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + CommunicationPathNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -331,10 +342,10 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -348,8 +359,8 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.CommunicationPath_4011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.CommunicationPath_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -358,8 +369,10 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -388,8 +401,8 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -397,8 +410,8 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -408,46 +421,58 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -469,12 +494,13 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -504,20 +530,20 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -525,15 +551,15 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -542,9 +568,9 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -552,9 +578,10 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -570,11 +597,11 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -585,8 +612,8 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -598,7 +625,7 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -624,13 +651,14 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -642,7 +670,7 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -663,12 +691,15 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -678,10 +709,13 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -698,12 +732,15 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -721,30 +758,34 @@ public class CommunicationPathNameEditPart extends PapyrusLabelEditPart implemen */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java index 43dc9039641..024a41af975 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java @@ -27,7 +27,7 @@ public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditP /** * @generated */ - public static final String VISUAL_ID = "4009"; + public static final String VISUAL_ID = "Constraint_ConstrainedElementEdge"; /** * @generated @@ -63,6 +63,6 @@ public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditP */ @Override public SimpleDashedEdgeFigure getPrimaryShape() { - return (SimpleDashedEdgeFigure)getFigure(); + return (SimpleDashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java index 9876135110e..29b4f7772ba 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java @@ -47,7 +47,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { /** * @generated */ - public static final String VISUAL_ID = "2005"; + public static final String VISUAL_ID = "Constraint_Shape"; /** * @generated @@ -73,9 +73,12 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies @@ -91,7 +94,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -118,6 +121,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -135,21 +139,22 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override public ConstraintFigure getPrimaryShape() { - return (ConstraintFigure)primaryShape; + return (ConstraintFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ConstraintNameEditPart) { - ((ConstraintNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ConstraintNameEditPart) { + ((ConstraintNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ConstraintSpecificationEditPart) { - ((ConstraintSpecificationEditPart)childEditPart).setLabel(getPrimaryShape().getConstraintFigure()); + if (childEditPart instanceof ConstraintSpecificationEditPart) { + ((ConstraintSpecificationEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintFigure()); return true; } + return false; } @@ -157,10 +162,10 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ConstraintNameEditPart) { + if (childEditPart instanceof ConstraintNameEditPart) { return true; } - if(childEditPart instanceof ConstraintSpecificationEditPart) { + if (childEditPart instanceof ConstraintSpecificationEditPart) { return true; } return false; @@ -171,7 +176,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -182,7 +187,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -216,6 +221,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -228,7 +234,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -241,7 +247,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -252,7 +258,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -270,8 +276,8 @@ public class ConstraintEditPart extends AbstractConstraintEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java index 35ef64380db..eb5e1d4c0e6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java @@ -47,7 +47,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { /** * @generated */ - public static final String VISUAL_ID = "56"; + public static final String VISUAL_ID = "Constraint_Shape_CN"; /** * @generated @@ -73,9 +73,12 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies @@ -91,7 +94,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -118,6 +121,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -135,21 +139,22 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override public ConstraintFigure getPrimaryShape() { - return (ConstraintFigure)primaryShape; + return (ConstraintFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ConstraintNameEditPartCN) { - ((ConstraintNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ConstraintNameEditPartCN) { + ((ConstraintNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ConstraintSpecificationEditPartCN) { - ((ConstraintSpecificationEditPartCN)childEditPart).setLabel(getPrimaryShape().getConstraintFigure()); + if (childEditPart instanceof ConstraintSpecificationEditPartCN) { + ((ConstraintSpecificationEditPartCN) childEditPart).setLabel(getPrimaryShape().getConstraintFigure()); return true; } + return false; } @@ -157,10 +162,10 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ConstraintNameEditPartCN) { + if (childEditPart instanceof ConstraintNameEditPartCN) { return true; } - if(childEditPart instanceof ConstraintSpecificationEditPartCN) { + if (childEditPart instanceof ConstraintSpecificationEditPartCN) { return true; } return false; @@ -171,7 +176,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -182,7 +187,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -216,6 +221,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -228,7 +234,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -241,7 +247,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -252,7 +258,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -270,8 +276,8 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java index 934cb97a611..6b3d737abf5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ConstraintNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "2"; + public static final String VISUAL_ID = "Constraint_NameLabel"; /** * @generated @@ -144,12 +146,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ConstraintNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Constraint_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java index 50c4f1d12ba..dd1f096cf5a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "57"; + public static final String VISUAL_ID = "Constraint_NameLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ConstraintNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Constraint_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java index 2e059a1d2fd..00bae402acf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "3"; + public static final String VISUAL_ID = "Constraint_BodyLabel"; /** * @generated @@ -144,12 +146,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,26 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + ConstraintSpecificationEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +334,10 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +353,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Constraint_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +363,10 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +395,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +404,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +416,58 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +489,13 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +526,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +540,12 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +553,15 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +570,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +581,10 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +602,11 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +618,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +632,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +658,14 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +677,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +699,15 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +718,13 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +743,15 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +789,27 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +846,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +857,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +865,6 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java index 3a7004fbd1b..385c5ca592a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "58"; + public static final String VISUAL_ID = "Constraint_BodyLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,28 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + ConstraintSpecificationEditPartCN.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +336,10 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +355,8 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Constraint_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +365,10 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +397,8 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +406,8 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +418,58 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +491,13 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +528,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +542,12 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +555,15 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +572,9 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +583,10 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +604,11 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +620,8 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +634,7 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +660,14 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +679,7 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +701,15 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +720,13 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +745,15 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +791,27 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +848,8 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +859,7 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +867,6 @@ public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPar */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java index 7e685885c30..a6272d69863 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java @@ -50,7 +50,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "2012"; + public static final String VISUAL_ID = "NamedElement_DefaultShape"; /** * @generated @@ -76,12 +76,16 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new DeploymentDiagramChangeStereotypedShapeEditpolicy()); + installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, + new DeploymentDiagramChangeStereotypedShapeEditpolicy()); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultNamedElementItemSemanticEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); @@ -96,7 +100,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -123,6 +127,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -140,17 +145,18 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override public NodeNamedElementFigure getPrimaryShape() { - return (NodeNamedElementFigure)primaryShape; + return (NodeNamedElementFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DefaultNamedElementNameEditPart) { - ((DefaultNamedElementNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DefaultNamedElementNameEditPart) { + ((DefaultNamedElementNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -158,7 +164,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DefaultNamedElementNameEditPart) { + if (childEditPart instanceof DefaultNamedElementNameEditPart) { return true; } return false; @@ -169,7 +175,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -180,7 +186,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -214,6 +220,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -226,7 +233,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -239,7 +246,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -250,7 +257,7 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -268,8 +275,8 @@ public class DefaultNamedElementEditPart extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java index 839daa28025..ecf378d6d6c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -85,12 +86,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "53"; + public static final String VISUAL_ID = "NamedElement_NameLabel"; /** * @generated @@ -148,12 +150,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -161,12 +163,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -174,12 +176,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -187,12 +189,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -243,12 +245,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); - if(parserElement == null) { + if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for(View view : views) { - if(AppearanceHelper.showElementIcon(view)) { + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } @@ -261,10 +263,11 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -277,12 +280,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -291,10 +294,11 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -313,22 +317,26 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + DefaultNamedElementNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -340,10 +348,10 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -359,8 +367,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.NamedElement_2012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.NamedElement_DefaultShape, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -369,8 +378,10 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -399,8 +410,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -408,8 +419,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -420,46 +431,58 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -481,12 +504,13 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -517,12 +541,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -531,12 +555,12 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +568,15 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +585,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -572,9 +596,10 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -592,11 +617,11 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -608,8 +633,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -622,7 +647,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -648,13 +673,14 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -666,7 +692,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -688,12 +714,15 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -704,10 +733,13 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -726,12 +758,15 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -769,31 +804,35 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } - if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) { + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON + .equals(((EAnnotation) event.getNewValue()).getSource())) { refreshLabel(); } super.handleNotificationEvent(event); @@ -826,7 +865,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -836,6 +876,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -843,5 +884,6 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java index 7bf37fb925e..7ea06d4a961 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "15"; + public static final String VISUAL_ID = "Dependency_StereotypeLabel"; /** * @generated @@ -127,7 +129,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -160,12 +165,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,28 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DependencyAppliedStereotypeEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +355,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +374,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Dependency_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +384,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +416,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +425,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +437,58 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +510,13 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +547,20 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +568,15 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +585,9 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +596,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +617,11 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +647,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +673,14 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +692,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +714,15 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +733,13 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +758,15 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +785,34 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java index 6e612bad06e..3608d19e91d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java @@ -29,7 +29,7 @@ public class DependencyBranchEditPart extends UMLConnectionNodeEditPart implemen /** * @generated */ - public static final String VISUAL_ID = "4010"; + public static final String VISUAL_ID = "Dependency_BranchEdge"; /** * @generated @@ -66,6 +66,6 @@ public class DependencyBranchEditPart extends UMLConnectionNodeEditPart implemen */ @Override public DashedEdgeFigure getPrimaryShape() { - return (DashedEdgeFigure)getFigure(); + return (DashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java index 4eb7b30df1f..b1541618c58 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java @@ -32,7 +32,7 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr /** * @generated */ - public static final String VISUAL_ID = "4004"; + public static final String VISUAL_ID = "Dependency_Edge"; /** * @generated @@ -48,7 +48,8 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); } @@ -57,11 +58,12 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DependencyNameEditPart) { - ((DependencyNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DependencyNameEditPart) { + ((DependencyNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); } - if(childEditPart instanceof DependencyAppliedStereotypeEditPart) { - ((DependencyAppliedStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); + if (childEditPart instanceof DependencyAppliedStereotypeEditPart) { + ((DependencyAppliedStereotypeEditPart) childEditPart) + .setLabel(getPrimaryShape().getAppliedStereotypeLabel()); } return false; } @@ -71,7 +73,7 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -81,10 +83,10 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DependencyNameEditPart) { + if (childEditPart instanceof DependencyNameEditPart) { return true; } - if(childEditPart instanceof DependencyAppliedStereotypeEditPart) { + if (childEditPart instanceof DependencyAppliedStereotypeEditPart) { return true; } return false; @@ -95,7 +97,7 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -119,6 +121,6 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override public DashedEdgeFigure getPrimaryShape() { - return (DashedEdgeFigure)getFigure(); + return (DashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java index fb28ab9d160..490e5e0910c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class DependencyNameEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "12"; + public static final String VISUAL_ID = "Dependency_NameLabel"; /** * @generated @@ -127,7 +129,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 40)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID), + new Point(0, 40)); } /** @@ -160,12 +165,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,25 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), DependencyNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +352,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +371,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Dependency_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +381,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +413,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +422,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +434,58 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +507,13 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +544,20 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +565,15 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +582,9 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +593,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +614,11 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +630,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +644,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +670,14 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +689,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +711,15 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +730,13 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +755,15 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +782,34 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java index b1c081a0cf9..9f2e79155af 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java @@ -52,7 +52,7 @@ public class DependencyNodeEditPart extends NodeEditPart { /** * @generated */ - public static final String VISUAL_ID = "2011"; + public static final String VISUAL_ID = "Dependency_Shape"; /** * @generated @@ -78,7 +78,9 @@ public class DependencyNodeEditPart extends NodeEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); @@ -94,16 +96,16 @@ public class DependencyNodeEditPart extends NodeEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case MultiDependencyLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -111,7 +113,7 @@ public class DependencyNodeEditPart extends NodeEditPart { } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -145,7 +147,7 @@ public class DependencyNodeEditPart extends NodeEditPart { */ @Override public DependencyNodeFigure getPrimaryShape() { - return (DependencyNodeFigure)primaryShape; + return (DependencyNodeFigure) primaryShape; } /** @@ -153,7 +155,7 @@ public class DependencyNodeEditPart extends NodeEditPart { */ @Override protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof MultiDependencyLabelEditPart) { + if (borderItemEditPart instanceof MultiDependencyLabelEditPart) { BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); locator.setBorderItemOffset(new Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); @@ -182,6 +184,7 @@ public class DependencyNodeEditPart extends NodeEditPart { @Override protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -202,7 +205,7 @@ public class DependencyNodeEditPart extends NodeEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -213,7 +216,7 @@ public class DependencyNodeEditPart extends NodeEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -231,8 +234,8 @@ public class DependencyNodeEditPart extends NodeEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java index 9c47fe0b69d..01875584c0b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "14"; + public static final String VISUAL_ID = "Deployment_StereotypeLabel"; /** * @generated @@ -127,7 +129,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -160,12 +165,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,28 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentAppliedStereotypeEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +355,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +374,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Deployment_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +384,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +416,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +425,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +437,58 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +510,13 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +547,20 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +568,15 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +585,9 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +596,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +617,11 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +647,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +673,14 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +692,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +714,15 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +733,13 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +758,15 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +785,34 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java index f5bd1084568..3a481824e6a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java @@ -33,7 +33,7 @@ public class DeploymentDiagramEditPart extends PapyrusDiagramEditPart { /** * @generated */ - public static final String VISUAL_ID = "1000"; + public static final String VISUAL_ID = "Package_DeploymentDiagram"; /** * @generated @@ -48,11 +48,14 @@ public class DeploymentDiagramEditPart extends PapyrusDiagramEditPart { @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelCanonicalEditPolicy()); + installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java index 85f94ee4070..b90dbd45099 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java @@ -30,7 +30,7 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr /** * @generated */ - public static final String VISUAL_ID = "4001"; + public static final String VISUAL_ID = "Deployment_Edge"; /** * @generated @@ -46,7 +46,8 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); } @@ -54,11 +55,12 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentNameEditPart) { - ((DeploymentNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeploymentNameEditPart) { + ((DeploymentNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); } - if(childEditPart instanceof DeploymentAppliedStereotypeEditPart) { - ((DeploymentAppliedStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); + if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) { + ((DeploymentAppliedStereotypeEditPart) childEditPart) + .setLabel(getPrimaryShape().getAppliedStereotypeLabel()); } return false; } @@ -68,7 +70,7 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -78,10 +80,10 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentNameEditPart) { + if (childEditPart instanceof DeploymentNameEditPart) { return true; } - if(childEditPart instanceof DeploymentAppliedStereotypeEditPart) { + if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) { return true; } return false; @@ -92,7 +94,7 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -116,6 +118,6 @@ public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITr */ @Override public DashedEdgeFigure getPrimaryShape() { - return (DashedEdgeFigure)getFigure(); + return (DashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java index 6b17c6fb877..69e0f7e587a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class DeploymentNameEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "13"; + public static final String VISUAL_ID = "Deployment_NameLabel"; /** * @generated @@ -127,7 +129,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -160,12 +165,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,25 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), DeploymentNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +352,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +371,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Deployment_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +381,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +413,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +422,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +434,58 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +507,13 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +544,20 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +565,15 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +582,9 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +593,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +614,11 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +630,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +644,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +670,14 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +689,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +711,15 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +730,13 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +755,15 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +782,34 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java index 818ceca2c8d..11c4f45f25f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java @@ -63,7 +63,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa /** * @generated */ - public static final String VISUAL_ID = "2014"; + public static final String VISUAL_ID = "DeploymentSpecification_Shape_CCN"; /** * @generated @@ -88,10 +88,13 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -108,16 +111,16 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -125,7 +128,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -153,16 +156,17 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -177,17 +181,18 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ public DeploymentSpecificationFigure getPrimaryShape() { - return (DeploymentSpecificationFigure)primaryShape; + return (DeploymentSpecificationFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { - ((DeploymentSpecAsClassifierNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { + ((DeploymentSpecAsClassifierNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -195,7 +200,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { + if (childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { return true; } return false; @@ -205,7 +210,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -215,7 +220,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -225,7 +230,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -235,7 +240,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof DeploymentSpecAsClassifierFloatingLabelEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsClassifierFloatingLabelEditPart) { BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); locator.setBorderItemOffset(new Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); @@ -259,6 +264,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa */ protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -268,7 +274,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -280,7 +286,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -290,7 +296,7 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -306,8 +312,8 @@ public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPa * @generated */ protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java index 83c3c3474a6..11a8ab7b366 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "65"; + public static final String VISUAL_ID = "DeploymentSpecification_FloatingNameLabel_CCN"; /** * @generated @@ -128,7 +130,10 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -153,9 +158,9 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab */ public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -164,10 +169,10 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -175,12 +180,12 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -188,12 +193,12 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -201,12 +206,12 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -214,12 +219,12 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -275,10 +280,11 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -290,12 +296,12 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -303,10 +309,11 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -324,22 +331,27 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsClassifierFloatingLabelEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -350,10 +362,10 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -367,8 +379,9 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_CCN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -377,8 +390,10 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -407,8 +422,8 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -416,8 +431,8 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -427,46 +442,58 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -488,12 +515,13 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -523,20 +551,20 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +572,15 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +589,9 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -571,9 +599,10 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -589,11 +618,11 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -617,7 +646,7 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -643,13 +672,14 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -661,7 +691,7 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -683,12 +713,15 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -699,10 +732,13 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -721,12 +757,15 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -744,24 +783,27 @@ public class DeploymentSpecAsClassifierFloatingLabelEditPart extends FloatingLab */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java index deacd177693..b379d3fbbaf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "64"; + public static final String VISUAL_ID = "DeploymentSpecification_NameLabel_CCN"; /** * @generated @@ -141,12 +143,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -154,12 +156,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -167,12 +169,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -180,12 +182,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -241,10 +243,11 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -256,12 +259,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -269,10 +272,11 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -290,22 +294,28 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsClassifierNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -316,10 +326,10 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -333,8 +343,9 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_CCN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -343,8 +354,10 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -373,8 +386,8 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -382,8 +395,8 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -393,46 +406,58 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -454,12 +479,13 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -489,12 +515,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -503,12 +529,12 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -516,15 +542,15 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -533,9 +559,9 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -543,9 +569,10 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -561,11 +588,11 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -576,8 +603,8 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -589,7 +616,7 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -615,13 +642,14 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -633,7 +661,7 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -654,12 +682,15 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -669,10 +700,13 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -689,12 +723,15 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -729,24 +766,27 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -781,7 +821,8 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -790,6 +831,7 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -797,5 +839,6 @@ public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEd */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java index a0f5bbaa852..0ed71d57bcc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java @@ -63,7 +63,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd /** * @generated */ - public static final String VISUAL_ID = "2016"; + public static final String VISUAL_ID = "DeploymentSpecification_Shape_ACN"; /** * @generated @@ -88,10 +88,13 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -108,16 +111,16 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -125,7 +128,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -153,16 +156,17 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -177,17 +181,18 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ public DeploymentSpecificationFigure getPrimaryShape() { - return (DeploymentSpecificationFigure)primaryShape; + return (DeploymentSpecificationFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { - ((DeploymentSpecAsNestedArtifactNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { + ((DeploymentSpecAsNestedArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -195,7 +200,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { + if (childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { return true; } return false; @@ -205,7 +210,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -215,7 +220,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -225,7 +230,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -235,7 +240,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof DeploymentSpecAsNestedArtifactFloatingLabelEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsNestedArtifactFloatingLabelEditPart) { BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); locator.setBorderItemOffset(new Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); @@ -259,6 +264,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd */ protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -268,7 +274,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -280,7 +286,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -290,7 +296,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -306,8 +312,8 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } @@ -315,6 +321,7 @@ public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEd * @generated */ public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + return getChildBySemanticHint( + UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java index db8e2c63b6f..c7ee67a609c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "69"; + public static final String VISUAL_ID = "DeploymentSpecification_FloatingNameLabel_ACN"; /** * @generated @@ -128,7 +130,10 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -153,9 +158,9 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin */ public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -164,10 +169,10 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -175,12 +180,12 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -188,12 +193,12 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -201,12 +206,12 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -214,12 +219,12 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -275,10 +280,11 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -290,12 +296,12 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -303,10 +309,11 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -324,22 +331,27 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsNestedArtifactFloatingLabelEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -350,10 +362,10 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -367,8 +379,9 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2016, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_ACN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -377,8 +390,10 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -407,8 +422,8 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -416,8 +431,8 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -427,46 +442,58 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -488,12 +515,13 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -523,20 +551,20 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +572,15 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +589,9 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -571,9 +599,10 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -589,11 +618,11 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -617,7 +646,7 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -643,13 +672,14 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -661,7 +691,7 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -683,12 +713,15 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -699,10 +732,13 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -721,12 +757,15 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -744,24 +783,27 @@ public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends Floatin */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java index 1440e846878..d925b7b030d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "68"; + public static final String VISUAL_ID = "DeploymentSpecification_NameLabel_ACN"; /** * @generated @@ -141,12 +143,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -154,12 +156,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -167,12 +169,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -180,12 +182,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -241,10 +243,11 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -256,12 +259,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -269,10 +272,11 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -290,22 +294,27 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsNestedArtifactNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -316,10 +325,10 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -333,8 +342,9 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2016, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_ACN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -343,8 +353,10 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -373,8 +385,8 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -382,8 +394,8 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -393,46 +405,58 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -454,12 +478,13 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -489,12 +514,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -503,12 +528,12 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -516,15 +541,15 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -533,9 +558,9 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -543,9 +568,10 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -561,11 +587,11 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -576,8 +602,8 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -589,7 +615,7 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -615,13 +641,14 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -633,7 +660,7 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -654,12 +681,15 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -669,10 +699,13 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -689,12 +722,15 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -729,24 +765,27 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -781,7 +820,8 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -790,6 +830,7 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -797,5 +838,6 @@ public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartme */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java index 8cb8aca86ac..2aaa1f8cf1c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java @@ -63,7 +63,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi /** * @generated */ - public static final String VISUAL_ID = "2015"; + public static final String VISUAL_ID = "DeploymentSpecification_Shape_CN"; /** * @generated @@ -88,10 +88,13 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -108,16 +111,16 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -125,7 +128,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -153,16 +156,17 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -177,17 +181,18 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ public DeploymentSpecificationFigure getPrimaryShape() { - return (DeploymentSpecificationFigure)primaryShape; + return (DeploymentSpecificationFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { - ((DeploymentSpecAsPackageableElNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { + ((DeploymentSpecAsPackageableElNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -195,7 +200,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { + if (childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { return true; } return false; @@ -205,7 +210,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -215,7 +220,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -225,7 +230,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -235,7 +240,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof DeploymentSpecAsPackageableElFloatingLabelEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsPackageableElFloatingLabelEditPart) { BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); locator.setBorderItemOffset(new Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); @@ -259,6 +264,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi */ protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -268,7 +274,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -280,7 +286,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -290,7 +296,7 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -306,8 +312,8 @@ public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEdi * @generated */ protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java index 4c0a6bbddd4..d4a340efbd5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "67"; + public static final String VISUAL_ID = "DeploymentSpecification_FloatingNameLabel_CN"; /** * @generated @@ -128,7 +130,10 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -153,9 +158,9 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating */ public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -164,10 +169,10 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -175,12 +180,12 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -188,12 +193,12 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -201,12 +206,12 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -214,12 +219,12 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -275,10 +280,11 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -290,12 +296,12 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -303,10 +309,11 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -324,22 +331,27 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsPackageableElFloatingLabelEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -350,10 +362,10 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -367,8 +379,9 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2015, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_CN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -377,8 +390,10 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -407,8 +422,8 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -416,8 +431,8 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -427,46 +442,58 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -488,12 +515,13 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -523,20 +551,20 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +572,15 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +589,9 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -571,9 +599,10 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -589,11 +618,11 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -617,7 +646,7 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -643,13 +672,14 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -661,7 +691,7 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -683,12 +713,15 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -699,10 +732,13 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -721,12 +757,15 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -744,24 +783,27 @@ public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends Floating */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java index 510fc7b479b..ec83f3bcb9a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "66"; + public static final String VISUAL_ID = "DeploymentSpecification_NameLabel_CN"; /** * @generated @@ -141,12 +143,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -154,12 +156,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -167,12 +169,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -180,12 +182,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -241,10 +243,11 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -256,12 +259,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -269,10 +272,11 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -290,22 +294,27 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecAsPackageableElNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -316,10 +325,10 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -333,8 +342,9 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2015, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape_CN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -343,8 +353,10 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -373,8 +385,8 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -382,8 +394,8 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -393,46 +405,58 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -454,12 +478,13 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -489,12 +514,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -503,12 +528,12 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -516,15 +541,15 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -533,9 +558,9 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -543,9 +568,10 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -561,11 +587,11 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -576,8 +602,8 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -589,7 +615,7 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -615,13 +641,14 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -633,7 +660,7 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -654,12 +681,15 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -669,10 +699,13 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -689,12 +722,15 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -729,24 +765,27 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -781,7 +820,8 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -790,6 +830,7 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -797,5 +838,6 @@ public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmen */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java index 501ccebd461..fda4258abca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java @@ -62,7 +62,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart /** * @generated */ - public static final String VISUAL_ID = "2013"; + public static final String VISUAL_ID = "DeploymentSpecification_Shape"; /** * @generated @@ -87,10 +87,13 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -107,16 +110,16 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View)child.getModel(); + View childView = (View) child.getModel(); String vid = UMLVisualIDRegistry.getVisualID(childView); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { @Override protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } @@ -124,7 +127,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -152,16 +155,17 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! */ - if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { Object notifier = event.getNotifier(); - List<?> modelChildren = ((View)getModel()).getChildren(); - if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); + } /** @@ -176,17 +180,18 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ public DeploymentSpecificationFigure getPrimaryShape() { - return (DeploymentSpecificationFigure)primaryShape; + return (DeploymentSpecificationFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecificationNameEditPart) { - ((DeploymentSpecificationNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeploymentSpecificationNameEditPart) { + ((DeploymentSpecificationNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -194,7 +199,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeploymentSpecificationNameEditPart) { + if (childEditPart instanceof DeploymentSpecificationNameEditPart) { return true; } return false; @@ -204,7 +209,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -214,7 +219,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -224,7 +229,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof IBorderItemEditPart) { + if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); @@ -234,7 +239,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if(borderItemEditPart instanceof DeploymentSpecificationFloatingLabelEditPart) { + if (borderItemEditPart instanceof DeploymentSpecificationFloatingLabelEditPart) { IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { @@ -257,6 +262,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart */ protected NodeFigure createMainFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -266,7 +272,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -278,7 +284,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -288,7 +294,7 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -304,8 +310,8 @@ public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart * @generated */ protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java index ef43996c980..07435b85278 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -84,12 +85,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "63"; + public static final String VISUAL_ID = "DeploymentSpecification_FloatingNameLabel"; /** * @generated @@ -128,7 +130,10 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -153,9 +158,9 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE */ public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -164,10 +169,10 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -175,12 +180,12 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -188,12 +193,12 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -201,12 +206,12 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -214,12 +219,12 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -275,10 +280,11 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -290,12 +296,12 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -303,10 +309,11 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -324,22 +331,27 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecificationFloatingLabelEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -350,10 +362,10 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -367,8 +379,9 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -377,8 +390,10 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -407,8 +422,8 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -416,8 +431,8 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -427,46 +442,58 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -488,12 +515,13 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -523,20 +551,20 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +572,15 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +589,9 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -571,9 +599,10 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -589,11 +618,11 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -617,7 +646,7 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -643,13 +672,14 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -661,7 +691,7 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -683,12 +713,15 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -699,10 +732,13 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -721,12 +757,15 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -744,24 +783,27 @@ public class DeploymentSpecificationFloatingLabelEditPart extends FloatingLabelE */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java index c18f3ac16bb..5327e04871a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "62"; + public static final String VISUAL_ID = "DeploymentSpecification_NameLabel"; /** * @generated @@ -141,12 +143,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -154,12 +156,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -167,12 +169,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -180,12 +182,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -241,10 +243,11 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -256,12 +259,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -269,10 +272,11 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -290,22 +294,28 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + DeploymentSpecificationNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -316,10 +326,10 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -333,8 +343,9 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.DeploymentSpecification_Shape, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -343,8 +354,10 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -373,8 +386,8 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -382,8 +395,8 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -393,46 +406,58 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -454,12 +479,13 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -489,12 +515,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -503,12 +529,12 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -516,15 +542,15 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -533,9 +559,9 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -543,9 +569,10 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -561,11 +588,11 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -576,8 +603,8 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -589,7 +616,7 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -615,13 +642,14 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -633,7 +661,7 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -654,12 +682,15 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -669,10 +700,13 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -689,12 +723,15 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -729,24 +766,27 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -781,7 +821,8 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -790,6 +831,7 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -797,5 +839,6 @@ public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditP */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java index 9c30c979506..ee450dbff00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java @@ -40,7 +40,7 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd /** * @generated */ - public static final String VISUAL_ID = "17"; + public static final String VISUAL_ID = "Device_NestedNodeCompartment"; /** * @generated @@ -69,6 +69,7 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -78,7 +79,7 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -88,6 +89,7 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -97,7 +99,10 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -107,13 +112,13 @@ public class DeviceCompositeCompartmentEditPart extends LinkLFShapeCompartmentEd * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java index c574021eda6..f323b2c2da3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java @@ -41,7 +41,7 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment /** * @generated */ - public static final String VISUAL_ID = "30"; + public static final String VISUAL_ID = "Device_NestedNodeCompartment_CN"; /** * @generated @@ -71,6 +71,7 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -80,7 +81,7 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class DeviceCompositeCompartmentEditPartCN extends LinkLFShapeCompartment * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java index be5b84b3d4f..2db866f919d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java @@ -52,7 +52,7 @@ public class DeviceEditPart extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "2003"; + public static final String VISUAL_ID = "Device_Shape"; /** * @generated @@ -78,13 +78,18 @@ public class DeviceEditPart extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -101,7 +106,7 @@ public class DeviceEditPart extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -128,6 +133,7 @@ public class DeviceEditPart extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -145,23 +151,25 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override public DeviceFigure getPrimaryShape() { - return (DeviceFigure)primaryShape; + return (DeviceFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeviceNameEditPart) { - ((DeviceNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeviceNameEditPart) { + ((DeviceNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof DeviceCompositeCompartmentEditPart) { + + if (childEditPart instanceof DeviceCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((DeviceCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.add(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -169,12 +177,12 @@ public class DeviceEditPart extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeviceNameEditPart) { + if (childEditPart instanceof DeviceNameEditPart) { return true; } - if(childEditPart instanceof DeviceCompositeCompartmentEditPart) { + if (childEditPart instanceof DeviceCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((DeviceCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -185,7 +193,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -196,7 +204,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -207,7 +215,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof DeviceCompositeCompartmentEditPart) { + if (editPart instanceof DeviceCompositeCompartmentEditPart) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -233,6 +241,7 @@ public class DeviceEditPart extends NamedElementEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -245,7 +254,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -258,7 +267,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -269,7 +278,7 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -287,8 +296,8 @@ public class DeviceEditPart extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java index 0d7bdeba7e1..6e878a0eceb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java @@ -52,7 +52,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "16"; + public static final String VISUAL_ID = "Device_Shape_CCN"; /** * @generated @@ -78,13 +78,18 @@ public class DeviceEditPartCN extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -101,7 +106,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -128,6 +133,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -145,17 +151,18 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override public DeviceFigure getPrimaryShape() { - return (DeviceFigure)primaryShape; + return (DeviceFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeviceNameEditPartCN) { - ((DeviceNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof DeviceNameEditPartCN) { + ((DeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -163,7 +170,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof DeviceNameEditPartCN) { + if (childEditPart instanceof DeviceNameEditPartCN) { return true; } return false; @@ -174,7 +181,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -185,7 +192,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -219,6 +226,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -231,7 +239,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -244,7 +252,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -255,7 +263,7 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -273,8 +281,8 @@ public class DeviceEditPartCN extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java index d8c7681976a..5ac0ccd60c8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeviceNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "6"; + public static final String VISUAL_ID = "Device_NameLabel"; /** * @generated @@ -144,12 +146,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), DeviceNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Device_2003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Device_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements IT */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java index 544786af33d..addd5285cbf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "20"; + public static final String VISUAL_ID = "Device_NameLabel_CCN"; /** * @generated @@ -144,12 +146,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), DeviceNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Device_16, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Device_Shape_CCN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java index a0ca9da1020..bfe032a9316 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java @@ -40,7 +40,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap /** * @generated */ - public static final String VISUAL_ID = "18"; + public static final String VISUAL_ID = "ExecutionEnvironment_NestedNodeCompartment"; /** * @generated @@ -69,6 +69,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -78,7 +79,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -88,6 +89,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -97,7 +99,10 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -107,13 +112,13 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends LinkLFShap * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java index 9265afc53b6..2feb9119f4a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java @@ -41,7 +41,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh /** * @generated */ - public static final String VISUAL_ID = "31"; + public static final String VISUAL_ID = "ExecutionEnvironment_NestedNodeCompartment_CN"; /** * @generated @@ -71,6 +71,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -80,7 +81,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends LinkLFSh * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java index d937444f712..4887c345098 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java @@ -52,7 +52,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "2002"; + public static final String VISUAL_ID = "ExecutionEnvironment_Shape"; /** * @generated @@ -78,13 +78,18 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -101,7 +106,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -128,6 +133,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -145,23 +151,25 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override public ExecutionEnvironmentFigure getPrimaryShape() { - return (ExecutionEnvironmentFigure)primaryShape; + return (ExecutionEnvironmentFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ExecutionEnvironmentNameEditPart) { - ((ExecutionEnvironmentNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ExecutionEnvironmentNameEditPart) { + ((ExecutionEnvironmentNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { + + if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ExecutionEnvironmentCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.add(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -169,12 +177,12 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ExecutionEnvironmentNameEditPart) { + if (childEditPart instanceof ExecutionEnvironmentNameEditPart) { return true; } - if(childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { + if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -185,7 +193,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -196,7 +204,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -207,7 +215,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { + if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -233,6 +241,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -245,7 +254,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -258,7 +267,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -269,7 +278,7 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -287,8 +296,8 @@ public class ExecutionEnvironmentEditPart extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java index 91ce2469036..38055996602 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java @@ -52,7 +52,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "21"; + public static final String VISUAL_ID = "ExecutionEnvironment_Shape_CCN"; /** * @generated @@ -78,13 +78,18 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -101,7 +106,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -128,6 +133,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -145,17 +151,18 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override public ExecutionEnvironmentFigure getPrimaryShape() { - return (ExecutionEnvironmentFigure)primaryShape; + return (ExecutionEnvironmentFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ExecutionEnvironmentNameEditPartCN) { - ((ExecutionEnvironmentNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) { + ((ExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -163,7 +170,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ExecutionEnvironmentNameEditPartCN) { + if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) { return true; } return false; @@ -174,7 +181,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -185,7 +192,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -219,6 +226,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -231,7 +239,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -244,7 +252,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -255,7 +263,7 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -273,8 +281,8 @@ public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java index 4cdeb6809aa..2083b9fe2ac 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "5"; + public static final String VISUAL_ID = "ExecutionEnvironment_NameLabel"; /** * @generated @@ -144,12 +146,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,28 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + ExecutionEnvironmentNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +336,10 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +355,9 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_2002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.ExecutionEnvironment_Shape, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -355,8 +366,10 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +398,8 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +407,8 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +419,58 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +492,13 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +529,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +543,12 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +556,15 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +573,9 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +584,10 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +605,11 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +621,8 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +635,7 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +661,14 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +680,7 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +702,15 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +721,13 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +746,15 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +792,27 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +849,8 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +860,7 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +868,6 @@ public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java index 7be5adea4ec..c984369c3d6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "22"; + public static final String VISUAL_ID = "ExecutionEnvironment_NameLabel_CCN"; /** * @generated @@ -144,12 +146,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,28 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + ExecutionEnvironmentNameEditPartCN.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +336,10 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +355,9 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_21, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.ExecutionEnvironment_Shape_CCN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -355,8 +366,10 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +398,8 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +407,8 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +419,58 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +492,13 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +529,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +543,12 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +556,15 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +573,9 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +584,10 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +605,11 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +621,8 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +635,7 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +661,14 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +680,7 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +702,15 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +721,13 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +746,15 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +792,27 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +849,8 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +860,7 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +868,6 @@ public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPa */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java index 5fbe6cf73aa..c8857f8cc74 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "4"; + public static final String VISUAL_ID = "Generalization_StereotypeLabel"; /** * @generated @@ -127,7 +129,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -160,12 +165,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,28 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + GeneralizationAppliedStereotypeEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +355,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +374,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Generalization_4003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Generalization_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +384,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +416,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +425,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +437,58 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +510,13 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +547,20 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +568,15 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +585,9 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +596,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +617,11 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +647,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -655,7 +684,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -677,12 +706,15 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -693,10 +725,13 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -715,12 +750,15 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -739,30 +777,34 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java index 03038347cc6..c6348744709 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java @@ -30,7 +30,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements /** * @generated */ - public static final String VISUAL_ID = "4003"; + public static final String VISUAL_ID = "Generalization_Edge"; /** * @generated @@ -46,7 +46,8 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); } @@ -54,8 +55,9 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof GeneralizationAppliedStereotypeEditPart) { - ((GeneralizationAppliedStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); + if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) { + ((GeneralizationAppliedStereotypeEditPart) childEditPart) + .setLabel(getPrimaryShape().getAppliedStereotypeLabel()); } return false; } @@ -65,7 +67,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -75,7 +77,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof GeneralizationAppliedStereotypeEditPart) { + if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) { return true; } return false; @@ -86,7 +88,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -110,6 +112,6 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements */ @Override public GeneralizationFigure getPrimaryShape() { - return (GeneralizationFigure)getFigure(); + return (GeneralizationFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java index a0e2cc13682..6093902759d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java @@ -28,7 +28,7 @@ public class LinkDescriptorEditPart extends ConnectionEditPart implements ITreeB /** * @generated */ - public static final String VISUAL_ID = "4005"; + public static final String VISUAL_ID = "Link_DescriptorEdge"; /** * @generated @@ -65,6 +65,6 @@ public class LinkDescriptorEditPart extends ConnectionEditPart implements ITreeB */ @Override public SimpleDashedEdgeFigure getPrimaryShape() { - return (SimpleDashedEdgeFigure)getFigure(); + return (SimpleDashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java index eead68b7913..46957a6063f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "11"; + public static final String VISUAL_ID = "Manifestation_StereotypeLabel"; /** * @generated @@ -127,7 +129,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID), + new Point(0, 30)); } /** @@ -160,12 +165,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,28 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + ManifestationAppliedStereotypeEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +355,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +374,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Manifestation_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +384,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +416,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +425,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +437,58 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +510,13 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +547,20 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +568,15 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +585,9 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +596,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +617,11 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +633,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +647,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +673,14 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +692,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +714,15 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +733,13 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +758,15 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +785,34 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java index 192be56707e..ef9b6fdedd7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java @@ -30,7 +30,7 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements /** * @generated */ - public static final String VISUAL_ID = "4002"; + public static final String VISUAL_ID = "Manifestation_Edge"; /** * @generated @@ -46,7 +46,8 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeLinkLabelDisplayEditPolicy()); installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); } @@ -54,11 +55,12 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ManifestationNameEditPart) { - ((ManifestationNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ManifestationNameEditPart) { + ((ManifestationNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); } - if(childEditPart instanceof ManifestationAppliedStereotypeEditPart) { - ((ManifestationAppliedStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); + if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) { + ((ManifestationAppliedStereotypeEditPart) childEditPart) + .setLabel(getPrimaryShape().getAppliedStereotypeLabel()); } return false; } @@ -68,7 +70,7 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -78,10 +80,10 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ManifestationNameEditPart) { + if (childEditPart instanceof ManifestationNameEditPart) { return true; } - if(childEditPart instanceof ManifestationAppliedStereotypeEditPart) { + if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) { return true; } return false; @@ -92,7 +94,7 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -116,6 +118,6 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements */ @Override public DashedEdgeFigure getPrimaryShape() { - return (DashedEdgeFigure)getFigure(); + return (DashedEdgeFigure) getFigure(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java index 37cdbe1c569..759a5f3f2da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java @@ -62,6 +62,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ManifestationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { +public class ManifestationNameEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider { /** * @generated */ - public static final String VISUAL_ID = "10"; + public static final String VISUAL_ID = "Manifestation_NameLabel"; /** * @generated @@ -127,7 +129,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID), new Point(0, 60)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID), + new Point(0, 60)); } /** @@ -160,12 +165,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -173,12 +178,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -186,12 +191,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -199,12 +204,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -263,10 +268,11 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -279,12 +285,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -293,10 +299,11 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -315,22 +322,25 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ManifestationNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -342,10 +352,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -361,8 +371,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Manifestation_Edge, getParserElement(), this, VISUAL_ID); } return parser; } @@ -371,8 +381,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -401,8 +413,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -410,8 +422,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -422,46 +434,58 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -483,12 +507,13 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -519,20 +544,20 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -540,15 +565,15 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -557,9 +582,9 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -568,9 +593,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -588,11 +614,11 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -604,8 +630,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -618,7 +644,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -644,13 +670,14 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -662,7 +689,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -684,12 +711,15 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -700,10 +730,13 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -722,12 +755,15 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -746,30 +782,34 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } + super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java index d2ff87126de..59988ea5c52 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java @@ -49,7 +49,7 @@ public class ModelEditPart extends PackageEditPart { /** * @generated */ - public static final String VISUAL_ID = "2010"; + public static final String VISUAL_ID = "Model_Shape"; /** * @generated @@ -75,10 +75,14 @@ public class ModelEditPart extends PackageEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -95,7 +99,7 @@ public class ModelEditPart extends PackageEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -122,6 +126,7 @@ public class ModelEditPart extends PackageEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -139,23 +144,25 @@ public class ModelEditPart extends PackageEditPart { */ @Override public PackageFigure getPrimaryShape() { - return (PackageFigure)primaryShape; + return (PackageFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ModelNameEditPart) { - ((ModelNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ModelNameEditPart) { + ((ModelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ModelPackageableElementCompartmentEditPart) { + + if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ModelPackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.add(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -163,12 +170,12 @@ public class ModelEditPart extends PackageEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ModelNameEditPart) { + if (childEditPart instanceof ModelNameEditPart) { return true; } - if(childEditPart instanceof ModelPackageableElementCompartmentEditPart) { + if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); - pane.remove(((ModelPackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -179,7 +186,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -190,7 +197,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -201,7 +208,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ModelPackageableElementCompartmentEditPart) { + if (editPart instanceof ModelPackageableElementCompartmentEditPart) { return getPrimaryShape().getPackageableElementFigure(); } return getContentPane(); @@ -227,6 +234,7 @@ public class ModelEditPart extends PackageEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -239,7 +247,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -252,7 +260,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -263,7 +271,7 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -281,8 +289,8 @@ public class ModelEditPart extends PackageEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java index 47c9b62f17c..c585817ef62 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java @@ -49,7 +49,7 @@ public class ModelEditPartCN extends PackageEditPart { /** * @generated */ - public static final String VISUAL_ID = "49"; + public static final String VISUAL_ID = "Model_Shape_CN"; /** * @generated @@ -75,10 +75,14 @@ public class ModelEditPartCN extends PackageEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -95,7 +99,7 @@ public class ModelEditPartCN extends PackageEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -122,6 +126,7 @@ public class ModelEditPartCN extends PackageEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -139,23 +144,25 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override public PackageFigure getPrimaryShape() { - return (PackageFigure)primaryShape; + return (PackageFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ModelNameEditPartCN) { - ((ModelNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof ModelNameEditPartCN) { + ((ModelNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) { + + if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ModelPackageableElementCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -163,12 +170,12 @@ public class ModelEditPartCN extends PackageEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof ModelNameEditPartCN) { + if (childEditPart instanceof ModelNameEditPartCN) { return true; } - if(childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) { + if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); - pane.remove(((ModelPackageableElementCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -179,7 +186,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -190,7 +197,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -201,7 +208,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ModelPackageableElementCompartmentEditPartCN) { + if (editPart instanceof ModelPackageableElementCompartmentEditPartCN) { return getPrimaryShape().getPackageableElementFigure(); } return getContentPane(); @@ -227,6 +234,7 @@ public class ModelEditPartCN extends PackageEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -239,7 +247,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -252,7 +260,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -263,7 +271,7 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -281,8 +289,8 @@ public class ModelEditPartCN extends PackageEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java index 7efcb381eb7..6731681e85e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -85,12 +86,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ModelNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "48"; + public static final String VISUAL_ID = "Model_NameLabel"; /** * @generated @@ -148,12 +150,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -161,12 +163,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -174,12 +176,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -187,12 +189,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -243,12 +245,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); - if(parserElement == null) { + if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for(View view : views) { - if(AppearanceHelper.showElementIcon(view)) { + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } @@ -261,10 +263,11 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -277,12 +280,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -291,10 +294,11 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -313,22 +317,26 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), ModelNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -340,10 +348,10 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -359,8 +367,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Model_2010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Model_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -369,8 +377,10 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -399,8 +409,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -408,8 +418,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -420,46 +430,58 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -481,12 +503,13 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -517,12 +540,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -531,12 +554,12 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +567,15 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +584,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -572,9 +595,10 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -592,11 +616,11 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -608,8 +632,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -622,7 +646,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -648,13 +672,14 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -666,7 +691,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -688,12 +713,15 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -704,10 +732,13 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -726,12 +757,15 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -769,31 +803,35 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } - if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) { + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON + .equals(((EAnnotation) event.getNewValue()).getSource())) { refreshLabel(); } super.handleNotificationEvent(event); @@ -826,7 +864,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -836,6 +875,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -843,5 +883,6 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java index f1e51b7a424..30ec827e4fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -85,12 +86,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class ModelNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "50"; + public static final String VISUAL_ID = "Model_NameLabel_CN"; /** * @generated @@ -148,12 +150,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -161,12 +163,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -174,12 +176,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -187,12 +189,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -243,12 +245,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); - if(parserElement == null) { + if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for(View view : views) { - if(AppearanceHelper.showElementIcon(view)) { + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } @@ -261,10 +263,11 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -277,12 +280,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -291,10 +294,11 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -313,22 +317,25 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), ModelNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -340,10 +347,10 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -359,8 +366,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Model_49, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Model_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -369,8 +376,10 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -399,8 +408,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -408,8 +417,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -420,46 +429,58 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -481,12 +502,13 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -517,12 +539,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -531,12 +553,12 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +566,15 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +583,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -572,9 +594,10 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -592,11 +615,11 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -608,8 +631,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -622,7 +645,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -648,13 +671,14 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -666,7 +690,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -688,12 +712,15 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -704,10 +731,13 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -726,12 +756,15 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -769,31 +802,35 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } - if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) { + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON + .equals(((EAnnotation) event.getNewValue()).getSource())) { refreshLabel(); } super.handleNotificationEvent(event); @@ -826,7 +863,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -836,6 +874,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -843,5 +882,6 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java index 9de50b4046f..75aae6a45b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java @@ -41,7 +41,7 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa /** * @generated */ - public static final String VISUAL_ID = "51"; + public static final String VISUAL_ID = "Model_PackagedElementCompartment"; /** * @generated @@ -70,6 +70,7 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -80,7 +81,7 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class ModelPackageableElementCompartmentEditPart extends LinkLFShapeCompa * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java index 0b094521b6e..bd9068e4d59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java @@ -41,7 +41,7 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom /** * @generated */ - public static final String VISUAL_ID = "52"; + public static final String VISUAL_ID = "Model_PackagedElementCompartment_CN"; /** * @generated @@ -70,6 +70,7 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -80,7 +81,7 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class ModelPackageableElementCompartmentEditPartCN extends LinkLFShapeCom * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java index 1934a1352a1..c9eee85d960 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java @@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -83,12 +84,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { +public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { /** * @generated */ - public static final String VISUAL_ID = "7"; + public static final String VISUAL_ID = "Dependency_MultiNameLabel"; /** * @generated @@ -127,7 +129,10 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ static { - registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID), new Point(0, 0)); + registerSnapBackPosition( + UMLVisualIDRegistry.getType( + org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID), + new Point(0, 0)); } /** @@ -154,9 +159,9 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement @Override public IBorderItemLocator getBorderItemLocator() { IFigure parentFigure = getFigure().getParent(); - if(parentFigure != null && parentFigure.getLayoutManager() != null) { + if (parentFigure != null && parentFigure.getLayoutManager() != null) { Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator)constraint; + return (IBorderItemLocator) constraint; } return null; } @@ -166,10 +171,10 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override public void refreshBounds() { - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); } @@ -177,12 +182,12 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -190,12 +195,12 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -203,12 +208,12 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -216,12 +221,12 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -279,10 +284,11 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -295,12 +301,12 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -309,10 +315,11 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -331,22 +338,26 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult( + parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), + MultiDependencyLabelEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -358,10 +369,10 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -377,8 +388,8 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_2011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Dependency_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -387,8 +398,10 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -417,8 +430,8 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -426,8 +439,8 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -438,46 +451,58 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -499,12 +524,13 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -535,20 +561,20 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -556,15 +582,15 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -573,9 +599,9 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -584,9 +610,10 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -604,11 +631,11 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -620,8 +647,8 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -634,7 +661,7 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -660,13 +687,14 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -678,7 +706,7 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -700,12 +728,15 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -716,10 +747,13 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -738,12 +772,15 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -762,24 +799,27 @@ public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implement @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java index c0bbfe8cccd..b5a70958eab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "41"; + public static final String VISUAL_ID = "Artifact_NameLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), NestedArtifactNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_40, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Artifact_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart imple */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java index a842c6522e8..7e31cc13c5c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java @@ -50,7 +50,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { /** * @generated */ - public static final String VISUAL_ID = "40"; + public static final String VISUAL_ID = "Artifact_Shape_CN"; /** * @generated @@ -76,13 +76,18 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies @@ -98,7 +103,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -132,17 +137,18 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override public ArtifactFigure getPrimaryShape() { - return (ArtifactFigure)primaryShape; + return (ArtifactFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedArtifactNameEditPart) { - ((NestedArtifactNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NestedArtifactNameEditPart) { + ((NestedArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -150,7 +156,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedArtifactNameEditPart) { + if (childEditPart instanceof NestedArtifactNameEditPart) { return true; } return false; @@ -161,7 +167,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -172,7 +178,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -206,6 +212,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -218,7 +225,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -231,7 +238,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -242,7 +249,7 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -260,8 +267,8 @@ public class NestedArtifactNodeEditPartCN extends NodeEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java index d292db19f38..5f02d9ecd21 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java @@ -51,7 +51,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { /** * @generated */ - public static final String VISUAL_ID = "44"; + public static final String VISUAL_ID = "Device_Shape_CN"; /** * @generated @@ -77,13 +77,18 @@ public class NestedDeviceEditPartCN extends NodeEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -100,7 +105,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -134,23 +139,25 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override public DeviceFigure getPrimaryShape() { - return (DeviceFigure)primaryShape; + return (DeviceFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedDeviceNameEditPartCN) { - ((NestedDeviceNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NestedDeviceNameEditPartCN) { + ((NestedDeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof DeviceCompositeCompartmentEditPartCN) { + + if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((DeviceCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -158,12 +165,12 @@ public class NestedDeviceEditPartCN extends NodeEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedDeviceNameEditPartCN) { + if (childEditPart instanceof NestedDeviceNameEditPartCN) { return true; } - if(childEditPart instanceof DeviceCompositeCompartmentEditPartCN) { + if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((DeviceCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -174,7 +181,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -185,7 +192,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -196,7 +203,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof DeviceCompositeCompartmentEditPartCN) { + if (editPart instanceof DeviceCompositeCompartmentEditPartCN) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -222,6 +229,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -234,7 +242,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -247,7 +255,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -258,7 +266,7 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -276,8 +284,8 @@ public class NestedDeviceEditPartCN extends NodeEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java index a86b20b888c..4a43aedd272 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "45"; + public static final String VISUAL_ID = "Device_NameLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), NestedDeviceNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Device_44, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Device_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart imple */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java index 478dc5312db..5fddf4bd8e5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java @@ -51,7 +51,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { /** * @generated */ - public static final String VISUAL_ID = "46"; + public static final String VISUAL_ID = "ExecutionEnvironment_Shape_CN"; /** * @generated @@ -77,13 +77,18 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -100,7 +105,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -134,23 +139,25 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override public ExecutionEnvironmentFigure getPrimaryShape() { - return (ExecutionEnvironmentFigure)primaryShape; + return (ExecutionEnvironmentFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) { - ((NestedExecutionEnvironmentNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) { + ((NestedExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { + + if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((ExecutionEnvironmentCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -158,12 +165,12 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) { + if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) { return true; } - if(childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { + if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -174,7 +181,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -185,7 +192,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -196,7 +203,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { + if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -222,6 +229,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -234,7 +242,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -247,7 +255,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -258,7 +266,7 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -276,8 +284,8 @@ public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java index e0bf3326168..03bfb38fa3c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "47"; + public static final String VISUAL_ID = "ExecutionEnvironment_NameLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,27 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), + NestedExecutionEnvironmentNameEditPartCN.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +335,10 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +354,9 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_46, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.ExecutionEnvironment_Shape_CN, getParserElement(), this, + VISUAL_ID); } return parser; } @@ -355,8 +365,10 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +397,8 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +406,8 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +418,58 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +491,13 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +528,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +542,12 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +555,15 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +572,9 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +583,10 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +604,11 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +620,8 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +634,7 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +660,14 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +679,7 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +701,15 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +720,13 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +745,15 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +791,27 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +848,8 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +859,7 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +867,6 @@ public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartment */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java index 388e8062db9..ad0db63d124 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java @@ -50,7 +50,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { /** * @generated */ - public static final String VISUAL_ID = "42"; + public static final String VISUAL_ID = "Node_Shape_CN"; /** * @generated @@ -76,13 +76,18 @@ public class NestedNodeEditPartCN extends NodeEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -99,7 +104,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -133,23 +138,25 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override public NodeFigure getPrimaryShape() { - return (NodeFigure)primaryShape; + return (NodeFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedNodeNameEditPart) { - ((NestedNodeNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NestedNodeNameEditPart) { + ((NestedNodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof NodeCompositeCompartmentEditPartCN) { + + if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((NodeCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -157,12 +164,12 @@ public class NestedNodeEditPartCN extends NodeEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NestedNodeNameEditPart) { + if (childEditPart instanceof NestedNodeNameEditPart) { return true; } - if(childEditPart instanceof NodeCompositeCompartmentEditPartCN) { + if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((NodeCompositeCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -173,7 +180,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -184,7 +191,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -195,7 +202,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof NodeCompositeCompartmentEditPartCN) { + if (editPart instanceof NodeCompositeCompartmentEditPartCN) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -221,6 +228,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { @Override protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -233,7 +241,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -246,7 +254,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -257,7 +265,7 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -275,8 +283,8 @@ public class NestedNodeEditPartCN extends NodeEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java index c51a5e3ee3e..b3a6d2e5dde 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "43"; + public static final String VISUAL_ID = "Node_NameLabel_CN"; /** * @generated @@ -144,12 +146,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), NestedNodeNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Node_42, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Node_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implement */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java index e58c83eecba..a5afcadbaba 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java @@ -40,7 +40,7 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit /** * @generated */ - public static final String VISUAL_ID = "19"; + public static final String VISUAL_ID = "Node_NestedNodeCompartment"; /** * @generated @@ -69,6 +69,7 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -78,7 +79,7 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -88,6 +89,7 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -97,7 +99,10 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -107,13 +112,13 @@ public class NodeCompositeCompartmentEditPart extends LinkLFShapeCompartmentEdit * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java index aa473e33704..0a5cecc28b1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java @@ -41,7 +41,7 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd /** * @generated */ - public static final String VISUAL_ID = "32"; + public static final String VISUAL_ID = "Node_NestedNodeCompartment_CN"; /** * @generated @@ -71,6 +71,7 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); } @@ -80,7 +81,7 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class NodeCompositeCompartmentEditPartCN extends LinkLFShapeCompartmentEd * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java index 9b8f3765ddd..79bf6263923 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java @@ -51,7 +51,7 @@ public class NodeEditPart extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "2008"; + public static final String VISUAL_ID = "Node_Shape"; /** * @generated @@ -77,13 +77,18 @@ public class NodeEditPart extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -100,7 +105,7 @@ public class NodeEditPart extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -127,6 +132,7 @@ public class NodeEditPart extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -144,23 +150,25 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override public NodeFigure getPrimaryShape() { - return (NodeFigure)primaryShape; + return (NodeFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NodeNameEditPart) { - ((NodeNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NodeNameEditPart) { + ((NodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof NodeCompositeCompartmentEditPart) { + + if (childEditPart instanceof NodeCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((NodeCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.add(((NodeCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -168,12 +176,12 @@ public class NodeEditPart extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NodeNameEditPart) { + if (childEditPart instanceof NodeNameEditPart) { return true; } - if(childEditPart instanceof NodeCompositeCompartmentEditPart) { + if (childEditPart instanceof NodeCompositeCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompositeCompartmentFigure(); - pane.remove(((NodeCompositeCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((NodeCompositeCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -184,7 +192,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -195,7 +203,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -206,7 +214,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof NodeCompositeCompartmentEditPart) { + if (editPart instanceof NodeCompositeCompartmentEditPart) { return getPrimaryShape().getCompositeCompartmentFigure(); } return getContentPane(); @@ -232,6 +240,7 @@ public class NodeEditPart extends NamedElementEditPart { @Override protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -244,7 +253,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -257,7 +266,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -268,7 +277,7 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -286,8 +295,8 @@ public class NodeEditPart extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java index 793d44dabf8..983bccaf937 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java @@ -51,7 +51,7 @@ public class NodeEditPartCN extends NamedElementEditPart { /** * @generated */ - public static final String VISUAL_ID = "23"; + public static final String VISUAL_ID = "Node_Shape_CCN"; /** * @generated @@ -77,13 +77,18 @@ public class NodeEditPartCN extends NamedElementEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); + installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, + new ShowHideClassifierContentsEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -100,7 +105,7 @@ public class NodeEditPartCN extends NamedElementEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -127,6 +132,7 @@ public class NodeEditPartCN extends NamedElementEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -144,17 +150,18 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override public NodeFigure getPrimaryShape() { - return (NodeFigure)primaryShape; + return (NodeFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NodeNameEditPartCN) { - ((NodeNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof NodeNameEditPartCN) { + ((NodeNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } + return false; } @@ -162,7 +169,7 @@ public class NodeEditPartCN extends NamedElementEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof NodeNameEditPartCN) { + if (childEditPart instanceof NodeNameEditPartCN) { return true; } return false; @@ -173,7 +180,7 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -184,7 +191,7 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -218,6 +225,7 @@ public class NodeEditPartCN extends NamedElementEditPart { @Override protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -230,7 +238,7 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -243,7 +251,7 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -254,7 +262,7 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -272,8 +280,8 @@ public class NodeEditPartCN extends NamedElementEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java index 2560dfb2d8b..57803c95f17 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NodeNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "9"; + public static final String VISUAL_ID = "Node_NameLabel"; /** * @generated @@ -144,12 +146,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,26 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString( + ParserUtil.getParserAdapter(getParserElement(), NodeNameEditPart.this), + (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +334,10 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +353,8 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Node_2008, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Node_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +363,10 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +395,8 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +404,8 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +416,58 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +489,13 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +526,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +540,12 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +553,15 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +570,9 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +581,10 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +602,11 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +618,8 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +632,7 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +658,14 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +677,7 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +699,15 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +718,13 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +743,15 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +789,27 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +846,8 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +857,7 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +865,6 @@ public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITex */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java index e840ac1c719..e2ec1283e70 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java @@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -81,12 +82,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class NodeNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "24"; + public static final String VISUAL_ID = "Node_NameLabel_CCN"; /** * @generated @@ -144,12 +146,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -157,12 +159,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -170,12 +172,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -183,12 +185,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -247,10 +249,11 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -263,12 +266,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -277,10 +280,11 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -299,22 +303,25 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), NodeNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -326,10 +333,10 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -345,8 +352,8 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Node_23, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Node_Shape_CCN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -355,8 +362,10 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -385,8 +394,8 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -394,8 +403,8 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -406,46 +415,58 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -467,12 +488,13 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -503,12 +525,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -517,12 +539,12 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -530,15 +552,15 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -547,9 +569,9 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -558,9 +580,10 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -578,11 +601,11 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -594,8 +617,8 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -608,7 +631,7 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -634,13 +657,14 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -652,7 +676,7 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -674,12 +698,15 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -690,10 +717,13 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -712,12 +742,15 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -755,24 +788,27 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); @@ -809,7 +845,8 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -819,6 +856,7 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -826,5 +864,6 @@ public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements IT */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java index a74e208c796..13a7268c692 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java @@ -48,7 +48,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit /** * @generated */ - public static final String VISUAL_ID = "2009"; + public static final String VISUAL_ID = "Package_Shape"; /** * @generated @@ -74,10 +74,14 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -94,7 +98,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -121,6 +125,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -138,23 +143,25 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override public PackageFigure getPrimaryShape() { - return (PackageFigure)primaryShape; + return (PackageFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPart) { - ((PackageNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof PackageNameEditPart) { + ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPart) { + + if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((PackagePackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.add(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -162,12 +169,12 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPart) { + if (childEditPart instanceof PackageNameEditPart) { return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPart) { + if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); - pane.remove(((PackagePackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -178,7 +185,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -189,7 +196,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -200,7 +207,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof PackagePackageableElementCompartmentEditPart) { + if (editPart instanceof PackagePackageableElementCompartmentEditPart) { return getPrimaryShape().getPackageableElementFigure(); } return getContentPane(); @@ -226,6 +233,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -238,7 +246,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -251,7 +259,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -262,7 +270,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -280,8 +288,8 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java index 94382074e45..5ab8adcc18a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java @@ -49,7 +49,7 @@ public class PackageEditPartCN extends PackageEditPart { /** * @generated */ - public static final String VISUAL_ID = "36"; + public static final String VISUAL_ID = "Package_Shape_CN"; /** * @generated @@ -75,10 +75,14 @@ public class PackageEditPartCN extends PackageEditPart { protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -95,7 +99,7 @@ public class PackageEditPartCN extends PackageEditPart { @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -122,6 +126,7 @@ public class PackageEditPartCN extends PackageEditPart { @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -139,23 +144,25 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override public PackageFigure getPrimaryShape() { - return (PackageFigure)primaryShape; + return (PackageFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPartCN) { - ((PackageNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof PackageNameEditPartCN) { + ((PackageNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) { + + if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((PackagePackageableElementCompartmentEditPartCN)childEditPart).getFigure()); + pane.add(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure()); return true; } + return false; } @@ -163,12 +170,12 @@ public class PackageEditPartCN extends PackageEditPart { * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPartCN) { + if (childEditPart instanceof PackageNameEditPartCN) { return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) { + if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); - pane.remove(((PackagePackageableElementCompartmentEditPartCN)childEditPart).getFigure()); + pane.remove(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure()); return true; } return false; @@ -179,7 +186,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -190,7 +197,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -201,7 +208,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof PackagePackageableElementCompartmentEditPartCN) { + if (editPart instanceof PackagePackageableElementCompartmentEditPartCN) { return getPrimaryShape().getPackageableElementFigure(); } return getContentPane(); @@ -227,6 +234,7 @@ public class PackageEditPartCN extends PackageEditPart { @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -239,7 +247,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -252,7 +260,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -263,7 +271,7 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -281,8 +289,8 @@ public class PackageEditPartCN extends PackageEditPart { */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java index d4feb88bce8..6dc72a7dbe6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -85,12 +86,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class PackageNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class PackageNameEditPart extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "35"; + public static final String VISUAL_ID = "Package_NameLabel"; /** * @generated @@ -148,12 +150,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -161,12 +163,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -174,12 +176,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -187,12 +189,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -243,12 +245,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); - if(parserElement == null) { + if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for(View view : views) { - if(AppearanceHelper.showElementIcon(view)) { + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } @@ -261,10 +263,11 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -277,12 +280,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -291,10 +294,11 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -313,22 +317,25 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), PackageNameEditPart.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -340,10 +347,10 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -359,8 +366,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Package_2009, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Package_Shape, getParserElement(), this, VISUAL_ID); } return parser; } @@ -369,8 +376,10 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -399,8 +408,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -408,8 +417,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -420,46 +429,58 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -481,12 +502,13 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -517,12 +539,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -531,12 +553,12 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +566,15 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +583,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -572,9 +594,10 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -592,11 +615,11 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -608,8 +631,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -622,7 +645,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -648,13 +671,14 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -666,7 +690,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -688,12 +712,15 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -704,10 +731,13 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -726,12 +756,15 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -769,31 +802,35 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } - if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) { + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON + .equals(((EAnnotation) event.getNewValue()).getSource())) { refreshLabel(); } super.handleNotificationEvent(event); @@ -826,7 +863,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -836,6 +874,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -843,5 +882,6 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java index 21ca07b4f34..cd9afb68eaf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirect import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; @@ -85,12 +86,13 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { +public class PackageNameEditPartCN extends PapyrusCompartmentEditPart + implements ITextAwareEditPart, IControlParserForDirectEdit { /** * @generated */ - public static final String VISUAL_ID = "37"; + public static final String VISUAL_ID = "Package_NameLabel_CN"; /** * @generated @@ -148,12 +150,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected String getLabelTextHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getText(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getText(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); } else { - return ((Label)figure).getText(); + return ((Label) figure).getText(); } } @@ -161,12 +163,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setText(text); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setText(text); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); } else { - ((Label)figure).setText(text); + ((Label) figure).setText(text); } } @@ -174,12 +176,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected Image getLabelIconHelper(IFigure figure) { - if(figure instanceof WrappingLabel) { - return ((WrappingLabel)figure).getIcon(); - } else if(figure instanceof ILabelFigure) { - return ((ILabelFigure)figure).getIcon(); + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); } else { - return ((Label)figure).getIcon(); + return ((Label) figure).getIcon(); } } @@ -187,12 +189,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { - if(figure instanceof WrappingLabel) { - ((WrappingLabel)figure).setIcon(icon); - } else if(figure instanceof ILabelFigure) { - ((ILabelFigure)figure).setIcon(icon); + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); } else { - ((Label)figure).setIcon(icon); + ((Label) figure).setIcon(icon); } } @@ -243,12 +245,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); - if(parserElement == null) { + if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for(View view : views) { - if(AppearanceHelper.showElementIcon(view)) { + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } @@ -261,10 +263,11 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); - if(parserElement != null && getParser() != null) { - text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } - if(text == null || text.length() == 0) { + if (text == null || text.length() == 0) { text = defaultText; } return text; @@ -277,12 +280,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -291,10 +294,11 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public String getEditText() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); + return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + getParserOptions().intValue()); } /** @@ -313,22 +317,25 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements @Override public String isValid(final Object value) { - if(value instanceof String) { + if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value)); - } - }); + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(ParserUtil.getParserAdapter( + getParserElement(), PackageNameEditPartCN.this), (String) value)); + } + }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } + // shouldn't get here return null; } @@ -340,10 +347,10 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IContentAssistProcessor getCompletionProcessor() { - if(getParserElement() == null || getParser() == null) { + if (getParserElement() == null || getParser() == null) { return null; } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); } /** @@ -359,8 +366,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override public IParser getParser() { - if(parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Package_36, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN.VISUAL_ID)); + if (parser == null) { + parser = ParserUtil.getParser(UMLElementTypes.Package_Shape_CN, getParserElement(), this, VISUAL_ID); } return parser; } @@ -369,8 +376,10 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected DirectEditManager getManager() { - if(manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); } return manager; } @@ -399,8 +408,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(Point eventLocation) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint()); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); } } @@ -408,8 +417,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void performDirectEdit(char initialCharacter) { - if(getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager)getManager()).show(initialCharacter); + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } @@ -420,46 +429,58 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void performDirectEditRequest(Request request) { + final Request theRequest = request; - if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { directEditionMode = getDirectEditionType(); } - switch(directEditionMode) { + switch (directEditionMode) { case IDirectEdition.NO_DIRECT_EDITION: // no direct edition mode => does nothing return; case IDirectEdition.EXTENDED_DIRECT_EDITOR: updateExtendedEditorConfiguration(); - if(configuration == null || configuration.getLanguage() == null) { + if (configuration == null || configuration.getLanguage() == null) { // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); Dialog dialog = null; - if(configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this)); + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); initializeDirectEditManager(theRequest); return; - } else if(configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this); + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) + .createPopupEditorHelper(this); helper.showEditor(); return; - } else if(configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), + configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } final Dialog finalDialog = dialog; - if(Window.OK == dialog.open()) { + + if (Window.OK == dialog.open()) { TransactionalEditingDomain domain = getEditingDomain(); RecordingCommand command = new RecordingCommand(domain, "Edit Label") { @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), + ((ILabelEditorDialog) finalDialog).getValue()); + } }; domain.getCommandStack().execute(command); @@ -481,12 +502,13 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - @Override public void run() { - if(isActive() && isEditable()) { - if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -517,12 +539,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ protected void refreshLabel() { EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy == null) { + if (maskLabelPolicy == null) { maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); } - if(maskLabelPolicy == null) { - View view = (View)getModel(); - if(view.isVisible()) { + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); } else { @@ -531,12 +553,12 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements } } Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } @@ -544,15 +566,15 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } - if(resolveSemanticElement() instanceof Feature) { - if(((Feature)resolveSemanticElement()).isStatic()) { - ((WrappingLabel)getFigure()).setTextUnderline(true); + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); } else { - ((WrappingLabel)getFigure()).setTextUnderline(false); + ((WrappingLabel) getFigure()).setTextUnderline(false); } } } @@ -561,9 +583,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } } @@ -572,9 +594,10 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void refreshFont() { - FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if(style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -592,11 +615,11 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void addSemanticListeners() { - if(getParser() instanceof ISemanticParser) { + if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element); - for(int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$ + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); @@ -608,8 +631,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected void removeSemanticListeners() { - if(parserElements != null) { - for(int i = 0; i < parserElements.size(); i++) { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { @@ -622,7 +645,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ @Override protected AccessibleEditPart getAccessibleEditPart() { - if(accessibleEP == null) { + if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @Override @@ -648,13 +671,14 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ public int getDirectEditionType() { - if(checkExtendedEditor()) { + if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return IDirectEdition.EXTENDED_DIRECT_EDITOR; } - if(checkDefaultEdition()) { + if (checkDefaultEdition()) { return IDirectEdition.DEFAULT_DIRECT_EDITOR; } + // not a named element. no specific editor => do nothing return IDirectEdition.NO_DIRECT_EDITION; } @@ -666,7 +690,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected boolean checkExtendedEditor() { - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); } return false; @@ -688,12 +712,15 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void initExtendedEditorConfiguration() { - if(configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, + resolveSemanticElement(), this); } } } @@ -704,10 +731,13 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") + && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), + this); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } @@ -726,12 +756,15 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements @Override public void run() { - if(isActive() && isEditable()) { - if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (isActive() && isEditable()) { + if (theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest)theRequest; + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); @@ -769,31 +802,35 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements protected void handleNotificationEvent(Notification event) { refreshLabel(); Object feature = event.getFeature(); - if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer)event.getNewValue(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { refreshUnderline(); - } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { - if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } - if(getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser)getParser(); - if(modelParser.areSemanticElementsAffected(null, event)) { + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); - if(resolveSemanticElement() != null) { + if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } - if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) { + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON + .equals(((EAnnotation) event.getNewValue()).getSource())) { refreshLabel(); } super.handleNotificationEvent(event); @@ -826,7 +863,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements * @generated */ protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + } /** @@ -836,6 +874,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements public void deactivate() { removeOwnerElementListeners(); super.deactivate(); + } /** @@ -843,5 +882,6 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements */ protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java index 4e5180346bb..ba37b9a74e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java @@ -41,7 +41,7 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom /** * @generated */ - public static final String VISUAL_ID = "38"; + public static final String VISUAL_ID = "Package_PackagedElementCompartment"; /** * @generated @@ -70,6 +70,7 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -80,7 +81,7 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class PackagePackageableElementCompartmentEditPart extends LinkLFShapeCom * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java index 7738572f2d8..9de61947d9a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java @@ -41,7 +41,7 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC /** * @generated */ - public static final String VISUAL_ID = "39"; + public static final String VISUAL_ID = "Package_PackagedElementCompartment_CN"; /** * @generated @@ -70,6 +70,7 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); //in Papyrus diagrams are not strongly synchronised //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicyCN()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy()); @@ -80,7 +81,7 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC */ @Override protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -90,6 +91,7 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC */ @Override public EditPart getTargetEditPart(Request request) { + return super.getTargetEditPart(request); } @@ -99,7 +101,10 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC @Override protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) + || NotationPackage.eINSTANCE.getSize_Height().equals(feature) + || NotationPackage.eINSTANCE.getLocation_X().equals(feature) + || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -109,13 +114,13 @@ public class PackagePackageableElementCompartmentEditPartCN extends LinkLFShapeC * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java index fe5e571f7e5..12d885bf811 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java @@ -35,199 +35,295 @@ public class UMLEditPartFactory implements EditPartFactory { */ @Override public EditPart createEditPart(EditPart context, Object model) { - if(model instanceof View) { - View view = (View)model; - switch(UMLVisualIDRegistry.getVisualID(view)) { + if (model instanceof View) { + View view = (View) model; + switch (UMLVisualIDRegistry.getVisualID(view)) { + case DeploymentDiagramEditPart.VISUAL_ID: return new DeploymentDiagramEditPart(view); + case DependencyNodeEditPart.VISUAL_ID: return new DependencyNodeEditPart(view); + case MultiDependencyLabelEditPart.VISUAL_ID: return new MultiDependencyLabelEditPart(view); + case ModelEditPart.VISUAL_ID: return new ModelEditPart(view); + case ModelNameEditPart.VISUAL_ID: return new ModelNameEditPart(view); + case PackageEditPart.VISUAL_ID: return new PackageEditPart(view); + case PackageNameEditPart.VISUAL_ID: return new PackageNameEditPart(view); + case ConstraintEditPart.VISUAL_ID: return new ConstraintEditPart(view); + case ConstraintNameEditPart.VISUAL_ID: return new ConstraintNameEditPart(view); + case ConstraintSpecificationEditPart.VISUAL_ID: return new ConstraintSpecificationEditPart(view); + case CommentEditPart.VISUAL_ID: return new CommentEditPart(view); + case CommentBodyEditPart.VISUAL_ID: return new CommentBodyEditPart(view); + case ExecutionEnvironmentEditPart.VISUAL_ID: return new ExecutionEnvironmentEditPart(view); + case ExecutionEnvironmentNameEditPart.VISUAL_ID: return new ExecutionEnvironmentNameEditPart(view); + case DeviceEditPart.VISUAL_ID: return new DeviceEditPart(view); + case DeviceNameEditPart.VISUAL_ID: return new DeviceNameEditPart(view); + case ArtifactEditPart.VISUAL_ID: return new ArtifactEditPart(view); + case ArtifactNameEditPart.VISUAL_ID: return new ArtifactNameEditPart(view); + case ArtifactFloatingLabelEditPart.VISUAL_ID: return new ArtifactFloatingLabelEditPart(view); + case NodeEditPart.VISUAL_ID: return new NodeEditPart(view); + case NodeNameEditPart.VISUAL_ID: return new NodeNameEditPart(view); + case DefaultNamedElementEditPart.VISUAL_ID: return new DefaultNamedElementEditPart(view); + case DefaultNamedElementNameEditPart.VISUAL_ID: return new DefaultNamedElementNameEditPart(view); + case DeploymentSpecificationEditPart.VISUAL_ID: return new DeploymentSpecificationEditPart(view); + case DeploymentSpecificationNameEditPart.VISUAL_ID: return new DeploymentSpecificationNameEditPart(view); + case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: return new DeploymentSpecificationFloatingLabelEditPart(view); + case ModelEditPartCN.VISUAL_ID: return new ModelEditPartCN(view); + case ModelNameEditPartCN.VISUAL_ID: return new ModelNameEditPartCN(view); + case PackageEditPartCN.VISUAL_ID: return new PackageEditPartCN(view); + case PackageNameEditPartCN.VISUAL_ID: return new PackageNameEditPartCN(view); + case DeviceEditPartCN.VISUAL_ID: return new DeviceEditPartCN(view); + case DeviceNameEditPartCN.VISUAL_ID: return new DeviceNameEditPartCN(view); + case NestedDeviceEditPartCN.VISUAL_ID: return new NestedDeviceEditPartCN(view); + case NestedDeviceNameEditPartCN.VISUAL_ID: return new NestedDeviceNameEditPartCN(view); + case ExecutionEnvironmentEditPartCN.VISUAL_ID: return new ExecutionEnvironmentEditPartCN(view); + case ExecutionEnvironmentNameEditPartCN.VISUAL_ID: return new ExecutionEnvironmentNameEditPartCN(view); + case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: return new NestedExecutionEnvironmentEditPartCN(view); + case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID: return new NestedExecutionEnvironmentNameEditPartCN(view); + case NodeEditPartCN.VISUAL_ID: return new NodeEditPartCN(view); + case NodeNameEditPartCN.VISUAL_ID: return new NodeNameEditPartCN(view); + case NestedNodeEditPartCN.VISUAL_ID: return new NestedNodeEditPartCN(view); + case NestedNodeNameEditPart.VISUAL_ID: return new NestedNodeNameEditPart(view); + case ArtifactEditPartCN.VISUAL_ID: return new ArtifactEditPartCN(view); + case ArtifactNameEditPartCN.VISUAL_ID: return new ArtifactNameEditPartCN(view); + case ArtifactFloatingLabelEditPartCN.VISUAL_ID: return new ArtifactFloatingLabelEditPartCN(view); + case ArtifactEditPartACN.VISUAL_ID: return new ArtifactEditPartACN(view); + case ArtifactNameEditPartACN.VISUAL_ID: return new ArtifactNameEditPartACN(view); + case ArtifactFloatingLabelEditPartACN.VISUAL_ID: return new ArtifactFloatingLabelEditPartACN(view); + case NestedArtifactNodeEditPartCN.VISUAL_ID: return new NestedArtifactNodeEditPartCN(view); + case NestedArtifactNameEditPart.VISUAL_ID: return new NestedArtifactNameEditPart(view); + case CommentEditPartCN.VISUAL_ID: return new CommentEditPartCN(view); + case CommentBodyEditPartCN.VISUAL_ID: return new CommentBodyEditPartCN(view); + case ConstraintEditPartCN.VISUAL_ID: return new ConstraintEditPartCN(view); + case ConstraintNameEditPartCN.VISUAL_ID: return new ConstraintNameEditPartCN(view); + case ConstraintSpecificationEditPartCN.VISUAL_ID: return new ConstraintSpecificationEditPartCN(view); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: return new DeploymentSpecAsClassifierEditPart(view); + case DeploymentSpecAsClassifierNameEditPart.VISUAL_ID: return new DeploymentSpecAsClassifierNameEditPart(view); + case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: return new DeploymentSpecAsClassifierFloatingLabelEditPart(view); + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: return new DeploymentSpecAsPackageableElEditPart(view); + case DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID: return new DeploymentSpecAsPackageableElNameEditPart(view); + case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: return new DeploymentSpecAsPackageableElFloatingLabelEditPart(view); + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: return new DeploymentSpecAsNestedArtifactEditPart(view); + case DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID: return new DeploymentSpecAsNestedArtifactNameEditPart(view); + case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: return new DeploymentSpecAsNestedArtifactFloatingLabelEditPart(view); + case ModelPackageableElementCompartmentEditPart.VISUAL_ID: return new ModelPackageableElementCompartmentEditPart(view); + case PackagePackageableElementCompartmentEditPart.VISUAL_ID: return new PackagePackageableElementCompartmentEditPart(view); + case DeviceCompositeCompartmentEditPart.VISUAL_ID: return new DeviceCompositeCompartmentEditPart(view); + case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: return new ExecutionEnvironmentCompositeCompartmentEditPart(view); + case NodeCompositeCompartmentEditPart.VISUAL_ID: return new NodeCompositeCompartmentEditPart(view); + case ArtifactCompositeCompartmentEditPart.VISUAL_ID: return new ArtifactCompositeCompartmentEditPart(view); + case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: return new ModelPackageableElementCompartmentEditPartCN(view); + case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: return new PackagePackageableElementCompartmentEditPartCN(view); + case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: return new DeviceCompositeCompartmentEditPartCN(view); + case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: return new ExecutionEnvironmentCompositeCompartmentEditPartCN(view); + case NodeCompositeCompartmentEditPartCN.VISUAL_ID: return new NodeCompositeCompartmentEditPartCN(view); + case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: return new ArtifactCompositeCompartmentEditPartCN(view); + case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: return new ArtifactCompositeCompartmentEditPartACN(view); + case LinkDescriptorEditPart.VISUAL_ID: return new LinkDescriptorEditPart(view); + case CommentAnnotatedElementEditPart.VISUAL_ID: return new CommentAnnotatedElementEditPart(view); + case ConstraintConstrainedElementEditPart.VISUAL_ID: return new ConstraintConstrainedElementEditPart(view); + case DeploymentEditPart.VISUAL_ID: return new DeploymentEditPart(view); + case DeploymentNameEditPart.VISUAL_ID: return new DeploymentNameEditPart(view); + case DeploymentAppliedStereotypeEditPart.VISUAL_ID: return new DeploymentAppliedStereotypeEditPart(view); + case ManifestationEditPart.VISUAL_ID: return new ManifestationEditPart(view); + case ManifestationNameEditPart.VISUAL_ID: return new ManifestationNameEditPart(view); + case ManifestationAppliedStereotypeEditPart.VISUAL_ID: return new ManifestationAppliedStereotypeEditPart(view); + case GeneralizationEditPart.VISUAL_ID: return new GeneralizationEditPart(view); + case GeneralizationAppliedStereotypeEditPart.VISUAL_ID: return new GeneralizationAppliedStereotypeEditPart(view); + case DependencyEditPart.VISUAL_ID: return new DependencyEditPart(view); + case DependencyNameEditPart.VISUAL_ID: return new DependencyNameEditPart(view); + case DependencyAppliedStereotypeEditPart.VISUAL_ID: return new DependencyAppliedStereotypeEditPart(view); + case DependencyBranchEditPart.VISUAL_ID: return new DependencyBranchEditPart(view); + case CommunicationPathEditPart.VISUAL_ID: return new CommunicationPathEditPart(view); + case CommunicationPathNameEditPart.VISUAL_ID: return new CommunicationPathNameEditPart(view); + case CommunicationPathAppliedStereotypeEditPart.VISUAL_ID: return new CommunicationPathAppliedStereotypeEditPart(view); + } } return createUnrecognizedEditPart(context, model); @@ -245,10 +341,11 @@ public class UMLEditPartFactory implements EditPartFactory { * @generated */ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) { - if(source.getFigure() instanceof IMultilineEditableFigure) { - return new MultilineCellEditorLocator((IMultilineEditableFigure)source.getFigure()); + if (source.getFigure() instanceof IMultilineEditableFigure) { + return new MultilineCellEditorLocator((IMultilineEditableFigure) source.getFigure()); } else { return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source); + } } @@ -281,15 +378,15 @@ public class UMLEditPartFactory implements EditPartFactory { */ @Override public void relocate(CellEditor celleditor) { - Text text = (Text)celleditor.getControl(); + Text text = (Text) celleditor.getControl(); Rectangle rect = getMultilineEditableFigure().getBounds().getCopy(); rect.x = getMultilineEditableFigure().getEditionLocation().x; rect.y = getMultilineEditableFigure().getEditionLocation().y; getMultilineEditableFigure().translateToAbsolute(rect); - if(getMultilineEditableFigure().getText().length() > 0) { + if (getMultilineEditableFigure().getText().length() > 0) { rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT))); } - if(!rect.equals(new Rectangle(text.getBounds()))) { + if (!rect.equals(new Rectangle(text.getBounds()))) { text.setBounds(rect.x, rect.y, rect.width, rect.height); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java index 5202a4591f7..f87262fb99e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -110,10 +110,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { @Override @SuppressWarnings("unchecked") public Command getCommand(Request request) { - if(request instanceof ReconnectRequest) { - Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel(); - if(view instanceof View) { - String id = UMLVisualIDRegistry.getVisualID((View)view); + if (request instanceof ReconnectRequest) { + Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel(); + if (view instanceof View) { + String id = UMLVisualIDRegistry.getVisualID((View) view); request.getExtendedData().put(VISUAL_ID_KEY, id); request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view); } @@ -127,7 +127,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated */ protected String getVisualID(IEditCommandRequest request) { - return (String)request.getParameter(VISUAL_ID_KEY); + return (String) request.getParameter(VISUAL_ID_KEY); } /** @@ -138,8 +138,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { IEditCommandRequest completedRequest = completeRequest(request); Command semanticCommand = getSemanticCommandSwitch(completedRequest); semanticCommand = getEditHelperCommand(completedRequest, semanticCommand); - if(completedRequest instanceof DestroyRequest) { - DestroyRequest destroyRequest = (DestroyRequest)completedRequest; + if (completedRequest instanceof DestroyRequest) { + DestroyRequest destroyRequest = (DestroyRequest) completedRequest; return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null; } return semanticCommand; @@ -149,7 +149,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated */ protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) { - Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel())); + Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel())); return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand); } @@ -157,8 +157,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated */ private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) { - if(editPolicyCommand != null) { - ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand); + if (editPolicyCommand != null) { + ICommand command = editPolicyCommand instanceof ICommandProxy + ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand); request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command); } IElementType requestContextElementType = getContextElementType(request); @@ -166,8 +167,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { ICommand command = requestContextElementType.getEditCommand(request); request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null); request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null); - if(command != null) { - if(!(command instanceof CompositeTransactionalCommand)) { + if (command != null) { + if (!(command instanceof CompositeTransactionalCommand)) { command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command); } return new ICommandProxy(command); @@ -187,28 +188,28 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated */ protected Command getSemanticCommandSwitch(IEditCommandRequest req) { - if(req instanceof CreateRelationshipRequest) { - return getCreateRelationshipCommand((CreateRelationshipRequest)req); - } else if(req instanceof CreateElementRequest) { - return getCreateCommand((CreateElementRequest)req); - } else if(req instanceof ConfigureRequest) { - return getConfigureCommand((ConfigureRequest)req); - } else if(req instanceof DestroyElementRequest) { - return getDestroyElementCommand((DestroyElementRequest)req); - } else if(req instanceof DestroyReferenceRequest) { - return getDestroyReferenceCommand((DestroyReferenceRequest)req); - } else if(req instanceof DuplicateElementsRequest) { - return getDuplicateCommand((DuplicateElementsRequest)req); - } else if(req instanceof GetEditContextRequest) { - return getEditContextCommand((GetEditContextRequest)req); - } else if(req instanceof MoveRequest) { - return getMoveCommand((MoveRequest)req); - } else if(req instanceof ReorientReferenceRelationshipRequest) { - return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest)req); - } else if(req instanceof ReorientRelationshipRequest) { - return getReorientRelationshipCommand((ReorientRelationshipRequest)req); - } else if(req instanceof SetRequest) { - return getSetCommand((SetRequest)req); + if (req instanceof CreateRelationshipRequest) { + return getCreateRelationshipCommand((CreateRelationshipRequest) req); + } else if (req instanceof CreateElementRequest) { + return getCreateCommand((CreateElementRequest) req); + } else if (req instanceof ConfigureRequest) { + return getConfigureCommand((ConfigureRequest) req); + } else if (req instanceof DestroyElementRequest) { + return getDestroyElementCommand((DestroyElementRequest) req); + } else if (req instanceof DestroyReferenceRequest) { + return getDestroyReferenceCommand((DestroyReferenceRequest) req); + } else if (req instanceof DuplicateElementsRequest) { + return getDuplicateCommand((DuplicateElementsRequest) req); + } else if (req instanceof GetEditContextRequest) { + return getEditContextCommand((GetEditContextRequest) req); + } else if (req instanceof MoveRequest) { + return getMoveCommand((MoveRequest) req); + } else if (req instanceof ReorientReferenceRelationshipRequest) { + return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); + } else if (req instanceof ReorientRelationshipRequest) { + return getReorientRelationshipCommand((ReorientRelationshipRequest) req); + } else if (req instanceof SetRequest) { + return getSetCommand((SetRequest) req); } return null; } @@ -232,11 +233,11 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */ protected Command getCreateCommand(CreateElementRequest req) { IElementType requestElementType = req.getElementType(); - if(requestElementType instanceof IElementType) { + if (requestElementType instanceof IElementType) { IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer()); - if(commandProvider != null) { + if (commandProvider != null) { ICommand command = commandProvider.getEditCommand(req); - if(command != null && command.canExecute()) { + if (command != null && command.canExecute()) { return new ICommandProxy(command); } } @@ -249,7 +250,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */ protected Command getExtendedTypeCreationCommand(CreateElementRequest request, IElementType requestElementType) { IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer()); - if(provider == null) { + if (provider == null) { return UnexecutableCommand.INSTANCE; } // Retrieve create command from the Element Edit service @@ -260,9 +261,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /** * @generated */ - protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, IElementType requestElementType) { + protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, + IElementType requestElementType) { IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType); - if(provider == null) { + if (provider == null) { return UnexecutableCommand.INSTANCE; } // Retrieve create command from the Element Edit service @@ -273,9 +275,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /** * @generated */ - protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, IElementType requestElementType) { + protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, + IElementType requestElementType) { IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType); - if(provider == null) { + if (provider == null) { return UnexecutableCommand.INSTANCE; } // Retrieve create command from the Element Edit service @@ -324,11 +327,11 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */ protected Command getMoveCommand(MoveRequest req) { EObject targetCEObject = req.getTargetContainer(); - if(targetCEObject != null) { + if (targetCEObject != null) { IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject); - if(provider != null) { + if (provider != null) { ICommand moveCommand = provider.getEditCommand(req); - if(moveCommand != null) { + if (moveCommand != null) { return new ICommandProxy(moveCommand); } } @@ -336,6 +339,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { } else { return getGEFWrapper(new MoveElementsCommand(req)); } + } /** @@ -365,7 +369,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated */ protected TransactionalEditingDomain getEditingDomain() { - return ((IGraphicalEditPart)getHost()).getEditingDomain(); + return ((IGraphicalEditPart) getHost()).getEditingDomain(); } /** @@ -375,9 +379,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */ protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) { assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$ - for(Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) { - View nextView = (View)it.next(); - if(nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$ + for (Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) { + View nextView = (View) it.next(); + if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() //$NON-NLS-1$ + || nextView.getElement() != view.getElement()) { continue; } cmd.add(new DeleteCommand(getEditingDomain(), nextView)); @@ -389,7 +394,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */ public static LinkConstraints getLinkConstraints() { LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints(); - if(cached == null) { + if (cached == null) { UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints()); } return cached; @@ -407,138 +412,146 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { } /** - * @generated - */ - public boolean canCreateLink_4005() { - return canExistLink_4005(); + * @generated + */ + public boolean canCreateLink_DescriptorEdge() { + return canExistLink_DescriptorEdge(); } /** - * @generated - */ - public boolean canCreateCommentAnnotatedElement_4008(Comment source, Element target) { - if(source != null) { - if(source.getAnnotatedElements().contains(target)) { + * @generated + */ + public boolean canCreateComment_AnnotatedElementEdge(Comment source, Element target) { + if (source != null) { + if (source.getAnnotatedElements().contains(target)) { return false; } } - return canExistCommentAnnotatedElement_4008(source, target); + + return canExistComment_AnnotatedElementEdge(source, target); } /** - * @generated - */ - public boolean canCreateConstraintConstrainedElement_4009(Constraint source, Element target) { - if(source != null) { - if(source.getConstrainedElements().contains(target)) { + * @generated + */ + public boolean canCreateConstraint_ConstrainedElementEdge(Constraint source, Element target) { + if (source != null) { + if (source.getConstrainedElements().contains(target)) { return false; } } - return canExistConstraintConstrainedElement_4009(source, target); + + return canExistConstraint_ConstrainedElementEdge(source, target); } /** - * @generated - */ - public boolean canCreateDeployment_4001(DeploymentTarget container, NamedElement source, NamedElement target) { - return canExistDeployment_4001(container, null, source, target); + * @generated + */ + public boolean canCreateDeployment_Edge(DeploymentTarget container, NamedElement source, NamedElement target) { + return canExistDeployment_Edge(container, null, source, target); } /** - * @generated - */ - public boolean canCreateManifestation_4002(Artifact container, NamedElement source, NamedElement target) { - return canExistManifestation_4002(container, null, source, target); + * @generated + */ + public boolean canCreateManifestation_Edge(Artifact container, NamedElement source, NamedElement target) { + return canExistManifestation_Edge(container, null, source, target); } /** - * @generated - */ - public boolean canCreateGeneralization_4003(Classifier container, Classifier source, Classifier target) { - return canExistGeneralization_4003(container, null, source, target); + * @generated + */ + public boolean canCreateGeneralization_Edge(Classifier container, Classifier source, Classifier target) { + return canExistGeneralization_Edge(container, null, source, target); } /** - * @generated - */ - public boolean canCreateDependency_4004(Package container, NamedElement source, NamedElement target) { - return canExistDependency_4004(container, null, source, target); + * @generated + */ + public boolean canCreateDependency_Edge(Package container, NamedElement source, NamedElement target) { + return canExistDependency_Edge(container, null, source, target); } /** - * @generated - */ - public boolean canCreateDependency_4010(Package container, NamedElement source, NamedElement target) { - return canExistDependency_4010(container, null, source, target); + * @generated + */ + public boolean canCreateDependency_BranchEdge(Package container, NamedElement source, NamedElement target) { + return canExistDependency_BranchEdge(container, null, source, target); } /** * @generated */ - public boolean canCreateCommunicationPath_4011(Package container, Type source, Type target) { - return canExistCommunicationPath_4011(container, null, source, target); + public boolean canCreateCommunicationPath_Edge(Package container, Type source, Type target) { + return canExistCommunicationPath_Edge(container, null, source, target); } /** - * @generated - */ - public boolean canExistLink_4005() { + * @generated + */ + public boolean canExistLink_DescriptorEdge() { return true; } /** - * @generated - */ - public boolean canExistCommentAnnotatedElement_4008(Comment source, Element target) { + * @generated + */ + public boolean canExistComment_AnnotatedElementEdge(Comment source, Element target) { return true; } /** - * @generated - */ - public boolean canExistConstraintConstrainedElement_4009(Constraint source, Element target) { + * @generated + */ + public boolean canExistConstraint_ConstrainedElementEdge(Constraint source, Element target) { return true; } /** - * @generated - */ - public boolean canExistDeployment_4001(DeploymentTarget container, Deployment linkInstance, NamedElement source, NamedElement target) { + * @generated + */ + public boolean canExistDeployment_Edge(DeploymentTarget container, Deployment linkInstance, NamedElement source, + NamedElement target) { return true; } /** - * @generated - */ - public boolean canExistManifestation_4002(Artifact container, Manifestation linkInstance, NamedElement source, NamedElement target) { + * @generated + */ + public boolean canExistManifestation_Edge(Artifact container, Manifestation linkInstance, NamedElement source, + NamedElement target) { return true; } /** - * @generated - */ - public boolean canExistGeneralization_4003(Classifier container, Generalization linkInstance, Classifier source, Classifier target) { + * @generated + */ + public boolean canExistGeneralization_Edge(Classifier container, Generalization linkInstance, Classifier source, + Classifier target) { return true; } /** - * @generated - */ - public boolean canExistDependency_4004(Package container, Dependency linkInstance, NamedElement source, NamedElement target) { + * @generated + */ + public boolean canExistDependency_Edge(Package container, Dependency linkInstance, NamedElement source, + NamedElement target) { return true; } /** - * @generated - */ - public boolean canExistDependency_4010(Package container, Dependency linkInstance, NamedElement source, NamedElement target) { + * @generated + */ + public boolean canExistDependency_BranchEdge(Package container, Dependency linkInstance, NamedElement source, + NamedElement target) { return true; } /** * @generated */ - public boolean canExistCommunicationPath_4011(Package container, CommunicationPath linkInstance, Type source, Type target) { + public boolean canExistCommunicationPath_Edge(Package container, CommunicationPath linkInstance, Type source, + Type target) { return true; } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java index 45e2c7cdb0c..4b86a21db87 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java @@ -54,9 +54,9 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected void showPrimarySelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(true); - ((WrappingLabel)getHostFigure()).setFocus(true); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(true); } else { showSelection(); showFocus(); @@ -68,9 +68,9 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected void showSelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(true); - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(false); } else { hideSelection(); addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); @@ -85,11 +85,11 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected void hideSelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(false); - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(false); + ((WrappingLabel) getHostFigure()).setFocus(false); } else { - if(selectionFeedbackFigure != null) { + if (selectionFeedbackFigure != null) { removeFeedback(selectionFeedbackFigure); getHostFigure().removeFigureListener(getHostPositionListener()); selectionFeedbackFigure = null; @@ -103,8 +103,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected void showFocus() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setFocus(true); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(true); } else { hideFocus(); addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); @@ -117,10 +117,10 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected void hideFocus() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(false); } else { - if(focusFeedbackFigure != null) { + if (focusFeedbackFigure != null) { removeFeedback(focusFeedbackFigure); focusFeedbackFigure = null; } @@ -132,8 +132,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ protected Rectangle getFeedbackBounds() { Rectangle bounds; - if(getHostFigure() instanceof Label) { - bounds = ((Label)getHostFigure()).getTextBounds(); + if (getHostFigure() instanceof Label) { + bounds = ((Label) getHostFigure()).getTextBounds(); bounds.intersect(getHostFigure().getBounds()); } else { bounds = getHostFigure().getBounds().getCopy(); @@ -147,7 +147,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated */ protected IFigure createSelectionFeedbackFigure() { - if(getHostFigure() instanceof Label) { + if (getHostFigure() instanceof Label) { Label feedbackFigure = new Label(); feedbackFigure.setOpaque(true); feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected); @@ -177,7 +177,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated */ protected void updateLabel(Label target) { - Label source = (Label)getHostFigure(); + Label source = (Label) getHostFigure(); target.setText(source.getText()); target.setTextAlignment(source.getTextAlignment()); target.setFont(source.getFont()); @@ -187,9 +187,9 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated */ protected void refreshSelectionFeedback() { - if(selectionFeedbackFigure != null) { - if(selectionFeedbackFigure instanceof Label) { - updateLabel((Label)selectionFeedbackFigure); + if (selectionFeedbackFigure != null) { + if (selectionFeedbackFigure instanceof Label) { + updateLabel((Label) selectionFeedbackFigure); selectionFeedbackFigure.setBounds(getFeedbackBounds()); } else { selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5)); @@ -201,7 +201,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated */ protected void refreshFocusFeedback() { - if(focusFeedbackFigure != null) { + if (focusFeedbackFigure != null) { focusFeedbackFigure.setBounds(getFeedbackBounds()); } } @@ -219,9 +219,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated */ private FigureListener getHostPositionListener() { - if(hostPositionListener == null) { + if (hostPositionListener == null) { hostPositionListener = new FigureListener() { - @Override public void figureMoved(IFigure source) { refreshFeedback(); @@ -236,7 +235,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */ @Override protected List<?> createSelectionHandles() { - MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost()); + MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost()); moveHandle.setBorder(null); moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost())); return Collections.singletonList(moveHandle); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java index 656109f9689..ee6174ff3d8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java @@ -48,9 +48,9 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ @Override protected void showPrimarySelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(true); - ((WrappingLabel)getHostFigure()).setFocus(true); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(true); } else { showSelection(); showFocus(); @@ -62,9 +62,9 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ @Override protected void showSelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(true); - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(false); } else { hideSelection(); addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); @@ -79,11 +79,11 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ @Override protected void hideSelection() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setSelected(false); - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(false); + ((WrappingLabel) getHostFigure()).setFocus(false); } else { - if(selectionFeedbackFigure != null) { + if (selectionFeedbackFigure != null) { removeFeedback(selectionFeedbackFigure); getHostFigure().removeFigureListener(getHostPositionListener()); selectionFeedbackFigure = null; @@ -97,8 +97,8 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ @Override protected void showFocus() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setFocus(true); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(true); } else { hideFocus(); addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); @@ -111,10 +111,10 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ @Override protected void hideFocus() { - if(getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel)getHostFigure()).setFocus(false); + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(false); } else { - if(focusFeedbackFigure != null) { + if (focusFeedbackFigure != null) { removeFeedback(focusFeedbackFigure); focusFeedbackFigure = null; } @@ -126,8 +126,8 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */ protected Rectangle getFeedbackBounds() { Rectangle bounds; - if(getHostFigure() instanceof Label) { - bounds = ((Label)getHostFigure()).getTextBounds(); + if (getHostFigure() instanceof Label) { + bounds = ((Label) getHostFigure()).getTextBounds(); bounds.intersect(getHostFigure().getBounds()); } else { bounds = getHostFigure().getBounds().getCopy(); @@ -141,7 +141,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated */ protected IFigure createSelectionFeedbackFigure() { - if(getHostFigure() instanceof Label) { + if (getHostFigure() instanceof Label) { Label feedbackFigure = new Label(); feedbackFigure.setOpaque(true); feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected); @@ -171,7 +171,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated */ protected void updateLabel(Label target) { - Label source = (Label)getHostFigure(); + Label source = (Label) getHostFigure(); target.setText(source.getText()); target.setTextAlignment(source.getTextAlignment()); target.setFont(source.getFont()); @@ -181,9 +181,9 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated */ protected void refreshSelectionFeedback() { - if(selectionFeedbackFigure != null) { - if(selectionFeedbackFigure instanceof Label) { - updateLabel((Label)selectionFeedbackFigure); + if (selectionFeedbackFigure != null) { + if (selectionFeedbackFigure instanceof Label) { + updateLabel((Label) selectionFeedbackFigure); selectionFeedbackFigure.setBounds(getFeedbackBounds()); } else { selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5)); @@ -195,7 +195,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated */ protected void refreshFocusFeedback() { - if(focusFeedbackFigure != null) { + if (focusFeedbackFigure != null) { focusFeedbackFigure.setBounds(getFeedbackBounds()); } } @@ -213,9 +213,8 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated */ private FigureListener getHostPositionListener() { - if(hostPositionListener == null) { + if (hostPositionListener == null) { hostPositionListener = new FigureListener() { - @Override public void figureMoved(IFigure source) { refreshFeedback(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java index 908ead81ee8..52ca946e95b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java @@ -41,8 +41,9 @@ public abstract class UMLAbstractExpression { protected void setStatus(int severity, String message, Throwable throwable) { String pluginID = UMLDiagramEditorPlugin.ID; this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$ - if(!this.status.isOK()) { - UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$ + if (!this.status.isOK()) { + UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), //$NON-NLS-1$//$NON-NLS-2$ + throwable); } } @@ -103,7 +104,7 @@ public abstract class UMLAbstractExpression { */ @SuppressWarnings("rawtypes") public Object evaluate(Object context, Map env) { - if(context().isInstance(context)) { + if (context().isInstance(context)) { try { return doEvaluate(context, env); } catch (Exception e) { @@ -120,48 +121,48 @@ public abstract class UMLAbstractExpression { * @generated */ public static Object performCast(Object value, EDataType targetType) { - if(targetType instanceof EEnum) { - if(value instanceof EEnumLiteral) { - EEnumLiteral literal = (EEnumLiteral)value; + if (targetType instanceof EEnum) { + if (value instanceof EEnumLiteral) { + EEnumLiteral literal = (EEnumLiteral) value; return (literal.getInstance() != null) ? literal.getInstance() : literal; } } - if(false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) { + if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) { return value; } Class<?> targetClass = targetType.getInstanceClass(); - Number num = (Number)value; + Number num = (Number) value; Class<?> valClass = value.getClass(); Class<?> targetWrapperClass = targetClass; - if(targetClass.isPrimitive()) { + if (targetClass.isPrimitive()) { targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass); } - if(valClass.equals(targetWrapperClass)) { + if (valClass.equals(targetWrapperClass)) { return value; } - if(Number.class.isAssignableFrom(targetWrapperClass)) { - if(targetWrapperClass.equals(Byte.class)) { + if (Number.class.isAssignableFrom(targetWrapperClass)) { + if (targetWrapperClass.equals(Byte.class)) { return new Byte(num.byteValue()); } - if(targetWrapperClass.equals(Integer.class)) { + if (targetWrapperClass.equals(Integer.class)) { return new Integer(num.intValue()); } - if(targetWrapperClass.equals(Short.class)) { + if (targetWrapperClass.equals(Short.class)) { return new Short(num.shortValue()); } - if(targetWrapperClass.equals(Long.class)) { + if (targetWrapperClass.equals(Long.class)) { return new Long(num.longValue()); } - if(targetWrapperClass.equals(BigInteger.class)) { + if (targetWrapperClass.equals(BigInteger.class)) { return BigInteger.valueOf(num.longValue()); } - if(targetWrapperClass.equals(Float.class)) { + if (targetWrapperClass.equals(Float.class)) { return new Float(num.floatValue()); } - if(targetWrapperClass.equals(Double.class)) { + if (targetWrapperClass.equals(Double.class)) { return new Double(num.doubleValue()); } - if(targetWrapperClass.equals(BigDecimal.class)) { + if (targetWrapperClass.equals(BigDecimal.class)) { return new BigDecimal(num.doubleValue()); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java index 0af0290fcc7..733f5e3cea0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java @@ -48,9 +48,9 @@ public class UMLOCLFactory { */ protected UMLOCLFactory() { this.expressions = new UMLAbstractExpression[3]; - this.expressionBodies = new String[]{ "self.name.concat(\'.file\') ", //$NON-NLS-1$ - "self.oclIsKindOf(DeploymentTarget)", //$NON-NLS-1$ - "not self.oclIsKindOf(DeploymentSpecification)", //$NON-NLS-1$ + this.expressionBodies = new String[] { "self.name.concat(\'.file\') ", //$NON-NLS-1$ + "self.oclIsKindOf(DeploymentTarget)", //$NON-NLS-1$ + "not self.oclIsKindOf(DeploymentSpecification)", //$NON-NLS-1$ }; } @@ -59,7 +59,7 @@ public class UMLOCLFactory { */ private static UMLOCLFactory getInstance() { UMLOCLFactory instance = UMLDiagramEditorPlugin.getInstance().getUMLOCLFactory(); - if(instance == null) { + if (instance == null) { UMLDiagramEditorPlugin.getInstance().setUMLOCLFactory(instance = new UMLOCLFactory()); } return instance; @@ -75,13 +75,15 @@ public class UMLOCLFactory { /** * @generated */ - public static UMLAbstractExpression getExpression(int index, EClassifier context, Map<String, EClassifier> environment) { + public static UMLAbstractExpression getExpression(int index, EClassifier context, + Map<String, EClassifier> environment) { UMLOCLFactory cached = getInstance(); - if(index < 0 || index >= cached.expressions.length) { + if (index < 0 || index >= cached.expressions.length) { throw new IllegalArgumentException(); } - if(cached.expressions[index] == null) { - cached.expressions[index] = getExpression(cached.expressionBodies[index], context, environment == null ? Collections.<String, EClassifier> emptyMap() : environment); + if (cached.expressions[index] == null) { + cached.expressions[index] = getExpression(cached.expressionBodies[index], context, + environment == null ? Collections.<String, EClassifier>emptyMap() : environment); } return cached.expressions[index]; } @@ -91,7 +93,8 @@ public class UMLOCLFactory { * * @generated */ - public static UMLAbstractExpression getExpression(String body, EClassifier context, Map<String, EClassifier> environment) { + public static UMLAbstractExpression getExpression(String body, EClassifier context, + Map<String, EClassifier> environment) { return new Expression(body, context, environment); } @@ -101,7 +104,7 @@ public class UMLOCLFactory { * @generated */ public static UMLAbstractExpression getExpression(String body, EClassifier context) { - return getExpression(body, context, Collections.<String, EClassifier> emptyMap()); + return getExpression(body, context, Collections.<String, EClassifier>emptyMap()); } /** @@ -142,14 +145,14 @@ public class UMLOCLFactory { @Override @SuppressWarnings("rawtypes") protected Object doEvaluate(Object context, Map env) { - if(oclExpression == null) { + if (oclExpression == null) { return null; } // on the first call, both evalEnvironment and extentMap are clear, for later we have finally, below. EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv = oclInstance.getEvaluationEnvironment(); // initialize environment - for(Object nextKey : env.keySet()) { - evalEnv.replace((String)nextKey, env.get(nextKey)); + for (Object nextKey : env.keySet()) { + evalEnv.replace((String) nextKey, env.get(nextKey)); } try { Object result = oclInstance.evaluate(context, oclExpression); @@ -163,10 +166,12 @@ public class UMLOCLFactory { /** * @generated */ - private static void initCustomEnv(Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> ecoreEnv, Map<String, EClassifier> environment) { + private static void initCustomEnv(Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> ecoreEnv, + Map<String, EClassifier> environment) { // Use EObject as implicit root class for any object, to allow eContainer() and other EObject operations from OCL expressions - ParsingOptions.setOption(ecoreEnv, ParsingOptions.implicitRootClass(ecoreEnv), EcorePackage.eINSTANCE.getEObject()); - for(String varName : environment.keySet()) { + ParsingOptions.setOption(ecoreEnv, ParsingOptions.implicitRootClass(ecoreEnv), + EcorePackage.eINSTANCE.getEObject()); + for (String varName : environment.keySet()) { EClassifier varType = environment.get(varName); ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false); } @@ -175,7 +180,8 @@ public class UMLOCLFactory { /** * @generated */ - private static Variable createVar(Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> ecoreEnv, String name, EClassifier type) { + private static Variable createVar(Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> ecoreEnv, + String name, EClassifier type) { Variable var = EcoreFactory.eINSTANCE.createVariable(); var.setName(name); var.setType(ecoreEnv.getUMLReflection().getOCLType(type)); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java index ccb7959b126..17d5a33bc1e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java @@ -74,10 +74,10 @@ public class MessageFormatParser extends AbstractAttributeParser { * @generated */ protected String getDefaultPattern() { - if(defaultPattern == null) { + if (defaultPattern == null) { StringBuffer sb = new StringBuffer(); - for(int i = 0; i < features.length; i++) { - if(i > 0) { + for (int i = 0; i < features.length; i++) { + if (i > 0) { sb.append(' '); } sb.append('{'); @@ -111,7 +111,7 @@ public class MessageFormatParser extends AbstractAttributeParser { * @generated */ protected MessageFormat getViewProcessor() { - if(viewProcessor == null) { + if (viewProcessor == null) { viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); } return viewProcessor; @@ -121,8 +121,9 @@ public class MessageFormatParser extends AbstractAttributeParser { * @generated */ protected MessageFormat getEditorProcessor() { - if(editorProcessor == null) { - editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + if (editorProcessor == null) { + editorProcessor = new MessageFormat( + getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); } return editorProcessor; } @@ -131,10 +132,10 @@ public class MessageFormatParser extends AbstractAttributeParser { * @generated */ protected String getDefaultEditablePattern() { - if(defaultEditablePattern == null) { + if (defaultEditablePattern == null) { StringBuffer sb = new StringBuffer(); - for(int i = 0; i < editableFeatures.length; i++) { - if(i > 0) { + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { sb.append(' '); } sb.append('{'); @@ -159,8 +160,9 @@ public class MessageFormatParser extends AbstractAttributeParser { * @generated */ protected MessageFormat getEditProcessor() { - if(editProcessor == null) { - editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + if (editProcessor == null) { + editProcessor = new MessageFormat( + getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); } return editProcessor; } @@ -170,8 +172,9 @@ public class MessageFormatParser extends AbstractAttributeParser { */ @Override public String getEditString(IAdaptable adapter, int flags) { - EObject element = (EObject)adapter.getAdapter(EObject.class); - return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)) + .toString(); } /** @@ -181,8 +184,9 @@ public class MessageFormatParser extends AbstractAttributeParser { public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { ParsePosition pos = new ParsePosition(0); Object[] values = getEditProcessor().parse(editString, pos); - if(values == null) { - return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); + if (values == null) { + return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, + NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); } return validateNewValues(values); } @@ -201,7 +205,7 @@ public class MessageFormatParser extends AbstractAttributeParser { */ @Override public String getPrintString(IAdaptable adapter, int flags) { - EObject element = (EObject)adapter.getAdapter(EObject.class); + EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java index 78b1c9d107e..c2d665ca2d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java @@ -45,14 +45,16 @@ public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider public void buildContextMenu(final IMenuManager menu) { getViewer().flush(); try { - TransactionUtil.getEditingDomain((EObject)getViewer().getContents().getModel()).runExclusive(new Runnable() { + TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()) + .runExclusive(new Runnable() { - @Override - public void run() { - ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part); - menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL); - } - }); + @Override + public void run() { + ContributionItemService.getInstance() + .contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part); + menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL); + } + }); } catch (Exception e) { UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java index 3d4a481ca2f..66ebd37596d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java @@ -103,7 +103,8 @@ public class UMLCreationWizard extends Wizard implements INewWizard { this.workbench = workbench; this.selection = selection; setWindowTitle(Messages.UMLCreationWizardTitle); - setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$ + setDefaultPageImageDescriptor( + UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$ setNeedsProgressMonitor(true); } @@ -112,18 +113,21 @@ public class UMLCreationWizard extends Wizard implements INewWizard { */ @Override public void addPages() { - diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLDeployment_diagram"); //$NON-NLS-1$ //$NON-NLS-2$ + diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), //$NON-NLS-1$ + "PapyrusUMLDeployment_diagram"); //$NON-NLS-1$ diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle); diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription); addPage(diagramModelFilePage); + domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "umlDeployment") { //$NON-NLS-1$ //$NON-NLS-2$ @Override public void setVisible(boolean visible) { - if(visible) { + if (visible) { String fileName = diagramModelFilePage.getFileName(); fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLDeployment_diagram".length()); //$NON-NLS-1$ - setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "umlDeployment")); //$NON-NLS-1$ + setFileName( + UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "umlDeployment")); //$NON-NLS-1$ } super.setVisible(visible); } @@ -142,12 +146,14 @@ public class UMLCreationWizard extends Wizard implements INewWizard { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException { - diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor); - if(isOpenNewlyCreatedDiagramEditor() && diagram != null) { + diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), + domainModelFilePage.getURI(), monitor); + if (isOpenNewlyCreatedDiagramEditor() && diagram != null) { try { UMLDiagramEditorUtil.openDiagram(diagram); } catch (PartInitException e) { - ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, null, e.getStatus()); + ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, + null, e.getStatus()); } } } @@ -157,8 +163,9 @@ public class UMLCreationWizard extends Wizard implements INewWizard { } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { - if(e.getTargetException() instanceof CoreException) { - ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardCreationError, null, ((CoreException)e.getTargetException()).getStatus()); + if (e.getTargetException() instanceof CoreException) { + ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardCreationError, null, + ((CoreException) e.getTargetException()).getStatus()); } else { UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$ } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java index 9f5df37400e..a9a93f349de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java @@ -58,11 +58,11 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage { */ protected IPath getFilePath() { IPath path = getContainerFullPath(); - if(path == null) { + if (path == null) { path = new Path(""); //$NON-NLS-1$ } String fileName = getFileName(); - if(fileName != null) { + if (fileName != null) { path = path.append(fileName); } return path; @@ -83,11 +83,11 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage { */ @Override protected boolean validatePage() { - if(!super.validatePage()) { + if (!super.validatePage()) { return false; } String extension = getExtension(); - if(extension != null && !getFilePath().toString().endsWith("." + extension)) { + if (extension != null && !getFilePath().toString().endsWith("." + extension)) { setErrorMessage(NLS.bind(Messages.UMLCreationWizardPageExtensionError, extension)); return false; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java index 7cca9c53792..4c5613a1cbb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java @@ -52,7 +52,7 @@ public class UMLDiagramActionBarContributor extends DiagramActionBarContributor fileMenu.remove("pageSetupAction"); //$NON-NLS-1$ IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); assert editMenu != null; - if(editMenu.find("validationGroup") == null) { //$NON-NLS-1$ + if (editMenu.find("validationGroup") == null) { //$NON-NLS-1$ editMenu.add(new GroupMarker("validationGroup")); //$NON-NLS-1$ } IAction validateAction = new ValidateAction(page); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java index db027b06eb8..bad22276988 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java @@ -102,13 +102,17 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */ public UMLDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException { super(servicesRegistry, diagram); + // adds a listener to the palette service, which reacts to palette customizations PapyrusPaletteService.getInstance().addProviderChangeListener(this); + // Share the same editing provider editingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); documentProvider = new GmfMultiDiagramDocumentProvider(editingDomain); + // overrides editing domain created by super constructor setDocumentProvider(documentProvider); + } /** @@ -125,7 +129,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) { PaletteRoot paletteRoot; - if(existingPaletteRoot == null) { + if (existingPaletteRoot == null) { paletteRoot = PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent()); } else { PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent()); @@ -221,7 +225,8 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override protected void configureGraphicalViewer() { super.configureGraphicalViewer(); - DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer()); + DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, + getDiagramGraphicalViewer()); getDiagramGraphicalViewer().setContextMenu(provider); getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer()); } @@ -263,7 +268,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh * @generated */ protected OperationHistoryDirtyState getDirtyState() { - if(dirtyState == null) { + if (dirtyState == null) { dirtyState = OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory()); } return dirtyState; @@ -274,10 +279,11 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */ @Override protected void setUndoContext(IUndoContext context) { - if(dirtyState != null) { + if (dirtyState != null) { dirtyState.dispose(); dirtyState = null; } + super.setUndoContext(context); } @@ -295,8 +301,9 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override public void providerChanged(ProviderChangeEvent event) { // update the palette if the palette service has changed - if(PapyrusPaletteService.getInstance().equals(event.getSource())) { - PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, getDefaultPaletteContent()); + if (PapyrusPaletteService.getInstance().equals(event.getSource())) { + PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, + getDefaultPaletteContent()); } } @@ -308,10 +315,12 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh // remove palette service listener // remove preference listener PapyrusPaletteService.getInstance().removeProviderChangeListener(this); - if(dirtyState != null) { + + if (dirtyState != null) { dirtyState.dispose(); dirtyState = null; } + super.dispose(); } @@ -348,10 +357,13 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override protected void configurePaletteViewer(PaletteViewer viewer) { super.configurePaletteViewer(viewer); + // customize menu... viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer)); + viewer.getKeyHandler().setParent(getPaletteKeyHandler()); viewer.getControl().addMouseListener(getPaletteMouseListener()); + // Add a transfer drag target listener that is supported on // palette template entries whose template is a creation tool. // This will enable drag and drop of the palette shape creation @@ -373,7 +385,9 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh * @return Palette Key Handler for the palette */ private KeyHandler getPaletteKeyHandler() { - if(paletteKeyHandler == null) { + + if (paletteKeyHandler == null) { + paletteKeyHandler = new KeyHandler() { /** @@ -388,18 +402,27 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */ @Override public boolean keyReleased(KeyEvent event) { - if(event.keyCode == SWT.Selection) { + + if (event.keyCode == SWT.Selection) { + Tool tool = getPaletteViewer().getActiveTool().createTool(); - if(toolSupportsAccessibility(tool)) { + + if (toolSupportsAccessibility(tool)) { + tool.keyUp(event, getDiagramGraphicalViewer()); + // deactivate current selection getPaletteViewer().setActiveTool(null); + return true; } + } return super.keyReleased(event); } + }; + } return paletteKeyHandler; } @@ -408,7 +431,9 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh * @return Palette Mouse listener for the palette */ private MouseListener getPaletteMouseListener() { - if(paletteMouseListener == null) { + + if (paletteMouseListener == null) { + paletteMouseListener = new MouseListener() { /** @@ -426,10 +451,13 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override public void mouseDoubleClick(MouseEvent e) { Tool tool = getPaletteViewer().getActiveTool().createTool(); - if(toolSupportsAccessibility(tool)) { + + if (toolSupportsAccessibility(tool)) { + tool.setViewer(getDiagramGraphicalViewer()); tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain()); tool.mouseDoubleClick(e, getDiagramGraphicalViewer()); + // Current active tool should be deactivated, // but if it is down here it will get // reactivated deep in GEF palette code after @@ -447,15 +475,18 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh public void mouseUp(MouseEvent e) { // Deactivate current active tool here if a // double-click was handled. - if(clearActiveTool) { + if (clearActiveTool) { getPaletteViewer().setActiveTool(null); clearActiveTool = false; } + } }; + } return paletteMouseListener; } + }; } @@ -473,20 +504,23 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override protected void initializeGraphicalViewer() { super.initializeGraphicalViewer(); + // Enable Drop - getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) { + getDiagramGraphicalViewer().addDropTargetListener( + new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) { - @Override - protected Object getJavaObject(TransferData data) { - // It is usual for the transfer data not to be set because it is available locally - return LocalSelectionTransfer.getTransfer().getSelection(); - } + @Override + protected Object getJavaObject(TransferData data) { + // It is usual for the transfer data not to be set because it is available locally + return LocalSelectionTransfer.getTransfer().getSelection(); + } + + @Override + protected TransactionalEditingDomain getTransactionalEditingDomain() { + return getEditingDomain(); + } + }); - @Override - protected TransactionalEditingDomain getTransactionalEditingDomain() { - return getEditingDomain(); - } - }); } /** @@ -494,10 +528,10 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */ @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if(getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) { - IMultiDiagramEditor editor = (IMultiDiagramEditor)getSite().getPage().getActiveEditor(); + if (getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) { + IMultiDiagramEditor editor = (IMultiDiagramEditor) getSite().getPage().getActiveEditor(); // If not the active editor, ignore selection changed. - if(this.equals(editor.getActiveEditor())) { + if (this.equals(editor.getActiveEditor())) { updateActions(getSelectionActions()); super.selectionChanged(part, selection); } else { @@ -509,7 +543,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh // from // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart, // ISelection) - if(part == this) { + if (part == this) { rebuildStatusLine(); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java index cae528dab5d..6e73b9dfc45 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java @@ -96,9 +96,11 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin { instance = this; myLogHelper = new LogHelper(this); PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); - adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory(); + adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance() + .getItemProvidersAdapterFactory(); DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer(); diagramPreferenceInitializer.initializeDefaultPreferences(); + } /** @@ -141,8 +143,8 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin { * @generated */ public ImageDescriptor getItemImageDescriptor(Object item) { - IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(item, IItemLabelProvider.class); - if(labelProvider != null) { + IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class); + if (labelProvider != null) { return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item)); } return null; @@ -173,8 +175,9 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin { */ public static ImageDescriptor findImageDescriptor(String path) { final IPath p = new Path(path); - if(p.isAbsolute() && p.segmentCount() > 1) { - return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString()); + if (p.isAbsolute() && p.segmentCount() > 1) { + return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), + p.removeFirstSegments(1).makeAbsolute().toString()); } else { return getBundledImageDescriptor(p.makeAbsolute().toString()); } @@ -191,7 +194,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin { */ public Image getBundledImage(String path) { Image image = getImageRegistry().get(path); - if(image == null) { + if (image == null) { getImageRegistry().put(path, getBundledImageDescriptor(path)); image = getImageRegistry().get(path); } @@ -211,7 +214,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin { * @generated */ public UMLDocumentProvider getDocumentProvider() { - if(documentProvider == null) { + if (documentProvider == null) { documentProvider = new UMLDocumentProvider(); } return documentProvider; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java index 092b0027b4f..d46b2e14fe2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java @@ -85,9 +85,9 @@ public class UMLDiagramEditorUtil { public static boolean openDiagram(Resource diagram) throws PartInitException { String path = diagram.getURI().toPlatformString(true); IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path)); - if(workspaceResource instanceof IFile) { + if (workspaceResource instanceof IFile) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - return null != page.openEditor(new FileEditorInput((IFile)workspaceResource), UMLDiagramEditor.ID); + return null != page.openEditor(new FileEditorInput((IFile) workspaceResource), UMLDiagramEditor.ID); } return false; } @@ -96,7 +96,7 @@ public class UMLDiagramEditorUtil { * @generated */ public static void setCharset(IFile file) { - if(file == null) { + if (file == null) { return; } try { @@ -110,7 +110,8 @@ public class UMLDiagramEditorUtil { * @generated */ public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { - return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE); + return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, + DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE); } /** @@ -121,7 +122,7 @@ public class UMLDiagramEditorUtil { public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); - if(wizardDialogSettings == null) { + if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); @@ -142,29 +143,37 @@ public class UMLDiagramEditorUtil { final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI); final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI); final String diagramName = diagramURI.lastSegment(); - AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) { - + AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, + Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) { @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { Package model = createInitialModel(); attachModelToResource(model, modelResource); - Diagram diagram = ViewService.createDiagram(model, DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - if(diagram != null) { + + Diagram diagram = ViewService.createDiagram(model, DeploymentDiagramEditPart.MODEL_ID, + UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); + if (diagram != null) { diagramResource.getContents().add(diagram); diagram.setName(diagramName); diagram.setElement(model); } + try { - modelResource.save(org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions()); - diagramResource.save(org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions()); + modelResource.save( + org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions()); + diagramResource.save( + org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions()); } catch (IOException e) { + UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$ } return CommandResult.newOKCommandResult(); } }; try { - OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null); + OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), + null); } catch (ExecutionException e) { UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$ } @@ -198,49 +207,56 @@ public class UMLDiagramEditorUtil { */ public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) { diagramPart.getDiagramGraphicalViewer().deselectAll(); + EditPart firstPrimary = null; - for(EditPart nextPart : editParts) { + for (EditPart nextPart : editParts) { diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); - if(firstPrimary == null && nextPart instanceof IPrimaryEditPart) { + if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) { firstPrimary = nextPart; } } - if(!editParts.isEmpty()) { - diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0)); + + if (!editParts.isEmpty()) { + diagramPart.getDiagramGraphicalViewer() + .reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0)); } } /** * @generated */ - private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List<EditPart> editPartCollector) { - IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer)diagramPart.getViewer(); + private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, + List<EditPart> editPartCollector) { + IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart.getViewer(); final int intialNumOfEditParts = editPartCollector.size(); - if(element instanceof View) { // support notation element lookup - EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(element); - if(editPart != null) { + + if (element instanceof View) { // support notation element lookup + EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(element); + if (editPart != null) { editPartCollector.add(editPart); return 1; } } + String elementID = EMFCoreUtil.getProxyID(element); @SuppressWarnings("unchecked") List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class); // perform the possible hierarchy disjoint -> take the top-most parts only - for(EditPart nextPart : associatedParts) { + for (EditPart nextPart : associatedParts) { EditPart parentPart = nextPart.getParent(); - while(parentPart != null && !associatedParts.contains(parentPart)) { + while (parentPart != null && !associatedParts.contains(parentPart)) { parentPart = parentPart.getParent(); } - if(parentPart == null) { + if (parentPart == null) { editPartCollector.add(nextPart); } } - if(intialNumOfEditParts == editPartCollector.size()) { - if(!associatedParts.isEmpty()) { + + if (intialNumOfEditParts == editPartCollector.size()) { + if (!associatedParts.isEmpty()) { editPartCollector.add(associatedParts.get(0)); } else { - if(element.eContainer() != null) { + if (element.eContainer() != null) { return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector); } } @@ -251,19 +267,22 @@ public class UMLDiagramEditorUtil { /** * @generated */ - public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { + public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, + LazyElement2ViewMap lazyElement2ViewMap) { boolean hasStructuralURI = false; - if(targetElement.eResource() instanceof XMLResource) { - hasStructuralURI = ((XMLResource)targetElement.eResource()).getID(targetElement) == null; + if (targetElement.eResource() instanceof XMLResource) { + hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null; } + View view = null; LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>(); - if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { + if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement); - } else if(findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) { + } else if (findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) { EditPart editPart = editPartHolder.get(0); - view = editPart.getModel() instanceof View ? (View)editPart.getModel() : null; + view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null; } + return (view == null) ? diagramEditPart.getDiagramView() : view; } @@ -301,17 +320,18 @@ public class UMLDiagramEditorUtil { * @generated */ public final Map<EObject, View> getElement2ViewMap() { - if(element2ViewMap == null) { + if (element2ViewMap == null) { element2ViewMap = new HashMap<EObject, View>(); // map possible notation elements to itself as these can't be found by view.getElement() - for(EObject element : elementSet) { - if(element instanceof View) { - View view = (View)element; - if(view.getDiagram() == scope.getDiagram()) { + for (EObject element : elementSet) { + if (element instanceof View) { + View view = (View) element; + if (view.getDiagram() == scope.getDiagram()) { element2ViewMap.put(element, view); // take only those that part of our diagram } } } + buildElement2ViewMap(scope, element2ViewMap, elementSet); } return element2ViewMap; @@ -320,25 +340,28 @@ public class UMLDiagramEditorUtil { /** * @generated */ - private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap, Set<? extends EObject> elements) { - if(elements.size() == element2ViewMap.size()) { + private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap, + Set<? extends EObject> elements) { + if (elements.size() == element2ViewMap.size()) { return true; } - if(parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) { + + if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) + && elements.contains(parentView.getElement())) { element2ViewMap.put(parentView.getElement(), parentView); - if(elements.size() == element2ViewMap.size()) { + if (elements.size() == element2ViewMap.size()) { return true; } } boolean complete = false; - for(Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete;) { - complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements); + for (Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements); } - for(Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) { - complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements); + for (Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements); } - for(Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) { - complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements); + for (Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements); } return complete; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java index 6b9703e6b38..65ce9e64f35 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java @@ -117,106 +117,106 @@ public class UMLDiagramUpdater implements DiagramUpdater { @Override public List<UMLNodeDescriptor> getSemanticChildren(View view) { String vid = UMLVisualIDRegistry.getVisualID(view); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentDiagramEditPart.VISUAL_ID: - return getPackage_1000SemanticChildren(view); + return getPackage_DeploymentDiagram_SemanticChildren(view); case ModelPackageableElementCompartmentEditPart.VISUAL_ID: - return getModelModelCompartment_51SemanticChildren(view); + return getModel_PackagedElementCompartment_SemanticChildren(view); case PackagePackageableElementCompartmentEditPart.VISUAL_ID: - return getPackagePackageableElementCompartment_38SemanticChildren(view); + return getPackage_PackagedElementCompartment_SemanticChildren(view); case DeviceCompositeCompartmentEditPart.VISUAL_ID: - return getDeviceDeviceCompositeCompartment_17SemanticChildren(view); + return getDevice_NestedNodeCompartment_SemanticChildren(view); case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: - return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(view); + return getExecutionEnvironment_NestedNodeCompartment_SemanticChildren(view); case NodeCompositeCompartmentEditPart.VISUAL_ID: - return getNodeCompositeCompartment_19SemanticChildren(view); + return getNode_NestedNodeCompartment_SemanticChildren(view); case ArtifactCompositeCompartmentEditPart.VISUAL_ID: - return getArtifactArtifactCompositeCompartment_26SemanticChildren(view); + return getArtifact_NestedArtifactCompartment_SemanticChildren(view); case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: - return getModelModelCompartment_52SemanticChildren(view); + return getModel_PackagedElementCompartment_CN_SemanticChildren(view); case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: - return getPackagePackageableElementCompartment_39SemanticChildren(view); + return getPackage_PackagedElementCompartment_CN_SemanticChildren(view); case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: - return getDeviceDeviceCompositeCompartment_30SemanticChildren(view); + return getDevice_NestedNodeCompartment_CN_SemanticChildren(view); case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: - return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(view); + return getExecutionEnvironment_NestedNodeCompartment_CN_SemanticChildren(view); case NodeCompositeCompartmentEditPartCN.VISUAL_ID: - return getNodeCompositeCompartment_32SemanticChildren(view); + return getNode_NestedNodeCompartment_CN_SemanticChildren(view); case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: - return getArtifactArtifactCompositeCompartment_33SemanticChildren(view); + return getArtifact_NestedArtifactCompartment_CCN_SemanticChildren(view); case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: - return getArtifactArtifactCompositeCompartment_34SemanticChildren(view); + return getArtifact_NestedArtifactCompartment_ACN_SemanticChildren(view); } } return Collections.emptyList(); } /** - * @generated - */ - public List<UMLNodeDescriptor> getPackage_1000SemanticChildren(View view) { - if(!view.isSetElement()) { + * @generated + */ + public List<UMLNodeDescriptor> getPackage_DeploymentDiagram_SemanticChildren(View view) { + if (!view.isSetElement()) { return Collections.emptyList(); } - Package modelElement = (Package)view.getElement(); + Package modelElement = (Package) view.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement)it.next(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DependencyNodeEditPart.VISUAL_ID.equals(visualID)) { + if (DependencyNodeEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(ModelEditPart.VISUAL_ID.equals(visualID)) { + if (ModelEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(PackageEditPart.VISUAL_ID.equals(visualID)) { + if (PackageEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(ExecutionEnvironmentEditPart.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeviceEditPart.VISUAL_ID.equals(visualID)) { + if (DeviceEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(ArtifactEditPart.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NodeEditPart.VISUAL_ID.equals(visualID)) { + if (NodeEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecificationEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecificationEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { - Constraint childElement = (Constraint)it.next(); + for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { + Constraint childElement = (Constraint) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ConstraintEditPart.VISUAL_ID.equals(visualID)) { + if (ConstraintEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { - Comment childElement = (Comment)it.next(); + for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { + Comment childElement = (Comment) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(CommentEditPart.VISUAL_ID.equals(visualID)) { + if (CommentEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedMembers().iterator(); it.hasNext();) { - NamedElement childElement = (NamedElement)it.next(); + for (Iterator<?> it = modelElement.getOwnedMembers().iterator(); it.hasNext();) { + NamedElement childElement = (NamedElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DefaultNamedElementEditPart.VISUAL_ID.equals(visualID)) { + if (DefaultNamedElementEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -227,60 +227,60 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getModelModelCompartment_51SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getModel_PackagedElementCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Model modelElement = (Model)containerView.getElement(); + Model modelElement = (Model) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement)it.next(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ModelEditPartCN.VISUAL_ID.equals(visualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(PackageEditPartCN.VISUAL_ID.equals(visualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { - Comment childElement = (Comment)it.next(); + for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { + Comment childElement = (Comment) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(CommentEditPartCN.VISUAL_ID.equals(visualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { - Constraint childElement = (Constraint)it.next(); + for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { + Constraint childElement = (Constraint) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -291,60 +291,60 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_38SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getPackage_PackagedElementCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Package modelElement = (Package)containerView.getElement(); + Package modelElement = (Package) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement)it.next(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ModelEditPartCN.VISUAL_ID.equals(visualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(PackageEditPartCN.VISUAL_ID.equals(visualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { - Comment childElement = (Comment)it.next(); + for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { + Comment childElement = (Comment) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(CommentEditPartCN.VISUAL_ID.equals(visualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { - Constraint childElement = (Constraint)it.next(); + for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { + Constraint childElement = (Constraint) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -355,36 +355,36 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_17SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getDevice_NestedNodeCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Device modelElement = (Device)containerView.getElement(); + Device modelElement = (Device) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -395,32 +395,32 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getExecutionEnvironment_NestedNodeCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - ExecutionEnvironment modelElement = (ExecutionEnvironment)containerView.getElement(); + ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -431,40 +431,40 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getNodeCompositeCompartment_19SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getNode_NestedNodeCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Node modelElement = (Node)containerView.getElement(); + Node modelElement = (Node) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -475,24 +475,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_26SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getArtifact_NestedArtifactCompartment_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Artifact modelElement = (Artifact)containerView.getElement(); + Artifact modelElement = (Artifact) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { - Artifact childElement = (Artifact)it.next(); + for (Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { + Artifact childElement = (Artifact) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -503,60 +503,60 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getModelModelCompartment_52SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getModel_PackagedElementCompartment_CN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Model modelElement = (Model)containerView.getElement(); + Model modelElement = (Model) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement)it.next(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ModelEditPartCN.VISUAL_ID.equals(visualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(PackageEditPartCN.VISUAL_ID.equals(visualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { - Comment childElement = (Comment)it.next(); + for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { + Comment childElement = (Comment) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(CommentEditPartCN.VISUAL_ID.equals(visualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { - Constraint childElement = (Constraint)it.next(); + for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { + Constraint childElement = (Constraint) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -567,56 +567,56 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_39SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getPackage_PackagedElementCompartment_CN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Package modelElement = (Package)containerView.getElement(); + Package modelElement = (Package) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement)it.next(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(PackageEditPartCN.VISUAL_ID.equals(visualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { - Comment childElement = (Comment)it.next(); + for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) { + Comment childElement = (Comment) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(CommentEditPartCN.VISUAL_ID.equals(visualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { - Constraint childElement = (Constraint)it.next(); + for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) { + Constraint childElement = (Constraint) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -627,36 +627,36 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_30SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getDevice_NestedNodeCompartment_CN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Device modelElement = (Device)containerView.getElement(); + Device modelElement = (Device) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -667,32 +667,32 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getExecutionEnvironment_NestedNodeCompartment_CN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - ExecutionEnvironment modelElement = (ExecutionEnvironment)containerView.getElement(); + ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -703,40 +703,40 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getNodeCompositeCompartment_32SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getNode_NestedNodeCompartment_CN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Node modelElement = (Node)containerView.getElement(); + Node modelElement = (Node) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { - Node childElement = (Node)it.next(); + for (Iterator<?> it = modelElement.getNestedNodes().iterator(); it.hasNext();) { + Node childElement = (Node) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(DeviceEditPartCN.VISUAL_ID.equals(visualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(NodeEditPartCN.VISUAL_ID.equals(visualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } } - for(Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { - Classifier childElement = (Classifier)it.next(); + for (Iterator<?> it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -747,24 +747,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_33SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getArtifact_NestedArtifactCompartment_CCN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Artifact modelElement = (Artifact)containerView.getElement(); + Artifact modelElement = (Artifact) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { - Artifact childElement = (Artifact)it.next(); + for (Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { + Artifact childElement = (Artifact) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -775,24 +775,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_34SemanticChildren(View view) { - if(false == view.eContainer() instanceof View) { + public List<UMLNodeDescriptor> getArtifact_NestedArtifactCompartment_ACN_SemanticChildren(View view) { + if (false == view.eContainer() instanceof View) { return Collections.emptyList(); } - View containerView = (View)view.eContainer(); - if(!containerView.isSetElement()) { + View containerView = (View) view.eContainer(); + if (!containerView.isSetElement()) { return Collections.emptyList(); } - Artifact modelElement = (Artifact)containerView.getElement(); + Artifact modelElement = (Artifact) containerView.getElement(); LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for(Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { - Artifact childElement = (Artifact)it.next(); + for (Iterator<?> it = modelElement.getNestedArtifacts().iterator(); it.hasNext();) { + Artifact childElement = (Artifact) it.next(); String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if(ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(visualID)) { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } @@ -806,76 +806,76 @@ public class UMLDiagramUpdater implements DiagramUpdater { @Override public List<UMLLinkDescriptor> getContainedLinks(View view) { String vid = UMLVisualIDRegistry.getVisualID(view); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DeploymentDiagramEditPart.VISUAL_ID: - return getPackage_1000ContainedLinks(view); + return getPackage_DeploymentDiagram_ContainedLinks(view); case DependencyNodeEditPart.VISUAL_ID: - return getDependency_2011ContainedLinks(view); + return getDependency_Shape_ContainedLinks(view); case ModelEditPart.VISUAL_ID: - return getModel_2010ContainedLinks(view); + return getModel_Shape_ContainedLinks(view); case PackageEditPart.VISUAL_ID: - return getPackage_2009ContainedLinks(view); + return getPackage_Shape_ContainedLinks(view); case ConstraintEditPart.VISUAL_ID: - return getConstraint_2005ContainedLinks(view); + return getConstraint_Shape_ContainedLinks(view); case CommentEditPart.VISUAL_ID: - return getComment_2001ContainedLinks(view); + return getComment_Shape_ContainedLinks(view); case ExecutionEnvironmentEditPart.VISUAL_ID: - return getExecutionEnvironment_2002ContainedLinks(view); + return getExecutionEnvironment_Shape_ContainedLinks(view); case DeviceEditPart.VISUAL_ID: - return getDevice_2003ContainedLinks(view); + return getDevice_Shape_ContainedLinks(view); case ArtifactEditPart.VISUAL_ID: - return getArtifact_2006ContainedLinks(view); + return getArtifact_Shape_ContainedLinks(view); case NodeEditPart.VISUAL_ID: - return getNode_2008ContainedLinks(view); + return getNode_Shape_ContainedLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: - return getNamedElement_2012ContainedLinks(view); + return getNamedElement_DefaultShape_ContainedLinks(view); case DeploymentSpecificationEditPart.VISUAL_ID: - return getDeploymentSpecification_2013ContainedLinks(view); + return getDeploymentSpecification_Shape_ContainedLinks(view); case ModelEditPartCN.VISUAL_ID: - return getModel_49ContainedLinks(view); + return getModel_Shape_CN_ContainedLinks(view); case PackageEditPartCN.VISUAL_ID: - return getPackage_36ContainedLinks(view); + return getPackage_Shape_CN_ContainedLinks(view); case DeviceEditPartCN.VISUAL_ID: - return getDevice_16ContainedLinks(view); + return getDevice_Shape_CCN_ContainedLinks(view); case NestedDeviceEditPartCN.VISUAL_ID: - return getDevice_44ContainedLinks(view); + return getDevice_Shape_CN_ContainedLinks(view); case ExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_21ContainedLinks(view); + return getExecutionEnvironment_Shape_CCN_ContainedLinks(view); case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_46ContainedLinks(view); + return getExecutionEnvironment_Shape_CN_ContainedLinks(view); case NodeEditPartCN.VISUAL_ID: - return getNode_23ContainedLinks(view); + return getNode_Shape_CCN_ContainedLinks(view); case NestedNodeEditPartCN.VISUAL_ID: - return getNode_42ContainedLinks(view); + return getNode_Shape_CN_ContainedLinks(view); case ArtifactEditPartCN.VISUAL_ID: - return getArtifact_25ContainedLinks(view); + return getArtifact_Shape_CCN_ContainedLinks(view); case ArtifactEditPartACN.VISUAL_ID: - return getArtifact_28ContainedLinks(view); + return getArtifact_Shape_ACN_ContainedLinks(view); case NestedArtifactNodeEditPartCN.VISUAL_ID: - return getArtifact_40ContainedLinks(view); + return getArtifact_Shape_CN_ContainedLinks(view); case CommentEditPartCN.VISUAL_ID: - return getComment_54ContainedLinks(view); + return getComment_Shape_CN_ContainedLinks(view); case ConstraintEditPartCN.VISUAL_ID: - return getConstraint_56ContainedLinks(view); + return getConstraint_Shape_CN_ContainedLinks(view); case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - return getDeploymentSpecification_2014ContainedLinks(view); + return getDeploymentSpecification_Shape_CCN_ContainedLinks(view); case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - return getDeploymentSpecification_2015ContainedLinks(view); + return getDeploymentSpecification_Shape_CN_ContainedLinks(view); case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - return getDeploymentSpecification_2016ContainedLinks(view); + return getDeploymentSpecification_Shape_ACN_ContainedLinks(view); case DeploymentEditPart.VISUAL_ID: - return getDeployment_4001ContainedLinks(view); + return getDeployment_Edge_ContainedLinks(view); case ManifestationEditPart.VISUAL_ID: - return getManifestation_4002ContainedLinks(view); + return getManifestation_Edge_ContainedLinks(view); case GeneralizationEditPart.VISUAL_ID: - return getGeneralization_4003ContainedLinks(view); + return getGeneralization_Edge_ContainedLinks(view); case DependencyEditPart.VISUAL_ID: - return getDependency_4004ContainedLinks(view); + return getDependency_Edge_ContainedLinks(view); case DependencyBranchEditPart.VISUAL_ID: - return getDependency_4010ContainedLinks(view); + return getDependency_BranchEdge_ContainedLinks(view); case CommunicationPathEditPart.VISUAL_ID: - return getCommunicationPath_4011ContainedLinks(view); + return getCommunicationPath_Edge_ContainedLinks(view); } } return Collections.emptyList(); @@ -887,74 +887,74 @@ public class UMLDiagramUpdater implements DiagramUpdater { @Override public List<UMLLinkDescriptor> getIncomingLinks(View view) { String vid = UMLVisualIDRegistry.getVisualID(view); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DependencyNodeEditPart.VISUAL_ID: - return getDependency_2011IncomingLinks(view); + return getDependency_Shape_IncomingLinks(view); case ModelEditPart.VISUAL_ID: - return getModel_2010IncomingLinks(view); + return getModel_Shape_IncomingLinks(view); case PackageEditPart.VISUAL_ID: - return getPackage_2009IncomingLinks(view); + return getPackage_Shape_IncomingLinks(view); case ConstraintEditPart.VISUAL_ID: - return getConstraint_2005IncomingLinks(view); + return getConstraint_Shape_IncomingLinks(view); case CommentEditPart.VISUAL_ID: - return getComment_2001IncomingLinks(view); + return getComment_Shape_IncomingLinks(view); case ExecutionEnvironmentEditPart.VISUAL_ID: - return getExecutionEnvironment_2002IncomingLinks(view); + return getExecutionEnvironment_Shape_IncomingLinks(view); case DeviceEditPart.VISUAL_ID: - return getDevice_2003IncomingLinks(view); + return getDevice_Shape_IncomingLinks(view); case ArtifactEditPart.VISUAL_ID: - return getArtifact_2006IncomingLinks(view); + return getArtifact_Shape_IncomingLinks(view); case NodeEditPart.VISUAL_ID: - return getNode_2008IncomingLinks(view); + return getNode_Shape_IncomingLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: - return getNamedElement_2012IncomingLinks(view); + return getNamedElement_DefaultShape_IncomingLinks(view); case DeploymentSpecificationEditPart.VISUAL_ID: - return getDeploymentSpecification_2013IncomingLinks(view); + return getDeploymentSpecification_Shape_IncomingLinks(view); case ModelEditPartCN.VISUAL_ID: - return getModel_49IncomingLinks(view); + return getModel_Shape_CN_IncomingLinks(view); case PackageEditPartCN.VISUAL_ID: - return getPackage_36IncomingLinks(view); + return getPackage_Shape_CN_IncomingLinks(view); case DeviceEditPartCN.VISUAL_ID: - return getDevice_16IncomingLinks(view); + return getDevice_Shape_CCN_IncomingLinks(view); case NestedDeviceEditPartCN.VISUAL_ID: - return getDevice_44IncomingLinks(view); + return getDevice_Shape_CN_IncomingLinks(view); case ExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_21IncomingLinks(view); + return getExecutionEnvironment_Shape_CCN_IncomingLinks(view); case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_46IncomingLinks(view); + return getExecutionEnvironment_Shape_CN_IncomingLinks(view); case NodeEditPartCN.VISUAL_ID: - return getNode_23IncomingLinks(view); + return getNode_Shape_CCN_IncomingLinks(view); case NestedNodeEditPartCN.VISUAL_ID: - return getNode_42IncomingLinks(view); + return getNode_Shape_CN_IncomingLinks(view); case ArtifactEditPartCN.VISUAL_ID: - return getArtifact_25IncomingLinks(view); + return getArtifact_Shape_CCN_IncomingLinks(view); case ArtifactEditPartACN.VISUAL_ID: - return getArtifact_28IncomingLinks(view); + return getArtifact_Shape_ACN_IncomingLinks(view); case NestedArtifactNodeEditPartCN.VISUAL_ID: - return getArtifact_40IncomingLinks(view); + return getArtifact_Shape_CN_IncomingLinks(view); case CommentEditPartCN.VISUAL_ID: - return getComment_54IncomingLinks(view); + return getComment_Shape_CN_IncomingLinks(view); case ConstraintEditPartCN.VISUAL_ID: - return getConstraint_56IncomingLinks(view); + return getConstraint_Shape_CN_IncomingLinks(view); case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - return getDeploymentSpecification_2014IncomingLinks(view); + return getDeploymentSpecification_Shape_CCN_IncomingLinks(view); case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - return getDeploymentSpecification_2015IncomingLinks(view); + return getDeploymentSpecification_Shape_CN_IncomingLinks(view); case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - return getDeploymentSpecification_2016IncomingLinks(view); + return getDeploymentSpecification_Shape_ACN_IncomingLinks(view); case DeploymentEditPart.VISUAL_ID: - return getDeployment_4001IncomingLinks(view); + return getDeployment_Edge_IncomingLinks(view); case ManifestationEditPart.VISUAL_ID: - return getManifestation_4002IncomingLinks(view); + return getManifestation_Edge_IncomingLinks(view); case GeneralizationEditPart.VISUAL_ID: - return getGeneralization_4003IncomingLinks(view); + return getGeneralization_Edge_IncomingLinks(view); case DependencyEditPart.VISUAL_ID: - return getDependency_4004IncomingLinks(view); + return getDependency_Edge_IncomingLinks(view); case DependencyBranchEditPart.VISUAL_ID: - return getDependency_4010IncomingLinks(view); + return getDependency_BranchEdge_IncomingLinks(view); case CommunicationPathEditPart.VISUAL_ID: - return getCommunicationPath_4011IncomingLinks(view); + return getCommunicationPath_Edge_IncomingLinks(view); } } return Collections.emptyList(); @@ -966,1459 +966,1527 @@ public class UMLDiagramUpdater implements DiagramUpdater { @Override public List<UMLLinkDescriptor> getOutgoingLinks(View view) { String vid = UMLVisualIDRegistry.getVisualID(view); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case DependencyNodeEditPart.VISUAL_ID: - return getDependency_2011OutgoingLinks(view); + return getDependency_Shape_OutgoingLinks(view); case ModelEditPart.VISUAL_ID: - return getModel_2010OutgoingLinks(view); + return getModel_Shape_OutgoingLinks(view); case PackageEditPart.VISUAL_ID: - return getPackage_2009OutgoingLinks(view); + return getPackage_Shape_OutgoingLinks(view); case ConstraintEditPart.VISUAL_ID: - return getConstraint_2005OutgoingLinks(view); + return getConstraint_Shape_OutgoingLinks(view); case CommentEditPart.VISUAL_ID: - return getComment_2001OutgoingLinks(view); + return getComment_Shape_OutgoingLinks(view); case ExecutionEnvironmentEditPart.VISUAL_ID: - return getExecutionEnvironment_2002OutgoingLinks(view); + return getExecutionEnvironment_Shape_OutgoingLinks(view); case DeviceEditPart.VISUAL_ID: - return getDevice_2003OutgoingLinks(view); + return getDevice_Shape_OutgoingLinks(view); case ArtifactEditPart.VISUAL_ID: - return getArtifact_2006OutgoingLinks(view); + return getArtifact_Shape_OutgoingLinks(view); case NodeEditPart.VISUAL_ID: - return getNode_2008OutgoingLinks(view); + return getNode_Shape_OutgoingLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: - return getNamedElement_2012OutgoingLinks(view); + return getNamedElement_DefaultShape_OutgoingLinks(view); case DeploymentSpecificationEditPart.VISUAL_ID: - return getDeploymentSpecification_2013OutgoingLinks(view); + return getDeploymentSpecification_Shape_OutgoingLinks(view); case ModelEditPartCN.VISUAL_ID: - return getModel_49OutgoingLinks(view); + return getModel_Shape_CN_OutgoingLinks(view); case PackageEditPartCN.VISUAL_ID: - return getPackage_36OutgoingLinks(view); + return getPackage_Shape_CN_OutgoingLinks(view); case DeviceEditPartCN.VISUAL_ID: - return getDevice_16OutgoingLinks(view); + return getDevice_Shape_CCN_OutgoingLinks(view); case NestedDeviceEditPartCN.VISUAL_ID: - return getDevice_44OutgoingLinks(view); + return getDevice_Shape_CN_OutgoingLinks(view); case ExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_21OutgoingLinks(view); + return getExecutionEnvironment_Shape_CCN_OutgoingLinks(view); case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - return getExecutionEnvironment_46OutgoingLinks(view); + return getExecutionEnvironment_Shape_CN_OutgoingLinks(view); case NodeEditPartCN.VISUAL_ID: - return getNode_23OutgoingLinks(view); + return getNode_Shape_CCN_OutgoingLinks(view); case NestedNodeEditPartCN.VISUAL_ID: - return getNode_42OutgoingLinks(view); + return getNode_Shape_CN_OutgoingLinks(view); case ArtifactEditPartCN.VISUAL_ID: - return getArtifact_25OutgoingLinks(view); + return getArtifact_Shape_CCN_OutgoingLinks(view); case ArtifactEditPartACN.VISUAL_ID: - return getArtifact_28OutgoingLinks(view); + return getArtifact_Shape_ACN_OutgoingLinks(view); case NestedArtifactNodeEditPartCN.VISUAL_ID: - return getArtifact_40OutgoingLinks(view); + return getArtifact_Shape_CN_OutgoingLinks(view); case CommentEditPartCN.VISUAL_ID: - return getComment_54OutgoingLinks(view); + return getComment_Shape_CN_OutgoingLinks(view); case ConstraintEditPartCN.VISUAL_ID: - return getConstraint_56OutgoingLinks(view); + return getConstraint_Shape_CN_OutgoingLinks(view); case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - return getDeploymentSpecification_2014OutgoingLinks(view); + return getDeploymentSpecification_Shape_CCN_OutgoingLinks(view); case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - return getDeploymentSpecification_2015OutgoingLinks(view); + return getDeploymentSpecification_Shape_CN_OutgoingLinks(view); case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - return getDeploymentSpecification_2016OutgoingLinks(view); + return getDeploymentSpecification_Shape_ACN_OutgoingLinks(view); case DeploymentEditPart.VISUAL_ID: - return getDeployment_4001OutgoingLinks(view); + return getDeployment_Edge_OutgoingLinks(view); case ManifestationEditPart.VISUAL_ID: - return getManifestation_4002OutgoingLinks(view); + return getManifestation_Edge_OutgoingLinks(view); case GeneralizationEditPart.VISUAL_ID: - return getGeneralization_4003OutgoingLinks(view); + return getGeneralization_Edge_OutgoingLinks(view); case DependencyEditPart.VISUAL_ID: - return getDependency_4004OutgoingLinks(view); + return getDependency_Edge_OutgoingLinks(view); case DependencyBranchEditPart.VISUAL_ID: - return getDependency_4010OutgoingLinks(view); + return getDependency_BranchEdge_OutgoingLinks(view); case CommunicationPathEditPart.VISUAL_ID: - return getCommunicationPath_4011OutgoingLinks(view); + return getCommunicationPath_Edge_OutgoingLinks(view); } } return Collections.emptyList(); } /** - * @generated - */ - public List<UMLLinkDescriptor> getPackage_1000ContainedLinks(View view) { - Package modelElement = (Package)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getPackage_DeploymentDiagram_ContainedLinks(View view) { + Package modelElement = (Package) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_2011ContainedLinks(View view) { + public List<UMLLinkDescriptor> getDependency_Shape_ContainedLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getModel_2010ContainedLinks(View view) { - Model modelElement = (Model)view.getElement(); + public List<UMLLinkDescriptor> getModel_Shape_ContainedLinks(View view) { + Model modelElement = (Model) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_2009ContainedLinks(View view) { - Package modelElement = (Package)view.getElement(); + public List<UMLLinkDescriptor> getPackage_Shape_ContainedLinks(View view) { + Package modelElement = (Package) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_2005ContainedLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); + public List<UMLLinkDescriptor> getConstraint_Shape_ContainedLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_2001ContainedLinks(View view) { - Comment modelElement = (Comment)view.getElement(); + public List<UMLLinkDescriptor> getComment_Shape_ContainedLinks(View view) { + Comment modelElement = (Comment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_2002ContainedLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_ContainedLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_2003ContainedLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_ContainedLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_2006ContainedLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_ContainedLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_2008ContainedLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_ContainedLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNamedElement_2012ContainedLinks(View view) { + public List<UMLLinkDescriptor> getNamedElement_DefaultShape_ContainedLinks(View view) { return Collections.emptyList(); } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2013ContainedLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getModel_49ContainedLinks(View view) { - Model modelElement = (Model)view.getElement(); + public List<UMLLinkDescriptor> getModel_Shape_CN_ContainedLinks(View view) { + Model modelElement = (Model) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_36ContainedLinks(View view) { - Package modelElement = (Package)view.getElement(); + public List<UMLLinkDescriptor> getPackage_Shape_CN_ContainedLinks(View view) { + Package modelElement = (Package) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_16ContainedLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_CCN_ContainedLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_44ContainedLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_CN_ContainedLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_21ContainedLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CCN_ContainedLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_46ContainedLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CN_ContainedLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_23ContainedLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_CCN_ContainedLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_42ContainedLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_CN_ContainedLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_25ContainedLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_CCN_ContainedLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_28ContainedLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_ACN_ContainedLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_40ContainedLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_CN_ContainedLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_54ContainedLinks(View view) { - Comment modelElement = (Comment)view.getElement(); + public List<UMLLinkDescriptor> getComment_Shape_CN_ContainedLinks(View view) { + Comment modelElement = (Comment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_56ContainedLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); + public List<UMLLinkDescriptor> getConstraint_Shape_CN_ContainedLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2014ContainedLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CCN_ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2015ContainedLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CN_ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2016ContainedLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_ACN_ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeployment_4001ContainedLinks(View view) { + public List<UMLLinkDescriptor> getDeployment_Edge_ContainedLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getManifestation_4002ContainedLinks(View view) { + public List<UMLLinkDescriptor> getManifestation_Edge_ContainedLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getGeneralization_4003ContainedLinks(View view) { + public List<UMLLinkDescriptor> getGeneralization_Edge_ContainedLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4004ContainedLinks(View view) { + public List<UMLLinkDescriptor> getDependency_Edge_ContainedLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4010ContainedLinks(View view) { + public List<UMLLinkDescriptor> getDependency_BranchEdge_ContainedLinks(View view) { return Collections.emptyList(); } /** - * @generated - */ - public List<UMLLinkDescriptor> getCommunicationPath_4011ContainedLinks(View view) { - CommunicationPath modelElement = (CommunicationPath)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getCommunicationPath_Edge_ContainedLinks(View view) { + CommunicationPath modelElement = (CommunicationPath) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_2011IncomingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDependency_Shape_IncomingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getModel_2010IncomingLinks(View view) { - Model modelElement = (Model)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getModel_Shape_IncomingLinks(View view) { + Model modelElement = (Model) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_2009IncomingLinks(View view) { - Package modelElement = (Package)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getPackage_Shape_IncomingLinks(View view) { + Package modelElement = (Package) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_2005IncomingLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getConstraint_Shape_IncomingLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_2001IncomingLinks(View view) { - Comment modelElement = (Comment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getComment_Shape_IncomingLinks(View view) { + Comment modelElement = (Comment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_2002IncomingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_IncomingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_2003IncomingLinks(View view) { - Device modelElement = (Device)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDevice_Shape_IncomingLinks(View view) { + Device modelElement = (Device) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_2006IncomingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getArtifact_Shape_IncomingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_2008IncomingLinks(View view) { - Node modelElement = (Node)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getNode_Shape_IncomingLinks(View view) { + Node modelElement = (Node) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNamedElement_2012IncomingLinks(View view) { - NamedElement modelElement = (NamedElement)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getNamedElement_DefaultShape_IncomingLinks(View view) { + NamedElement modelElement = (NamedElement) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2013IncomingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getModel_49IncomingLinks(View view) { - Model modelElement = (Model)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getModel_Shape_CN_IncomingLinks(View view) { + Model modelElement = (Model) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_36IncomingLinks(View view) { - Package modelElement = (Package)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getPackage_Shape_CN_IncomingLinks(View view) { + Package modelElement = (Package) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_16IncomingLinks(View view) { - Device modelElement = (Device)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDevice_Shape_CCN_IncomingLinks(View view) { + Device modelElement = (Device) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_44IncomingLinks(View view) { - Device modelElement = (Device)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDevice_Shape_CN_IncomingLinks(View view) { + Device modelElement = (Device) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_21IncomingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CCN_IncomingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_46IncomingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CN_IncomingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_23IncomingLinks(View view) { - Node modelElement = (Node)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getNode_Shape_CCN_IncomingLinks(View view) { + Node modelElement = (Node) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_42IncomingLinks(View view) { - Node modelElement = (Node)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getNode_Shape_CN_IncomingLinks(View view) { + Node modelElement = (Node) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_25IncomingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getArtifact_Shape_CCN_IncomingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_28IncomingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getArtifact_Shape_ACN_IncomingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_40IncomingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getArtifact_Shape_CN_IncomingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_54IncomingLinks(View view) { - Comment modelElement = (Comment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getComment_Shape_CN_IncomingLinks(View view) { + Comment modelElement = (Comment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_56IncomingLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getConstraint_Shape_CN_IncomingLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2014IncomingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CCN_IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2015IncomingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CN_IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2016IncomingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_ACN_IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeployment_4001IncomingLinks(View view) { - Deployment modelElement = (Deployment)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDeployment_Edge_IncomingLinks(View view) { + Deployment modelElement = (Deployment) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getManifestation_4002IncomingLinks(View view) { - Manifestation modelElement = (Manifestation)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getManifestation_Edge_IncomingLinks(View view) { + Manifestation modelElement = (Manifestation) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getGeneralization_4003IncomingLinks(View view) { - Generalization modelElement = (Generalization)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getGeneralization_Edge_IncomingLinks(View view) { + Generalization modelElement = (Generalization) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4004IncomingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDependency_Edge_IncomingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4010IncomingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + public List<UMLLinkDescriptor> getDependency_BranchEdge_IncomingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getCommunicationPath_4011IncomingLinks(View view) { - CommunicationPath modelElement = (CommunicationPath)view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + * @generated + */ + public List<UMLLinkDescriptor> getCommunicationPath_Edge_IncomingLinks(View view) { + CommunicationPath modelElement = (CommunicationPath) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter + .getCrossReferenceAdapter(view.eResource().getResourceSet()); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); + result.addAll( + getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_Edge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_BranchEdge(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_Edge(modelElement, crossReferencer)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_2011OutgoingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); + public List<UMLLinkDescriptor> getDependency_Shape_OutgoingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getModel_2010OutgoingLinks(View view) { - Model modelElement = (Model)view.getElement(); + public List<UMLLinkDescriptor> getModel_Shape_OutgoingLinks(View view) { + Model modelElement = (Model) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_2009OutgoingLinks(View view) { - Package modelElement = (Package)view.getElement(); + public List<UMLLinkDescriptor> getPackage_Shape_OutgoingLinks(View view) { + Package modelElement = (Package) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_2005OutgoingLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); + public List<UMLLinkDescriptor> getConstraint_Shape_OutgoingLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_2001OutgoingLinks(View view) { - Comment modelElement = (Comment)view.getElement(); + public List<UMLLinkDescriptor> getComment_Shape_OutgoingLinks(View view) { + Comment modelElement = (Comment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_2002OutgoingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_OutgoingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_2003OutgoingLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_OutgoingLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_2006OutgoingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_OutgoingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_2008OutgoingLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_OutgoingLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNamedElement_2012OutgoingLinks(View view) { - NamedElement modelElement = (NamedElement)view.getElement(); + public List<UMLLinkDescriptor> getNamedElement_DefaultShape_OutgoingLinks(View view) { + NamedElement modelElement = (NamedElement) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2013OutgoingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getModel_49OutgoingLinks(View view) { - Model modelElement = (Model)view.getElement(); + public List<UMLLinkDescriptor> getModel_Shape_CN_OutgoingLinks(View view) { + Model modelElement = (Model) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getPackage_36OutgoingLinks(View view) { - Package modelElement = (Package)view.getElement(); + public List<UMLLinkDescriptor> getPackage_Shape_CN_OutgoingLinks(View view) { + Package modelElement = (Package) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_16OutgoingLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_CCN_OutgoingLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDevice_44OutgoingLinks(View view) { - Device modelElement = (Device)view.getElement(); + public List<UMLLinkDescriptor> getDevice_Shape_CN_OutgoingLinks(View view) { + Device modelElement = (Device) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_21OutgoingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CCN_OutgoingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getExecutionEnvironment_46OutgoingLinks(View view) { - ExecutionEnvironment modelElement = (ExecutionEnvironment)view.getElement(); + public List<UMLLinkDescriptor> getExecutionEnvironment_Shape_CN_OutgoingLinks(View view) { + ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_23OutgoingLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_CCN_OutgoingLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getNode_42OutgoingLinks(View view) { - Node modelElement = (Node)view.getElement(); + public List<UMLLinkDescriptor> getNode_Shape_CN_OutgoingLinks(View view) { + Node modelElement = (Node) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_25OutgoingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_CCN_OutgoingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_28OutgoingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_ACN_OutgoingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getArtifact_40OutgoingLinks(View view) { - Artifact modelElement = (Artifact)view.getElement(); + public List<UMLLinkDescriptor> getArtifact_Shape_CN_OutgoingLinks(View view) { + Artifact modelElement = (Artifact) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getComment_54OutgoingLinks(View view) { - Comment modelElement = (Comment)view.getElement(); + public List<UMLLinkDescriptor> getComment_Shape_CN_OutgoingLinks(View view) { + Comment modelElement = (Comment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getConstraint_56OutgoingLinks(View view) { - Constraint modelElement = (Constraint)view.getElement(); + public List<UMLLinkDescriptor> getConstraint_Shape_CN_OutgoingLinks(View view) { + Constraint modelElement = (Constraint) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2014OutgoingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CCN_OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2015OutgoingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_CN_OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeploymentSpecification_2016OutgoingLinks(View view) { - DeploymentSpecification modelElement = (DeploymentSpecification)view.getElement(); + public List<UMLLinkDescriptor> getDeploymentSpecification_Shape_ACN_OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDeployment_4001OutgoingLinks(View view) { - Deployment modelElement = (Deployment)view.getElement(); + public List<UMLLinkDescriptor> getDeployment_Edge_OutgoingLinks(View view) { + Deployment modelElement = (Deployment) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getManifestation_4002OutgoingLinks(View view) { - Manifestation modelElement = (Manifestation)view.getElement(); + public List<UMLLinkDescriptor> getManifestation_Edge_OutgoingLinks(View view) { + Manifestation modelElement = (Manifestation) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getGeneralization_4003OutgoingLinks(View view) { + public List<UMLLinkDescriptor> getGeneralization_Edge_OutgoingLinks(View view) { return Collections.emptyList(); } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4004OutgoingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); + public List<UMLLinkDescriptor> getDependency_Edge_OutgoingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** * @generated */ - public List<UMLLinkDescriptor> getDependency_4010OutgoingLinks(View view) { - Dependency modelElement = (Dependency)view.getElement(); + public List<UMLLinkDescriptor> getDependency_BranchEdge_OutgoingLinks(View view) { + Dependency modelElement = (Dependency) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); return result; } /** - * @generated - */ - public List<UMLLinkDescriptor> getCommunicationPath_4011OutgoingLinks(View view) { - CommunicationPath modelElement = (CommunicationPath)view.getElement(); + * @generated + */ + public List<UMLLinkDescriptor> getCommunicationPath_Edge_OutgoingLinks(View view) { + CommunicationPath modelElement = (CommunicationPath) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_Edge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(modelElement)); return result; } /** * @generated */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Deployment_4001(DeploymentTarget container) { + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Deployment_Edge( + DeploymentTarget container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getDeployments().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Deployment) { + for (Iterator<?> links = container.getDeployments().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Deployment) { continue; } - Deployment link = (Deployment)linkObject; - if(!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Deployment link = (Deployment) linkObject; + if (!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_Edge, + DeploymentEditPart.VISUAL_ID)); } return result; } @@ -2426,30 +2494,31 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Manifestation_4002(Artifact container) { + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Manifestation_Edge(Artifact container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getManifestations().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Manifestation) { + for (Iterator<?> links = container.getManifestations().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Manifestation) { continue; } - Manifestation link = (Manifestation)linkObject; - if(!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Manifestation link = (Manifestation) linkObject; + if (!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_Edge, + ManifestationEditPart.VISUAL_ID)); } return result; } @@ -2457,20 +2526,21 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_4003(Classifier container) { + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_Edge(Classifier container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Generalization) { + for (Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Generalization) { continue; } - Generalization link = (Generalization)linkObject; - if(!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Generalization link = (Generalization) linkObject; + if (!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } Classifier dst = link.getGeneral(); Classifier src = link.getSpecific(); - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_Edge, + GeneralizationEditPart.VISUAL_ID)); } return result; } @@ -2478,30 +2548,31 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4004(Package container) { + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_Edge(Package container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Dependency) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Dependency) { continue; } - Dependency link = (Dependency)linkObject; - if(!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) linkObject; + if (!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_Edge, + DependencyEditPart.VISUAL_ID)); } return result; } @@ -2509,209 +2580,231 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4010(Package container) { + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_BranchEdge(Package container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Dependency) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Dependency) { continue; } - Dependency link = (Dependency)linkObject; - if(!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) linkObject; + if (!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_BranchEdge, + DependencyBranchEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_CommunicationPath_4011(Package container) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_CommunicationPath_Edge(Package container) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof CommunicationPath) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof CommunicationPath) { continue; } - CommunicationPath link = (CommunicationPath)linkObject; - if(!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + CommunicationPath link = (CommunicationPath) linkObject; + if (!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getEndTypes(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof Type) { + if (false == theTarget instanceof Type) { continue; } - Type dst = (Type)theTarget; + Type dst = (Type) theTarget; List<?> sources = link.getEndTypes(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof Type) { + if (false == theSource instanceof Type) { continue; } - Type src = (Type)theSource; - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.CommunicationPath_4011, CommunicationPathEditPart.VISUAL_ID)); + Type src = (Type) theSource; + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.CommunicationPath_Edge, + CommunicationPathEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Element target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge( + Element target, CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getComment_AnnotatedElement()) { - result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID)); + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getComment_AnnotatedElement()) { + result.add(new UMLLinkDescriptor(setting.getEObject(), target, + UMLElementTypes.Comment_AnnotatedElementEdge, CommentAnnotatedElementEditPart.VISUAL_ID)); } } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Element target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge( + Element target, CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) { - result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID)); + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) { + result.add(new UMLLinkDescriptor(setting.getEObject(), target, + UMLElementTypes.Constraint_ConstrainedElementEdge, + ConstraintConstrainedElementEditPart.VISUAL_ID)); } } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Deployment_4001(NamedElement target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Deployment_Edge(NamedElement target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Deployment) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() + || false == setting.getEObject() instanceof Deployment) { continue; } - Deployment link = (Deployment)setting.getEObject(); - if(!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Deployment link = (Deployment) setting.getEObject(); + if (!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Deployment_Edge, + DeploymentEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Manifestation_4002(NamedElement target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Manifestation_Edge(NamedElement target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Manifestation) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() + || false == setting.getEObject() instanceof Manifestation) { continue; } - Manifestation link = (Manifestation)setting.getEObject(); - if(!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Manifestation link = (Manifestation) setting.getEObject(); + if (!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Manifestation_Edge, + ManifestationEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_4003(Classifier target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_Edge(Classifier target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getGeneralization_General() || false == setting.getEObject() instanceof Generalization) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getGeneralization_General() + || false == setting.getEObject() instanceof Generalization) { continue; } - Generalization link = (Generalization)setting.getEObject(); - if(!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Generalization link = (Generalization) setting.getEObject(); + if (!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } Classifier src = link.getSpecific(); - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Generalization_Edge, + GeneralizationEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4004(NamedElement target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_Edge(NamedElement target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() + || false == setting.getEObject() instanceof Dependency) { continue; } - Dependency link = (Dependency)setting.getEObject(); - if(!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) setting.getEObject(); + if (!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_Edge, + DependencyEditPart.VISUAL_ID)); } return result; } /** - * @generated - */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4010(NamedElement target, CrossReferenceAdapter crossReferencer) { + * @generated + */ + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_BranchEdge(NamedElement target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() + || false == setting.getEObject() instanceof Dependency) { continue; } - Dependency link = (Dependency)setting.getEObject(); - if(!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) setting.getEObject(); + if (!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID)); + NamedElement src = (NamedElement) theSource; + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_BranchEdge, + DependencyBranchEditPart.VISUAL_ID)); } return result; } @@ -2719,24 +2812,27 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_CommunicationPath_4011(Type target, CrossReferenceAdapter crossReferencer) { + protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_CommunicationPath_Edge(Type target, + CrossReferenceAdapter crossReferencer) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for(EStructuralFeature.Setting setting : settings) { - if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getAssociation_EndType() || false == setting.getEObject() instanceof CommunicationPath) { + for (EStructuralFeature.Setting setting : settings) { + if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getAssociation_EndType() + || false == setting.getEObject() instanceof CommunicationPath) { continue; } - CommunicationPath link = (CommunicationPath)setting.getEObject(); - if(!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + CommunicationPath link = (CommunicationPath) setting.getEObject(); + if (!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> sources = link.getEndTypes(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof Type) { + if (false == theSource instanceof Type) { continue; } - Type src = (Type)theSource; - result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.CommunicationPath_4011, CommunicationPathEditPart.VISUAL_ID)); + Type src = (Type) theSource; + result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.CommunicationPath_Edge, + CommunicationPathEditPart.VISUAL_ID)); } return result; } @@ -2744,11 +2840,13 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Comment source) { + protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge( + Comment source) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> destinations = source.getAnnotatedElements().iterator(); destinations.hasNext();) { - Element destination = (Element)destinations.next(); - result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID)); + for (Iterator<?> destinations = source.getAnnotatedElements().iterator(); destinations.hasNext();) { + Element destination = (Element) destinations.next(); + result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.Comment_AnnotatedElementEdge, + CommentAnnotatedElementEditPart.VISUAL_ID)); } return result; } @@ -2756,11 +2854,13 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Constraint source) { + protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge( + Constraint source) { LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> destinations = source.getConstrainedElements().iterator(); destinations.hasNext();) { - Element destination = (Element)destinations.next(); - result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID)); + for (Iterator<?> destinations = source.getConstrainedElements().iterator(); destinations.hasNext();) { + Element destination = (Element) destinations.next(); + result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.Constraint_ConstrainedElementEdge, + ConstraintConstrainedElementEditPart.VISUAL_ID)); } return result; } @@ -2768,45 +2868,46 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Deployment_4001(NamedElement source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Deployment_Edge(NamedElement source) { DeploymentTarget container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof DeploymentTarget) { - container = (DeploymentTarget)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof DeploymentTarget) { + container = (DeploymentTarget) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getDeployments().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Deployment) { + for (Iterator<?> links = container.getDeployments().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Deployment) { continue; } - Deployment link = (Deployment)linkObject; - if(!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Deployment link = (Deployment) linkObject; + if (!DeploymentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - if(src != source) { + NamedElement src = (NamedElement) theSource; + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_Edge, + DeploymentEditPart.VISUAL_ID)); } return result; } @@ -2814,45 +2915,46 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Manifestation_4002(NamedElement source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Manifestation_Edge(NamedElement source) { Artifact container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof Artifact) { - container = (Artifact)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof Artifact) { + container = (Artifact) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getManifestations().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Manifestation) { + for (Iterator<?> links = container.getManifestations().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Manifestation) { continue; } - Manifestation link = (Manifestation)linkObject; - if(!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Manifestation link = (Manifestation) linkObject; + if (!ManifestationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - if(src != source) { + NamedElement src = (NamedElement) theSource; + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_Edge, + ManifestationEditPart.VISUAL_ID)); } return result; } @@ -2860,35 +2962,36 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Generalization_4003(Classifier source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Generalization_Edge(Classifier source) { Classifier container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof Classifier) { - container = (Classifier)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof Classifier) { + container = (Classifier) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Generalization) { + for (Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Generalization) { continue; } - Generalization link = (Generalization)linkObject; - if(!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Generalization link = (Generalization) linkObject; + if (!GeneralizationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } Classifier dst = link.getGeneral(); Classifier src = link.getSpecific(); - if(src != source) { + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_Edge, + GeneralizationEditPart.VISUAL_ID)); } return result; } @@ -2896,45 +2999,46 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4004(NamedElement source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_Edge(NamedElement source) { Package container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof Package) { - container = (Package)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof Package) { + container = (Package) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Dependency) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Dependency) { continue; } - Dependency link = (Dependency)linkObject; - if(!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) linkObject; + if (!DependencyEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - if(src != source) { + NamedElement src = (NamedElement) theSource; + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_Edge, + DependencyEditPart.VISUAL_ID)); } return result; } @@ -2942,45 +3046,46 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4010(NamedElement source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_BranchEdge(NamedElement source) { Package container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof Package) { - container = (Package)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof Package) { + container = (Package) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof Dependency) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof Dependency) { continue; } - Dependency link = (Dependency)linkObject; - if(!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + Dependency link = (Dependency) linkObject; + if (!DependencyBranchEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getSuppliers(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof NamedElement) { + if (false == theTarget instanceof NamedElement) { continue; } - NamedElement dst = (NamedElement)theTarget; + NamedElement dst = (NamedElement) theTarget; List<?> sources = link.getClients(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof NamedElement) { + if (false == theSource instanceof NamedElement) { continue; } - NamedElement src = (NamedElement)theSource; - if(src != source) { + NamedElement src = (NamedElement) theSource; + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_BranchEdge, + DependencyBranchEditPart.VISUAL_ID)); } return result; } @@ -2988,45 +3093,46 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_CommunicationPath_4011(Type source) { + protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_CommunicationPath_Edge(Type source) { Package container = null; // Find container element for the link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. - for(EObject element = source; element != null && container == null; element = element.eContainer()) { - if(element instanceof Package) { - container = (Package)element; + for (EObject element = source; element != null && container == null; element = element.eContainer()) { + if (element instanceof Package) { + container = (Package) element; } } - if(container == null) { + if (container == null) { return Collections.emptyList(); } LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); - for(Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { - EObject linkObject = (EObject)links.next(); - if(false == linkObject instanceof CommunicationPath) { + for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) { + EObject linkObject = (EObject) links.next(); + if (false == linkObject instanceof CommunicationPath) { continue; } - CommunicationPath link = (CommunicationPath)linkObject; - if(!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { + CommunicationPath link = (CommunicationPath) linkObject; + if (!CommunicationPathEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getLinkWithClassVisualID(link))) { continue; } List<?> targets = link.getEndTypes(); Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if(false == theTarget instanceof Type) { + if (false == theTarget instanceof Type) { continue; } - Type dst = (Type)theTarget; + Type dst = (Type) theTarget; List<?> sources = link.getEndTypes(); Object theSource = sources.size() == 1 ? sources.get(0) : null; - if(false == theSource instanceof Type) { + if (false == theSource instanceof Type) { continue; } - Type src = (Type)theSource; - if(src != source) { + Type src = (Type) theSource; + if (src != source) { continue; } - result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.CommunicationPath_4011, CommunicationPathEditPart.VISUAL_ID)); + result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.CommunicationPath_Edge, + CommunicationPathEditPart.VISUAL_ID)); } return result; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java index d2436ed1fdb..99cfec9b5f7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java @@ -75,12 +75,16 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override protected ElementInfo createElementInfo(Object element) throws CoreException { - if(false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) { - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[]{ element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); + if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) { + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, + new Object[] { element, "org.eclipse.ui.part.FileEditorInput", //$NON-NLS-1$ + "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ + null)); } - IEditorInput editorInput = (IEditorInput)element; - IDiagramDocument document = (IDiagramDocument)createDocument(editorInput); + IEditorInput editorInput = (IEditorInput) element; + IDiagramDocument document = (IDiagramDocument) createDocument(editorInput); + ResourceSetInfo info = new ResourceSetInfo(document, editorInput); info.setModificationStamp(computeModificationStamp(info)); info.fStatus = null; @@ -92,12 +96,15 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override protected IDocument createDocument(Object element) throws CoreException { - if(false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) { - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[]{ element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); + if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) { + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, + new Object[] { element, "org.eclipse.ui.part.FileEditorInput", //$NON-NLS-1$ + "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ + null)); } IDocument document = createEmptyDocument(); - setDocumentContent(document, (IEditorInput)element); + setDocumentContent(document, (IEditorInput) element); setupDocument(element, document); return document; } @@ -122,11 +129,11 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ private long computeModificationStamp(ResourceSetInfo info) { int result = 0; - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null) { - if(file.getLocation() != null) { + if (file != null) { + if (file.getLocation() != null) { result += file.getLocation().toFile().lastModified(); } else { result += file.getModificationStamp(); @@ -152,7 +159,10 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi private TransactionalEditingDomain createEditingDomain() { TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain(); editingDomain.setID("org.eclipse.papyrus.uml.diagram.deployment.EditingDomain"); //$NON-NLS-1$ - final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(NotificationFilter.createEventTypeFilter(Notification.ADD)).and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES)); + final NotificationFilter diagramResourceModifiedFilter = NotificationFilter + .createNotifierFilter(editingDomain.getResourceSet()) + .and(NotificationFilter.createEventTypeFilter(Notification.ADD)) + .and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES)); editingDomain.getResourceSet().eAdapters().add(new Adapter() { private Notifier myTarger; @@ -169,10 +179,10 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public void notifyChanged(Notification notification) { - if(diagramResourceModifiedFilter.matches(notification)) { + if (diagramResourceModifiedFilter.matches(notification)) { Object value = notification.getNewValue(); - if(value instanceof Resource) { - ((Resource)value).setTrackingModification(true); + if (value instanceof Resource) { + ((Resource) value).setTrackingModification(true); } } } @@ -181,7 +191,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi public void setTarget(Notifier newTarget) { myTarger = newTarget; } + }); + return editingDomain; } @@ -189,21 +201,21 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi * @generated */ protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException { - IDiagramDocument diagramDocument = (IDiagramDocument)document; + IDiagramDocument diagramDocument = (IDiagramDocument) document; TransactionalEditingDomain domain = diagramDocument.getEditingDomain(); - if(element instanceof FileEditorInput) { - IStorage storage = ((FileEditorInput)element).getStorage(); + if (element instanceof FileEditorInput) { + IStorage storage = ((FileEditorInput) element).getStorage(); Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor()); document.setContent(diagram); - } else if(element instanceof URIEditorInput) { - URI uri = ((URIEditorInput)element).getURI(); + } else if (element instanceof URIEditorInput) { + URI uri = ((URIEditorInput) element).getURI(); Resource resource = null; try { resource = domain.getResourceSet().getResource(uri.trimFragment(), false); - if(resource == null) { + if (resource == null) { resource = domain.getResourceSet().createResource(uri.trimFragment()); } - if(!resource.isLoaded()) { + if (!resource.isLoaded()) { try { @SuppressWarnings({ "rawtypes", "unchecked" }) Map<?, ?> options = new HashMap(GMFResourceFactory.getDefaultLoadOptions()); @@ -215,16 +227,16 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi throw e; } } - if(uri.fragment() != null) { + if (uri.fragment() != null) { EObject rootElement = resource.getEObject(uri.fragment()); - if(rootElement instanceof Diagram) { + if (rootElement instanceof Diagram) { document.setContent(rootElement); return; } } else { - for(Iterator<EObject> it = resource.getContents().iterator(); it.hasNext();) { + for (Iterator<EObject> it = resource.getContents().iterator(); it.hasNext();) { Object rootElement = it.next(); - if(rootElement instanceof Diagram) { + if (rootElement instanceof Diagram) { document.setContent(rootElement); return; } @@ -233,17 +245,21 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi throw new RuntimeException(Messages.UMLDocumentProvider_NoDiagramInResourceError); } catch (Exception e) { CoreException thrownExcp = null; - if(e instanceof CoreException) { - thrownExcp = (CoreException)e; + if (e instanceof CoreException) { + thrownExcp = (CoreException) e; } else { String msg = e.getLocalizedMessage(); - thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, msg != null ? msg : Messages.UMLDocumentProvider_DiagramLoadingError, e)); + thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + msg != null ? msg : Messages.UMLDocumentProvider_DiagramLoadingError, e)); } throw thrownExcp; } } else { - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[]{ element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, + new Object[] { element, "org.eclipse.ui.part.FileEditorInput", //$NON-NLS-1$ + "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ + null)); } } @@ -253,7 +269,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public long getModificationStamp(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { return computeModificationStamp(info); } return super.getModificationStamp(element); @@ -265,9 +281,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public boolean isDeleted(Object element) { IDiagramDocument document = getDiagramDocument(element); - if(document != null) { + if (document != null) { Resource diagramResource = document.getDiagram().eResource(); - if(diagramResource != null) { + if (diagramResource != null) { IFile file = WorkspaceSynchronizer.getFile(diagramResource); return file == null || file.getLocation() == null || !file.getLocation().toFile().exists(); } @@ -279,7 +295,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi * @generated */ public ResourceSetInfo getResourceSetInfo(Object editorInput) { - return (ResourceSetInfo)super.getElementInfo(editorInput); + return (ResourceSetInfo) super.getElementInfo(editorInput); } /** @@ -287,8 +303,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override protected void disposeElementInfo(Object element, ElementInfo info) { - if(info instanceof ResourceSetInfo) { - ResourceSetInfo resourceSetInfo = (ResourceSetInfo)info; + if (info instanceof ResourceSetInfo) { + ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info; resourceSetInfo.dispose(); } super.disposeElementInfo(element, info); @@ -300,17 +316,19 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected void doValidateState(Object element, Object computationContext) throws CoreException { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { LinkedList<IFile> files2Validate = new LinkedList<IFile>(); - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null && file.isReadOnly()) { + if (file != null && file.isReadOnly()) { files2Validate.add(file); } } - ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new IFile[files2Validate.size()]), computationContext); + ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new IFile[files2Validate.size()]), + computationContext); } + super.doValidateState(element, computationContext); } @@ -320,8 +338,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public boolean isReadOnly(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { - if(info.isUpdateCache()) { + if (info != null) { + if (info.isUpdateCache()) { try { updateCache(element); } catch (CoreException ex) { @@ -339,14 +357,14 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override public boolean isModifiable(Object element) { - if(!isStateValidated(element)) { - if(element instanceof FileEditorInput || element instanceof URIEditorInput) { + if (!isStateValidated(element)) { + if (element instanceof FileEditorInput || element instanceof URIEditorInput) { return true; } } ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { - if(info.isUpdateCache()) { + if (info != null) { + if (info.isUpdateCache()) { try { updateCache(element); } catch (CoreException ex) { @@ -364,11 +382,11 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ protected void updateCache(Object element) throws CoreException { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + if (info != null) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null && file.isReadOnly()) { + if (file != null && file.isReadOnly()) { info.setReadOnly(true); info.setModifiable(false); return; @@ -386,7 +404,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected void doUpdateStateCache(Object element) throws CoreException { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { info.setUpdateCache(true); } super.doUpdateStateCache(element); @@ -398,7 +416,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public boolean isSynchronized(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { return info.isSynchronized(); } return super.isSynchronized(element); @@ -410,12 +428,12 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected ISchedulingRule getResetRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>(); - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null) { + if (file != null) { rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file)); } } @@ -430,12 +448,12 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected ISchedulingRule getSaveRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>(); - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null) { + if (file != null) { rules.add(computeSchedulingRule(file)); } } @@ -450,12 +468,12 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected ISchedulingRule getSynchronizeRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>(); - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null) { + if (file != null) { rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file)); } } @@ -470,16 +488,17 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected ISchedulingRule getValidateStateRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { + if (info != null) { LinkedList<ISchedulingRule> files = new LinkedList<ISchedulingRule>(); - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); IFile file = WorkspaceSynchronizer.getFile(nextResource); - if(file != null) { + if (file != null) { files.add(file); } } - return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule(files.toArray(new IFile[files.size()])); + return ResourcesPlugin.getWorkspace().getRuleFactory() + .validateEditRule(files.toArray(new IFile[files.size()])); } return null; } @@ -488,7 +507,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi * @generated */ private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) { - if(toCreateOrModify.exists()) { + if (toCreateOrModify.exists()) { return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify); } IResource parent = toCreateOrModify; @@ -501,7 +520,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ toCreateOrModify = parent; parent = toCreateOrModify.getParent(); - } while(parent != null && !parent.exists()); + } while (parent != null && !parent.exists()); + return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify); } @@ -511,8 +531,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + if (info != null) { + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); handleElementChanged(info, nextResource, monitor); } @@ -525,25 +545,31 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi * @generated */ @Override - protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { + protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) + throws CoreException { ResourceSetInfo info = getResourceSetInfo(element); - if(info != null) { - if(!overwrite && !info.isSynchronized()) { - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, null)); + if (info != null) { + if (!overwrite && !info.isSynchronized()) { + throw new CoreException( + new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, + Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, null)); } info.stopResourceListening(); fireElementStateChanging(element); try { - monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); //"Saving diagram" - for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { + monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, + info.getResourceSet().getResources().size() + 1); //"Saving diagram" + for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = it.next(); - monitor.setTaskName(NLS.bind(Messages.UMLDocumentProvider_SaveNextResourceTask, nextResource.getURI())); - if(nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) { + monitor.setTaskName( + NLS.bind(Messages.UMLDocumentProvider_SaveNextResourceTask, nextResource.getURI())); + if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) { try { nextResource.save(UMLDiagramEditorUtil.getSaveOptions()); } catch (IOException e) { fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null)); + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, + EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null)); } } monitor.worked(1); @@ -559,29 +585,37 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi } else { URI newResoruceURI; List<IFile> affectedFiles = null; - if(element instanceof FileEditorInput) { - IFile newFile = ((FileEditorInput)element).getFile(); + if (element instanceof FileEditorInput) { + IFile newFile = ((FileEditorInput) element).getFile(); affectedFiles = Collections.singletonList(newFile); newResoruceURI = URI.createPlatformResourceURI(newFile.getFullPath().toString(), true); - } else if(element instanceof URIEditorInput) { - newResoruceURI = ((URIEditorInput)element).getURI(); + } else if (element instanceof URIEditorInput) { + newResoruceURI = ((URIEditorInput) element).getURI(); } else { fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[]{ element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, + new Object[] { element, "org.eclipse.ui.part.FileEditorInput", //$NON-NLS-1$ + "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ + null)); } - if(false == document instanceof IDiagramDocument) { + if (false == document instanceof IDiagramDocument) { fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$ + throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, + "Incorrect document used: " + document //$NON-NLS-1$ + + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", //$NON-NLS-1$ + null)); } - IDiagramDocument diagramDocument = (IDiagramDocument)document; - final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI); + IDiagramDocument diagramDocument = (IDiagramDocument) document; + final Resource newResource = diagramDocument.getEditingDomain().getResourceSet() + .createResource(newResoruceURI); final Diagram diagramCopy = EcoreUtil.copy(diagramDocument.getDiagram()); try { - new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) { - + new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), + NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) { @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { newResource.getContents().add(diagramCopy); return CommandResult.newOKCommandResult(); } @@ -589,10 +623,12 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi newResource.save(UMLDiagramEditorUtil.getSaveOptions()); } catch (ExecutionException e) { fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null)); + throw new CoreException( + new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null)); } catch (IOException e) { fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null)); + throw new CoreException( + new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null)); } newResource.unload(); } @@ -603,15 +639,17 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ protected void handleElementChanged(ResourceSetInfo info, Resource changedResource, IProgressMonitor monitor) { IFile file = WorkspaceSynchronizer.getFile(changedResource); - if(file != null) { + if (file != null) { try { file.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (CoreException ex) { - UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_handleElementContentChanged, ex); + UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_handleElementContentChanged, + ex); // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged } } changedResource.unload(); + fireElementContentAboutToBeReplaced(info.getEditorInput()); removeUnchangedElementListeners(info.getEditorInput(), info); info.fStatus = null; @@ -620,7 +658,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi } catch (CoreException e) { info.fStatus = e.getStatus(); } - if(!info.fCanBeSaved) { + if (!info.fCanBeSaved) { info.setModificationStamp(computeModificationStamp(info)); } addUnchangedElementListeners(info.getEditorInput(), info); @@ -631,8 +669,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi * @generated */ protected void handleElementMoved(IEditorInput input, URI uri) { - if(input instanceof FileEditorInput) { - IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(URI.decode(uri.path())).removeFirstSegments(1)); + if (input instanceof FileEditorInput) { + IFile newFile = ResourcesPlugin.getWorkspace().getRoot() + .getFile(new Path(URI.decode(uri.path())).removeFirstSegments(1)); fireElementMoved(input, newFile == null ? null : new FileEditorInput(newFile)); return; } @@ -654,8 +693,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi @Override public IDiagramDocument getDiagramDocument(Object element) { IDocument doc = getDocument(element); - if(doc instanceof IDiagramDocument) { - return (IDiagramDocument)doc; + if (doc instanceof IDiagramDocument) { + return (IDiagramDocument) doc; } return null; } @@ -778,7 +817,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi public void dispose() { stopResourceListening(); getResourceSet().eAdapters().remove(myResourceSetListener); - for(Iterator<Resource> it = getLoadedResourcesIterator(); it.hasNext();) { + for (Iterator<Resource> it = getLoadedResourcesIterator(); it.hasNext();) { Resource resource = it.next(); resource.unload(); } @@ -880,14 +919,13 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override public boolean handleResourceChanged(final Resource resource) { - synchronized(ResourceSetInfo.this) { - if(ResourceSetInfo.this.fCanBeSaved) { + synchronized (ResourceSetInfo.this) { + if (ResourceSetInfo.this.fCanBeSaved) { ResourceSetInfo.this.setUnSynchronized(resource); return true; } } Display.getDefault().asyncExec(new Runnable() { - @Override public void run() { handleElementChanged(ResourceSetInfo.this, resource, null); @@ -901,14 +939,13 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override public boolean handleResourceDeleted(Resource resource) { - synchronized(ResourceSetInfo.this) { - if(ResourceSetInfo.this.fCanBeSaved) { + synchronized (ResourceSetInfo.this) { + if (ResourceSetInfo.this.fCanBeSaved) { ResourceSetInfo.this.setUnSynchronized(resource); return true; } } Display.getDefault().asyncExec(new Runnable() { - @Override public void run() { fireElementDeleted(ResourceSetInfo.this.getEditorInput()); @@ -922,15 +959,14 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override public boolean handleResourceMoved(Resource resource, final URI newURI) { - synchronized(ResourceSetInfo.this) { - if(ResourceSetInfo.this.fCanBeSaved) { + synchronized (ResourceSetInfo.this) { + if (ResourceSetInfo.this.fCanBeSaved) { ResourceSetInfo.this.setUnSynchronized(resource); return true; } } - if(myDocument.getDiagram().eResource() == resource) { + if (myDocument.getDiagram().eResource() == resource) { Display.getDefault().asyncExec(new Runnable() { - @Override public void run() { handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI); @@ -964,7 +1000,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ public ResourceSetModificationListener(ResourceSetInfo info) { myInfo = info; - myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET).or(NotificationFilter.createEventTypeFilter(Notification.UNSET)).and(NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED)); + myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET) + .or(NotificationFilter.createEventTypeFilter(Notification.UNSET)) + .and(NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED)); } /** @@ -972,33 +1010,34 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi */ @Override public void notifyChanged(Notification notification) { - if(notification.getNotifier() instanceof ResourceSet) { + if (notification.getNotifier() instanceof ResourceSet) { super.notifyChanged(notification); } - if(!notification.isTouch() && myModifiedFilter.matches(notification)) { - if(notification.getNotifier() instanceof Resource) { - Resource resource = (Resource)notification.getNotifier(); - if(resource.isLoaded()) { + if (!notification.isTouch() && myModifiedFilter.matches(notification)) { + if (notification.getNotifier() instanceof Resource) { + Resource resource = (Resource) notification.getNotifier(); + if (resource.isLoaded()) { boolean modified = false; - for(Iterator<Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) { + for (Iterator<Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) { Resource nextResource = it.next(); - if(nextResource.isLoaded()) { + if (nextResource.isLoaded()) { modified = nextResource.isModified(); } } boolean dirtyStateChanged = false; - synchronized(myInfo) { - if(modified != myInfo.fCanBeSaved) { + synchronized (myInfo) { + if (modified != myInfo.fCanBeSaved) { myInfo.fCanBeSaved = modified; dirtyStateChanged = true; } - if(!resource.isModified()) { + if (!resource.isModified()) { myInfo.setSynchronized(resource); } } - if(dirtyStateChanged) { + if (dirtyStateChanged) { fireElementDirtyStateChanged(myInfo.getEditorInput(), modified); - if(!modified) { + + if (!modified) { myInfo.setModificationStamp(computeModificationStamp(myInfo)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java index fab05caa809..c9d3998711e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java @@ -60,10 +60,10 @@ public class UMLInitDiagramFileAction implements IObjectActionDelegate { public void selectionChanged(IAction action, ISelection selection) { domainModelURI = null; action.setEnabled(false); - if(selection instanceof IStructuredSelection == false || selection.isEmpty()) { + if (selection instanceof IStructuredSelection == false || selection.isEmpty()) { return; } - IFile file = (IFile)((IStructuredSelection)selection).getFirstElement(); + IFile file = (IFile) ((IStructuredSelection) selection).getFirstElement(); domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true); action.setEnabled(true); } @@ -89,8 +89,9 @@ public class UMLInitDiagramFileAction implements IObjectActionDelegate { } catch (WrappedException ex) { UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$ } - if(diagramRoot == null) { - MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage); + if (diagramRoot == null) { + MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, + Messages.InitDiagramFile_ResourceErrorDialogMessage); return; } Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java index f3930f5e737..853d4d58eda 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java @@ -30,7 +30,8 @@ public class UMLLinkDescriptor extends UpdaterLinkDescriptor { /** * @generated */ - public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, String linkVID) { + public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, + String linkVID) { super(source, destination, linkElement, elementType, linkVID); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java index 451178b481f..fb5bc73e394 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java @@ -33,11 +33,12 @@ public class UMLMatchingStrategy implements IEditorMatchingStrategy { } catch (PartInitException e) { return false; } - if(editorInput.equals(input)) { + + if (editorInput.equals(input)) { return true; } - if(editorInput instanceof URIEditorInput && input instanceof URIEditorInput) { - return ((URIEditorInput)editorInput).getURI().equals(((URIEditorInput)input).getURI()); + if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) { + return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI()); } return false; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java index 5a1f5de8149..83907b64558 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java @@ -67,25 +67,32 @@ public class UMLNewDiagramFileWizard extends Wizard { assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$ - myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY); + + myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, + StructuredSelection.EMPTY); myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle); - myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, DeploymentDiagramEditPart.MODEL_ID)); + myFileCreationPage.setDescription( + NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, DeploymentDiagramEditPart.MODEL_ID)); IPath filePath; String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment()); - if(domainModelURI.isPlatformResource()) { + if (domainModelURI.isPlatformResource()) { filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true)); - } else if(domainModelURI.isFile()) { + } else if (domainModelURI.isFile()) { filePath = new Path(domainModelURI.trimSegments(1).toFileString()); } else { // TODO : use some default path throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$ } myFileCreationPage.setContainerFullPath(filePath); - myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLDeployment_diagram")); //$NON-NLS-1$ - diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.UMLNewDiagramFileWizard_RootSelectionPageName); + myFileCreationPage.setFileName( + UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLDeployment_diagram")); //$NON-NLS-1$ + + diagramRootElementSelectionPage = new DiagramRootElementSelectionPage( + Messages.UMLNewDiagramFileWizard_RootSelectionPageName); diagramRootElementSelectionPage.setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle); diagramRootElementSelectionPage.setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription); diagramRootElementSelectionPage.setModelElement(diagramRoot); + myEditingDomain = editingDomain; } @@ -110,15 +117,19 @@ public class UMLNewDiagramFileWizard extends Wizard { URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true); ResourceSet resourceSet = myEditingDomain.getResourceSet(); final Resource diagramResource = resourceSet.createResource(diagramModelURI); - AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) { + AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, + Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) { @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - String diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement()); - if(diagramVID.equals(DeploymentDiagramEditPart.VISUAL_ID)) { + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { + String diagramVID = UMLVisualIDRegistry + .getDiagramVisualID(diagramRootElementSelectionPage.getModelElement()); + if (diagramVID.equals(DeploymentDiagramEditPart.VISUAL_ID)) { return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError); } - Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); + Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), + DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); diagramResource.getContents().add(diagram); return CommandResult.newOKCommandResult(); } @@ -162,11 +173,13 @@ public class UMLNewDiagramFileWizard extends Wizard { */ @Override protected boolean validatePage() { - if(getModelElement() == null) { + if (getModelElement() == null) { setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage); return false; } - boolean result = ViewService.getInstance().provides(new CreateDiagramViewOperation(new EObjectAdapter(getModelElement()), DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT)); + boolean result = ViewService.getInstance() + .provides(new CreateDiagramViewOperation(new EObjectAdapter(getModelElement()), + DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT)); setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage); return result; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java index d8f3ebb5e43..dccdd4dc546 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java @@ -113,6 +113,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ public UMLPaletteFactory() { + } /** @@ -120,52 +121,52 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ @Override public Tool createTool(String toolId) { - if(toolId.equals(DEPLOYMENT_TOOL_ARTIFACT)) { + if (toolId.equals(DEPLOYMENT_TOOL_ARTIFACT)) { return createArtifactCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_COMMENT)) { + if (toolId.equals(DEPLOYMENT_TOOL_COMMENT)) { return createCommentCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_CONSTRAINT)) { + if (toolId.equals(DEPLOYMENT_TOOL_CONSTRAINT)) { return createConstraintCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_DEVICE)) { + if (toolId.equals(DEPLOYMENT_TOOL_DEVICE)) { return createDeviceCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENTSPECIFICATION)) { + if (toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENTSPECIFICATION)) { return createDeploymentSpecification5CreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT)) { + if (toolId.equals(DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT)) { return createExecutionEnvironmentCreationTool(); } - if(toolId.equals(CREATEMODELCREATIONTOOL)) { + if (toolId.equals(CREATEMODELCREATIONTOOL)) { return createModelCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_NODE)) { + if (toolId.equals(DEPLOYMENT_TOOL_NODE)) { return createNodeCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_PACKAGE)) { + if (toolId.equals(DEPLOYMENT_TOOL_PACKAGE)) { return createPackageCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_COMMUNICATIONPATH)) { + if (toolId.equals(DEPLOYMENT_TOOL_COMMUNICATIONPATH)) { return createCommunicationPath1CreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_DEPENDENCY)) { + if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCY)) { return createDependencyCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_DEPENDENCYBRANCH)) { + if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCYBRANCH)) { return createDependencyBranchCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENT)) { + if (toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENT)) { return createDeploymentCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_GENERALIZATION)) { + if (toolId.equals(DEPLOYMENT_TOOL_GENERALIZATION)) { return createGeneralizationCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_LINK)) { + if (toolId.equals(DEPLOYMENT_TOOL_LINK)) { return createLinkCreationTool(); } - if(toolId.equals(DEPLOYMENT_TOOL_MANIFESTATION)) { + if (toolId.equals(DEPLOYMENT_TOOL_MANIFESTATION)) { return createManifestationCreationTool(); } // default return: null @@ -177,6 +178,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ @Override public Object getTemplate(String templateId) { + // default return: null return null; } @@ -186,8 +188,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createModelCreationTool() { List<IElementType> types = new ArrayList<IElementType>(2); - types.add(UMLElementTypes.Model_49); - types.add(UMLElementTypes.Model_2010); + types.add(UMLElementTypes.Model_Shape_CN); + types.add(UMLElementTypes.Model_Shape); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -197,8 +199,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createPackageCreationTool() { List<IElementType> types = new ArrayList<IElementType>(2); - types.add(UMLElementTypes.Package_2009); - types.add(UMLElementTypes.Package_36); + types.add(UMLElementTypes.Package_Shape); + types.add(UMLElementTypes.Package_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -208,7 +210,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createCommunicationPath1CreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.CommunicationPath_4011); + types.add(UMLElementTypes.CommunicationPath_Edge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -218,9 +220,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createNodeCreationTool() { List<IElementType> types = new ArrayList<IElementType>(3); - types.add(UMLElementTypes.Node_2008); - types.add(UMLElementTypes.Node_23); - types.add(UMLElementTypes.Node_42); + types.add(UMLElementTypes.Node_Shape); + types.add(UMLElementTypes.Node_Shape_CCN); + types.add(UMLElementTypes.Node_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -230,9 +232,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createDeviceCreationTool() { List<IElementType> types = new ArrayList<IElementType>(3); - types.add(UMLElementTypes.Device_2003); - types.add(UMLElementTypes.Device_16); - types.add(UMLElementTypes.Device_44); + types.add(UMLElementTypes.Device_Shape); + types.add(UMLElementTypes.Device_Shape_CCN); + types.add(UMLElementTypes.Device_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -242,10 +244,10 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createDeploymentSpecification5CreationTool() { List<IElementType> types = new ArrayList<IElementType>(4); - types.add(UMLElementTypes.DeploymentSpecification_2013); - types.add(UMLElementTypes.DeploymentSpecification_2014); - types.add(UMLElementTypes.DeploymentSpecification_2015); - types.add(UMLElementTypes.DeploymentSpecification_2016); + types.add(UMLElementTypes.DeploymentSpecification_Shape); + types.add(UMLElementTypes.DeploymentSpecification_Shape_CCN); + types.add(UMLElementTypes.DeploymentSpecification_Shape_CN); + types.add(UMLElementTypes.DeploymentSpecification_Shape_ACN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -255,9 +257,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createExecutionEnvironmentCreationTool() { List<IElementType> types = new ArrayList<IElementType>(3); - types.add(UMLElementTypes.ExecutionEnvironment_2002); - types.add(UMLElementTypes.ExecutionEnvironment_21); - types.add(UMLElementTypes.ExecutionEnvironment_46); + types.add(UMLElementTypes.ExecutionEnvironment_Shape); + types.add(UMLElementTypes.ExecutionEnvironment_Shape_CCN); + types.add(UMLElementTypes.ExecutionEnvironment_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -267,10 +269,10 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createArtifactCreationTool() { List<IElementType> types = new ArrayList<IElementType>(4); - types.add(UMLElementTypes.Artifact_2006); - types.add(UMLElementTypes.Artifact_25); - types.add(UMLElementTypes.Artifact_28); - types.add(UMLElementTypes.Artifact_40); + types.add(UMLElementTypes.Artifact_Shape); + types.add(UMLElementTypes.Artifact_Shape_CCN); + types.add(UMLElementTypes.Artifact_Shape_ACN); + types.add(UMLElementTypes.Artifact_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -280,8 +282,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createCommentCreationTool() { List<IElementType> types = new ArrayList<IElementType>(2); - types.add(UMLElementTypes.Comment_2001); - types.add(UMLElementTypes.Comment_54); + types.add(UMLElementTypes.Comment_Shape); + types.add(UMLElementTypes.Comment_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -291,8 +293,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createConstraintCreationTool() { List<IElementType> types = new ArrayList<IElementType>(2); - types.add(UMLElementTypes.Constraint_2005); - types.add(UMLElementTypes.Constraint_56); + types.add(UMLElementTypes.Constraint_Shape); + types.add(UMLElementTypes.Constraint_Shape_CN); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -302,8 +304,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createLinkCreationTool() { List<IElementType> types = new ArrayList<IElementType>(2); - types.add(UMLElementTypes.CommentAnnotatedElement_4008); - types.add(UMLElementTypes.ConstraintConstrainedElement_4009); + types.add(UMLElementTypes.Comment_AnnotatedElementEdge); + types.add(UMLElementTypes.Constraint_ConstrainedElementEdge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -313,7 +315,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createDependencyCreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.Dependency_4004); + types.add(UMLElementTypes.Dependency_Edge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -323,7 +325,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createDependencyBranchCreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.Dependency_4010); + types.add(UMLElementTypes.Dependency_BranchEdge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -333,7 +335,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createGeneralizationCreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.Generalization_4003); + types.add(UMLElementTypes.Generalization_Edge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -343,7 +345,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createDeploymentCreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.Deployment_4001); + types.add(UMLElementTypes.Deployment_Edge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } @@ -353,7 +355,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private Tool createManifestationCreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); - types.add(UMLElementTypes.Manifestation_4002); + types.add(UMLElementTypes.Manifestation_Edge); Tool tool = new AspectUnspecifiedTypeConnectionTool(types); return tool; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java index 84cfe7bec4b..81005626ac2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java @@ -131,8 +131,8 @@ public class UMLVisualIDRegistry { * @generated */ public static String getVisualID(View view) { - if(view instanceof Diagram) { - if(DeploymentDiagramEditPart.MODEL_ID.equals(view.getType())) { + if (view instanceof Diagram) { + if (DeploymentDiagramEditPart.MODEL_ID.equals(view.getType())) { return DeploymentDiagramEditPart.VISUAL_ID; } else { return null; @@ -146,12 +146,12 @@ public class UMLVisualIDRegistry { */ public static String getModelID(View view) { View diagram = view.getDiagram(); - while(view != diagram) { + while (view != diagram) { EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if(annotation != null) { + if (annotation != null) { return annotation.getDetails().get("modelID"); //$NON-NLS-1$ } - view = (View)view.eContainer(); + view = (View) view.eContainer(); } return diagram != null ? diagram.getType() : null; } @@ -174,7 +174,7 @@ public class UMLVisualIDRegistry { * @generated */ public static String getDiagramVisualID(EObject domainElement) { - if(domainElement == null) { + if (domainElement == null) { return null; } return DeploymentDiagramEditPart.VISUAL_ID; @@ -184,278 +184,292 @@ public class UMLVisualIDRegistry { * @generated */ public static String getNodeVisualID(View containerView, EObject domainElement) { - if(domainElement == null) { + if (domainElement == null) { return null; } - String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView); - if(!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { + String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry + .getModelID(containerView); + if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { return null; } String containerVisualID; - if(DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { - containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView); + if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { + containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry + .getVisualID(containerView); } else { - if(containerView instanceof Diagram) { + if (containerView instanceof Diagram) { containerVisualID = DeploymentDiagramEditPart.VISUAL_ID; } else { return null; } } - if(containerVisualID != null) { - switch(containerVisualID) { + if (containerVisualID != null) { + switch (containerVisualID) { case DeploymentDiagramEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { return DependencyNodeEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { return ModelEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_2006((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape((Artifact) domainElement)) { return ArtifactEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNamedElement().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNamedElement().isSuperTypeOf(domainElement.eClass())) { return DefaultNamedElementEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecificationEditPart.VISUAL_ID; } break; case ModelPackageableElementCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { return ModelEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return NestedDeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return NestedExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CN((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; } break; case PackagePackageableElementCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { return ModelEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CN((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return NestedDeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return NestedExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; } break; case DeviceCompositeCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CCN((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case NodeCompositeCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CCN((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case ArtifactCompositeCompartmentEditPart.VISUAL_ID: - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_ACN((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; } break; case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { return ModelEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return NestedDeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return NestedExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CN((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; } break; case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CN((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return NestedDeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return NestedExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; } break; case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CCN((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case NodeCompositeCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_CCN((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsClassifierEditPart.VISUAL_ID; } break; case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_ACN((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; } break; case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: - if(UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact)domainElement)) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) + && isArtifact_Shape_ACN((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; } break; @@ -468,513 +482,515 @@ public class UMLVisualIDRegistry { * @generated */ public static boolean canCreateNode(View containerView, String nodeVisualID) { - String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView); - if(!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { + String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry + .getModelID(containerView); + if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { return false; } String containerVisualID; - if(DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { - containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView); + if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) { + containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry + .getVisualID(containerView); } else { - if(containerView instanceof Diagram) { + if (containerView instanceof Diagram) { containerVisualID = DeploymentDiagramEditPart.VISUAL_ID; } else { return false; } } - if(containerVisualID != null) { - switch(containerVisualID) { + if (containerVisualID != null) { + switch (containerVisualID) { case DeploymentDiagramEditPart.VISUAL_ID: - if(DependencyNodeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DependencyNodeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ModelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ModelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackageEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (PackageEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (CommentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeviceEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (NodeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DefaultNamedElementEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DefaultNamedElementEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecificationEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecificationEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DependencyNodeEditPart.VISUAL_ID: - if(MultiDependencyLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (MultiDependencyLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ModelEditPart.VISUAL_ID: - if(ModelNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ModelNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ModelPackageableElementCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ModelPackageableElementCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case PackageEditPart.VISUAL_ID: - if(PackageNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (PackageNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackagePackageableElementCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (PackagePackageableElementCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ConstraintEditPart.VISUAL_ID: - if(ConstraintNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintSpecificationEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintSpecificationEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case CommentEditPart.VISUAL_ID: - if(CommentBodyEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (CommentBodyEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ExecutionEnvironmentEditPart.VISUAL_ID: - if(ExecutionEnvironmentNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeviceEditPart.VISUAL_ID: - if(DeviceNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeviceCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactEditPart.VISUAL_ID: - if(ArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NodeEditPart.VISUAL_ID: - if(NodeNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (NodeNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (NodeCompositeCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DefaultNamedElementEditPart.VISUAL_ID: - if(DefaultNamedElementNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DefaultNamedElementNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeploymentSpecificationEditPart.VISUAL_ID: - if(DeploymentSpecificationNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecificationNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ModelEditPartCN.VISUAL_ID: - if(ModelNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ModelNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ModelPackageableElementCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case PackageEditPartCN.VISUAL_ID: - if(PackageNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackageNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackagePackageableElementCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeviceEditPartCN.VISUAL_ID: - if(DeviceNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NestedDeviceEditPartCN.VISUAL_ID: - if(NestedDeviceNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedDeviceNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeviceCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ExecutionEnvironmentEditPartCN.VISUAL_ID: - if(ExecutionEnvironmentNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - if(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NodeEditPartCN.VISUAL_ID: - if(NodeNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NestedNodeEditPartCN.VISUAL_ID: - if(NestedNodeNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (NestedNodeNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactEditPartCN.VISUAL_ID: - if(ArtifactNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactFloatingLabelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactFloatingLabelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactCompositeCompartmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactEditPartACN.VISUAL_ID: - if(ArtifactNameEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactNameEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactFloatingLabelEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactFloatingLabelEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactCompositeCompartmentEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactCompositeCompartmentEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NestedArtifactNodeEditPartCN.VISUAL_ID: - if(NestedArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (NestedArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case CommentEditPartCN.VISUAL_ID: - if(CommentBodyEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (CommentBodyEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ConstraintEditPartCN.VISUAL_ID: - if(ConstraintNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintNameEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintSpecificationEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintSpecificationEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - if(DeploymentSpecAsClassifierNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - if(DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - if(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ModelPackageableElementCompartmentEditPart.VISUAL_ID: - if(ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case PackagePackageableElementCompartmentEditPart.VISUAL_ID: - if(ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeviceCompositeCompartmentEditPart.VISUAL_ID: - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NodeCompositeCompartmentEditPart.VISUAL_ID: - if(DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactCompositeCompartmentEditPart.VISUAL_ID: - if(ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: - if(ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ModelEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: - if(PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (PackageEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedArtifactNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedDeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NestedNodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (CommentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ConstraintEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: - if(ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case NodeCompositeCompartmentEditPartCN.VISUAL_ID: - if(DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (DeviceEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ExecutionEnvironmentEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (NodeEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartCN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: - if(ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: - if(ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { + if (ArtifactEditPartACN.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DeploymentEditPart.VISUAL_ID: - if(DeploymentNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DeploymentAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DeploymentAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case ManifestationEditPart.VISUAL_ID: - if(ManifestationNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ManifestationNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(ManifestationAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (ManifestationAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case GeneralizationEditPart.VISUAL_ID: - if(GeneralizationAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (GeneralizationAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case DependencyEditPart.VISUAL_ID: - if(DependencyNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DependencyNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(DependencyAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (DependencyAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; case CommunicationPathEditPart.VISUAL_ID: - if(CommunicationPathNameEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (CommunicationPathNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if(CommunicationPathAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { + if (CommunicationPathAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } break; @@ -987,25 +1003,25 @@ public class UMLVisualIDRegistry { * @generated */ public static String getLinkWithClassVisualID(EObject domainElement) { - if(domainElement == null) { + if (domainElement == null) { return null; } - if(UMLPackage.eINSTANCE.getDeployment().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDeployment().isSuperTypeOf(domainElement.eClass())) { return DeploymentEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getManifestation().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getManifestation().isSuperTypeOf(domainElement.eClass())) { return ManifestationEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) { return GeneralizationEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { return DependencyEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) { return DependencyBranchEditPart.VISUAL_ID; } - if(UMLPackage.eINSTANCE.getCommunicationPath().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getCommunicationPath().isSuperTypeOf(domainElement.eClass())) { return CommunicationPathEditPart.VISUAL_ID; } return null; @@ -1024,40 +1040,44 @@ public class UMLVisualIDRegistry { /** * @generated */ - private static boolean isArtifact_2006(Artifact domainElement) { - Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); - return result instanceof Boolean && ((Boolean)result).booleanValue(); + private static boolean isArtifact_Shape(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); } /** * @generated */ - private static boolean isArtifact_25(Artifact domainElement) { - Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); - return result instanceof Boolean && ((Boolean)result).booleanValue(); + private static boolean isArtifact_Shape_CCN(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); } /** * @generated */ - private static boolean isArtifact_28(Artifact domainElement) { - Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); - return result instanceof Boolean && ((Boolean)result).booleanValue(); + private static boolean isArtifact_Shape_ACN(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); } /** * @generated */ - private static boolean isArtifact_40(Artifact domainElement) { - Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); - return result instanceof Boolean && ((Boolean)result).booleanValue(); + private static boolean isArtifact_Shape_CN(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); } /** * @generated */ public static boolean checkNodeVisualID(View containerView, EObject domainElement, String candidate) { - if(candidate == null) { + if (candidate == null) { //unrecognized id is always bad return false; } @@ -1069,8 +1089,8 @@ public class UMLVisualIDRegistry { * @generated */ public static boolean isCompartmentVisualID(String visualID) { - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case ModelPackageableElementCompartmentEditPart.VISUAL_ID: case PackagePackageableElementCompartmentEditPart.VISUAL_ID: case DeviceCompositeCompartmentEditPart.VISUAL_ID: @@ -1094,8 +1114,8 @@ public class UMLVisualIDRegistry { * @generated */ public static boolean isSemanticLeafVisualID(String visualID) { - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case DeploymentDiagramEditPart.VISUAL_ID: return false; case DeviceEditPartCN.VISUAL_ID: @@ -1122,7 +1142,6 @@ public class UMLVisualIDRegistry { * @generated */ public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() { - /** * @generated */ @@ -1144,7 +1163,8 @@ public class UMLVisualIDRegistry { */ @Override public String getNodeVisualID(View containerView, EObject domainElement) { - return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement); + return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(containerView, + domainElement); } /** @@ -1152,7 +1172,8 @@ public class UMLVisualIDRegistry { */ @Override public boolean checkNodeVisualID(View containerView, EObject domainElement, String candidate) { - return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.checkNodeVisualID(containerView, domainElement, candidate); + return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.checkNodeVisualID(containerView, + domainElement, candidate); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java index ae05466824d..628b32c1fa7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java @@ -74,8 +74,8 @@ public class ValidateAction extends Action { @Override public void run() { IWorkbenchPart workbenchPart = page.getActivePart(); - if(workbenchPart instanceof IDiagramWorkbenchPart) { - final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart)workbenchPart; + if (workbenchPart instanceof IDiagramWorkbenchPart) { + final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart; try { new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() { @@ -95,10 +95,11 @@ public class ValidateAction extends Action { */ public static void runValidation(View view) { try { - if(UMLDiagramEditorUtil.openDiagram(view.eResource())) { - IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if(editorPart instanceof IDiagramWorkbenchPart) { - runValidation(((IDiagramWorkbenchPart)editorPart).getDiagramEditPart(), view); + if (UMLDiagramEditorUtil.openDiagram(view.eResource())) { + IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .getActiveEditor(); + if (editorPart instanceof IDiagramWorkbenchPart) { + runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view); } else { runNonUIValidation(view); } @@ -113,10 +114,12 @@ public class ValidateAction extends Action { */ public static void runNonUIValidation(View view) { Shell shell = Display.getCurrent().getActiveShell(); - if(shell == null) { + if (shell == null) { shell = new Shell(); } - DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram(), shell); + + DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance() + .createDiagramEditPart(view.getDiagram(), shell); runValidation(diagramEditPart, view); } @@ -140,7 +143,7 @@ public class ValidateAction extends Action { * @generated */ private static Diagnostic runEMFValidator(View target) { - if(target.isSetElement() && target.getElement() != null) { + if (target.isSetElement() && target.getElement() != null) { return new Diagnostician() { @Override @@ -157,14 +160,15 @@ public class ValidateAction extends Action { */ private static void validate(DiagramEditPart diagramEditPart, View view) { IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null; - if(target != null) { + if (target != null) { UMLMarkerNavigationProvider.deleteMarkers(target); } Diagnostic diagnostic = runEMFValidator(view); createMarkers(target, diagnostic, diagramEditPart); - IBatchValidator validator = (IBatchValidator)ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH); + IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance() + .newValidator(EvaluationMode.BATCH); validator.setIncludeLiveConstraints(true); - if(view.isSetElement() && view.getElement() != null) { + if (view.isSetElement() && view.getElement() != null) { IStatus status = validator.validate(view.getElement()); createMarkers(target, status, diagramEditPart); } @@ -174,16 +178,20 @@ public class ValidateAction extends Action { * @generated */ private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { - if(validationStatus.isOK()) { + if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); - UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses)); - for(Iterator it = allStatuses.iterator(); it.hasNext();) { - IConstraintStatus nextStatus = (IConstraintStatus)it.next(); + UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap( + diagramEditPart.getDiagramView(), + collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses)); + for (Iterator it = allStatuses.iterator(); it.hasNext();) { + IConstraintStatus nextStatus = (IConstraintStatus) it.next(); View view = UMLDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap); - addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus.getSeverity()); + addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), + EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), + nextStatus.getSeverity()); } } @@ -191,19 +199,23 @@ public class ValidateAction extends Action { * @generated */ private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { - if(emfValidationStatus.getSeverity() == Diagnostic.OK) { + if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; List<Diagnostic> allDiagnostics = new ArrayList<Diagnostic>(); - UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics)); - for(Iterator<Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { + UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap( + diagramEditPart.getDiagramView(), + collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics)); + for (Iterator<Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { Diagnostic nextDiagnostic = it.next(); List<?> data = nextDiagnostic.getData(); - if(data != null && !data.isEmpty() && data.get(0) instanceof EObject) { - EObject element = (EObject)data.get(0); + if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { + EObject element = (EObject) data.get(0); View view = UMLDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap); - addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); + addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), + EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), + diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } } @@ -211,8 +223,9 @@ public class ValidateAction extends Action { /** * @generated */ - private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, String message, int statusSeverity) { - if(target == null) { + private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, + String message, int statusSeverity) { + if (target == null) { return; } UMLMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity); @@ -222,13 +235,13 @@ public class ValidateAction extends Action { * @generated */ private static int diagnosticToStatusSeverity(int diagnosticSeverity) { - if(diagnosticSeverity == Diagnostic.OK) { + if (diagnosticSeverity == Diagnostic.OK) { return IStatus.OK; - } else if(diagnosticSeverity == Diagnostic.INFO) { + } else if (diagnosticSeverity == Diagnostic.INFO) { return IStatus.INFO; - } else if(diagnosticSeverity == Diagnostic.WARNING) { + } else if (diagnosticSeverity == Diagnostic.WARNING) { return IStatus.WARNING; - } else if(diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) { + } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) { return IStatus.ERROR; } return IStatus.INFO; @@ -237,14 +250,15 @@ public class ValidateAction extends Action { /** * @generated */ - private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List<IConstraintStatus> allConstraintStatuses) { - if(status instanceof IConstraintStatus) { - targetElementCollector.add(((IConstraintStatus)status).getTarget()); - allConstraintStatuses.add((IConstraintStatus)status); + private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, + List<IConstraintStatus> allConstraintStatuses) { + if (status instanceof IConstraintStatus) { + targetElementCollector.add(((IConstraintStatus) status).getTarget()); + allConstraintStatuses.add((IConstraintStatus) status); } - if(status.isMultiStatus()) { + if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); - for(int i = 0; i < children.length; i++) { + for (int i = 0; i < children.length; i++) { collectTargetElements(children[i], targetElementCollector, allConstraintStatuses); } } @@ -254,16 +268,17 @@ public class ValidateAction extends Action { /** * @generated */ - private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List<Diagnostic> allDiagnostics) { + private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, + List<Diagnostic> allDiagnostics) { List<?> data = diagnostic.getData(); EObject target = null; - if(data != null && !data.isEmpty() && data.get(0) instanceof EObject) { - target = (EObject)data.get(0); + if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { + target = (EObject) data.get(0); targetElementCollector.add(target); allDiagnostics.add(diagnostic); } - if(diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) { - for(Iterator<Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) { + if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) { + for (Iterator<Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) { collectTargetElements(it.next(), targetElementCollector, allDiagnostics); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java index 0637c711676..f2b66c7a135 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java @@ -31,6 +31,7 @@ public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer DiagramConnectionsPreferencePage.initDefaults(store); DiagramPrintingPreferencePage.initDefaults(store); DiagramRulersAndGridPreferencePage.initDefaults(store); + } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java index 70e2e45a092..b2aa15f0285 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java @@ -42,13 +42,13 @@ public class ElementInitializers { } /** - * @generated - */ - public void init_Model_2010(Model instance) { + * @generated + */ + public void init_Model_Shape(Model instance) { try { - Object value_0 = name_Model_2010(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Model_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -58,11 +58,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Package_2009(Package instance) { + public void init_Package_Shape(Package instance) { try { - Object value_0 = name_Package_2009(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Package_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -72,15 +72,15 @@ public class ElementInitializers { /** * @generated */ - public void init_Constraint_2005(Constraint instance) { + public void init_Constraint_Shape(Constraint instance) { try { - Object value_0 = name_Constraint_2005(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Constraint_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = specification_Constraint_2005(instance); - if(value_1 != null) { - instance.setSpecification((ValueSpecification)value_1); + Object value_1 = specification_Constraint_Shape(instance); + if (value_1 != null) { + instance.setSpecification((ValueSpecification) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -90,11 +90,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Comment_2001(Comment instance) { + public void init_Comment_Shape(Comment instance) { try { - Object value_0 = body_Comment_2001(instance); - if(value_0 != null) { - instance.setBody((String)value_0); + Object value_0 = body_Comment_Shape(instance); + if (value_0 != null) { + instance.setBody((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -104,11 +104,11 @@ public class ElementInitializers { /** * @generated */ - public void init_ExecutionEnvironment_2002(ExecutionEnvironment instance) { + public void init_ExecutionEnvironment_Shape(ExecutionEnvironment instance) { try { - Object value_0 = name_ExecutionEnvironment_2002(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_ExecutionEnvironment_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -118,11 +118,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Device_2003(Device instance) { + public void init_Device_Shape(Device instance) { try { - Object value_0 = name_Device_2003(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Device_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -132,15 +132,16 @@ public class ElementInitializers { /** * @generated */ - public void init_Artifact_2006(Artifact instance) { + public void init_Artifact_Shape(Artifact instance) { try { - Object value_0 = name_Artifact_2006(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Artifact_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -150,11 +151,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Node_2008(Node instance) { + public void init_Node_Shape(Node instance) { try { - Object value_0 = name_Node_2008(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Node_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -162,17 +163,18 @@ public class ElementInitializers { } /** - * @generated - */ - public void init_DeploymentSpecification_2013(DeploymentSpecification instance) { + * @generated + */ + public void init_DeploymentSpecification_Shape(DeploymentSpecification instance) { try { - Object value_0 = name_DeploymentSpecification_2013(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_DeploymentSpecification_Shape(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -182,11 +184,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Model_49(Model instance) { + public void init_Model_Shape_CN(Model instance) { try { - Object value_0 = name_Model_49(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Model_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -196,11 +198,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Package_36(Package instance) { + public void init_Package_Shape_CN(Package instance) { try { - Object value_0 = name_Package_36(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Package_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -210,11 +212,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Device_16(Device instance) { + public void init_Device_Shape_CCN(Device instance) { try { - Object value_0 = name_Device_16(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Device_Shape_CCN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -224,11 +226,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Device_44(Device instance) { + public void init_Device_Shape_CN(Device instance) { try { - Object value_0 = name_Device_44(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Device_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -238,11 +240,11 @@ public class ElementInitializers { /** * @generated */ - public void init_ExecutionEnvironment_21(ExecutionEnvironment instance) { + public void init_ExecutionEnvironment_Shape_CCN(ExecutionEnvironment instance) { try { - Object value_0 = name_ExecutionEnvironment_21(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_ExecutionEnvironment_Shape_CCN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -252,11 +254,11 @@ public class ElementInitializers { /** * @generated */ - public void init_ExecutionEnvironment_46(ExecutionEnvironment instance) { + public void init_ExecutionEnvironment_Shape_CN(ExecutionEnvironment instance) { try { - Object value_0 = name_ExecutionEnvironment_46(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_ExecutionEnvironment_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -266,11 +268,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Node_23(Node instance) { + public void init_Node_Shape_CCN(Node instance) { try { - Object value_0 = name_Node_23(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Node_Shape_CCN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -280,11 +282,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Node_42(Node instance) { + public void init_Node_Shape_CN(Node instance) { try { - Object value_0 = name_Node_42(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Node_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -294,15 +296,16 @@ public class ElementInitializers { /** * @generated */ - public void init_Artifact_25(Artifact instance) { + public void init_Artifact_Shape_CCN(Artifact instance) { try { - Object value_0 = name_Artifact_25(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Artifact_Shape_CCN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -312,15 +315,16 @@ public class ElementInitializers { /** * @generated */ - public void init_Artifact_28(Artifact instance) { + public void init_Artifact_Shape_ACN(Artifact instance) { try { - Object value_0 = name_Artifact_28(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Artifact_Shape_ACN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -330,15 +334,16 @@ public class ElementInitializers { /** * @generated */ - public void init_Artifact_40(Artifact instance) { + public void init_Artifact_Shape_CN(Artifact instance) { try { - Object value_0 = name_Artifact_40(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Artifact_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -348,11 +353,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Comment_54(Comment instance) { + public void init_Comment_Shape_CN(Comment instance) { try { - Object value_0 = body_Comment_54(instance); - if(value_0 != null) { - instance.setBody((String)value_0); + Object value_0 = body_Comment_Shape_CN(instance); + if (value_0 != null) { + instance.setBody((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -362,15 +367,15 @@ public class ElementInitializers { /** * @generated */ - public void init_Constraint_56(Constraint instance) { + public void init_Constraint_Shape_CN(Constraint instance) { try { - Object value_0 = name_Constraint_56(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Constraint_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = specification_Constraint_56(instance); - if(value_1 != null) { - instance.setSpecification((ValueSpecification)value_1); + Object value_1 = specification_Constraint_Shape_CN(instance); + if (value_1 != null) { + instance.setSpecification((ValueSpecification) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -378,17 +383,18 @@ public class ElementInitializers { } /** - * @generated - */ - public void init_DeploymentSpecification_2014(DeploymentSpecification instance) { + * @generated + */ + public void init_DeploymentSpecification_Shape_CCN(DeploymentSpecification instance) { try { - Object value_0 = name_DeploymentSpecification_2014(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_DeploymentSpecification_Shape_CCN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -398,15 +404,16 @@ public class ElementInitializers { /** * @generated */ - public void init_DeploymentSpecification_2015(DeploymentSpecification instance) { + public void init_DeploymentSpecification_Shape_CN(DeploymentSpecification instance) { try { - Object value_0 = name_DeploymentSpecification_2015(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_DeploymentSpecification_Shape_CN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -416,15 +423,16 @@ public class ElementInitializers { /** * @generated */ - public void init_DeploymentSpecification_2016(DeploymentSpecification instance) { + public void init_DeploymentSpecification_Shape_ACN(DeploymentSpecification instance) { try { - Object value_0 = name_DeploymentSpecification_2016(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_DeploymentSpecification_Shape_ACN(instance); + if (value_0 != null) { + instance.setName((String) value_0); } - Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); - if(value_1 != null) { - instance.setFileName((String)value_1); + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null) + .evaluate(instance); + if (value_1 != null) { + instance.setFileName((String) value_1); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -434,11 +442,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Deployment_4001(Deployment instance) { + public void init_Deployment_Edge(Deployment instance) { try { - Object value_0 = name_Deployment_4001(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Deployment_Edge(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -448,11 +456,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Manifestation_4002(Manifestation instance) { + public void init_Manifestation_Edge(Manifestation instance) { try { - Object value_0 = name_Manifestation_4002(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Manifestation_Edge(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -462,11 +470,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Dependency_4004(Dependency instance) { + public void init_Dependency_Edge(Dependency instance) { try { - Object value_0 = name_Dependency_4004(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Dependency_Edge(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -476,11 +484,11 @@ public class ElementInitializers { /** * @generated */ - public void init_Dependency_4010(Dependency instance) { + public void init_Dependency_BranchEdge(Dependency instance) { try { - Object value_0 = name_Dependency_4010(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_Dependency_BranchEdge(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -488,13 +496,13 @@ public class ElementInitializers { } /** - * @generated - */ - public void init_CommunicationPath_4011(CommunicationPath instance) { + * @generated + */ + public void init_CommunicationPath_Edge(CommunicationPath instance) { try { - Object value_0 = name_CommunicationPath_4011(instance); - if(value_0 != null) { - instance.setName((String)value_0); + Object value_0 = name_CommunicationPath_Edge(instance); + if (value_0 != null) { + instance.setName((String) value_0); } } catch (RuntimeException e) { UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ @@ -504,28 +512,28 @@ public class ElementInitializers { /** * @generated */ - private String name_Model_2010(Model it) { + private String name_Model_Shape(Model it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Package_2009(Package it) { + private String name_Package_Shape(Package it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Constraint_2005(Constraint it) { + private String name_Constraint_Shape(Constraint it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private ValueSpecification specification_Constraint_2005(Constraint it) { + private ValueSpecification specification_Constraint_Shape(Constraint it) { // Constraint specification init LiteralString value = UMLFactory.eINSTANCE.createLiteralString(); value.setValue(""); @@ -535,7 +543,7 @@ public class ElementInitializers { /** * @generated */ - private String body_Comment_2001(Comment it) { + private String body_Comment_Shape(Comment it) { // Comment body init return ""; } @@ -543,119 +551,119 @@ public class ElementInitializers { /** * @generated */ - private String name_ExecutionEnvironment_2002(ExecutionEnvironment it) { + private String name_ExecutionEnvironment_Shape(ExecutionEnvironment it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Device_2003(Device it) { + private String name_Device_Shape(Device it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Artifact_2006(Artifact it) { + private String name_Artifact_Shape(Artifact it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Node_2008(Node it) { + private String name_Node_Shape(Node it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** - * @generated - */ - private String name_DeploymentSpecification_2013(DeploymentSpecification it) { + * @generated + */ + private String name_DeploymentSpecification_Shape(DeploymentSpecification it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Model_49(Model it) { + private String name_Model_Shape_CN(Model it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Package_36(Package it) { + private String name_Package_Shape_CN(Package it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Device_16(Device it) { + private String name_Device_Shape_CCN(Device it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Device_44(Device it) { + private String name_Device_Shape_CN(Device it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_ExecutionEnvironment_21(ExecutionEnvironment it) { + private String name_ExecutionEnvironment_Shape_CCN(ExecutionEnvironment it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_ExecutionEnvironment_46(ExecutionEnvironment it) { + private String name_ExecutionEnvironment_Shape_CN(ExecutionEnvironment it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Node_23(Node it) { + private String name_Node_Shape_CCN(Node it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Node_42(Node it) { + private String name_Node_Shape_CN(Node it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Artifact_25(Artifact it) { + private String name_Artifact_Shape_CCN(Artifact it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Artifact_28(Artifact it) { + private String name_Artifact_Shape_ACN(Artifact it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Artifact_40(Artifact it) { + private String name_Artifact_Shape_CN(Artifact it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String body_Comment_54(Comment it) { + private String body_Comment_Shape_CN(Comment it) { // Comment body init return ""; } @@ -663,14 +671,14 @@ public class ElementInitializers { /** * @generated */ - private String name_Constraint_56(Constraint it) { + private String name_Constraint_Shape_CN(Constraint it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private ValueSpecification specification_Constraint_56(Constraint it) { + private ValueSpecification specification_Constraint_Shape_CN(Constraint it) { // Constraint specification init LiteralString value = UMLFactory.eINSTANCE.createLiteralString(); value.setValue(""); @@ -678,58 +686,58 @@ public class ElementInitializers { } /** - * @generated - */ - private String name_DeploymentSpecification_2014(DeploymentSpecification it) { + * @generated + */ + private String name_DeploymentSpecification_Shape_CCN(DeploymentSpecification it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_DeploymentSpecification_2015(DeploymentSpecification it) { + private String name_DeploymentSpecification_Shape_CN(DeploymentSpecification it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_DeploymentSpecification_2016(DeploymentSpecification it) { + private String name_DeploymentSpecification_Shape_ACN(DeploymentSpecification it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Deployment_4001(Deployment it) { + private String name_Deployment_Edge(Deployment it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Manifestation_4002(Manifestation it) { + private String name_Manifestation_Edge(Manifestation it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Dependency_4004(Dependency it) { + private String name_Dependency_Edge(Dependency it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** * @generated */ - private String name_Dependency_4010(Dependency it) { + private String name_Dependency_BranchEdge(Dependency it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } /** - * @generated - */ - private String name_CommunicationPath_4011(CommunicationPath it) { + * @generated + */ + private String name_CommunicationPath_Edge(CommunicationPath it) { return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); } @@ -738,7 +746,7 @@ public class ElementInitializers { */ public static ElementInitializers getInstance() { ElementInitializers cached = UMLDiagramEditorPlugin.getInstance().getElementInitializers(); - if(cached == null) { + if (cached == null) { UMLDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers()); } return cached; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java index cc2d5860570..b54f5e5f13d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java @@ -83,7 +83,8 @@ public class UMLElementTypes { /** * @generated */ - private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()); + private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages( + UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()); /** * @generated @@ -91,189 +92,223 @@ public class UMLElementTypes { private static Set<IElementType> KNOWN_ELEMENT_TYPES; /** - * @generated - */ - public static final IElementType Package_1000 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Package_1000"); //$NON-NLS-1$ + * @generated + */ + public static final IElementType Package_DeploymentDiagram = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Package_DeploymentDiagram"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Dependency_2011 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"); //$NON-NLS-1$ + public static final IElementType Dependency_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Dependency_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Model_2010 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Model_2010"); //$NON-NLS-1$ + public static final IElementType Model_Shape = getElementTypeByUniqueId("org.eclipse.papyrus.umldi.Model_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Package_2009 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Package_2009"); //$NON-NLS-1$ + public static final IElementType Package_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Package_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Constraint_2005 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"); //$NON-NLS-1$ + public static final IElementType Constraint_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Constraint_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Comment_2001 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"); //$NON-NLS-1$ + public static final IElementType Comment_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Comment_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType ExecutionEnvironment_2002 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"); //$NON-NLS-1$ + public static final IElementType ExecutionEnvironment_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Device_2003 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Device_2003"); //$NON-NLS-1$ + public static final IElementType Device_Shape = getElementTypeByUniqueId("org.eclipse.papyrus.umldi.Device_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Artifact_2006 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"); //$NON-NLS-1$ + public static final IElementType Artifact_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Artifact_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Node_2008 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Node_2008"); //$NON-NLS-1$ + public static final IElementType Node_Shape = getElementTypeByUniqueId("org.eclipse.papyrus.umldi.Node_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType NamedElement_2012 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"); //$NON-NLS-1$ + public static final IElementType NamedElement_DefaultShape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.NamedElement_DefaultShape"); //$NON-NLS-1$ /** - * @generated - */ - public static final IElementType DeploymentSpecification_2013 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2013"); //$NON-NLS-1$ + * @generated + */ + public static final IElementType DeploymentSpecification_Shape = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.DeploymentSpecification_Shape"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Model_49 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Model_49"); //$NON-NLS-1$ + public static final IElementType Model_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Model_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Package_36 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Package_36"); //$NON-NLS-1$ + public static final IElementType Package_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Package_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Device_16 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Device_16"); //$NON-NLS-1$ + public static final IElementType Device_Shape_CCN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Device_Shape_CCN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Device_44 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Device_44"); //$NON-NLS-1$ + public static final IElementType Device_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Device_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType ExecutionEnvironment_21 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"); //$NON-NLS-1$ + public static final IElementType ExecutionEnvironment_Shape_CCN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape_CCN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType ExecutionEnvironment_46 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"); //$NON-NLS-1$ + public static final IElementType ExecutionEnvironment_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.ExecutionEnvironment_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Node_23 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Node_23"); //$NON-NLS-1$ + public static final IElementType Node_Shape_CCN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Node_Shape_CCN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Node_42 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Node_42"); //$NON-NLS-1$ + public static final IElementType Node_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Node_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Artifact_25 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"); //$NON-NLS-1$ + public static final IElementType Artifact_Shape_CCN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Artifact_Shape_CCN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Artifact_28 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"); //$NON-NLS-1$ + public static final IElementType Artifact_Shape_ACN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Artifact_Shape_ACN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Artifact_40 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"); //$NON-NLS-1$ + public static final IElementType Artifact_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Artifact_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Comment_54 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Comment_54"); //$NON-NLS-1$ + public static final IElementType Comment_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Comment_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Constraint_56 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"); //$NON-NLS-1$ + public static final IElementType Constraint_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Constraint_Shape_CN"); //$NON-NLS-1$ /** - * @generated - */ - public static final IElementType DeploymentSpecification_2014 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2014"); //$NON-NLS-1$ + * @generated + */ + public static final IElementType DeploymentSpecification_Shape_CCN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_CCN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType DeploymentSpecification_2015 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2015"); //$NON-NLS-1$ + public static final IElementType DeploymentSpecification_Shape_CN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_CN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType DeploymentSpecification_2016 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2016"); //$NON-NLS-1$ + public static final IElementType DeploymentSpecification_Shape_ACN = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.DeploymentSpecification_Shape_ACN"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Link_4005 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Link_4005"); //$NON-NLS-1$ + public static final IElementType Link_DescriptorEdge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Link_DescriptorEdge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType CommentAnnotatedElement_4008 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"); //$NON-NLS-1$ + public static final IElementType Comment_AnnotatedElementEdge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Comment_AnnotatedElementEdge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType ConstraintConstrainedElement_4009 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"); //$NON-NLS-1$ + public static final IElementType Constraint_ConstrainedElementEdge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Constraint_ConstrainedElementEdge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Deployment_4001 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"); //$NON-NLS-1$ + public static final IElementType Deployment_Edge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Deployment_Edge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Manifestation_4002 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"); //$NON-NLS-1$ + public static final IElementType Manifestation_Edge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Manifestation_Edge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Generalization_4003 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"); //$NON-NLS-1$ + public static final IElementType Generalization_Edge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Generalization_Edge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Dependency_4004 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"); //$NON-NLS-1$ + public static final IElementType Dependency_Edge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Dependency_Edge"); //$NON-NLS-1$ /** * @generated */ - public static final IElementType Dependency_4010 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"); //$NON-NLS-1$ + public static final IElementType Dependency_BranchEdge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.Dependency_BranchEdge"); //$NON-NLS-1$ /** - * @generated - */ - public static final IElementType CommunicationPath_4011 = getElementTypeByUniqueId("org.eclipse.papyrus.uml.diagram.deployment.CommunicationPath_4011"); //$NON-NLS-1$ + * @generated + */ + public static final IElementType CommunicationPath_Edge = getElementTypeByUniqueId( + "org.eclipse.papyrus.umldi.CommunicationPath_Edge"); //$NON-NLS-1$ /** * @generated @@ -310,44 +345,80 @@ public class UMLElementTypes { */ public static synchronized ENamedElement getElement(IAdaptable hint) { Object type = hint.getAdapter(IElementType.class); - if(elements == null) { + if (elements == null) { elements = new IdentityHashMap<IElementType, ENamedElement>(); - elements.put(Package_1000, UMLPackage.eINSTANCE.getPackage()); - elements.put(Dependency_2011, UMLPackage.eINSTANCE.getDependency()); - elements.put(Model_2010, UMLPackage.eINSTANCE.getModel()); - elements.put(Package_2009, UMLPackage.eINSTANCE.getPackage()); - elements.put(Constraint_2005, UMLPackage.eINSTANCE.getConstraint()); - elements.put(Comment_2001, UMLPackage.eINSTANCE.getComment()); - elements.put(ExecutionEnvironment_2002, UMLPackage.eINSTANCE.getExecutionEnvironment()); - elements.put(Device_2003, UMLPackage.eINSTANCE.getDevice()); - elements.put(Artifact_2006, UMLPackage.eINSTANCE.getArtifact()); - elements.put(Node_2008, UMLPackage.eINSTANCE.getNode()); - elements.put(NamedElement_2012, UMLPackage.eINSTANCE.getNamedElement()); - elements.put(DeploymentSpecification_2013, UMLPackage.eINSTANCE.getDeploymentSpecification()); - elements.put(Model_49, UMLPackage.eINSTANCE.getModel()); - elements.put(Package_36, UMLPackage.eINSTANCE.getPackage()); - elements.put(Device_16, UMLPackage.eINSTANCE.getDevice()); - elements.put(Device_44, UMLPackage.eINSTANCE.getDevice()); - elements.put(ExecutionEnvironment_21, UMLPackage.eINSTANCE.getExecutionEnvironment()); - elements.put(ExecutionEnvironment_46, UMLPackage.eINSTANCE.getExecutionEnvironment()); - elements.put(Node_23, UMLPackage.eINSTANCE.getNode()); - elements.put(Node_42, UMLPackage.eINSTANCE.getNode()); - elements.put(Artifact_25, UMLPackage.eINSTANCE.getArtifact()); - elements.put(Artifact_28, UMLPackage.eINSTANCE.getArtifact()); - elements.put(Artifact_40, UMLPackage.eINSTANCE.getArtifact()); - elements.put(Comment_54, UMLPackage.eINSTANCE.getComment()); - elements.put(Constraint_56, UMLPackage.eINSTANCE.getConstraint()); - elements.put(DeploymentSpecification_2014, UMLPackage.eINSTANCE.getDeploymentSpecification()); - elements.put(DeploymentSpecification_2015, UMLPackage.eINSTANCE.getDeploymentSpecification()); - elements.put(DeploymentSpecification_2016, UMLPackage.eINSTANCE.getDeploymentSpecification()); - elements.put(CommentAnnotatedElement_4008, UMLPackage.eINSTANCE.getComment_AnnotatedElement()); - elements.put(ConstraintConstrainedElement_4009, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()); - elements.put(Deployment_4001, UMLPackage.eINSTANCE.getDeployment()); - elements.put(Manifestation_4002, UMLPackage.eINSTANCE.getManifestation()); - elements.put(Generalization_4003, UMLPackage.eINSTANCE.getGeneralization()); - elements.put(Dependency_4004, UMLPackage.eINSTANCE.getDependency()); - elements.put(Dependency_4010, UMLPackage.eINSTANCE.getDependency()); - elements.put(CommunicationPath_4011, UMLPackage.eINSTANCE.getCommunicationPath()); + + elements.put(Package_DeploymentDiagram, UMLPackage.eINSTANCE.getPackage()); + + elements.put(Dependency_Shape, UMLPackage.eINSTANCE.getDependency()); + + elements.put(Model_Shape, UMLPackage.eINSTANCE.getModel()); + + elements.put(Package_Shape, UMLPackage.eINSTANCE.getPackage()); + + elements.put(Constraint_Shape, UMLPackage.eINSTANCE.getConstraint()); + + elements.put(Comment_Shape, UMLPackage.eINSTANCE.getComment()); + + elements.put(ExecutionEnvironment_Shape, UMLPackage.eINSTANCE.getExecutionEnvironment()); + + elements.put(Device_Shape, UMLPackage.eINSTANCE.getDevice()); + + elements.put(Artifact_Shape, UMLPackage.eINSTANCE.getArtifact()); + + elements.put(Node_Shape, UMLPackage.eINSTANCE.getNode()); + + elements.put(NamedElement_DefaultShape, UMLPackage.eINSTANCE.getNamedElement()); + + elements.put(DeploymentSpecification_Shape, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + elements.put(Model_Shape_CN, UMLPackage.eINSTANCE.getModel()); + + elements.put(Package_Shape_CN, UMLPackage.eINSTANCE.getPackage()); + + elements.put(Device_Shape_CCN, UMLPackage.eINSTANCE.getDevice()); + + elements.put(Device_Shape_CN, UMLPackage.eINSTANCE.getDevice()); + + elements.put(ExecutionEnvironment_Shape_CCN, UMLPackage.eINSTANCE.getExecutionEnvironment()); + + elements.put(ExecutionEnvironment_Shape_CN, UMLPackage.eINSTANCE.getExecutionEnvironment()); + + elements.put(Node_Shape_CCN, UMLPackage.eINSTANCE.getNode()); + + elements.put(Node_Shape_CN, UMLPackage.eINSTANCE.getNode()); + + elements.put(Artifact_Shape_CCN, UMLPackage.eINSTANCE.getArtifact()); + + elements.put(Artifact_Shape_ACN, UMLPackage.eINSTANCE.getArtifact()); + + elements.put(Artifact_Shape_CN, UMLPackage.eINSTANCE.getArtifact()); + + elements.put(Comment_Shape_CN, UMLPackage.eINSTANCE.getComment()); + + elements.put(Constraint_Shape_CN, UMLPackage.eINSTANCE.getConstraint()); + + elements.put(DeploymentSpecification_Shape_CCN, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + elements.put(DeploymentSpecification_Shape_CN, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + elements.put(DeploymentSpecification_Shape_ACN, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + elements.put(Comment_AnnotatedElementEdge, UMLPackage.eINSTANCE.getComment_AnnotatedElement()); + + elements.put(Constraint_ConstrainedElementEdge, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()); + + elements.put(Deployment_Edge, UMLPackage.eINSTANCE.getDeployment()); + + elements.put(Manifestation_Edge, UMLPackage.eINSTANCE.getManifestation()); + + elements.put(Generalization_Edge, UMLPackage.eINSTANCE.getGeneralization()); + + elements.put(Dependency_Edge, UMLPackage.eINSTANCE.getDependency()); + + elements.put(Dependency_BranchEdge, UMLPackage.eINSTANCE.getDependency()); + + elements.put(CommunicationPath_Edge, UMLPackage.eINSTANCE.getCommunicationPath()); } return elements.get(type); } @@ -363,82 +434,82 @@ public class UMLElementTypes { * @generated */ public static IElementType getElementType(String visualID) { - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case DeploymentDiagramEditPart.VISUAL_ID: - return Package_1000; + return Package_DeploymentDiagram; case DependencyNodeEditPart.VISUAL_ID: - return Dependency_2011; + return Dependency_Shape; case ModelEditPart.VISUAL_ID: - return Model_2010; + return Model_Shape; case PackageEditPart.VISUAL_ID: - return Package_2009; + return Package_Shape; case ConstraintEditPart.VISUAL_ID: - return Constraint_2005; + return Constraint_Shape; case CommentEditPart.VISUAL_ID: - return Comment_2001; + return Comment_Shape; case ExecutionEnvironmentEditPart.VISUAL_ID: - return ExecutionEnvironment_2002; + return ExecutionEnvironment_Shape; case DeviceEditPart.VISUAL_ID: - return Device_2003; + return Device_Shape; case ArtifactEditPart.VISUAL_ID: - return Artifact_2006; + return Artifact_Shape; case NodeEditPart.VISUAL_ID: - return Node_2008; + return Node_Shape; case DefaultNamedElementEditPart.VISUAL_ID: - return NamedElement_2012; + return NamedElement_DefaultShape; case DeploymentSpecificationEditPart.VISUAL_ID: - return DeploymentSpecification_2013; + return DeploymentSpecification_Shape; case ModelEditPartCN.VISUAL_ID: - return Model_49; + return Model_Shape_CN; case PackageEditPartCN.VISUAL_ID: - return Package_36; + return Package_Shape_CN; case DeviceEditPartCN.VISUAL_ID: - return Device_16; + return Device_Shape_CCN; case NestedDeviceEditPartCN.VISUAL_ID: - return Device_44; + return Device_Shape_CN; case ExecutionEnvironmentEditPartCN.VISUAL_ID: - return ExecutionEnvironment_21; + return ExecutionEnvironment_Shape_CCN; case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - return ExecutionEnvironment_46; + return ExecutionEnvironment_Shape_CN; case NodeEditPartCN.VISUAL_ID: - return Node_23; + return Node_Shape_CCN; case NestedNodeEditPartCN.VISUAL_ID: - return Node_42; + return Node_Shape_CN; case ArtifactEditPartCN.VISUAL_ID: - return Artifact_25; + return Artifact_Shape_CCN; case ArtifactEditPartACN.VISUAL_ID: - return Artifact_28; + return Artifact_Shape_ACN; case NestedArtifactNodeEditPartCN.VISUAL_ID: - return Artifact_40; + return Artifact_Shape_CN; case CommentEditPartCN.VISUAL_ID: - return Comment_54; + return Comment_Shape_CN; case ConstraintEditPartCN.VISUAL_ID: - return Constraint_56; + return Constraint_Shape_CN; case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - return DeploymentSpecification_2014; + return DeploymentSpecification_Shape_CCN; case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - return DeploymentSpecification_2015; + return DeploymentSpecification_Shape_CN; case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - return DeploymentSpecification_2016; + return DeploymentSpecification_Shape_ACN; case LinkDescriptorEditPart.VISUAL_ID: - return Link_4005; + return Link_DescriptorEdge; case CommentAnnotatedElementEditPart.VISUAL_ID: - return CommentAnnotatedElement_4008; + return Comment_AnnotatedElementEdge; case ConstraintConstrainedElementEditPart.VISUAL_ID: - return ConstraintConstrainedElement_4009; + return Constraint_ConstrainedElementEdge; case DeploymentEditPart.VISUAL_ID: - return Deployment_4001; + return Deployment_Edge; case ManifestationEditPart.VISUAL_ID: - return Manifestation_4002; + return Manifestation_Edge; case GeneralizationEditPart.VISUAL_ID: - return Generalization_4003; + return Generalization_Edge; case DependencyEditPart.VISUAL_ID: - return Dependency_4004; + return Dependency_Edge; case DependencyBranchEditPart.VISUAL_ID: - return Dependency_4010; + return Dependency_BranchEdge; case CommunicationPathEditPart.VISUAL_ID: - return CommunicationPath_4011; + return CommunicationPath_Edge; } } return null; @@ -448,53 +519,56 @@ public class UMLElementTypes { * @generated */ public static synchronized boolean isKnownElementType(IElementType elementType) { - if(KNOWN_ELEMENT_TYPES == null) { + if (KNOWN_ELEMENT_TYPES == null) { KNOWN_ELEMENT_TYPES = new HashSet<IElementType>(); - KNOWN_ELEMENT_TYPES.add(Package_1000); - KNOWN_ELEMENT_TYPES.add(Dependency_2011); - KNOWN_ELEMENT_TYPES.add(Model_2010); - KNOWN_ELEMENT_TYPES.add(Package_2009); - KNOWN_ELEMENT_TYPES.add(Constraint_2005); - KNOWN_ELEMENT_TYPES.add(Comment_2001); - KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_2002); - KNOWN_ELEMENT_TYPES.add(Device_2003); - KNOWN_ELEMENT_TYPES.add(Artifact_2006); - KNOWN_ELEMENT_TYPES.add(Node_2008); - KNOWN_ELEMENT_TYPES.add(NamedElement_2012); - KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2013); - KNOWN_ELEMENT_TYPES.add(Model_49); - KNOWN_ELEMENT_TYPES.add(Package_36); - KNOWN_ELEMENT_TYPES.add(Device_16); - KNOWN_ELEMENT_TYPES.add(Device_44); - KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_21); - KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_46); - KNOWN_ELEMENT_TYPES.add(Node_23); - KNOWN_ELEMENT_TYPES.add(Node_42); - KNOWN_ELEMENT_TYPES.add(Artifact_25); - KNOWN_ELEMENT_TYPES.add(Artifact_28); - KNOWN_ELEMENT_TYPES.add(Artifact_40); - KNOWN_ELEMENT_TYPES.add(Comment_54); - KNOWN_ELEMENT_TYPES.add(Constraint_56); - KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2014); - KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2015); - KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2016); - KNOWN_ELEMENT_TYPES.add(Link_4005); - KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_4008); - KNOWN_ELEMENT_TYPES.add(ConstraintConstrainedElement_4009); - KNOWN_ELEMENT_TYPES.add(Deployment_4001); - KNOWN_ELEMENT_TYPES.add(Manifestation_4002); - KNOWN_ELEMENT_TYPES.add(Generalization_4003); - KNOWN_ELEMENT_TYPES.add(Dependency_4004); - KNOWN_ELEMENT_TYPES.add(Dependency_4010); - KNOWN_ELEMENT_TYPES.add(CommunicationPath_4011); + KNOWN_ELEMENT_TYPES.add(Package_DeploymentDiagram); + KNOWN_ELEMENT_TYPES.add(Dependency_Shape); + KNOWN_ELEMENT_TYPES.add(Model_Shape); + KNOWN_ELEMENT_TYPES.add(Package_Shape); + KNOWN_ELEMENT_TYPES.add(Constraint_Shape); + KNOWN_ELEMENT_TYPES.add(Comment_Shape); + KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_Shape); + KNOWN_ELEMENT_TYPES.add(Device_Shape); + KNOWN_ELEMENT_TYPES.add(Artifact_Shape); + KNOWN_ELEMENT_TYPES.add(Node_Shape); + KNOWN_ELEMENT_TYPES.add(NamedElement_DefaultShape); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_Shape); + KNOWN_ELEMENT_TYPES.add(Model_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Package_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Device_Shape_CCN); + KNOWN_ELEMENT_TYPES.add(Device_Shape_CN); + KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_Shape_CCN); + KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Node_Shape_CCN); + KNOWN_ELEMENT_TYPES.add(Node_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Artifact_Shape_CCN); + KNOWN_ELEMENT_TYPES.add(Artifact_Shape_ACN); + KNOWN_ELEMENT_TYPES.add(Artifact_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Comment_Shape_CN); + KNOWN_ELEMENT_TYPES.add(Constraint_Shape_CN); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_Shape_CCN); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_Shape_CN); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_Shape_ACN); + KNOWN_ELEMENT_TYPES.add(Link_DescriptorEdge); + KNOWN_ELEMENT_TYPES.add(Comment_AnnotatedElementEdge); + KNOWN_ELEMENT_TYPES.add(Constraint_ConstrainedElementEdge); + KNOWN_ELEMENT_TYPES.add(Deployment_Edge); + KNOWN_ELEMENT_TYPES.add(Manifestation_Edge); + KNOWN_ELEMENT_TYPES.add(Generalization_Edge); + KNOWN_ELEMENT_TYPES.add(Dependency_Edge); + KNOWN_ELEMENT_TYPES.add(Dependency_BranchEdge); + KNOWN_ELEMENT_TYPES.add(CommunicationPath_Edge); } + boolean result = KNOWN_ELEMENT_TYPES.contains(elementType); - if(!result) { + + if (!result) { IElementType[] supertypes = elementType.getAllSuperTypes(); - for(int i = 0; !result && (i < supertypes.length); i++) { + for (int i = 0; !result && (i < supertypes.length); i++) { result = KNOWN_ELEMENT_TYPES.contains(supertypes[i]); } } + return result; } @@ -533,12 +607,14 @@ public class UMLElementTypes { */ public static boolean isKindOf(IElementType subtype, IElementType supertype) { boolean result = subtype == supertype; - if(!result) { + + if (!result) { IElementType[] supertypes = subtype.getAllSuperTypes(); - for(int i = 0; !result && (i < supertypes.length); i++) { + for (int i = 0; !result && (i < supertypes.length); i++) { result = supertype == supertypes[i]; } } + return result; } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java index 74cca4ccc74..f38ddaf7045 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java @@ -42,18 +42,18 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr @Override protected void doGotoMarker(IMarker marker) { String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null); - if(elementId == null || !(getEditor() instanceof DiagramEditor)) { + if (elementId == null || !(getEditor() instanceof DiagramEditor)) { return; } - DiagramEditor editor = (DiagramEditor)getEditor(); + DiagramEditor editor = (DiagramEditor) getEditor(); Map<?, ?> editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry(); EObject targetView = editor.getDiagram().eResource().getEObject(elementId); - if(targetView == null) { + if (targetView == null) { return; } - EditPart targetEditPart = (EditPart)editPartRegistry.get(targetView); - if(targetEditPart != null) { - UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[]{ targetEditPart })); + EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView); + if (targetEditPart != null) { + UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart })); } } @@ -79,9 +79,9 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr marker.setAttribute(IMarker.LOCATION, location); marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId); int markerSeverity = IMarker.SEVERITY_INFO; - if(statusSeverity == IStatus.WARNING) { + if (statusSeverity == IStatus.WARNING) { markerSeverity = IMarker.SEVERITY_WARNING; - } else if(statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) { + } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) { markerSeverity = IMarker.SEVERITY_ERROR; } marker.setAttribute(IMarker.SEVERITY, markerSeverity); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java index 8f358e680eb..c7762c0fc71 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java @@ -81,848 +81,880 @@ import org.eclipse.uml2.uml.UMLPackage; public class UMLParserProvider extends AbstractProvider implements IParserProvider { /** - * @generated - */ - private IParser dependencyName_7Parser; + * @generated + */ + private IParser dependency_MultiNameLabel_Parser; /** * @generated */ - private IParser getDependencyName_7Parser() { - if(dependencyName_7Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDependency_MultiNameLabel_Parser() { + if (dependency_MultiNameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - dependencyName_7Parser = parser; + dependency_MultiNameLabel_Parser = parser; } - return dependencyName_7Parser; + return dependency_MultiNameLabel_Parser; } /** * @generated */ - private IParser modelName_48Parser; + private IParser model_NameLabel_Parser; /** * @generated */ - private IParser getModelName_48Parser() { - if(modelName_48Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getModel_NameLabel_Parser() { + if (model_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - modelName_48Parser = parser; + model_NameLabel_Parser = parser; } - return modelName_48Parser; + return model_NameLabel_Parser; } /** * @generated */ - private IParser packageName_35Parser; + private IParser package_NameLabel_Parser; /** * @generated */ - private IParser getPackageName_35Parser() { - if(packageName_35Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getPackage_NameLabel_Parser() { + if (package_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - packageName_35Parser = parser; + package_NameLabel_Parser = parser; } - return packageName_35Parser; + return package_NameLabel_Parser; } /** * @generated */ - private IParser constraintName_2Parser; + private IParser constraint_NameLabel_Parser; /** * @generated */ - private IParser getConstraintName_2Parser() { - if(constraintName_2Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getConstraint_NameLabel_Parser() { + if (constraint_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - constraintName_2Parser = parser; + constraint_NameLabel_Parser = parser; } - return constraintName_2Parser; + return constraint_NameLabel_Parser; } /** * @generated */ - private ConstraintParser constraintSpecification_3Parser; + private ConstraintParser constraint_BodyLabel_Parser; /** * @generated */ - private IParser getConstraintSpecification_3Parser() { - if(constraintSpecification_3Parser == null) { - constraintSpecification_3Parser = new ConstraintParser(); + private IParser getConstraint_BodyLabel_Parser() { + if (constraint_BodyLabel_Parser == null) { + constraint_BodyLabel_Parser = new ConstraintParser(); } - return constraintSpecification_3Parser; + return constraint_BodyLabel_Parser; } /** * @generated */ - private CommentParser commentBody_1Parser; + private CommentParser comment_BodyLabel_Parser; /** * @generated */ - private IParser getCommentBody_1Parser() { - if(commentBody_1Parser == null) { - commentBody_1Parser = new CommentParser(); + private IParser getComment_BodyLabel_Parser() { + if (comment_BodyLabel_Parser == null) { + comment_BodyLabel_Parser = new CommentParser(); } - return commentBody_1Parser; + return comment_BodyLabel_Parser; } /** * @generated */ - private IParser executionEnvironmentName_5Parser; + private IParser executionEnvironment_NameLabel_Parser; /** * @generated */ - private IParser getExecutionEnvironmentName_5Parser() { - if(executionEnvironmentName_5Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getExecutionEnvironment_NameLabel_Parser() { + if (executionEnvironment_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - executionEnvironmentName_5Parser = parser; + executionEnvironment_NameLabel_Parser = parser; } - return executionEnvironmentName_5Parser; + return executionEnvironment_NameLabel_Parser; } /** * @generated */ - private IParser deviceName_6Parser; + private IParser device_NameLabel_Parser; /** * @generated */ - private IParser getDeviceName_6Parser() { - if(deviceName_6Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDevice_NameLabel_Parser() { + if (device_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deviceName_6Parser = parser; + device_NameLabel_Parser = parser; } - return deviceName_6Parser; + return device_NameLabel_Parser; } /** * @generated */ - private IParser artifactName_8Parser; + private IParser artifact_NameLabel_Parser; /** * @generated */ - private IParser getArtifactName_8Parser() { - if(artifactName_8Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_NameLabel_Parser() { + if (artifact_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_8Parser = parser; + artifact_NameLabel_Parser = parser; } - return artifactName_8Parser; + return artifact_NameLabel_Parser; } /** * @generated */ - private IParser artifactName_61Parser; + private IParser artifact_FloatingNameLabel_Parser; /** * @generated */ - private IParser getArtifactName_61Parser() { - if(artifactName_61Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_FloatingNameLabel_Parser() { + if (artifact_FloatingNameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_61Parser = parser; + artifact_FloatingNameLabel_Parser = parser; } - return artifactName_61Parser; + return artifact_FloatingNameLabel_Parser; } /** * @generated */ - private IParser nodeName_9Parser; + private IParser node_NameLabel_Parser; /** * @generated */ - private IParser getNodeName_9Parser() { - if(nodeName_9Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getNode_NameLabel_Parser() { + if (node_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - nodeName_9Parser = parser; + node_NameLabel_Parser = parser; } - return nodeName_9Parser; + return node_NameLabel_Parser; } /** * @generated */ - private IParser namedElementName_53Parser; + private IParser namedElement_NameLabel_Parser; /** * @generated */ - private IParser getNamedElementName_53Parser() { - if(namedElementName_53Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getNamedElement_NameLabel_Parser() { + if (namedElement_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - namedElementName_53Parser = parser; + namedElement_NameLabel_Parser = parser; } - return namedElementName_53Parser; + return namedElement_NameLabel_Parser; } /** - * @generated - */ - private IParser deploymentSpecificationName_62Parser; + * @generated + */ + private IParser deploymentSpecification_NameLabel_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_62Parser() { - if(deploymentSpecificationName_62Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_NameLabel_Parser() { + if (deploymentSpecification_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_62Parser = parser; + deploymentSpecification_NameLabel_Parser = parser; } - return deploymentSpecificationName_62Parser; + return deploymentSpecification_NameLabel_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_63Parser; + private IParser deploymentSpecification_FloatingNameLabel_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_63Parser() { - if(deploymentSpecificationName_63Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_FloatingNameLabel_Parser() { + if (deploymentSpecification_FloatingNameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_63Parser = parser; + deploymentSpecification_FloatingNameLabel_Parser = parser; } - return deploymentSpecificationName_63Parser; + return deploymentSpecification_FloatingNameLabel_Parser; } /** * @generated */ - private IParser modelName_50Parser; + private IParser model_NameLabel_CN_Parser; /** * @generated */ - private IParser getModelName_50Parser() { - if(modelName_50Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getModel_NameLabel_CN_Parser() { + if (model_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - modelName_50Parser = parser; + model_NameLabel_CN_Parser = parser; } - return modelName_50Parser; + return model_NameLabel_CN_Parser; } /** * @generated */ - private IParser packageName_37Parser; + private IParser package_NameLabel_CN_Parser; /** * @generated */ - private IParser getPackageName_37Parser() { - if(packageName_37Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getPackage_NameLabel_CN_Parser() { + if (package_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - packageName_37Parser = parser; + package_NameLabel_CN_Parser = parser; } - return packageName_37Parser; + return package_NameLabel_CN_Parser; } /** * @generated */ - private IParser deviceName_20Parser; + private IParser device_NameLabel_CCN_Parser; /** * @generated */ - private IParser getDeviceName_20Parser() { - if(deviceName_20Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDevice_NameLabel_CCN_Parser() { + if (device_NameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deviceName_20Parser = parser; + device_NameLabel_CCN_Parser = parser; } - return deviceName_20Parser; + return device_NameLabel_CCN_Parser; } /** * @generated */ - private IParser deviceName_45Parser; + private IParser device_NameLabel_CN_Parser; /** * @generated */ - private IParser getDeviceName_45Parser() { - if(deviceName_45Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDevice_NameLabel_CN_Parser() { + if (device_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deviceName_45Parser = parser; + device_NameLabel_CN_Parser = parser; } - return deviceName_45Parser; + return device_NameLabel_CN_Parser; } /** * @generated */ - private IParser executionEnvironmentName_22Parser; + private IParser executionEnvironment_NameLabel_CCN_Parser; /** * @generated */ - private IParser getExecutionEnvironmentName_22Parser() { - if(executionEnvironmentName_22Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getExecutionEnvironment_NameLabel_CCN_Parser() { + if (executionEnvironment_NameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - executionEnvironmentName_22Parser = parser; + executionEnvironment_NameLabel_CCN_Parser = parser; } - return executionEnvironmentName_22Parser; + return executionEnvironment_NameLabel_CCN_Parser; } /** * @generated */ - private IParser executionEnvironmentName_47Parser; + private IParser executionEnvironment_NameLabel_CN_Parser; /** * @generated */ - private IParser getExecutionEnvironmentName_47Parser() { - if(executionEnvironmentName_47Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getExecutionEnvironment_NameLabel_CN_Parser() { + if (executionEnvironment_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - executionEnvironmentName_47Parser = parser; + executionEnvironment_NameLabel_CN_Parser = parser; } - return executionEnvironmentName_47Parser; + return executionEnvironment_NameLabel_CN_Parser; } /** * @generated */ - private IParser nodeName_24Parser; + private IParser node_NameLabel_CCN_Parser; /** * @generated */ - private IParser getNodeName_24Parser() { - if(nodeName_24Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getNode_NameLabel_CCN_Parser() { + if (node_NameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - nodeName_24Parser = parser; + node_NameLabel_CCN_Parser = parser; } - return nodeName_24Parser; + return node_NameLabel_CCN_Parser; } /** * @generated */ - private IParser nodeName_43Parser; + private IParser node_NameLabel_CN_Parser; /** * @generated */ - private IParser getNodeName_43Parser() { - if(nodeName_43Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getNode_NameLabel_CN_Parser() { + if (node_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - nodeName_43Parser = parser; + node_NameLabel_CN_Parser = parser; } - return nodeName_43Parser; + return node_NameLabel_CN_Parser; } /** * @generated */ - private IParser artifactName_27Parser; + private IParser artifact_NameLabel_CCN_Parser; /** * @generated */ - private IParser getArtifactName_27Parser() { - if(artifactName_27Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_NameLabel_CCN_Parser() { + if (artifact_NameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_27Parser = parser; + artifact_NameLabel_CCN_Parser = parser; } - return artifactName_27Parser; + return artifact_NameLabel_CCN_Parser; } /** * @generated */ - private IParser artifactName_59Parser; + private IParser artifact_FloatingNameLabel_CCN_Parser; /** * @generated */ - private IParser getArtifactName_59Parser() { - if(artifactName_59Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_FloatingNameLabel_CCN_Parser() { + if (artifact_FloatingNameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_59Parser = parser; + artifact_FloatingNameLabel_CCN_Parser = parser; } - return artifactName_59Parser; + return artifact_FloatingNameLabel_CCN_Parser; } /** * @generated */ - private IParser artifactName_29Parser; + private IParser artifact_NameLabel_ACN_Parser; /** * @generated */ - private IParser getArtifactName_29Parser() { - if(artifactName_29Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_NameLabel_ACN_Parser() { + if (artifact_NameLabel_ACN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_29Parser = parser; + artifact_NameLabel_ACN_Parser = parser; } - return artifactName_29Parser; + return artifact_NameLabel_ACN_Parser; } /** * @generated */ - private IParser artifactName_60Parser; + private IParser artifact_FloatingNameLabel_ACN_Parser; /** * @generated */ - private IParser getArtifactName_60Parser() { - if(artifactName_60Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_FloatingNameLabel_ACN_Parser() { + if (artifact_FloatingNameLabel_ACN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_60Parser = parser; + artifact_FloatingNameLabel_ACN_Parser = parser; } - return artifactName_60Parser; + return artifact_FloatingNameLabel_ACN_Parser; } /** * @generated */ - private IParser artifactName_41Parser; + private IParser artifact_NameLabel_CN_Parser; /** * @generated */ - private IParser getArtifactName_41Parser() { - if(artifactName_41Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getArtifact_NameLabel_CN_Parser() { + if (artifact_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - artifactName_41Parser = parser; + artifact_NameLabel_CN_Parser = parser; } - return artifactName_41Parser; + return artifact_NameLabel_CN_Parser; } /** * @generated */ - private CommentParser commentBody_55Parser; + private CommentParser comment_BodyLabel_CN_Parser; /** * @generated */ - private IParser getCommentBody_55Parser() { - if(commentBody_55Parser == null) { - commentBody_55Parser = new CommentParser(); + private IParser getComment_BodyLabel_CN_Parser() { + if (comment_BodyLabel_CN_Parser == null) { + comment_BodyLabel_CN_Parser = new CommentParser(); } - return commentBody_55Parser; + return comment_BodyLabel_CN_Parser; } /** * @generated */ - private IParser constraintName_57Parser; + private IParser constraint_NameLabel_CN_Parser; /** * @generated */ - private IParser getConstraintName_57Parser() { - if(constraintName_57Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getConstraint_NameLabel_CN_Parser() { + if (constraint_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - constraintName_57Parser = parser; + constraint_NameLabel_CN_Parser = parser; } - return constraintName_57Parser; + return constraint_NameLabel_CN_Parser; } /** * @generated */ - private ConstraintParser constraintSpecification_58Parser; + private ConstraintParser constraint_BodyLabel_CN_Parser; /** * @generated */ - private IParser getConstraintSpecification_58Parser() { - if(constraintSpecification_58Parser == null) { - constraintSpecification_58Parser = new ConstraintParser(); + private IParser getConstraint_BodyLabel_CN_Parser() { + if (constraint_BodyLabel_CN_Parser == null) { + constraint_BodyLabel_CN_Parser = new ConstraintParser(); } - return constraintSpecification_58Parser; + return constraint_BodyLabel_CN_Parser; } /** - * @generated - */ - private IParser deploymentSpecificationName_64Parser; + * @generated + */ + private IParser deploymentSpecification_NameLabel_CCN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_64Parser() { - if(deploymentSpecificationName_64Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_NameLabel_CCN_Parser() { + if (deploymentSpecification_NameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_64Parser = parser; + deploymentSpecification_NameLabel_CCN_Parser = parser; } - return deploymentSpecificationName_64Parser; + return deploymentSpecification_NameLabel_CCN_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_65Parser; + private IParser deploymentSpecification_FloatingNameLabel_CCN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_65Parser() { - if(deploymentSpecificationName_65Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_FloatingNameLabel_CCN_Parser() { + if (deploymentSpecification_FloatingNameLabel_CCN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_65Parser = parser; + deploymentSpecification_FloatingNameLabel_CCN_Parser = parser; } - return deploymentSpecificationName_65Parser; + return deploymentSpecification_FloatingNameLabel_CCN_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_66Parser; + private IParser deploymentSpecification_NameLabel_CN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_66Parser() { - if(deploymentSpecificationName_66Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_NameLabel_CN_Parser() { + if (deploymentSpecification_NameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_66Parser = parser; + deploymentSpecification_NameLabel_CN_Parser = parser; } - return deploymentSpecificationName_66Parser; + return deploymentSpecification_NameLabel_CN_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_67Parser; + private IParser deploymentSpecification_FloatingNameLabel_CN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_67Parser() { - if(deploymentSpecificationName_67Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_FloatingNameLabel_CN_Parser() { + if (deploymentSpecification_FloatingNameLabel_CN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_67Parser = parser; + deploymentSpecification_FloatingNameLabel_CN_Parser = parser; } - return deploymentSpecificationName_67Parser; + return deploymentSpecification_FloatingNameLabel_CN_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_68Parser; + private IParser deploymentSpecification_NameLabel_ACN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_68Parser() { - if(deploymentSpecificationName_68Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_NameLabel_ACN_Parser() { + if (deploymentSpecification_NameLabel_ACN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_68Parser = parser; + deploymentSpecification_NameLabel_ACN_Parser = parser; } - return deploymentSpecificationName_68Parser; + return deploymentSpecification_NameLabel_ACN_Parser; } /** * @generated */ - private IParser deploymentSpecificationName_69Parser; + private IParser deploymentSpecification_FloatingNameLabel_ACN_Parser; /** * @generated */ - private IParser getDeploymentSpecificationName_69Parser() { - if(deploymentSpecificationName_69Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeploymentSpecification_FloatingNameLabel_ACN_Parser() { + if (deploymentSpecification_FloatingNameLabel_ACN_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentSpecificationName_69Parser = parser; + deploymentSpecification_FloatingNameLabel_ACN_Parser = parser; } - return deploymentSpecificationName_69Parser; + return deploymentSpecification_FloatingNameLabel_ACN_Parser; } /** * @generated */ - private IParser deploymentName_13Parser; + private IParser deployment_NameLabel_Parser; /** * @generated */ - private IParser getDeploymentName_13Parser() { - if(deploymentName_13Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDeployment_NameLabel_Parser() { + if (deployment_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - deploymentName_13Parser = parser; + deployment_NameLabel_Parser = parser; } - return deploymentName_13Parser; + return deployment_NameLabel_Parser; } /** * @generated */ - private AppliedStereotypeParser deploymentName_14Parser; + private AppliedStereotypeParser deployment_StereotypeLabel_Parser; /** * @generated */ - private IParser getDeploymentName_14Parser() { - if(deploymentName_14Parser == null) { - deploymentName_14Parser = new AppliedStereotypeParser(); + private IParser getDeployment_StereotypeLabel_Parser() { + if (deployment_StereotypeLabel_Parser == null) { + deployment_StereotypeLabel_Parser = new AppliedStereotypeParser(); } - return deploymentName_14Parser; + return deployment_StereotypeLabel_Parser; } /** * @generated */ - private IParser manifestationName_10Parser; + private IParser manifestation_NameLabel_Parser; /** * @generated */ - private IParser getManifestationName_10Parser() { - if(manifestationName_10Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getManifestation_NameLabel_Parser() { + if (manifestation_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - manifestationName_10Parser = parser; + manifestation_NameLabel_Parser = parser; } - return manifestationName_10Parser; + return manifestation_NameLabel_Parser; } /** * @generated */ - private AppliedStereotypeParser manifestationName_11Parser; + private AppliedStereotypeParser manifestation_StereotypeLabel_Parser; /** * @generated */ - private IParser getManifestationName_11Parser() { - if(manifestationName_11Parser == null) { - manifestationName_11Parser = new AppliedStereotypeParser(); + private IParser getManifestation_StereotypeLabel_Parser() { + if (manifestation_StereotypeLabel_Parser == null) { + manifestation_StereotypeLabel_Parser = new AppliedStereotypeParser(); } - return manifestationName_11Parser; + return manifestation_StereotypeLabel_Parser; } /** * @generated */ - private AppliedStereotypeParser generalizationIsSubstitutable_4Parser; + private AppliedStereotypeParser generalization_StereotypeLabel_Parser; /** * @generated */ - private IParser getGeneralizationIsSubstitutable_4Parser() { - if(generalizationIsSubstitutable_4Parser == null) { - generalizationIsSubstitutable_4Parser = new AppliedStereotypeParser(); + private IParser getGeneralization_StereotypeLabel_Parser() { + if (generalization_StereotypeLabel_Parser == null) { + generalization_StereotypeLabel_Parser = new AppliedStereotypeParser(); } - return generalizationIsSubstitutable_4Parser; + return generalization_StereotypeLabel_Parser; } /** * @generated */ - private IParser dependencyName_12Parser; + private IParser dependency_NameLabel_Parser; /** * @generated */ - private IParser getDependencyName_12Parser() { - if(dependencyName_12Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getDependency_NameLabel_Parser() { + if (dependency_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - dependencyName_12Parser = parser; + dependency_NameLabel_Parser = parser; } - return dependencyName_12Parser; + return dependency_NameLabel_Parser; } /** * @generated */ - private AppliedStereotypeParser dependencyName_15Parser; + private AppliedStereotypeParser dependency_StereotypeLabel_Parser; /** * @generated */ - private IParser getDependencyName_15Parser() { - if(dependencyName_15Parser == null) { - dependencyName_15Parser = new AppliedStereotypeParser(); + private IParser getDependency_StereotypeLabel_Parser() { + if (dependency_StereotypeLabel_Parser == null) { + dependency_StereotypeLabel_Parser = new AppliedStereotypeParser(); } - return dependencyName_15Parser; + return dependency_StereotypeLabel_Parser; } /** - * @generated - */ - private IParser communicationPathName_6001Parser; + * @generated + */ + private IParser communicationPath_NameLabel_Parser; /** * @generated */ - private IParser getCommunicationPathName_6001Parser() { - if(communicationPathName_6001Parser == null) { - EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() }; + private IParser getCommunicationPath_NameLabel_Parser() { + if (communicationPath_NameLabel_Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - communicationPathName_6001Parser = parser; + communicationPath_NameLabel_Parser = parser; } - return communicationPathName_6001Parser; + return communicationPath_NameLabel_Parser; } /** * @generated */ - private AppliedStereotypeParser communicationPathName_6002Parser; + private AppliedStereotypeParser communicationPath_StereotypeLabel_Parser; /** * @generated */ - private IParser getCommunicationPathName_6002Parser() { - if(communicationPathName_6002Parser == null) { - communicationPathName_6002Parser = new AppliedStereotypeParser(); + private IParser getCommunicationPath_StereotypeLabel_Parser() { + if (communicationPath_StereotypeLabel_Parser == null) { + communicationPath_StereotypeLabel_Parser = new AppliedStereotypeParser(); } - return communicationPathName_6002Parser; + return communicationPath_StereotypeLabel_Parser; } /** * @generated */ protected IParser getParser(String visualID) { - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case MultiDependencyLabelEditPart.VISUAL_ID: - return getDependencyName_7Parser(); + return getDependency_MultiNameLabel_Parser(); + case ModelNameEditPart.VISUAL_ID: - return getModelName_48Parser(); + return getModel_NameLabel_Parser(); + case PackageNameEditPart.VISUAL_ID: - return getPackageName_35Parser(); + return getPackage_NameLabel_Parser(); + case ConstraintNameEditPart.VISUAL_ID: - return getConstraintName_2Parser(); + return getConstraint_NameLabel_Parser(); case ConstraintSpecificationEditPart.VISUAL_ID: - return getConstraintSpecification_3Parser(); + return getConstraint_BodyLabel_Parser(); + case CommentBodyEditPart.VISUAL_ID: - return getCommentBody_1Parser(); + return getComment_BodyLabel_Parser(); + case ExecutionEnvironmentNameEditPart.VISUAL_ID: - return getExecutionEnvironmentName_5Parser(); + return getExecutionEnvironment_NameLabel_Parser(); + case DeviceNameEditPart.VISUAL_ID: - return getDeviceName_6Parser(); + return getDevice_NameLabel_Parser(); + case ArtifactNameEditPart.VISUAL_ID: - return getArtifactName_8Parser(); + return getArtifact_NameLabel_Parser(); case ArtifactFloatingLabelEditPart.VISUAL_ID: - return getArtifactName_61Parser(); + return getArtifact_FloatingNameLabel_Parser(); + case NodeNameEditPart.VISUAL_ID: - return getNodeName_9Parser(); + return getNode_NameLabel_Parser(); + case DefaultNamedElementNameEditPart.VISUAL_ID: - return getNamedElementName_53Parser(); + return getNamedElement_NameLabel_Parser(); + case DeploymentSpecificationNameEditPart.VISUAL_ID: - return getDeploymentSpecificationName_62Parser(); + return getDeploymentSpecification_NameLabel_Parser(); case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: - return getDeploymentSpecificationName_63Parser(); + return getDeploymentSpecification_FloatingNameLabel_Parser(); + case ModelNameEditPartCN.VISUAL_ID: - return getModelName_50Parser(); + return getModel_NameLabel_CN_Parser(); + case PackageNameEditPartCN.VISUAL_ID: - return getPackageName_37Parser(); + return getPackage_NameLabel_CN_Parser(); + case DeviceNameEditPartCN.VISUAL_ID: - return getDeviceName_20Parser(); + return getDevice_NameLabel_CCN_Parser(); + case NestedDeviceNameEditPartCN.VISUAL_ID: - return getDeviceName_45Parser(); + return getDevice_NameLabel_CN_Parser(); + case ExecutionEnvironmentNameEditPartCN.VISUAL_ID: - return getExecutionEnvironmentName_22Parser(); + return getExecutionEnvironment_NameLabel_CCN_Parser(); + case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID: - return getExecutionEnvironmentName_47Parser(); + return getExecutionEnvironment_NameLabel_CN_Parser(); + case NodeNameEditPartCN.VISUAL_ID: - return getNodeName_24Parser(); + return getNode_NameLabel_CCN_Parser(); + case NestedNodeNameEditPart.VISUAL_ID: - return getNodeName_43Parser(); + return getNode_NameLabel_CN_Parser(); + case ArtifactNameEditPartCN.VISUAL_ID: - return getArtifactName_27Parser(); + return getArtifact_NameLabel_CCN_Parser(); case ArtifactFloatingLabelEditPartCN.VISUAL_ID: - return getArtifactName_59Parser(); + return getArtifact_FloatingNameLabel_CCN_Parser(); + case ArtifactNameEditPartACN.VISUAL_ID: - return getArtifactName_29Parser(); + return getArtifact_NameLabel_ACN_Parser(); case ArtifactFloatingLabelEditPartACN.VISUAL_ID: - return getArtifactName_60Parser(); + return getArtifact_FloatingNameLabel_ACN_Parser(); + case NestedArtifactNameEditPart.VISUAL_ID: - return getArtifactName_41Parser(); + return getArtifact_NameLabel_CN_Parser(); + case CommentBodyEditPartCN.VISUAL_ID: - return getCommentBody_55Parser(); + return getComment_BodyLabel_CN_Parser(); + case ConstraintNameEditPartCN.VISUAL_ID: - return getConstraintName_57Parser(); + return getConstraint_NameLabel_CN_Parser(); case ConstraintSpecificationEditPartCN.VISUAL_ID: - return getConstraintSpecification_58Parser(); + return getConstraint_BodyLabel_CN_Parser(); + case DeploymentSpecAsClassifierNameEditPart.VISUAL_ID: - return getDeploymentSpecificationName_64Parser(); + return getDeploymentSpecification_NameLabel_CCN_Parser(); case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: - return getDeploymentSpecificationName_65Parser(); + return getDeploymentSpecification_FloatingNameLabel_CCN_Parser(); + case DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID: - return getDeploymentSpecificationName_66Parser(); + return getDeploymentSpecification_NameLabel_CN_Parser(); case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: - return getDeploymentSpecificationName_67Parser(); + return getDeploymentSpecification_FloatingNameLabel_CN_Parser(); + case DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID: - return getDeploymentSpecificationName_68Parser(); + return getDeploymentSpecification_NameLabel_ACN_Parser(); case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: - return getDeploymentSpecificationName_69Parser(); + return getDeploymentSpecification_FloatingNameLabel_ACN_Parser(); + case DeploymentNameEditPart.VISUAL_ID: - return getDeploymentName_13Parser(); + return getDeployment_NameLabel_Parser(); case DeploymentAppliedStereotypeEditPart.VISUAL_ID: - return getDeploymentName_14Parser(); + return getDeployment_StereotypeLabel_Parser(); + case ManifestationNameEditPart.VISUAL_ID: - return getManifestationName_10Parser(); + return getManifestation_NameLabel_Parser(); case ManifestationAppliedStereotypeEditPart.VISUAL_ID: - return getManifestationName_11Parser(); + return getManifestation_StereotypeLabel_Parser(); + case GeneralizationAppliedStereotypeEditPart.VISUAL_ID: - return getGeneralizationIsSubstitutable_4Parser(); + return getGeneralization_StereotypeLabel_Parser(); + case DependencyNameEditPart.VISUAL_ID: - return getDependencyName_12Parser(); + return getDependency_NameLabel_Parser(); case DependencyAppliedStereotypeEditPart.VISUAL_ID: - return getDependencyName_15Parser(); + return getDependency_StereotypeLabel_Parser(); + case CommunicationPathNameEditPart.VISUAL_ID: - return getCommunicationPathName_6001Parser(); + return getCommunicationPath_NameLabel_Parser(); case CommunicationPathAppliedStereotypeEditPart.VISUAL_ID: - return getCommunicationPathName_6002Parser(); + return getCommunicationPath_StereotypeLabel_Parser(); + } } return null; @@ -942,12 +974,12 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid */ @Override public IParser getParser(IAdaptable hint) { - String vid = (String)hint.getAdapter(String.class); - if(vid != null) { + String vid = (String) hint.getAdapter(String.class); + if (vid != null) { return getParser(UMLVisualIDRegistry.getVisualID(vid)); } - View view = (View)hint.getAdapter(View.class); - if(view != null) { + View view = (View) hint.getAdapter(View.class); + if (view != null) { return getParser(UMLVisualIDRegistry.getVisualID(view)); } return null; @@ -958,9 +990,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid */ @Override public boolean provides(IOperation operation) { - if(operation instanceof GetParserOperation) { - IAdaptable hint = ((GetParserOperation)operation).getHint(); - if(UMLElementTypes.getElement(hint) == null) { + if (operation instanceof GetParserOperation) { + IAdaptable hint = ((GetParserOperation) operation).getHint(); + if (UMLElementTypes.getElement(hint) == null) { return false; } return getParser(hint) != null; @@ -992,7 +1024,7 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid */ @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - if(IElementType.class.equals(adapter)) { + if (IElementType.class.equals(adapter)) { return elementType; } return super.getAdapter(adapter); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java index 13ffca5ab4f..dd23d2fcf33 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java @@ -37,20 +37,20 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider */ @Override public void createDecorators(IDecoratorTarget decoratorTarget) { - EditPart editPart = (EditPart)decoratorTarget.getAdapter(EditPart.class); - if(editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { + EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class); + if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { Object model = editPart.getModel(); - if((model instanceof View)) { - View view = (View)model; - if(!(view instanceof Edge) && !view.isSetElement()) { + if ((model instanceof View)) { + View view = (View) model; + if (!(view instanceof Edge) && !view.isSetElement()) { return; } } EditDomain ed = editPart.getViewer().getEditDomain(); - if(!(ed instanceof DiagramEditDomain)) { + if (!(ed instanceof DiagramEditDomain)) { return; } - if(((DiagramEditDomain)ed).getEditorPart() instanceof UMLDiagramEditor) { + if (((DiagramEditDomain) ed).getEditorPart() instanceof UMLDiagramEditor) { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } @@ -61,11 +61,11 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider */ @Override public boolean provides(IOperation operation) { - if(!(operation instanceof CreateDecoratorsOperation)) { + if (!(operation instanceof CreateDecoratorsOperation)) { return false; } - IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation)operation).getDecoratorTarget(); - View view = (View)decoratorTarget.getAdapter(View.class); + IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); + View view = (View) decoratorTarget.getAdapter(View.class); return view != null && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java index 81f60fe97dc..291b484d220 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java @@ -40,7 +40,6 @@ public class UMLValidationProvider { public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) { final Runnable op = operation; Runnable task = new Runnable() { - @Override public void run() { try { @@ -51,7 +50,7 @@ public class UMLValidationProvider { } } }; - if(editingDomain != null) { + if (editingDomain != null) { try { editingDomain.runExclusive(task); } catch (Exception e) { @@ -66,11 +65,12 @@ public class UMLValidationProvider { * @generated */ static boolean isInDefaultEditorContext(Object object) { - if(shouldConstraintsBePrivate() && !constraintsActive) { + if (shouldConstraintsBePrivate() && !constraintsActive) { return false; } - if(object instanceof View) { - return constraintsActive && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View)object)); + if (object instanceof View) { + return constraintsActive + && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object)); } return true; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java index b7b87de0626..126a775aa59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java @@ -166,16 +166,16 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { */ @Override public final boolean provides(IOperation operation) { - if(operation instanceof CreateViewForKindOperation) { - return provides((CreateViewForKindOperation)operation); + if (operation instanceof CreateViewForKindOperation) { + return provides((CreateViewForKindOperation) operation); } assert operation instanceof CreateViewOperation; - if(operation instanceof CreateDiagramViewOperation) { - return provides((CreateDiagramViewOperation)operation); - } else if(operation instanceof CreateEdgeViewOperation) { - return provides((CreateEdgeViewOperation)operation); - } else if(operation instanceof CreateNodeViewOperation) { - return provides((CreateNodeViewOperation)operation); + if (operation instanceof CreateDiagramViewOperation) { + return provides((CreateDiagramViewOperation) operation); + } else if (operation instanceof CreateEdgeViewOperation) { + return provides((CreateEdgeViewOperation) operation); + } else if (operation instanceof CreateNodeViewOperation) { + return provides((CreateNodeViewOperation) operation); } return false; } @@ -190,15 +190,18 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { if (op.getViewKind() == Edge.class) return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null; */ + // check Diagram Type should be the class diagram String modelID = UMLVisualIDRegistry.getModelID(op.getContainerView()); - if(!getDiagramProvidedId().equals(modelID)) { + if (!getDiagramProvidedId().equals(modelID)) { return false; } + String visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint()); - if(Node.class.isAssignableFrom(op.getViewKind())) { + if (Node.class.isAssignableFrom(op.getViewKind())) { return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID); } + return true; } @@ -221,46 +224,49 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ protected boolean provides(CreateDiagramViewOperation op) { - return DeploymentDiagramEditPart.MODEL_ID.equals(op.getSemanticHint()) && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != null; + return DeploymentDiagramEditPart.MODEL_ID.equals(op.getSemanticHint()) + && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != null; } /** * @generated */ protected boolean provides(CreateNodeViewOperation op) { - if(op.getContainerView() == null) { + if (op.getContainerView() == null) { return false; } IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); EObject domainElement = getSemanticElement(op.getSemanticAdapter()); String visualID; - if(op.getSemanticHint() == null) { + if (op.getSemanticHint() == null) { // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy. // In this situation there should be NO elementType, visualID will be determined // by VisualIDRegistry.getNodeVisualID() for domainElement. - if(elementType != null || domainElement == null) { + if (elementType != null || domainElement == null) { return false; } visualID = UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement); } else { visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint()); - if(elementType != null) { - if(!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) { + if (elementType != null) { + + if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) { return false; // foreign element type } - String elementTypeHint = ((IHintedType)elementType).getSemanticHint(); - if(!op.getSemanticHint().equals(elementTypeHint)) { + + String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); + if (!op.getSemanticHint().equals(elementTypeHint)) { return false; // if semantic hint is specified it should be the same as in element type } //if (domainElement != null && !visualID.equals(org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement))) { // return false; // visual id for node EClass should match visual id from element type //} } else { - if(!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) { + if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) { return false; // foreign diagram } - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case DependencyNodeEditPart.VISUAL_ID: case ConstraintEditPart.VISUAL_ID: case CommentEditPart.VISUAL_ID: @@ -288,7 +294,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case ArtifactEditPartCN.VISUAL_ID: case ArtifactEditPartACN.VISUAL_ID: case NestedArtifactNodeEditPartCN.VISUAL_ID: - if(domainElement == null || !visualID.equals(UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement))) { + if (domainElement == null || !visualID + .equals(UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement))) { return false; // visual id in semantic hint should match visual id for domain element } break; @@ -298,6 +305,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { } } } + return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID); } @@ -307,13 +315,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { protected boolean provides(CreateEdgeViewOperation op) { IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); //RS: add code for extended types creation - if(elementType instanceof IExtendedHintedElementType) { + if (elementType instanceof IExtendedHintedElementType) { IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType); - if(!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) { + if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) + || (!(closestNonExtendedType instanceof IHintedType))) { return false; // foreign element type. } } else { - if(!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) { + if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) { return false; // foreign element type } } @@ -321,8 +330,9 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { // return false; // foreign element type //} // END R.S. - String elementTypeHint = ((IHintedType)elementType).getSemanticHint(); - if(elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) { + String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); + if (elementTypeHint == null + || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) { return false; // our hint is visual id and must be specified, and it should be the same as in element type } //String visualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(elementTypeHint); @@ -352,70 +362,78 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ @Override - public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, + boolean persisted, PreferencesHint preferencesHint) { final EObject domainElement = getSemanticElement(semanticAdapter); final String visualID; - if(semanticHint == null) { + if (semanticHint == null) { visualID = UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement); } else { visualID = UMLVisualIDRegistry.getVisualID(semanticHint); } - if(visualID != null) { - switch(visualID) { + if (visualID != null) { + switch (visualID) { case DependencyNodeEditPart.VISUAL_ID: - return createDependency_2011(domainElement, containerView, index, persisted, preferencesHint); + return createDependency_Shape(domainElement, containerView, index, persisted, preferencesHint); case ModelEditPart.VISUAL_ID: - return createModel_2010(domainElement, containerView, index, persisted, preferencesHint); + return createModel_Shape(domainElement, containerView, index, persisted, preferencesHint); case PackageEditPart.VISUAL_ID: - return createPackage_2009(domainElement, containerView, index, persisted, preferencesHint); + return createPackage_Shape(domainElement, containerView, index, persisted, preferencesHint); case ConstraintEditPart.VISUAL_ID: - return createConstraint_2005(domainElement, containerView, index, persisted, preferencesHint); + return createConstraint_Shape(domainElement, containerView, index, persisted, preferencesHint); case CommentEditPart.VISUAL_ID: - return createComment_2001(domainElement, containerView, index, persisted, preferencesHint); + return createComment_Shape(domainElement, containerView, index, persisted, preferencesHint); case ExecutionEnvironmentEditPart.VISUAL_ID: - return createExecutionEnvironment_2002(domainElement, containerView, index, persisted, preferencesHint); + return createExecutionEnvironment_Shape(domainElement, containerView, index, persisted, + preferencesHint); case DeviceEditPart.VISUAL_ID: - return createDevice_2003(domainElement, containerView, index, persisted, preferencesHint); + return createDevice_Shape(domainElement, containerView, index, persisted, preferencesHint); case ArtifactEditPart.VISUAL_ID: - return createArtifact_2006(domainElement, containerView, index, persisted, preferencesHint); + return createArtifact_Shape(domainElement, containerView, index, persisted, preferencesHint); case NodeEditPart.VISUAL_ID: - return createNode_2008(domainElement, containerView, index, persisted, preferencesHint); + return createNode_Shape(domainElement, containerView, index, persisted, preferencesHint); case DefaultNamedElementEditPart.VISUAL_ID: - return createNamedElement_2012(domainElement, containerView, index, persisted, preferencesHint); + return createNamedElement_DefaultShape(domainElement, containerView, index, persisted, preferencesHint); case DeploymentSpecificationEditPart.VISUAL_ID: - return createDeploymentSpecification_2013(domainElement, containerView, index, persisted, preferencesHint); + return createDeploymentSpecification_Shape(domainElement, containerView, index, persisted, + preferencesHint); case ModelEditPartCN.VISUAL_ID: - return createModel_49(domainElement, containerView, index, persisted, preferencesHint); + return createModel_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case PackageEditPartCN.VISUAL_ID: - return createPackage_36(domainElement, containerView, index, persisted, preferencesHint); + return createPackage_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case DeviceEditPartCN.VISUAL_ID: - return createDevice_16(domainElement, containerView, index, persisted, preferencesHint); + return createDevice_Shape_CCN(domainElement, containerView, index, persisted, preferencesHint); case NestedDeviceEditPartCN.VISUAL_ID: - return createDevice_44(domainElement, containerView, index, persisted, preferencesHint); + return createDevice_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case ExecutionEnvironmentEditPartCN.VISUAL_ID: - return createExecutionEnvironment_21(domainElement, containerView, index, persisted, preferencesHint); + return createExecutionEnvironment_Shape_CCN(domainElement, containerView, index, persisted, + preferencesHint); case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: - return createExecutionEnvironment_46(domainElement, containerView, index, persisted, preferencesHint); + return createExecutionEnvironment_Shape_CN(domainElement, containerView, index, persisted, + preferencesHint); case NodeEditPartCN.VISUAL_ID: - return createNode_23(domainElement, containerView, index, persisted, preferencesHint); + return createNode_Shape_CCN(domainElement, containerView, index, persisted, preferencesHint); case NestedNodeEditPartCN.VISUAL_ID: - return createNode_42(domainElement, containerView, index, persisted, preferencesHint); + return createNode_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case ArtifactEditPartCN.VISUAL_ID: - return createArtifact_25(domainElement, containerView, index, persisted, preferencesHint); + return createArtifact_Shape_CCN(domainElement, containerView, index, persisted, preferencesHint); case ArtifactEditPartACN.VISUAL_ID: - return createArtifact_28(domainElement, containerView, index, persisted, preferencesHint); + return createArtifact_Shape_ACN(domainElement, containerView, index, persisted, preferencesHint); case NestedArtifactNodeEditPartCN.VISUAL_ID: - return createArtifact_40(domainElement, containerView, index, persisted, preferencesHint); + return createArtifact_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case CommentEditPartCN.VISUAL_ID: - return createComment_54(domainElement, containerView, index, persisted, preferencesHint); + return createComment_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case ConstraintEditPartCN.VISUAL_ID: - return createConstraint_56(domainElement, containerView, index, persisted, preferencesHint); + return createConstraint_Shape_CN(domainElement, containerView, index, persisted, preferencesHint); case DeploymentSpecAsClassifierEditPart.VISUAL_ID: - return createDeploymentSpecification_2014(domainElement, containerView, index, persisted, preferencesHint); + return createDeploymentSpecification_Shape_CCN(domainElement, containerView, index, persisted, + preferencesHint); case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: - return createDeploymentSpecification_2015(domainElement, containerView, index, persisted, preferencesHint); + return createDeploymentSpecification_Shape_CN(domainElement, containerView, index, persisted, + preferencesHint); case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: - return createDeploymentSpecification_2016(domainElement, containerView, index, persisted, preferencesHint); + return createDeploymentSpecification_Shape_ACN(domainElement, containerView, index, persisted, + preferencesHint); } } // can't happen, provided #provides(CreateNodeViewOperation) is correct @@ -426,30 +444,37 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ @Override - public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, + boolean persisted, PreferencesHint preferencesHint) { IElementType elementType = getSemanticElementType(semanticAdapter); - String elementTypeHint = ((IHintedType)elementType).getSemanticHint(); + String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); String vid = UMLVisualIDRegistry.getVisualID(elementTypeHint); - if(vid != null) { - switch(vid) { + if (vid != null) { + switch (vid) { case LinkDescriptorEditPart.VISUAL_ID: - return createLink_4005(containerView, index, persisted, preferencesHint); + return createLink_DescriptorEdge(containerView, index, persisted, preferencesHint); case CommentAnnotatedElementEditPart.VISUAL_ID: - return createCommentAnnotatedElement_4008(containerView, index, persisted, preferencesHint); + return createComment_AnnotatedElementEdge(containerView, index, persisted, preferencesHint); case ConstraintConstrainedElementEditPart.VISUAL_ID: - return createConstraintConstrainedElement_4009(containerView, index, persisted, preferencesHint); + return createConstraint_ConstrainedElementEdge(containerView, index, persisted, preferencesHint); case DeploymentEditPart.VISUAL_ID: - return createDeployment_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createDeployment_Edge(getSemanticElement(semanticAdapter), containerView, index, persisted, + preferencesHint); case ManifestationEditPart.VISUAL_ID: - return createManifestation_4002(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createManifestation_Edge(getSemanticElement(semanticAdapter), containerView, index, persisted, + preferencesHint); case GeneralizationEditPart.VISUAL_ID: - return createGeneralization_4003(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createGeneralization_Edge(getSemanticElement(semanticAdapter), containerView, index, persisted, + preferencesHint); case DependencyEditPart.VISUAL_ID: - return createDependency_4004(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createDependency_Edge(getSemanticElement(semanticAdapter), containerView, index, persisted, + preferencesHint); case DependencyBranchEditPart.VISUAL_ID: - return createDependency_4010(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createDependency_BranchEdge(getSemanticElement(semanticAdapter), containerView, index, persisted, + preferencesHint); case CommunicationPathEditPart.VISUAL_ID: - return createCommunicationPath_4011(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); + return createCommunicationPath_Edge(getSemanticElement(semanticAdapter), containerView, index, + persisted, preferencesHint); } } // can never happen, provided #provides(CreateEdgeViewOperation) is correct @@ -459,7 +484,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createDependency_2011(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDependency_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DependencyNodeEditPart.VISUAL_ID)); @@ -467,20 +493,23 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DependencyNode"); - Node label7 = createLabel(node, UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID)); - label7.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location7 = (Location)label7.getLayoutConstraint(); - location7.setX(0); - location7.setY(5); + Node dependency_MultiNameLabel = createLabel(node, + UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID)); + dependency_MultiNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location dependency_MultiNameLabel_Location = (Location) dependency_MultiNameLabel.getLayoutConstraint(); + dependency_MultiNameLabel_Location.setX(0); + dependency_MultiNameLabel_Location.setY(5); return node; } /** * @generated */ - public Node createModel_2010(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createModel_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ModelEditPart.VISUAL_ID)); @@ -488,10 +517,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model"); - Node label48 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false); + Node model_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), + false, true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model"); return node; } @@ -499,7 +530,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createPackage_2009(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createPackage_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(PackageEditPart.VISUAL_ID)); @@ -507,10 +539,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package"); - Node label35 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false); + Node package_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), + false, true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package"); return node; } @@ -518,7 +552,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createConstraint_2005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createConstraint_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID)); @@ -526,17 +561,20 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint"); - Node label2 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID)); - Node label3 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPart.VISUAL_ID)); + Node constraint_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID)); + Node constraint_BodyLabel = createLabel(node, + UMLVisualIDRegistry.getType(ConstraintSpecificationEditPart.VISUAL_ID)); return node; } /** * @generated */ - public Node createComment_2001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createComment_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID)); @@ -544,16 +582,18 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment"); - Node label1 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID)); + Node comment_BodyLabel = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID)); return node; } /** * @generated */ - public Node createExecutionEnvironment_2002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createExecutionEnvironment_Shape(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPart.VISUAL_ID)); @@ -561,10 +601,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment"); - Node label5 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false); + Node executionEnvironment_NameLabel = createLabel(node, + UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID), + false, true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment"); return node; } @@ -572,7 +615,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createDevice_2003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDevice_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeviceEditPart.VISUAL_ID)); @@ -580,10 +624,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device"); - Node label6 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false); + Node device_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPart.VISUAL_ID), false, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device"); return node; } @@ -591,7 +637,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createArtifact_2006(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createArtifact_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ArtifactEditPart.VISUAL_ID)); @@ -599,15 +646,18 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact"); - Node label8 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID)); - Node label61 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPart.VISUAL_ID)); - label61.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location61 = (Location)label61.getLayoutConstraint(); - location61.setX(25); - location61.setY(0); - createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPart.VISUAL_ID), true, true, false, false); + Node artifact_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID)); + Node artifact_FloatingNameLabel = createLabel(node, + UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPart.VISUAL_ID)); + artifact_FloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location artifact_FloatingNameLabel_Location = (Location) artifact_FloatingNameLabel.getLayoutConstraint(); + artifact_FloatingNameLabel_Location.setX(25); + artifact_FloatingNameLabel_Location.setY(0); + createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPart.VISUAL_ID), true, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact"); return node; } @@ -615,7 +665,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createNode_2008(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createNode_Shape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NodeEditPart.VISUAL_ID)); @@ -623,10 +674,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node"); - Node label9 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false); + Node node_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPart.VISUAL_ID), false, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node"); return node; } @@ -634,7 +687,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createNamedElement_2012(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createNamedElement_DefaultShape(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DefaultNamedElementEditPart.VISUAL_ID)); @@ -642,16 +696,19 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DefaultNamedElement"); - Node label53 = createLabel(node, UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID)); + Node namedElement_NameLabel = createLabel(node, + UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID)); return node; } /** * @generated */ - public Node createDeploymentSpecification_2013(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDeploymentSpecification_Shape(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeploymentSpecificationEditPart.VISUAL_ID)); @@ -659,31 +716,38 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { node.setElement(domainElement); stampShortcut(containerView, node); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); - Node label62 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecificationNameEditPart.VISUAL_ID)); - Node label63 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID)); - label63.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location63 = (Location)label63.getLayoutConstraint(); - location63.setX(25); - location63.setY(0); + Node deploymentSpecification_NameLabel = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecificationNameEditPart.VISUAL_ID)); + Node deploymentSpecification_FloatingNameLabel = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID)); + deploymentSpecification_FloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deploymentSpecification_FloatingNameLabel_Location = (Location) deploymentSpecification_FloatingNameLabel + .getLayoutConstraint(); + deploymentSpecification_FloatingNameLabel_Location.setX(25); + deploymentSpecification_FloatingNameLabel_Location.setY(0); return node; } /** * @generated */ - public Node createModel_49(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createModel_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ModelEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model"); - Node label50 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false); + Node model_NameLabel_CN = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID), + false, true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model"); return node; } @@ -691,17 +755,20 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createPackage_36(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createPackage_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(PackageEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package"); - Node label37 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false); + Node package_NameLabel_CN = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID), + false, true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package"); return node; } @@ -709,33 +776,38 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createDevice_16(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDevice_Shape_CCN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeviceEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device"); - Node label20 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID)); + Node device_NameLabel_CCN = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID)); return node; } /** * @generated */ - public Node createDevice_44(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDevice_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NestedDeviceEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device"); - Node label45 = createLabel(node, UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false); + Node device_NameLabel_CN = createLabel(node, UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPartCN.VISUAL_ID), true, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device"); return node; } @@ -743,33 +815,41 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createExecutionEnvironment_21(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createExecutionEnvironment_Shape_CCN(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment"); - Node label22 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID)); + Node executionEnvironment_NameLabel_CCN = createLabel(node, + UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID)); return node; } /** * @generated */ - public Node createExecutionEnvironment_46(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createExecutionEnvironment_Shape_CN(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NestedExecutionEnvironmentEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment"); - Node label47 = createLabel(node, UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false); + Node executionEnvironment_NameLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID)); + createCompartment(node, + UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID), true, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment"); return node; } @@ -777,33 +857,38 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createNode_23(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createNode_Shape_CCN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NodeEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node"); - Node label24 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID)); + Node node_NameLabel_CCN = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID)); return node; } /** * @generated */ - public Node createNode_42(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createNode_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NestedNodeEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node"); - Node label43 = createLabel(node, UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID)); - createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false); + Node node_NameLabel_CN = createLabel(node, UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID)); + createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPartCN.VISUAL_ID), true, true, + false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node"); return node; } @@ -811,22 +896,27 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createArtifact_25(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createArtifact_Shape_CCN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact"); - Node label27 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID)); - Node label59 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartCN.VISUAL_ID)); - label59.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location59 = (Location)label59.getLayoutConstraint(); - location59.setX(25); - location59.setY(0); - createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false); + Node artifact_NameLabel_CCN = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID)); + Node artifact_FloatingNameLabel_CCN = createLabel(node, + UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartCN.VISUAL_ID)); + artifact_FloatingNameLabel_CCN.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location artifact_FloatingNameLabel_CCN_Location = (Location) artifact_FloatingNameLabel_CCN + .getLayoutConstraint(); + artifact_FloatingNameLabel_CCN_Location.setX(25); + artifact_FloatingNameLabel_CCN_Location.setY(0); + createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartCN.VISUAL_ID), true, + true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact"); return node; } @@ -834,22 +924,27 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createArtifact_28(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createArtifact_Shape_ACN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartACN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact"); - Node label29 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID)); - Node label60 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartACN.VISUAL_ID)); - label60.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location60 = (Location)label60.getLayoutConstraint(); - location60.setX(25); - location60.setY(0); - createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartACN.VISUAL_ID), true, true, false, false); + Node artifact_NameLabel_ACN = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID)); + Node artifact_FloatingNameLabel_ACN = createLabel(node, + UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartACN.VISUAL_ID)); + artifact_FloatingNameLabel_ACN.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location artifact_FloatingNameLabel_ACN_Location = (Location) artifact_FloatingNameLabel_ACN + .getLayoutConstraint(); + artifact_FloatingNameLabel_ACN_Location.setX(25); + artifact_FloatingNameLabel_ACN_Location.setY(0); + createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartACN.VISUAL_ID), true, + true, false, false); PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact"); return node; } @@ -857,119 +952,144 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createArtifact_40(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createArtifact_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(NestedArtifactNodeEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact"); - Node label41 = createLabel(node, UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID)); + Node artifact_NameLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID)); return node; } /** * @generated */ - public Node createComment_54(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createComment_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(CommentEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment"); - Node label55 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID)); + Node comment_BodyLabel_CN = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID)); return node; } /** * @generated */ - public Node createConstraint_56(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createConstraint_Shape_CN(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(ConstraintEditPartCN.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint"); - Node label57 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID)); - Node label58 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPartCN.VISUAL_ID)); + Node constraint_NameLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID)); + Node constraint_BodyLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(ConstraintSpecificationEditPartCN.VISUAL_ID)); return node; } /** * @generated */ - public Node createDeploymentSpecification_2014(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDeploymentSpecification_Shape_CCN(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierEditPart.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); - Node label64 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); - Node label65 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID)); - label65.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location65 = (Location)label65.getLayoutConstraint(); - location65.setX(25); - location65.setY(0); + Node deploymentSpecification_NameLabel_CCN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); + Node deploymentSpecification_FloatingNameLabel_CCN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID)); + deploymentSpecification_FloatingNameLabel_CCN.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deploymentSpecification_FloatingNameLabel_CCN_Location = (Location) deploymentSpecification_FloatingNameLabel_CCN + .getLayoutConstraint(); + deploymentSpecification_FloatingNameLabel_CCN_Location.setX(25); + deploymentSpecification_FloatingNameLabel_CCN_Location.setY(0); return node; } /** * @generated */ - public Node createDeploymentSpecification_2015(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDeploymentSpecification_Shape_CN(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElEditPart.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); - Node label66 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); - Node label67 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID)); - label67.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location67 = (Location)label67.getLayoutConstraint(); - location67.setX(25); - location67.setY(0); + Node deploymentSpecification_NameLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); + Node deploymentSpecification_FloatingNameLabel_CN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID)); + deploymentSpecification_FloatingNameLabel_CN.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deploymentSpecification_FloatingNameLabel_CN_Location = (Location) deploymentSpecification_FloatingNameLabel_CN + .getLayoutConstraint(); + deploymentSpecification_FloatingNameLabel_CN_Location.setX(25); + deploymentSpecification_FloatingNameLabel_CN_Location.setY(0); return node; } /** * @generated */ - public Node createDeploymentSpecification_2016(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Node createDeploymentSpecification_Shape_ACN(EObject domainElement, View containerView, int index, + boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); - Node label68 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); - Node label69 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID)); - label69.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location69 = (Location)label69.getLayoutConstraint(); - location69.setX(25); - location69.setY(0); + Node deploymentSpecification_NameLabel_ACN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + Node deploymentSpecification_FloatingNameLabel_ACN = createLabel(node, + UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID)); + deploymentSpecification_FloatingNameLabel_ACN.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deploymentSpecification_FloatingNameLabel_ACN_Location = (Location) deploymentSpecification_FloatingNameLabel_ACN + .getLayoutConstraint(); + deploymentSpecification_FloatingNameLabel_ACN_Location.setX(25); + deploymentSpecification_FloatingNameLabel_ACN_Location.setY(0); return node; } /** * @generated */ - public Edge createLink_4005(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createLink_DescriptorEdge(View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -982,18 +1102,21 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(LinkDescriptorEditPart.VISUAL_ID)); edge.setElement(null); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} + return edge; } /** * @generated */ - public Edge createCommentAnnotatedElement_4008(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createComment_AnnotatedElementEdge(View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1006,19 +1129,22 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(CommentAnnotatedElementEditPart.VISUAL_ID)); edge.setElement(null); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "CommentAnnotatedElement"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} + return edge; } /** * @generated */ - public Edge createConstraintConstrainedElement_4009(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createConstraint_ConstrainedElementEdge(View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1031,19 +1157,22 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(ConstraintConstrainedElementEditPart.VISUAL_ID)); edge.setElement(null); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "ConstraintConstrainedElement"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} + return edge; } /** * @generated */ - public Edge createDeployment_4001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createDeployment_Edge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1056,22 +1185,25 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(DeploymentEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Deployment"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - Node label13 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentNameEditPart.VISUAL_ID)); - label13.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location13 = (Location)label13.getLayoutConstraint(); - location13.setX(0); - location13.setY(60); - Node label14 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentAppliedStereotypeEditPart.VISUAL_ID)); - label14.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location14 = (Location)label14.getLayoutConstraint(); - location14.setX(0); - location14.setY(60); + Node deployment_NameLabel = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentNameEditPart.VISUAL_ID)); + deployment_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deployment_NameLabel_Location = (Location) deployment_NameLabel.getLayoutConstraint(); + deployment_NameLabel_Location.setX(0); + deployment_NameLabel_Location.setY(60); + Node deployment_StereotypeLabel = createLabel(edge, + UMLVisualIDRegistry.getType(DeploymentAppliedStereotypeEditPart.VISUAL_ID)); + deployment_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location deployment_StereotypeLabel_Location = (Location) deployment_StereotypeLabel.getLayoutConstraint(); + deployment_StereotypeLabel_Location.setX(0); + deployment_StereotypeLabel_Location.setY(60); + PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Deployment"); return edge; } @@ -1079,7 +1211,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Edge createManifestation_4002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createManifestation_Edge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1092,22 +1225,27 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(ManifestationEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Manifestation"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - Node label10 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationNameEditPart.VISUAL_ID)); - label10.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location10 = (Location)label10.getLayoutConstraint(); - location10.setX(0); - location10.setY(60); - Node label11 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationAppliedStereotypeEditPart.VISUAL_ID)); - label11.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location11 = (Location)label11.getLayoutConstraint(); - location11.setX(0); - location11.setY(30); + Node manifestation_NameLabel = createLabel(edge, + UMLVisualIDRegistry.getType(ManifestationNameEditPart.VISUAL_ID)); + manifestation_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location manifestation_NameLabel_Location = (Location) manifestation_NameLabel.getLayoutConstraint(); + manifestation_NameLabel_Location.setX(0); + manifestation_NameLabel_Location.setY(60); + Node manifestation_StereotypeLabel = createLabel(edge, + UMLVisualIDRegistry.getType(ManifestationAppliedStereotypeEditPart.VISUAL_ID)); + manifestation_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location manifestation_StereotypeLabel_Location = (Location) manifestation_StereotypeLabel + .getLayoutConstraint(); + manifestation_StereotypeLabel_Location.setX(0); + manifestation_StereotypeLabel_Location.setY(30); + PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Manifestation"); return edge; } @@ -1115,7 +1253,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Edge createGeneralization_4003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createGeneralization_Edge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1128,17 +1267,21 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(GeneralizationEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Generalization"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - Node label4 = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationAppliedStereotypeEditPart.VISUAL_ID)); - label4.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location4 = (Location)label4.getLayoutConstraint(); - location4.setX(0); - location4.setY(60); + Node generalization_StereotypeLabel = createLabel(edge, + UMLVisualIDRegistry.getType(GeneralizationAppliedStereotypeEditPart.VISUAL_ID)); + generalization_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location generalization_StereotypeLabel_Location = (Location) generalization_StereotypeLabel + .getLayoutConstraint(); + generalization_StereotypeLabel_Location.setX(0); + generalization_StereotypeLabel_Location.setY(60); + PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization"); return edge; } @@ -1146,7 +1289,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Edge createDependency_4004(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createDependency_Edge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1159,22 +1303,25 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(DependencyEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyLink"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - Node label12 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID)); - label12.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location12 = (Location)label12.getLayoutConstraint(); - location12.setX(0); - location12.setY(40); - Node label15 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyAppliedStereotypeEditPart.VISUAL_ID)); - label15.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location15 = (Location)label15.getLayoutConstraint(); - location15.setX(0); - location15.setY(60); + Node dependency_NameLabel = createLabel(edge, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID)); + dependency_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location dependency_NameLabel_Location = (Location) dependency_NameLabel.getLayoutConstraint(); + dependency_NameLabel_Location.setX(0); + dependency_NameLabel_Location.setY(40); + Node dependency_StereotypeLabel = createLabel(edge, + UMLVisualIDRegistry.getType(DependencyAppliedStereotypeEditPart.VISUAL_ID)); + dependency_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location dependency_StereotypeLabel_Location = (Location) dependency_StereotypeLabel.getLayoutConstraint(); + dependency_StereotypeLabel_Location.setX(0); + dependency_StereotypeLabel_Location.setY(60); + PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "DependencyLink"); return edge; } @@ -1182,7 +1329,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Edge createDependency_4010(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createDependency_BranchEdge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1195,19 +1343,22 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(DependencyBranchEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyBranchLink"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} + return edge; } /** * @generated */ - public Edge createCommunicationPath_4011(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + public Edge createCommunicationPath_Edge(EObject domainElement, View containerView, int index, boolean persisted, + PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); @@ -1220,22 +1371,27 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { edge.setType(UMLVisualIDRegistry.getType(CommunicationPathEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences - final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "CommunicationPath"); //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - Node label6001 = createLabel(edge, UMLVisualIDRegistry.getType(CommunicationPathNameEditPart.VISUAL_ID)); - label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location6001 = (Location)label6001.getLayoutConstraint(); - location6001.setX(0); - location6001.setY(40); - Node label6002 = createLabel(edge, UMLVisualIDRegistry.getType(CommunicationPathAppliedStereotypeEditPart.VISUAL_ID)); - label6002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location6002 = (Location)label6002.getLayoutConstraint(); - location6002.setX(0); - location6002.setY(60); + Node communicationPath_NameLabel = createLabel(edge, + UMLVisualIDRegistry.getType(CommunicationPathNameEditPart.VISUAL_ID)); + communicationPath_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location communicationPath_NameLabel_Location = (Location) communicationPath_NameLabel.getLayoutConstraint(); + communicationPath_NameLabel_Location.setX(0); + communicationPath_NameLabel_Location.setY(40); + Node communicationPath_StereotypeLabel = createLabel(edge, + UMLVisualIDRegistry.getType(CommunicationPathAppliedStereotypeEditPart.VISUAL_ID)); + communicationPath_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location communicationPath_StereotypeLabel_Location = (Location) communicationPath_StereotypeLabel + .getLayoutConstraint(); + communicationPath_StereotypeLabel_Location.setX(0); + communicationPath_StereotypeLabel_Location.setY(60); + return edge; } @@ -1243,7 +1399,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ protected void stampShortcut(View containerView, Node target) { - if(!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { + if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", DeploymentDiagramEditPart.MODEL_ID); //$NON-NLS-1$ @@ -1264,20 +1420,23 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) { + protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, + boolean canFilter) { //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment(); //rv.setShowTitle(showTitle); //rv.setCollapsed(isCollapsed); Node rv = NotationFactory.eINSTANCE.createBasicCompartment(); + rv.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); - if(hasTitle) { + + if (hasTitle) { TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle(); rv.getStyles().add(ts); } - if(canSort) { + if (canSort) { rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle()); } - if(canFilter) { + if (canFilter) { rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle()); } rv.setType(hint); @@ -1289,11 +1448,11 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ protected EObject getSemanticElement(IAdaptable semanticAdapter) { - if(semanticAdapter == null) { + if (semanticAdapter == null) { return null; } - EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class); - if(eObject != null) { + EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); + if (eObject != null) { return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject); } return null; @@ -1303,25 +1462,29 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ protected IElementType getSemanticElementType(IAdaptable semanticAdapter) { - if(semanticAdapter == null) { + if (semanticAdapter == null) { return null; } - return (IElementType)semanticAdapter.getAdapter(IElementType.class); + return (IElementType) semanticAdapter.getAdapter(IElementType.class); } /** * @generated */ private void initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) { - String fontConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.FONT); - String fontColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FONT); - FontStyle viewFontStyle = (FontStyle)view.getStyle(NotationPackage.Literals.FONT_STYLE); - if(viewFontStyle != null) { + String fontConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.FONT); + String fontColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.COLOR_FONT); + + FontStyle viewFontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE); + if (viewFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(store, fontConstant); viewFontStyle.setFontName(fontData.getName()); viewFontStyle.setFontHeight(fontData.getHeight()); viewFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); viewFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); + org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant); viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } @@ -1331,24 +1494,35 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { * @generated */ private void initForegroundFromPrefs(View view, final IPreferenceStore store, String elementName) { - String lineColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_LINE); + String lineColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.COLOR_LINE); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant); - ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), + FigureUtilities.RGBToInteger(lineRGB)); } /** * @generated */ private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) { - String fillColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FILL); - String gradientColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_GRADIENT); - String gradientPolicyConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.GRADIENT_POLICY); + String fillColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.COLOR_FILL); + String gradientColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.COLOR_GRADIENT); + String gradientPolicyConstant = PreferencesConstantsHelper.getElementConstant(elementName, + PreferencesConstantsHelper.GRADIENT_POLICY); + org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant); - ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB)); - FillStyle fillStyle = (FillStyle)view.getStyle(NotationPackage.Literals.FILL_STYLE); - fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());; - if(store.getBoolean(gradientPolicyConstant)) { - GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(gradientColorConstant)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), + FigureUtilities.RGBToInteger(fillRGB)); + + FillStyle fillStyle = (FillStyle) view.getStyle(NotationPackage.Literals.FILL_STYLE); + fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue()); + + ; + if (store.getBoolean(gradientPolicyConstant)) { + GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter( + store.getString(gradientColorConstant)); fillStyle.setGradient(gradientPreferenceConverter.getGradientData()); fillStyle.setTransparency(gradientPreferenceConverter.getTransparency()); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLVisualTypeProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLVisualTypeProvider.java index ae9869395e8..15c179204be 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLVisualTypeProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLVisualTypeProvider.java @@ -36,11 +36,13 @@ public class UMLVisualTypeProvider extends AbstractVisualTypeProvider { @Override public IElementType getElementType(Diagram diagram, String viewType) { IElementType result = null; + try { result = UMLElementTypes.getElementType(viewType); } catch (NumberFormatException e) { // Not supported by this diagram } + return result; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java index 90f4d9d7c3f..f04d4fbdc33 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java @@ -49,8 +49,8 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr * @generated */ private Object unwrap(Object element) { - if(element instanceof IStructuredSelection) { - return ((IStructuredSelection)element).getFirstElement(); + if (element instanceof IStructuredSelection) { + return ((IStructuredSelection) element).getFirstElement(); } return element; } @@ -59,11 +59,11 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr * @generated */ private View getView(Object element) { - if(element instanceof View) { - return (View)element; + if (element instanceof View) { + return (View) element; } - if(element instanceof IAdaptable) { - return (View)((IAdaptable)element).getAdapter(View.class); + if (element instanceof IAdaptable) { + return (View) ((IAdaptable) element).getAdapter(View.class); } return null; } @@ -73,13 +73,13 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr */ private IElementType getElementType(View view) { // For intermediate views climb up the containment hierarchy to find the one associated with an element type. - while(view != null) { + while (view != null) { String vid = UMLVisualIDRegistry.getVisualID(view); IElementType etype = UMLElementTypes.getElementType(vid); - if(etype != null) { + if (etype != null) { return etype; } - view = view.eContainer() instanceof View ? (View)view.eContainer() : null; + view = view.eContainer() instanceof View ? (View) view.eContainer() : null; } return null; } |