diff options
author | Camille Letavernier | 2014-08-21 11:43:07 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-08-21 13:50:25 +0000 |
commit | dbc038b44bcbb890ae256d15eb09eb285512f020 (patch) | |
tree | 757e736583eea3ae352ad9ac91a81df7e59b79ff /plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric | |
parent | ea48a20561464c3cbb7895d430583669a9f82fcc (diff) | |
download | org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.gz org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.xz org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.zip |
[Code style] Apply clean-up and formatter on Main plug-ins
Diffstat (limited to 'plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric')
61 files changed, 986 insertions, 969 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java index a8302d4f326..ba66300ed6e 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java @@ -45,10 +45,11 @@ import org.eclipse.uml2.uml.util.UMLUtil; /** * Represents a creation command for a SysML parametric diagram + * * @author Laurent Wouters */ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - + /** * {@inheritDoc} */ @@ -82,12 +83,12 @@ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiag Diagram diagram = null; if (element instanceof org.eclipse.uml2.uml.Class) { - org.eclipse.uml2.uml.Class cOwner = (org.eclipse.uml2.uml.Class)element; + org.eclipse.uml2.uml.Class cOwner = (org.eclipse.uml2.uml.Class) element; Block block = UMLUtil.getStereotypeApplication(cOwner, Block.class); - if(block != null) { - canvasDomainElement = (EObject)element; - Package owningPackage = ((Element)element).getNearestPackage(); + if (block != null) { + canvasDomainElement = element; + Package owningPackage = ((Element) element).getNearestPackage(); diagram = super.doCreateDiagram(diagramResource, owner, owningPackage, prototype, name); } @@ -95,18 +96,18 @@ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiag try { canvasDomainElement = null; - IEditCommandRequest request = new CreateElementRequest((Package)element, SysMLElementTypes.BLOCK); + IEditCommandRequest request = new CreateElementRequest(element, SysMLElementTypes.BLOCK); IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(element); - if(commandService == null) { + if (commandService == null) { return null; } ICommand createElementCommand = commandService.getEditCommand(request); - if((createElementCommand != null) && (createElementCommand.canExecute())) { + if ((createElementCommand != null) && (createElementCommand.canExecute())) { createElementCommand.execute(new NullProgressMonitor(), null); EObject block = GMFCommandUtils.getCommandEObjectResult(createElementCommand); canvasDomainElement = block; - diagram = super.doCreateDiagram(diagramResource, owner, (Package)element, prototype, name); + diagram = super.doCreateDiagram(diagramResource, owner, element, prototype, name); } } catch (ExecutionException e) { @@ -138,9 +139,9 @@ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiag */ @Override protected void initializeDiagram(EObject diagram) { - if(diagram instanceof Diagram) { - Diagram currentDiagram = (Diagram)diagram; - if(canvasDomainElement != null) { + if (diagram instanceof Diagram) { + Diagram currentDiagram = (Diagram) diagram; + if (canvasDomainElement != null) { currentDiagram.setElement(canvasDomainElement); initializeDiagramContent(currentDiagram); } @@ -149,19 +150,19 @@ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiag /** * Initialize the diagram with the canvas domain element shown. - * + * * @param diagram - * the diagram to initialize + * the diagram to initialize */ protected void initializeDiagramContent(Diagram diagram) { // Create a view for the canvasDomainElement in the new diagram View view = - ViewService.getInstance().createNode(new SemanticAdapter(canvasDomainElement, null), diagram, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, ViewUtil.APPEND, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); + ViewService.getInstance().createNode(new SemanticAdapter(canvasDomainElement, null), diagram, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, ViewUtil.APPEND, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); view.setElement(diagram.getElement()); // Update the view position and size (should adapt to canvas current size) - Bounds viewBounds = (Bounds)((Node)view).getLayoutConstraint(); + Bounds viewBounds = (Bounds) ((Node) view).getLayoutConstraint(); viewBounds.setX(DEFAULT_MARGIN); viewBounds.setY(DEFAULT_MARGIN); viewBounds.setHeight(DEFAULT_HEIGHT); @@ -170,14 +171,14 @@ public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiag /** * {@inheritDoc} - * + * * @generated NOT */ @Override public boolean isParentReassignable() { - // Bug 374626: [Model Explorer] Moving an IBD from a block to another block shall be forbidden + // Bug 374626: [Model Explorer] Moving an IBD from a block to another block shall be forbidden return false; } - - // End of user code + + // End of user code } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java index 0046556e84e..ee096dc9e71 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java @@ -33,7 +33,7 @@ import org.eclipse.ui.PartInitException; /** * An editor to be used in multitabs editor. This editor extends the original UML Diagram. - * + * */ public class ParametricDiagramForMultiEditor extends ParametricDiagramEditor { @@ -49,16 +49,16 @@ public class ParametricDiagramForMultiEditor extends ParametricDiagramEditor { /** The editor splitter. */ private Composite splitter; - + private Image titleImage; /** * Constructor for SashSystem v2. Context and required objects are retrieved from the * ServiceRegistry. - * + * * @throws BackboneException * @throws ServiceException - * + * */ public ParametricDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { super(servicesRegistry, diagram); @@ -77,11 +77,11 @@ public class ParametricDiagramForMultiEditor extends ParametricDiagramEditor { @Override public void dispose() { - if(titleImage != null) { + if (titleImage != null) { titleImage.dispose(); titleImage = null; } - + super.dispose(); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java index 03f91a71aba..3c40491759a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java @@ -31,14 +31,15 @@ public class ParametricDiagramEditPart extends DiagramEditPart { super(view); } + @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DiagramSemanticEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DiagramSemanticEditPolicy()); installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy()); installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultContainerNodeEditPolicy()); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java index 7cef9cbda07..960b88a1f6b 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java @@ -16,7 +16,7 @@ package org.eclipse.papyrus.sysml.diagram.parametric.edit.policy; import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand; import org.eclipse.gef.requests.ReconnectRequest; -// Start of user code custom imports +// Start of user code custom imports // End of user code import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomDefaultSemanticEditPolicy; @@ -52,5 +52,5 @@ public class DiagramSemanticEditPolicy extends CustomDefaultSemanticEditPolicy { @Override protected Command getReorientRefRelationshipTargetCommand(ReconnectRequest request) { return UnexecutableCommand.INSTANCE; - } + } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java index 3e46ba51694..ea245a123ed 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java @@ -31,19 +31,19 @@ public class ParametricDiagramDragDropEditPolicy extends CustomDiagramDragDropEd @Override public int getNodeVisualID(View containerView, EObject domainElement) { String domainType = registry.getNodeGraphicalType(domainElement, containerView.getType()); - if (IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { + if (org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { return -1; // undefined } return new Integer(domainType); } - + /** * {@inheritDoc} */ @Override public int getLinkWithClassVisualID(EObject domainElement) { String domainType = registry.getEdgeGraphicalType(domainElement); - if (IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { + if (org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { return -1; // undefined } return new Integer(domainType); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java index c427b750145..9394e8c22ac 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.factory; +package org.eclipse.papyrus.sysml.diagram.parametric.factory; import java.util.Arrays; import java.util.HashMap; @@ -31,44 +31,45 @@ public class DiagramPaletteFactory extends PaletteFactory.Adapter { private static HashMap<String, IElementType[]> nodesToolIdTypesMap = new HashMap<String, IElementType[]>() { { - put("parametric.tool.blockcomposite", new IElementType[]{ SysMLElementTypes.BLOCK }); - put("parametric.tool.blockpropertycomposite", new IElementType[]{ SysMLElementTypes.PART_PROPERTY }); - put("parametric.tool.reference", new IElementType[]{ SysMLElementTypes.REFERENCE_PROPERTY }); - put("parametric.tool.value", new IElementType[]{ SysMLElementTypes.VALUE_PROPERTY }); - put("parametric.tool.constraintblockpropertycomposite", new IElementType[]{ SysMLElementTypes.CONSTRAINT_PROPERTY }); - put("parametric.tool.flowport", new IElementType[]{ SysMLElementTypes.FLOW_PORT }); - put("parametric.tool.port", new IElementType[]{ UMLElementTypes.PORT }); - put("parametric.tool.parameter", new IElementType[]{ UMLElementTypes.PROPERTY }); - //Start of user code Custom nodes - put("parametric.tool.constraint", new IElementType[]{ UMLElementTypes.CONSTRAINT }); - put("parametric.tool.comment", new IElementType[]{ UMLElementTypes.COMMENT }); - //End of user code + put("parametric.tool.blockcomposite", new IElementType[] { SysMLElementTypes.BLOCK }); + put("parametric.tool.blockpropertycomposite", new IElementType[] { SysMLElementTypes.PART_PROPERTY }); + put("parametric.tool.reference", new IElementType[] { SysMLElementTypes.REFERENCE_PROPERTY }); + put("parametric.tool.value", new IElementType[] { SysMLElementTypes.VALUE_PROPERTY }); + put("parametric.tool.constraintblockpropertycomposite", new IElementType[] { SysMLElementTypes.CONSTRAINT_PROPERTY }); + put("parametric.tool.flowport", new IElementType[] { SysMLElementTypes.FLOW_PORT }); + put("parametric.tool.port", new IElementType[] { UMLElementTypes.PORT }); + put("parametric.tool.parameter", new IElementType[] { UMLElementTypes.PROPERTY }); + // Start of user code Custom nodes + put("parametric.tool.constraint", new IElementType[] { UMLElementTypes.CONSTRAINT }); + put("parametric.tool.comment", new IElementType[] { UMLElementTypes.COMMENT }); + // End of user code } }; private static HashMap<String, IElementType[]> edgesToolIdTypesMap = new HashMap<String, IElementType[]>() { { - put("parametric.tool.connector", new IElementType[]{ UMLElementTypes.CONNECTOR }); - put("parametric.tool.dependency", new IElementType[]{ UMLElementTypes.DEPENDENCY }); - //Start of user code Custom edges - put("parametric.tool.comment_constraint_link", new IElementType[]{ ElementTypes.COMMENT_ANNOTATED_ELEMENT }); - put("parametric.tool.context_link", new IElementType[]{ ElementTypes.CONTEXT_LINK }); - //End of user code + put("parametric.tool.connector", new IElementType[] { UMLElementTypes.CONNECTOR }); + put("parametric.tool.dependency", new IElementType[] { UMLElementTypes.DEPENDENCY }); + // Start of user code Custom edges + put("parametric.tool.comment_constraint_link", new IElementType[] { ElementTypes.COMMENT_ANNOTATED_ELEMENT }); + put("parametric.tool.context_link", new IElementType[] { ElementTypes.CONTEXT_LINK }); + // End of user code } }; + @Override public Tool createTool(String toolId) { IElementType[] types; - + types = nodesToolIdTypesMap.get(toolId); - if(types != null) { + if (types != null) { return new AspectUnspecifiedTypeCreationTool(Arrays.asList(types)); } types = edgesToolIdTypesMap.get(toolId); - if(types != null) { + if (types != null) { return new AspectUnspecifiedTypeConnectionTool(Arrays.asList(types)); } return null; diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java index 5d09c4db0a9..ef56c9aa4ad 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java @@ -25,40 +25,40 @@ import org.eclipse.papyrus.sysml.diagram.parametric.Activator; public class ParametricDiagramEditor extends org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditor { /** context used when trying to find services */ - public static final String ID = "org.eclipse.papyrus.sysml.diagram.parametric.part.ParametricDiagramEditorID"; //$NON-NLS-1$ + public static final String ID = "org.eclipse.papyrus.sysml.diagram.parametric.part.ParametricDiagramEditorID"; //$NON-NLS-1$ - /** - * {@inheritDoc} - */ - @Override - public String getContextID() { - return CONTEXT_ID; - } + /** + * {@inheritDoc} + */ + @Override + public String getContextID() { + return CONTEXT_ID; + } - /** - * @throws org.eclipse.papyrus.infra.core.services.ServiceException - * @generated + /** + * @throws org.eclipse.papyrus.infra.core.services.ServiceException + * @generated */ public ParametricDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException, org.eclipse.papyrus.infra.core.services.ServiceException { - super(servicesRegistry, diagram); - } - - // Start of user code Custom Editor Methods + super(servicesRegistry, diagram); + } + + // Start of user code Custom Editor Methods // End of user code /** * @generated */ @Override - public String getContributorId() { - return Activator.PLUGIN_ID; - } + public String getContributorId() { + return Activator.PLUGIN_ID; + } /** * @generated */ @Override - protected PreferencesHint getPreferencesHint() { - return Activator.DIAGRAM_PREFERENCES_HINT; - } + protected PreferencesHint getPreferencesHint() { + return Activator.DIAGRAM_PREFERENCES_HINT; + } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java index d0027c9811c..0a84ca4d3b7 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; +package org.eclipse.papyrus.sysml.diagram.parametric.preferences; import java.util.Collections; import java.util.LinkedHashMap; @@ -25,49 +25,49 @@ import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; public class BlockCompositePreferencePage extends ParametricDiagramNodePreferencePage { /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; //$NON-NLS-1$ + public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; //$NON-NLS-1$ - /** The compartments default visibility for preferences */ + /** The compartments default visibility for preferences */ public static final Map<String, Boolean> compartmentDefaultVisibilityMap; - /** The compartment titles default visibility for preferences */ + /** The compartment titles default visibility for preferences */ public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; - + /** Static attribute initialization */ static { compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - + compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - - + + // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(compartmentDefaultVisibilityMap); - Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); + // End of user code + + Collections.unmodifiableMap(compartmentDefaultVisibilityMap); + Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); } - + /** Constructor */ public BlockCompositePreferencePage() { super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID); //$NON-NLS-1$ + setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID); //$NON-NLS-1$ } - + /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { // Start of user code custom default initializations // End of user code - + // Initialize default visibility for compartments in preference page. - for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentDefaultVisibilityMap.keySet()) { String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); } // Initialize default title visibility for compartments in preference page. - for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); } @@ -78,7 +78,7 @@ public class BlockCompositePreferencePage extends ParametricDiagramNodePreferenc */ @Override protected void initializeCompartmentNamesList() { - for(String name : compartmentDefaultVisibilityMap.keySet()) { + for (String name : compartmentDefaultVisibilityMap.keySet()) { this.compartmentNamesList.add(name); } } @@ -88,9 +88,9 @@ public class BlockCompositePreferencePage extends ParametricDiagramNodePreferenc */ @Override protected void initializeCompartmentTitlesList() { - for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String name : compartmentTitleDefaultVisibilityMap.keySet()) { this.compartmentTitlesList.add(name); } } - + } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java index 01beb9c96f6..baf66ca53e7 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java @@ -19,25 +19,25 @@ import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; public class CommentAnnotatedElementPreferencePage extends ParametricDiagramLinkPreferencePage { /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"; //$NON-NLS-1$ + protected static String prefKey = ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"; //$NON-NLS-1$ + - /** Default constructor */ public CommentAnnotatedElementPreferencePage() { super(); setPreferenceKey(ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"); //$NON-NLS-1$ } - + /** * Initialize defaults using a specified {@link IPreferenceStore} - * + * * @param store - * the preference store. - */ + * the preference store. + */ public static void initDefaults(IPreferenceStore store) { // Start of user code custom default initializations - // End of user code - + // End of user code + } - -} + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java index c7bfb4b27ed..9b4a5ecd860 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java @@ -21,24 +21,24 @@ public class CommentPreferencePage extends ParametricDiagramNodePreferencePage { /** Constant key to access preferences */ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Comment"; //$NON-NLS-1$ - - /** Default constructor */ + + /** Default constructor */ public CommentPreferencePage() { super(); setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Comment"); //$NON-NLS-1$ } - + /** * Initialize defaults using a specified {@link IPreferenceStore} - * + * * @param store - * the preference store. + * the preference store. */ public static void initDefaults(IPreferenceStore store) { // Start of user code custom default initializations - // End of user code - + // End of user code + } - + } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java index 21a36cf840d..96d5e6434de 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java @@ -30,7 +30,7 @@ public class ConnectorPreferencePage extends ParametricDiagramLinkPreferencePage /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations + // Start of user code custom default initializations // End of user code } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java index 78bbfcd1371..e44b40abc91 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java @@ -19,25 +19,25 @@ import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; public class ConstraintConstrainedElementPreferencePage extends ParametricDiagramLinkPreferencePage { /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"; //$NON-NLS-1$ + protected static String prefKey = ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"; //$NON-NLS-1$ + - /** Default constructor */ public ConstraintConstrainedElementPreferencePage() { super(); setPreferenceKey(ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"); //$NON-NLS-1$ } - + /** * Initialize defaults using a specified {@link IPreferenceStore} - * + * * @param store - * the preference store. - */ + * the preference store. + */ public static void initDefaults(IPreferenceStore store) { // Start of user code custom default initializations - // End of user code - + // End of user code + } - -} + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java index ddd7092d8e4..b36251c17cf 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java @@ -21,24 +21,24 @@ public class ConstraintPreferencePage extends ParametricDiagramNodePreferencePag /** Constant key to access preferences */ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Constraint"; //$NON-NLS-1$ - - /** Default constructor */ + + /** Default constructor */ public ConstraintPreferencePage() { super(); setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Constraint"); //$NON-NLS-1$ } - + /** * Initialize defaults using a specified {@link IPreferenceStore} - * + * * @param store - * the preference store. + * the preference store. */ public static void initDefaults(IPreferenceStore store) { // Start of user code custom default initializations - // End of user code - + // End of user code + } - + } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java index a2387b722b0..c561639997d 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java @@ -30,7 +30,7 @@ public class DependencyPreferencePage extends ParametricDiagramLinkPreferencePag /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations + // Start of user code custom default initializations // End of user code } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java index e4e00384afe..d2e3fdb0011 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java @@ -27,14 +27,14 @@ public class ParametricDiagramLinkPreferencePage extends AbstractPapyrusLinkPref /** The list of label names for this link */ protected List<String> labelsList; - + /** Constructor */ public ParametricDiagramLinkPreferencePage() { labelsList = new ArrayList<String>(); initializeLabelsList(); Collections.unmodifiableList(labelsList); } - + /** * {@inheritDoc} */ @@ -43,26 +43,26 @@ public class ParametricDiagramLinkPreferencePage extends AbstractPapyrusLinkPref super.createPageContents(parent); // Add label visibility group - if(!labelsList.isEmpty()) { + if (!labelsList.isEmpty()) { OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList); addAbstractGroup(compartmentGroup); } } - + /** * {@inheritDoc} - */ + */ @Override protected String getBundleId() { return Activator.PLUGIN_ID; } - + /** Initialize the list containing names of labels. */ protected void initializeLabelsList() { - // Implemented by subclasses. + // Implemented by subclasses. } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java index d7fa5e0b367..5a0f58d98f4 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java @@ -28,13 +28,13 @@ public class ParametricDiagramNodePreferencePage extends AbstractPapyrusNodePref /** The list owning the names of compartments */ protected List<String> compartmentNamesList; - + /** The list owning the names of compartment that have a title */ protected List<String> compartmentTitlesList; /** The list of label names for this node */ protected List<String> labelsList; - + /** Constructor */ public ParametricDiagramNodePreferencePage() { this.labelsList = new ArrayList<String>(); @@ -49,27 +49,27 @@ public class ParametricDiagramNodePreferencePage extends AbstractPapyrusNodePref Collections.unmodifiableList(compartmentNamesList); Collections.unmodifiableList(compartmentTitlesList); } - + /** * {@inheritDoc} */ @Override protected void createPageContents(Composite parent) { super.createPageContents(parent); - + // Add compartments visibility group - if(!compartmentNamesList.isEmpty()) { + if (!compartmentNamesList.isEmpty()) { OrderedCompartmentGroup compartmentGroup = new OrderedCompartmentGroup(parent, getPreferenceKey(), this, compartmentNamesList, compartmentTitlesList, getPreferenceStore()); addAbstractGroup(compartmentGroup); } // Add label visibility group - if(!labelsList.isEmpty()) { + if (!labelsList.isEmpty()) { OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList); addAbstractGroup(compartmentGroup); } } - + /** * {@inheritDoc} */ @@ -80,17 +80,17 @@ public class ParametricDiagramNodePreferencePage extends AbstractPapyrusNodePref /** Initialize the list containing names of labels. */ protected void initializeLabelsList() { - // Implemented by subclasses. + // Implemented by subclasses. } /** Initialize the list containing the names of compartments. */ protected void initializeCompartmentNamesList() { - // Implemented by subclasses. + // Implemented by subclasses. } - + /** Initialize the list containing the names of compartment that have titles. */ protected void initializeCompartmentTitlesList() { - // Implemented by subclasses. + // Implemented by subclasses. } /** @@ -108,7 +108,7 @@ public class ParametricDiagramNodePreferencePage extends AbstractPapyrusNodePref protected final TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() { return new TreeMap<String, Boolean>(); } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java index 38e2c098561..560e1b430ab 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java @@ -26,14 +26,14 @@ public class ParametricDiagramPreferenceInitializer extends AbstractPreferenceIn @Override public void initializeDefaultPreferences() { IPreferenceStore store = getPreferenceStore(); - - org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPreferencePage.initDefaults(store); - org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentPreferencePage.initDefaults(store); + + org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPreferencePage.initDefaults(store); + org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentPreferencePage.initDefaults(store); org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentAnnotatedElementPreferencePage.initDefaults(store); BlockCompositePreferencePage.initDefaults(store); BlockPropertyCompositePreferencePage.initDefaults(store); ConnectorPreferencePage.initDefaults(store); DependencyPreferencePage.initDefaults(store); - + } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java index ab9be3ea5a5..f63c6714da0 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; +package org.eclipse.papyrus.sysml.diagram.parametric.provider; import java.util.HashMap; import java.util.Map; @@ -62,32 +62,32 @@ public class CustomEditPartProvider extends CustomAbstractEditPartProvider { diagramType = ElementTypes.DIAGRAM_ID; // Nodes - nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, CustomConstraintBlockPropertyCompositeEditPart.class); - nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, CustomBlockPropertyCompositeEditPart.class); - nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, CustomBlockCompositeEditPartTN.class); - nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeEditPart.class); - nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeEditPart.class); + nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, CustomConstraintBlockPropertyCompositeEditPart.class); + nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, CustomBlockPropertyCompositeEditPart.class); + nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, CustomBlockCompositeEditPartTN.class); + nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeEditPart.class); + nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeEditPart.class); nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, CustomConstraintParameterAffixedNodeEditPart.class); - + // Decorations - nodeMap.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, FlowPortAffixedLabelNameEditPart.class); - nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, BlockPropertyStructureCompartmentEditPart.class); - nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, StructureCompartmentEditPart.class); - nodeMap.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, CustomBlockLabelNameEditPart.class); // TODO : change for multi FlowText - nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeAffixedLabelEditPart.class); - nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, PortAffixedLabelNameEditPart.class); - nodeMap.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, PropertyNodeLabelEditPart.class); - nodeMap.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, ConstraintNodeLabelEditPart.class); - nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeLinkLabelEditPart.class); - nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, ConnectorLinkLabelEditPart.class); - nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, ConnectorLinkLabelSourceMultiplicityEditPart.class); - nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, ConnectorLinkLabelTargetMultiplicityEditPart.class); - nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, NamedElementLinkLabelNameEditPart.class); - - + nodeMap.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, FlowPortAffixedLabelNameEditPart.class); + nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, BlockPropertyStructureCompartmentEditPart.class); + nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, StructureCompartmentEditPart.class); + nodeMap.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, CustomBlockLabelNameEditPart.class); // TODO : change for multi FlowText + nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeAffixedLabelEditPart.class); + nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, PortAffixedLabelNameEditPart.class); + nodeMap.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, PropertyNodeLabelEditPart.class); + nodeMap.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, ConstraintNodeLabelEditPart.class); + nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeLinkLabelEditPart.class); + nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, ConnectorLinkLabelEditPart.class); + nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, ConnectorLinkLabelSourceMultiplicityEditPart.class); + nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, ConnectorLinkLabelTargetMultiplicityEditPart.class); + nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, NamedElementLinkLabelNameEditPart.class); + + // Edges - edgeMap.put(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, ConnectorEditPart.class); - edgeMap.put(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, DependencyEditPart.class); + edgeMap.put(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, ConnectorEditPart.class); + edgeMap.put(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, DependencyEditPart.class); } /** @@ -95,19 +95,19 @@ public class CustomEditPartProvider extends CustomAbstractEditPartProvider { */ @Override public boolean provides(IOperation operation) { - if(operation instanceof CreateGraphicEditPartOperation) { - View newView = ((IEditPartOperation)operation).getView(); + if (operation instanceof CreateGraphicEditPartOperation) { + View newView = ((IEditPartOperation) operation).getView(); if (newView == null) { return false; } - + String graphicalType = newView.getType(); - if((newView instanceof Node) && (!nodeMap.containsKey(graphicalType))) { + if ((newView instanceof Node) && (!nodeMap.containsKey(graphicalType))) { return false; } - - if((newView instanceof Edge) && (!edgeMap.containsKey(graphicalType))) { + + if ((newView instanceof Edge) && (!edgeMap.containsKey(graphicalType))) { return false; } } @@ -122,7 +122,7 @@ public class CustomEditPartProvider extends CustomAbstractEditPartProvider { protected Class<?> getNodeEditPartClass(View view) { return nodeMap.get(view.getType()); } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java index 0cd8644457e..0d20a3bdf92 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; +package org.eclipse.papyrus.sysml.diagram.parametric.provider; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; @@ -23,231 +23,233 @@ import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.util.UMLUtil; - + public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry { /** Default constructor */ public CustomGraphicalTypeRegistry() { - + super(); - + // Nodes - knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID); - knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); - knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID); - knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID); - knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID); - knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); + knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID); + knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); + knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID); + knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID); + knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID); + knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); // Decorations - knownNodes.add(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID); - knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID); - knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID); - knownNodes.add(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID); - knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID); - knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID); - knownNodes.add(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID); - knownNodes.add(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID); - knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID); - knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID); - knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID); - knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID); - knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID); - + knownNodes.add(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID); + knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID); + knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID); + knownNodes.add(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID); + knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID); + knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID); + knownNodes.add(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID); + knownNodes.add(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID); + knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID); + knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID); + knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID); + knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID); + knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID); + // Edges knownEdges.add(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID); knownEdges.add(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID); } - + /** * {@inheritDoc} */ @Override public String getNodeGraphicalType(EObject domainElement, String containerType) { - // Start of user code getNodeGraphicalType(EObject domainElement, String containerType) + // Start of user code getNodeGraphicalType(EObject domainElement, String containerType) // End of user code - - if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(domainElement)) { + + if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(domainElement)) { if (ElementTypes.DIAGRAM_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; } - if(((ISpecializationType)SysMLElementTypes.CONSTRAINT_PROPERTY).getMatcher().matches(domainElement)) { + if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_PROPERTY).getMatcher().matches(domainElement)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(domainElement)) { return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } + } // These element are only authorized on Block, not in Constraint Block. In ConstraintBlock it must become a ConstraintParameter - if (UMLUtil.getStereotypeApplication((Element)domainElement.eContainer(), ConstraintBlock.class) == null) { - if(((ISpecializationType)SysMLElementTypes.PART_PROPERTY).getMatcher().matches(domainElement)) { + if (UMLUtil.getStereotypeApplication((Element) domainElement.eContainer(), ConstraintBlock.class) == null) { + if (((ISpecializationType) SysMLElementTypes.PART_PROPERTY).getMatcher().matches(domainElement)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } - if(((ISpecializationType)SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(domainElement)) { + } + if (((ISpecializationType) SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(domainElement)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; } - if(((ISpecializationType)SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(domainElement)) { + if (((ISpecializationType) SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(domainElement)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; } } // Order is important for Part/Reference/ConstraintProperty which are also Property - if(UMLElementTypes.PROPERTY.getEClass().isInstance(domainElement)) { + if (UMLElementTypes.PROPERTY.getEClass().isInstance(domainElement)) { if (SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) { return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; - } + } if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; - } + } return UNDEFINED_TYPE; - } - if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(domainElement)) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { + } + if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(domainElement)) { + if (ElementTypes.DIAGRAM_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; } return UNDEFINED_TYPE; } return super.getNodeGraphicalType(domainElement, containerType); - } - + } + /** * {@inheritDoc} */ + @Override public String getNodeGraphicalType(String proposedType, String containerType) { // Start of user code getNodeGraphicalType(String proposedType, String containerType) // End of user code - - if(SysMLElementTypes.BLOCK.getSemanticHint().equals(proposedType)) { + + if (SysMLElementTypes.BLOCK.getSemanticHint().equals(proposedType)) { if (ElementTypes.DIAGRAM_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } - - if(UMLElementTypes.PROPERTY.getSemanticHint().equals(proposedType)) { + } + + if (UMLElementTypes.PROPERTY.getSemanticHint().equals(proposedType)) { if (SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) { return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; - } + } if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; - } + } return UNDEFINED_TYPE; - } - - if(SysMLElementTypes.CONSTRAINT_PROPERTY.getSemanticHint().equals(proposedType)) { + } + + if (SysMLElementTypes.CONSTRAINT_PROPERTY.getSemanticHint().equals(proposedType)) { if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { - + return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } + } - if(SysMLElementTypes.PART_PROPERTY.getSemanticHint().equals(proposedType)) { + if (SysMLElementTypes.PART_PROPERTY.getSemanticHint().equals(proposedType)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } - if(SysMLElementTypes.REFERENCE_PROPERTY.getSemanticHint().equals(proposedType)) { + } + if (SysMLElementTypes.REFERENCE_PROPERTY.getSemanticHint().equals(proposedType)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } - if(SysMLElementTypes.VALUE_PROPERTY.getSemanticHint().equals(proposedType)) { + } + if (SysMLElementTypes.VALUE_PROPERTY.getSemanticHint().equals(proposedType)) { if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; - } + } return UNDEFINED_TYPE; - } + } return super.getNodeGraphicalType(proposedType, containerType); - } - + } + /** * {@inheritDoc} */ @Override public String getEdgeGraphicalType(EObject domainElement) { - // Start of user code getEdgeGraphicalType(EObject domainElement) + // Start of user code getEdgeGraphicalType(EObject domainElement) // End of user code - - if(UMLElementTypes.CONNECTOR.getEClass().isInstance(domainElement)) { + + if (UMLElementTypes.CONNECTOR.getEClass().isInstance(domainElement)) { return UMLGraphicalTypes.LINK_UML_CONNECTOR_ID; - } - if(UMLElementTypes.DEPENDENCY.getEClass().isInstance(domainElement)) { + } + if (UMLElementTypes.DEPENDENCY.getEClass().isInstance(domainElement)) { return UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID; - } + } return super.getEdgeGraphicalType(domainElement); - } - + } + /** * {@inheritDoc} */ + @Override public String getEdgeGraphicalType(String proposedType) { // Start of user code getEdgeGraphicalType(String proposedType) // End of user code - - if(UMLElementTypes.CONNECTOR.getSemanticHint().equals(proposedType)) { + + if (UMLElementTypes.CONNECTOR.getSemanticHint().equals(proposedType)) { return UMLGraphicalTypes.LINK_UML_CONNECTOR_ID; - } - if(UMLElementTypes.DEPENDENCY.getSemanticHint().equals(proposedType)) { + } + if (UMLElementTypes.DEPENDENCY.getSemanticHint().equals(proposedType)) { return UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID; - } + } return super.getEdgeGraphicalType(proposedType); - } + } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java index befa6ce3ac6..51ddb08410c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; +package org.eclipse.papyrus.sysml.diagram.parametric.provider; public class CustomGraphicalTypes { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java index 5a47486000e..318d7a10c2b 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; +package org.eclipse.papyrus.sysml.diagram.parametric.provider; import java.util.HashMap; import java.util.Map; @@ -38,17 +38,17 @@ public class CustomViewProvider extends CustomAbstractViewProvider { /** Map containing node view types supported by this provider */ protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>(); - + /** Map containing edge view types supported by this provider */ protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>(); - + /** Default constructor */ public CustomViewProvider() { super(); this.registry = new CustomGraphicalTypeRegistry(); diagramType = ElementTypes.DIAGRAM_ID; - + // Custom classifier nodes nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, BlockCompositeClassifierViewFactory.class); nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, BlockPropertyCompositeClassifierViewFactory.class); @@ -63,13 +63,13 @@ public class CustomViewProvider extends CustomAbstractViewProvider { nodeMap.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, InnerLabelViewFactory.class); nodeMap.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, InnerLabelViewFactory.class); // Custom compartments - nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, CompartmentShapeViewFactory.class); + nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, CompartmentShapeViewFactory.class); nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, CompartmentShapeViewFactory.class); // Custom affixed labels nodeMap.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, AffixedLabelViewFactory.class); nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, AffixedLabelViewFactory.class); nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, AffixedLabelViewFactory.class); - + // Custom edges edgeMap.put(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, ConnectorLinkViewFactory.class); edgeMap.put(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, DependencyLinkViewFactory.class); @@ -89,7 +89,7 @@ public class CustomViewProvider extends CustomAbstractViewProvider { protected Class<?> getNodeViewClass(IAdaptable semanticAdapter, View containerView, String graphicalType) { return nodeMap.get(graphicalType); } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java index 603137f01b5..30019c4d429 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java @@ -25,7 +25,7 @@ public class ElementTypes extends AbstractElementTypeEnumerator { /** SysML Parametric Diagram :: Diagram */ public static final String DIAGRAM_ID = "Parametric"; //$NON-NLS-1$ - + /** ********************************************************* */ @@ -33,36 +33,36 @@ public class ElementTypes extends AbstractElementTypeEnumerator { /** ********************************************************* */ /** CompositeDiagram :: CONSTRAINT */ - public static final IHintedType CONSTRAINT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_2114"); //$NON-NLS-1$ + public static final IHintedType CONSTRAINT = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_2114"); //$NON-NLS-1$ public static final String CONSTRAINT_LABEL_NAME_HINT = "5197"; //$NON-NLS-1$ public static final String CONSTRAINT_LABEL_SPECIFICATION_HINT = "6039"; //$NON-NLS-1$ /** CompositeDiagram :: COMMENT_CN */ - public static final IHintedType COMMENT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_3097"); //$NON-NLS-1$ + public static final IHintedType COMMENT_CN = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_3097"); //$NON-NLS-1$ public static final String COMMENT_CN_LABEL_BODY_HINT = "5150"; //$NON-NLS-1$ /** CompositeDiagram :: COMMENT */ - public static final IHintedType COMMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_2109"); //$NON-NLS-1$ + public static final IHintedType COMMENT = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_2109"); //$NON-NLS-1$ public static final String COMMENT_LABEL_BODY_HINT = "5192"; //$NON-NLS-1$ /** CompositeDiagram :: CONSTRAINT_CN */ - public static final IHintedType CONSTRAINT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_3120"); //$NON-NLS-1$ + public static final IHintedType CONSTRAINT_CN = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_3120"); //$NON-NLS-1$ public static final String CONSTRAINT_CN_LABEL_NAME_HINT = "6048"; //$NON-NLS-1$ public static final String CONSTRAINT_CN_LABEL_SPECIFICATION_HINT = "6049"; //$NON-NLS-1$ /** CompositeDiagram :: COMMENT_ANNOTATED_ELEMENT */ - public static final IHintedType COMMENT_ANNOTATED_ELEMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.CommentAnnotatedElement_4002"); //$NON-NLS-1$ + public static final IHintedType COMMENT_ANNOTATED_ELEMENT = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.composite.CommentAnnotatedElement_4002"); //$NON-NLS-1$ /** CompositeDiagram :: CONTEXT_LINK */ - public static final IHintedType CONTEXT_LINK = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.parametric.ContextLink"); //$NON-NLS-1$ + public static final IHintedType CONTEXT_LINK = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.parametric.ContextLink"); //$NON-NLS-1$ /** CompositeDiagram :: CONContextLinkAppliedStereotype */ - public static final IHintedType CONTEXT_LINK_APPLIED_STEREOTYPE = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.parametric.ContextLinkAppliedStereotype"); //$NON-NLS-1$ + public static final IHintedType CONTEXT_LINK_APPLIED_STEREOTYPE = (IHintedType) getElementType("org.eclipse.papyrus.uml.diagram.parametric.ContextLinkAppliedStereotype"); //$NON-NLS-1$ -} +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java index f12fe38788b..186fd31af2c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java @@ -64,7 +64,7 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { public String getEdgeGraphicalType(EObject domainElement) { String graphicalType = UNDEFINED_TYPE; - if(domainElement == null) { + if (domainElement == null) { return UNDEFINED_TYPE; } return graphicalType; @@ -74,8 +74,8 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { * {@inheritDoc} */ public String getEdgeGraphicalType(IElementType elementType) { - if(elementType instanceof IHintedType) { - String semanticHint = ((IHintedType)elementType).getSemanticHint(); + if (elementType instanceof IHintedType) { + String semanticHint = ((IHintedType) elementType).getSemanticHint(); return getEdgeGraphicalType(semanticHint); } @@ -86,7 +86,7 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { * {@inheritDoc} */ public String getEdgeGraphicalType(String proposedType) { - if(isKnownEdgeType(proposedType)) { + if (isKnownEdgeType(proposedType)) { return proposedType; } @@ -99,28 +99,28 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { public String getNodeGraphicalType(EObject domainElement, String containerType) { String graphicalType = UNDEFINED_TYPE; - if((containerType == null) || (domainElement == null)) { + if ((containerType == null) || (domainElement == null)) { return UNDEFINED_TYPE; } - if(domainElement instanceof org.eclipse.uml2.uml.Constraint) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode + if (domainElement instanceof org.eclipse.uml2.uml.Constraint) { + if (ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode graphicalType = ElementTypes.CONSTRAINT.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint(); } } - if(domainElement instanceof org.eclipse.uml2.uml.Comment) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Comment TopNode + if (domainElement instanceof org.eclipse.uml2.uml.Comment) { + if (ElementTypes.DIAGRAM_ID.equals(containerType)) { // Comment TopNode graphicalType = ElementTypes.COMMENT.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); } @@ -133,8 +133,8 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { * {@inheritDoc} */ public String getNodeGraphicalType(IElementType elementType, String containerType) { - if(elementType instanceof IHintedType) { - String semanticHint = ((IHintedType)elementType).getSemanticHint(); + if (elementType instanceof IHintedType) { + String semanticHint = ((IHintedType) elementType).getSemanticHint(); return getNodeGraphicalType(semanticHint, containerType); } @@ -145,40 +145,40 @@ public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { * {@inheritDoc} */ public String getNodeGraphicalType(String proposedType, String containerType) { - if((UMLElementTypes.COMMENT.getSemanticHint().equals(proposedType))) { + if ((UMLElementTypes.COMMENT.getSemanticHint().equals(proposedType))) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode + if (ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode return ElementTypes.COMMENT.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return ElementTypes.COMMENT_CN.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return ElementTypes.COMMENT_CN.getSemanticHint(); } return UNDEFINED_TYPE; } - if(UMLElementTypes.CONSTRAINT.getSemanticHint().equals(proposedType)) { + if (UMLElementTypes.CONSTRAINT.getSemanticHint().equals(proposedType)) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode + if (ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode return ElementTypes.CONSTRAINT.getSemanticHint(); } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) { return ElementTypes.CONSTRAINT_CN.getSemanticHint(); } - - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { + + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) { return ElementTypes.CONSTRAINT_CN.getSemanticHint(); } return UNDEFINED_TYPE; } - if(isKnownNodeType(proposedType)) { + if (isKnownNodeType(proposedType)) { return proposedType; } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java index 4b4495a584c..a3f92e3f1e4 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java @@ -27,82 +27,82 @@ public interface IGraphicalTypeRegistry { /** * Get a valid edge graphical type for the domain element. - * + * * @param domainElement - * the domain element. + * the domain element. * @return the domain element graphical type. */ public String getEdgeGraphicalType(EObject domainElement); - + /** * Get a valid edge graphical type for the element type. - * + * * @param elementType - * the element type. + * the element type. * @param containerType - * the type of the graphical owner of the domain element. + * the type of the graphical owner of the domain element. * @return the domain element graphical type. */ public String getEdgeGraphicalType(IElementType elementType); - + /** * Get a valid edge graphical type for the proposed type. - * + * * @param proposedType - * the proposed type. + * the proposed type. * @param containerType - * the type of the graphical owner of the domain element. + * the type of the graphical owner of the domain element. * @return the domain element graphical type. */ public String getEdgeGraphicalType(String proposedType); - + /** * Get a valid node graphical type for the domain element. - * + * * @param domainElement - * the domain element. + * the domain element. * @param containerType - * the type of the graphical owner of the domain element. + * the type of the graphical owner of the domain element. * @return the domain element graphical type. */ public String getNodeGraphicalType(EObject domainElement, String containerType); - + /** * Get a valid node graphical type for the element type. - * + * * @param elementType - * the element type. + * the element type. * @param containerType - * the type of the graphical owner of the domain element. + * the type of the graphical owner of the domain element. * @return the domain element graphical type. */ public String getNodeGraphicalType(IElementType elementType, String containerType); - + /** * Get a valid node graphical type for the proposed type. - * + * * @param proposedType - * the proposed type. + * the proposed type. * @param containerType - * the type of the graphical owner of the domain element. + * the type of the graphical owner of the domain element. * @return the domain element graphical type. */ public String getNodeGraphicalType(String proposedType, String containerType); - + /** * Test if the type is a known edge graphical type in this diagram - * + * * @param type - * the type to test + * the type to test * @return true if the type is known */ public boolean isKnownEdgeType(String type); - + /** * Test if the type is a known node graphical type in this diagram - * + * * @param type - * the type to test + * the type to test * @return true if the type is known */ public boolean isKnownNodeType(String type); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java index 2af0e220aa3..197a8dbb518 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java @@ -37,14 +37,14 @@ public class InheritedCompositeDiagramEditPartProvider extends UMLEditPartProvid } return super.createEditPart(view); } - + @Override public synchronized boolean provides(IOperation operation) { - if(operation instanceof CreateGraphicEditPartOperation) { - View view = ((IEditPartOperation)operation).getView(); + if (operation instanceof CreateGraphicEditPartOperation) { + View view = ((IEditPartOperation) operation).getView(); // Ensure current diagram is a Parametric Diagram - if(!ElementTypes.DIAGRAM_ID.equals(view.getDiagram().getType())) { + if (!ElementTypes.DIAGRAM_ID.equals(view.getDiagram().getType())) { return false; } @@ -52,10 +52,10 @@ public class InheritedCompositeDiagramEditPartProvider extends UMLEditPartProvid EObject eobject = view.getElement(); /** Nodes (and ChildLabelNodes) *********** */ - if(eobject instanceof org.eclipse.uml2.uml.Constraint) { + if (eobject instanceof org.eclipse.uml2.uml.Constraint) { return true; } - if(eobject instanceof org.eclipse.uml2.uml.Comment) { + if (eobject instanceof org.eclipse.uml2.uml.Comment) { return true; } @@ -66,14 +66,14 @@ public class InheritedCompositeDiagramEditPartProvider extends UMLEditPartProvid String hint = view.getType(); /** Edges (Feature) : COMMENT_ANNOTATED_ELEMENT *********** */ - if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(hint)) { + if (ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(hint)) { return true; } /** Edges (Feature) : CONSTRAINT_CONSTRAINED_ELEMENT *********** */ - if(ElementTypes.CONTEXT_LINK.getSemanticHint().equals(hint)) { + if (ElementTypes.CONTEXT_LINK.getSemanticHint().equals(hint)) { return true; } - if(ElementTypes.CONTEXT_LINK_APPLIED_STEREOTYPE.getSemanticHint().equals(hint)) { + if (ElementTypes.CONTEXT_LINK_APPLIED_STEREOTYPE.getSemanticHint().equals(hint)) { return true; } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java index 0132d2b0c7d..668674b5790 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java @@ -42,8 +42,8 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { Edge createdEdge = null; - IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class); - if(elementType != null) { + IElementType elementType = (IElementType) semanticAdapter.getAdapter(IElementType.class); + if (elementType != null) { if (elementType == ElementTypes.CONTEXT_LINK) { org.eclipse.papyrus.uml.diagram.clazz.providers.UMLViewProvider classDiagramUMLProvider = new org.eclipse.papyrus.uml.diagram.clazz.providers.UMLViewProvider(); createdEdge = classDiagramUMLProvider.createConstraintContext_8500(containerView, index, persisted, preferencesHint); @@ -53,7 +53,7 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { } } - if(createdEdge == null) { + if (createdEdge == null) { Activator.log.error(new Exception("Could not create Edge.")); } @@ -64,7 +64,7 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { protected boolean provides(CreateViewForKindOperation op) { // Never use this method (often incorrectly implemented due to GMF Tooling choices). String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { + if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { return false; } @@ -75,21 +75,21 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { protected boolean provides(CreateEdgeViewOperation op) { // Must have a container - if(op.getContainerView() == null) { + if (op.getContainerView() == null) { return false; } // This provider is registered for InternalBlock Diagram only String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { + if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { return false; } IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); - if(elementType == ElementTypes.COMMENT_ANNOTATED_ELEMENT) { + if (elementType == ElementTypes.COMMENT_ANNOTATED_ELEMENT) { return true; } - if(elementType == ElementTypes.CONTEXT_LINK) { + if (elementType == ElementTypes.CONTEXT_LINK) { return true; } @@ -98,15 +98,15 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { // ///////////////////////////////////////////////////////////////////// // IElementType may be null (especially when drop from ModelExplorer). - // In such a case, test the semantic EObject instead. - if(elementType == null) { - EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class); + // In such a case, test the semantic EObject instead. + if (elementType == null) { + EObject domainElement = (EObject) op.getSemanticAdapter().getAdapter(EObject.class); String domainElementGraphicalType = op.getSemanticHint(); - if(domainElementGraphicalType == null) { + if (domainElementGraphicalType == null) { domainElementGraphicalType = registry.getEdgeGraphicalType(domainElement); } - if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) { + if ((!org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) { return true; } } @@ -117,7 +117,7 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { @Override protected boolean provides(CreateNodeViewOperation op) { // Must have a container - if(op.getContainerView() == null) { + if (op.getContainerView() == null) { return false; } // Get the type of the container @@ -125,7 +125,7 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { // This provider is registered for InternalBlock Diagram only String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { + if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { return false; } @@ -133,23 +133,23 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { // Test possibility to provide a view based on the ElementType and its expected container. // ///////////////////////////////////////////////////////////////////// - IElementType elementType = (IElementType)op.getSemanticAdapter().getAdapter(IElementType.class); - if(elementType == UMLElementTypes.CONSTRAINT) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { + IElementType elementType = (IElementType) op.getSemanticAdapter().getAdapter(IElementType.class); + if (elementType == UMLElementTypes.CONSTRAINT) { + if (ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { return true; } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) { return true; } } - if(elementType == UMLElementTypes.COMMENT) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { + if (elementType == UMLElementTypes.COMMENT) { + if (ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { return true; } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) { return true; } - if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerGraphicalType)) { + if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerGraphicalType)) { return true; } } @@ -160,16 +160,16 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { // IElementType may be null (especially when drop from ModelExplorer). // In such a case, test the semantic EObject instead. - if(elementType == null) { - EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class); + if (elementType == null) { + EObject domainElement = (EObject) op.getSemanticAdapter().getAdapter(EObject.class); String domainElementGraphicalType = op.getSemanticHint(); - if(domainElementGraphicalType == null) { + if (domainElementGraphicalType == null) { domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType); } else { domainElementGraphicalType = registry.getNodeGraphicalType(domainElementGraphicalType, containerGraphicalType); } - if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownNodeType(domainElementGraphicalType))) { + if ((!org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownNodeType(domainElementGraphicalType))) { return true; } } @@ -184,9 +184,9 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { String containerGraphicalType = containerView.getType(); // Get the type of the domain element - EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class); + EObject domainElement = (EObject) semanticAdapter.getAdapter(EObject.class); - if(semanticHint != null) { + if (semanticHint != null) { // Look for a possible graphicalType replacement String graphicalType = registry.getNodeGraphicalType(semanticHint, containerGraphicalType); return super.createNode(new SemanticAdapter(domainElement, null), containerView, graphicalType, index, persisted, preferencesHint); @@ -195,7 +195,7 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { String domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType); // Create the expected node - if(!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) { + if (!org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) { return super.createNode(semanticAdapter, containerView, domainElementGraphicalType, index, persisted, preferencesHint); } @@ -203,48 +203,48 @@ public class InheritedCompositeDiagramViewProvider extends UMLViewProvider { return null; } - + @Override protected void stampShortcut(View containerView, Node target) { - if(!ElementTypes.DIAGRAM_ID.equals(containerView.getDiagram().getType())) { + if (!ElementTypes.DIAGRAM_ID.equals(containerView.getDiagram().getType())) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ElementTypes.DIAGRAM_ID); //$NON-NLS-1$ target.getEAnnotations().add(shortcutAnnotation); } } - -// /** -// * @generated -// */ -// @SuppressWarnings("unchecked") -// public Edge createContextLink_8500(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { -// Connector edge = NotationFactory.eINSTANCE.createConnector(); -// edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); -// RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); -// ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); -// points.add(new RelativeBendpoint()); -// points.add(new RelativeBendpoint()); -// bendpoints.setPoints(points); -// edge.setBendpoints(bendpoints); -// ViewUtil.insertChildView(containerView, edge, index, persisted); -// edge.setType(UMLVisualIDRegistry.getType(ContextLinkEditPart.VISUAL_ID)); -// edge.setElement(null); -// // initializePreferences -// final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); -// PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Undefined"); -// PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Undefined"); -// //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); -// //} -// PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "Undefined"); -// Node label8501 = createLabel(edge, UMLVisualIDRegistry.getType(ContextLinkAppliedStereotypeEditPart.VISUAL_ID)); -// label8501.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); -// Location location8501 = (Location)label8501.getLayoutConstraint(); -// location8501.setX(0); -// location8501.setY(15); -// return edge; -// } - -} + + // /** + // * @generated + // */ + // @SuppressWarnings("unchecked") + // public Edge createContextLink_8500(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + // Connector edge = NotationFactory.eINSTANCE.createConnector(); + // edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); + // RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); + // ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); + // points.add(new RelativeBendpoint()); + // points.add(new RelativeBendpoint()); + // bendpoints.setPoints(points); + // edge.setBendpoints(bendpoints); + // ViewUtil.insertChildView(containerView, edge, index, persisted); + // edge.setType(UMLVisualIDRegistry.getType(ContextLinkEditPart.VISUAL_ID)); + // edge.setElement(null); + // // initializePreferences + // final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore(); + // PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Undefined"); + // PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Undefined"); + // //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); + // //} + // PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "Undefined"); + // Node label8501 = createLabel(edge, UMLVisualIDRegistry.getType(ContextLinkAppliedStereotypeEditPart.VISUAL_ID)); + // label8501.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + // Location location8501 = (Location)label8501.getLayoutConstraint(); + // location8501.setX(0); + // location8501.setY(15); + // return edge; + // } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java index 4d2bd6536ed..3666d0c192f 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java @@ -25,11 +25,11 @@ public class ParametricDiagramEditPartProvider extends AbstractEditPartProvider @Override public boolean provides(IOperation operation) { - if(operation instanceof CreateGraphicEditPartOperation) { - View view = ((IEditPartOperation)operation).getView(); + if (operation instanceof CreateGraphicEditPartOperation) { + View view = ((IEditPartOperation) operation).getView(); // Ensure current diagram is Parametric Diagram - if(ElementTypes.DIAGRAM_ID.equals(view.getType())) { + if (ElementTypes.DIAGRAM_ID.equals(view.getType())) { return true; } } @@ -39,7 +39,7 @@ public class ParametricDiagramEditPartProvider extends AbstractEditPartProvider @Override protected Class<?> getDiagramEditPartClass(View view) { - if(ElementTypes.DIAGRAM_ID.equals(view.getType())) { + if (ElementTypes.DIAGRAM_ID.equals(view.getType())) { return ParametricDiagramEditPart.class; } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java index dfb80dac34a..a483e666967 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java @@ -27,31 +27,31 @@ public class ParametricDiagramEditPolicyProvider extends AbstractProvider implem public boolean provides(IOperation operation) { - CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation; - if(!(epOperation.getEditPart() instanceof GraphicalEditPart)) { + CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation; + if (!(epOperation.getEditPart() instanceof GraphicalEditPart)) { return false; } - GraphicalEditPart gep = (GraphicalEditPart)epOperation.getEditPart(); + GraphicalEditPart gep = (GraphicalEditPart) epOperation.getEditPart(); String diagramType = gep.getNotationView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { + if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { return false; } - if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart) { + if (gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart) { return true; - } - if(gep instanceof PortAffixedNodeEditPart) { + } + if (gep instanceof PortAffixedNodeEditPart) { return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.UseCaseEditPartCN) { + } + if (gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.UseCaseEditPartCN) { return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPart) { + } + if (gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPart) { return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.InteractionConstraintEditPartCN) { + } + if (gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.InteractionConstraintEditPartCN) { return true; - } + } return false; } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java index 77f17d204fc..bb6d60896be 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java @@ -21,24 +21,23 @@ import org.eclipse.papyrus.sysml.diagram.parametric.factory.ParametricDiagramVie public class ParametricDiagramViewProvider extends AbstractViewProvider { - @Override - protected boolean provides(CreateDiagramViewOperation operation) { - - if(ElementTypes.DIAGRAM_ID.equals(operation.getSemanticHint())) { - return true; - } - - return false; + @Override + protected boolean provides(CreateDiagramViewOperation operation) { + + if (ElementTypes.DIAGRAM_ID.equals(operation.getSemanticHint())) { + return true; } - - @Override - protected Class<?> getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) { - if(ElementTypes.DIAGRAM_ID.equals(diagramKind)) { - return ParametricDiagramViewFactory.class; - } - - Activator.log.error(new Exception("Could not create View.")); - return null; + + return false; + } + + @Override + protected Class<?> getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) { + if (ElementTypes.DIAGRAM_ID.equals(diagramKind)) { + return ParametricDiagramViewFactory.class; } -} + Activator.log.error(new Exception("Could not create View.")); + return null; + } +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java index e404d658977..a49f14b0078 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java @@ -11,7 +11,7 @@ * CEA LIST - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.utils; +package org.eclipse.papyrus.sysml.diagram.parametric.utils; public class ParametricDiagramGraphicalTypes { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java index bb75848751b..452589070da 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java @@ -45,6 +45,7 @@ public class Activator extends AbstractUIPlugin { * * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -65,6 +66,7 @@ public class Activator extends AbstractUIPlugin { * * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); @@ -72,7 +74,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getInstance() { @@ -81,10 +83,10 @@ public class Activator extends AbstractUIPlugin { /** * Returns an image descriptor for the image file at the given plug-in relative path. - * + * * @generated * @param path - * the path + * the path * @return the image descriptor */ public static ImageDescriptor getBundledImageDescriptor(String path) { @@ -92,9 +94,9 @@ public class Activator extends AbstractUIPlugin { } /** - * + * * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() - * + * * @return Shared Preference Store. */ @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java index c955400e9d2..32af7b0cd56 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java @@ -39,7 +39,7 @@ import org.eclipse.uml2.uml.util.UMLUtil; import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper; /** - * + * */ public class CustomBindingConnectorCreateCommand extends EditElementCommand { @@ -55,41 +55,43 @@ public class CustomBindingConnectorCreateCommand extends EditElementCommand { /** * A BindingConnector could be created in Parametric only if at least one end is a ConstraintParameter. * Also check Block.isEncapsulated (could not cross a Block which is encapsulted) - * @return + * + * @return */ @Override public boolean canExecute() { - if(this.source == null) { + if (this.source == null) { return false; } - if(this.target == null) { + if (this.target == null) { return true; } - if(this.source == this.target) { + if (this.source == this.target) { return false; } if (this.source != null && this.target != null) { - - boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); - + + boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); + return hasEncapsulationViolation ? false : - // one of the end must be a ConstraintParameter - ConstraintBlockHelper.isConstraintParameter((Element)source, RequestParameterUtils.getSourceView(getRequest())) - || ConstraintBlockHelper.isConstraintParameter((Element)target, RequestParameterUtils.getTargetView(getRequest())); + // one of the end must be a ConstraintParameter + ConstraintBlockHelper.isConstraintParameter((Element) source, RequestParameterUtils.getSourceView(getRequest())) + || ConstraintBlockHelper.isConstraintParameter((Element) target, RequestParameterUtils.getTargetView(getRequest())); } return false; } /** * Check that BindingConnector do not cross a "Block.isEncapsulated" Part/Reference/ConstraintProperty + * * @return true no encapsulation problem, false else */ private boolean checkEncapsulationCrossing() { org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils util = new org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils(); - // source end - get the nestedPath + // source end - get the nestedPath List<Property> nestedPropertyPath = util.getNestedPropertyPath(RequestParameterUtils.getSourceView(getRequest()), RequestParameterUtils.getTargetView(getRequest())); - // check for each level of path if crossing an isEncapsultaed Block + // check for each level of path if crossing an isEncapsultaed Block for (Property property : nestedPropertyPath) { Type type = property.getType(); Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); @@ -99,7 +101,7 @@ public class CustomBindingConnectorCreateCommand extends EditElementCommand { } } } - + // target end - get the nestedPath nestedPropertyPath = util.getNestedPropertyPath(RequestParameterUtils.getTargetView(getRequest()), RequestParameterUtils.getSourceView(getRequest())); // check for each level of path if crossing an isEncapsultaed Block @@ -117,6 +119,7 @@ public class CustomBindingConnectorCreateCommand extends EditElementCommand { /** * Create the connector, affect its owner, calculate nestedPath + * * @param monitor * @param info * @return CommandResult contains the created Connector @@ -124,22 +127,22 @@ public class CustomBindingConnectorCreateCommand extends EditElementCommand { @Override protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - if(!canExecute()) { + if (!canExecute()) { throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$ } // Create the Connector and its ConnectorEnd. Correct container are set and paths are set in case of <<NestedConnectorEnd>>. StructuredClassifier deducedContainer = new ConnectorUtils().deduceContainer(RequestParameterUtils.getSourceView(getRequest()), RequestParameterUtils.getTargetView(getRequest())); - ((CreateRelationshipRequest)getRequest()).setContainer(deducedContainer); + ((CreateRelationshipRequest) getRequest()).setContainer(deducedContainer); IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(deducedContainer); ICommand editCommand = commandProvider.getEditCommand(getRequest()); - + if (editCommand.canExecute()) { editCommand.execute(monitor, info); Object newObject = editCommand.getCommandResult().getReturnValue(); - + if (newObject instanceof Connector) { - Connector connector = (Connector)newObject; + Connector connector = (Connector) newObject; // Apply the <<BindingConnector>> stereotype StereotypeApplicationHelper.INSTANCE.applyStereotype(connector, BlocksPackage.eINSTANCE.getBindingConnector()); } @@ -148,5 +151,5 @@ public class CustomBindingConnectorCreateCommand extends EditElementCommand { } return CommandResult.newErrorCommandResult("Invalid arguments in create link command"); } - + } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java index e723548ea11..fa24c96febd 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java @@ -28,6 +28,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; @@ -56,48 +57,51 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm public CustomBindingConnectorReorientCommand(ReorientReferenceRelationshipRequestWithGraphical request) { super(request); - source = reorientDirection == ReorientReferenceRelationshipRequest.REORIENT_SOURCE ? request.getNewRelationshipEnd() : request.getReferenceOwner(); - target = reorientDirection == ReorientReferenceRelationshipRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd(); + source = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getNewRelationshipEnd() : request.getReferenceOwner(); + target = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd(); } /** * A BindingConnector could be reoriented in Parametric only if at least one end is a ConstraintParameter. * Also check Block.isEncapsulated (could not cross a Block which is encapsulted) - * @return + * + * @return */ + @Override public boolean canExecute() { - - if(this.source == this.target) { + + if (this.source == this.target) { return false; } - + Object connectorView = getRequest().getParameter(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); if (connectorView instanceof org.eclipse.gmf.runtime.notation.Connector) { View sourceView = getSourceView(); View targetView = getTargetView(); - + if (this.source != null && this.target != null) { - boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); - + boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); + return hasEncapsulationViolation ? false : - // one of the end must be a ConstraintParameter - ConstraintBlockHelper.isConstraintParameter((Element)source, sourceView) - || ConstraintBlockHelper.isConstraintParameter((Element)target, targetView); - } + // one of the end must be a ConstraintParameter + ConstraintBlockHelper.isConstraintParameter((Element) source, sourceView) + || ConstraintBlockHelper.isConstraintParameter((Element) target, targetView); + } } return false; } /** * Check that BindingConnector do not cross a "Block.isEncapsulated" Part/Reference/ConstraintProperty + * * @return true no encapsulation problem, false else */ private boolean checkEncapsulationCrossing() { org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils util = new org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils(); - // source end - get the nestedPath + // source end - get the nestedPath List<Property> nestedPropertyPath = util.getNestedPropertyPath(getSourceView(), getTargetView()); - // check for each level of path if crossing an isEncapsultaed Block + // check for each level of path if crossing an isEncapsultaed Block for (Property property : nestedPropertyPath) { Type type = property.getType(); Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); @@ -107,10 +111,10 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm } } } - - // target end - get the nestedPath + + // target end - get the nestedPath nestedPropertyPath = util.getNestedPropertyPath(getTargetView(), getSourceView()); - // check for each level of path if crossing an isEncapsultaed Block + // check for each level of path if crossing an isEncapsultaed Block for (Property property : nestedPropertyPath) { Type type = property.getType(); Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); @@ -122,21 +126,21 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm } return true; } - + @Override /** * Get the link to re-orient. - * + * * @return the edited {@link Connector} */ protected Connector getLink() { - return (Connector)(getConnectorView()).getElement(); + return (Connector) (getConnectorView()).getElement(); } - + @Override protected void replaceOwner(Connector connector, StructuredClassifier newOwner) { - - View sourceView = getSourceView(); + + View sourceView = getSourceView(); View targetView = getTargetView(); StructuredClassifier deducedContainer = new ConnectorUtils().deduceContainer(sourceView, targetView); @@ -144,24 +148,24 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm super.replaceOwner(connector, deducedContainer); } } - - private org.eclipse.gmf.runtime.notation.Connector getConnectorView () { - return (org.eclipse.gmf.runtime.notation.Connector)getRequest().getParameter(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); + + private org.eclipse.gmf.runtime.notation.Connector getConnectorView() { + return (org.eclipse.gmf.runtime.notation.Connector) getRequest().getParameter(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); } private View getSourceView() { - return reorientDirection == ReorientReferenceRelationshipRequest.REORIENT_SOURCE ? - (View)((ReorientReferenceRelationshipRequestWithGraphical)getRequest()).getSourceEditPart().getModel() : - getConnectorView().getSource(); + return reorientDirection == ReorientRequest.REORIENT_SOURCE ? + (View) ((ReorientReferenceRelationshipRequestWithGraphical) getRequest()).getSourceEditPart().getModel() : + getConnectorView().getSource(); } - + private View getTargetView() { - return reorientDirection == ReorientReferenceRelationshipRequest.REORIENT_TARGET ? - (View)((ReorientReferenceRelationshipRequestWithGraphical)getRequest()).getTargetEditPart().getModel() : - getConnectorView().getTarget(); + return reorientDirection == ReorientRequest.REORIENT_TARGET ? + (View) ((ReorientReferenceRelationshipRequestWithGraphical) getRequest()).getTargetEditPart().getModel() : + getConnectorView().getTarget(); } - + @Override protected Property findNewOppositePartWithPort() { // no Port allowed in Parametric @@ -175,31 +179,31 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm } /** - * Reorient connector - recalculate nestedPath - remove connector deprecated representations (all diagrams) + * Reorient connector - recalculate nestedPath - remove connector deprecated representations (all diagrams) */ @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { CommandResult result = super.doExecuteWithResult(monitor, info); - + // apply or update NestedConnectorEnd stereotype and its PropertyPath if needed Connector connector = getLink(); if (connector.getEnds().size() == 2) { updateNestedPropertyPath(connector.getEnds().get(0), getSourceView(), getTargetView()); updateNestedPropertyPath(connector.getEnds().get(1), getTargetView(), getSourceView()); } - + Set<View> memberViewsToDestroy = getMemberViewsToDestroy(connector); - // Suppress Connector representation which are not coherant with the new ConnectorEnd + // Suppress Connector representation which are not coherant with the new ConnectorEnd for (View view : memberViewsToDestroy) { // exclude reoriented connector representation - if (view != getConnectorView()) { + if (view != getConnectorView()) { // Check Connector View ends matches with semantic ConnectorEnds - View sourceNode = ((org.eclipse.gmf.runtime.notation.Connector)view).getSource(); - View targetNode = ((org.eclipse.gmf.runtime.notation.Connector)view).getTarget(); - + View sourceNode = ((org.eclipse.gmf.runtime.notation.Connector) view).getSource(); + View targetNode = ((org.eclipse.gmf.runtime.notation.Connector) view).getTarget(); + EObject sourceElement = sourceNode.getElement(); EObject targetElement = targetNode.getElement(); - + EList<ConnectorEnd> ends = connector.getEnds(); boolean isSameEnds = true; for (ConnectorEnd connectorEnd : ends) { @@ -208,7 +212,7 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm break; } } - + // if no matching between graphical and semantic, we destroy the representation if (!isSameEnds) { final DestroyElementRequest destroyRequest = new DestroyElementRequest(getRequest().getEditingDomain(), view, false); @@ -222,20 +226,20 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm return result; } - + protected Set<View> getMemberViewsToDestroy(final Connector connector) { Set<View> viewsToDestroy = new HashSet<View>(); // Find Views in Composite Structure Diagram that are referencing current member Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(connector, null).iterator(); - while(viewIt.hasNext()) { + while (viewIt.hasNext()) { View view = viewIt.next(); viewsToDestroy.add(view); } return viewsToDestroy; } - + private void updateNestedPropertyPath(ConnectorEnd connectorEnd, View sourceView, View targetView) { ConnectorUtils utils = new ConnectorUtils(); List<Property> nestedPropertyPath = utils.getNestedPropertyPath(sourceView, targetView); @@ -244,7 +248,7 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm NestedConnectorEnd nestedConnectorEnd = UMLUtil.getStereotypeApplication(connectorEnd, NestedConnectorEnd.class); if (nestedConnectorEnd == null) { // apply stereotype if no application found - nestedConnectorEnd = (NestedConnectorEnd)StereotypeApplicationHelper.INSTANCE.applyStereotype(connectorEnd, BlocksPackage.eINSTANCE.getNestedConnectorEnd()); + nestedConnectorEnd = (NestedConnectorEnd) StereotypeApplicationHelper.INSTANCE.applyStereotype(connectorEnd, BlocksPackage.eINSTANCE.getNestedConnectorEnd()); } // set new path nestedConnectorEnd.getPropertyPath().clear(); @@ -256,7 +260,7 @@ public class CustomBindingConnectorReorientCommand extends ConnectorReorientComm if (NestedConnectorEnd.class.isInstance(stereotypeApplication)) { EcoreUtil.delete(stereotypeApplication, true); } - } - } + } + } } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java index 5b82c60ff3c..39e064573e3 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java @@ -49,13 +49,13 @@ public class CustomParametricContextLinkCreateCommand extends */
@Override
public boolean canExecute() {
- if(source == null && target == null) {
+ if (source == null && target == null) {
return false;
}
- if(source != null && !(source instanceof Constraint)) {
+ if (source != null && !(source instanceof Constraint)) {
return false;
}
- if(target != null && !(target instanceof Namespace)) {
+ if (target != null && !(target instanceof Namespace)) {
if (target instanceof Property) {
if (!(((Property) target).getType() instanceof Namespace)) {
// not a Part / Reference / ConstraintProperty => could not create context link
@@ -67,57 +67,57 @@ public class CustomParametricContextLinkCreateCommand extends return false;
}
}
- if(getSource() == null) {
+ if (getSource() == null) {
return true; // link creation is in progress; source is not defined yet
}
View viewSource = findView(source);
-
+
// Only one context link per Constraint
- if(viewSource != null && source instanceof Constraint) {
+ if (viewSource != null && source instanceof Constraint) {
List<?> sourceConnections = ViewUtil.getSourceConnections(viewSource);
if (!sourceConnections.isEmpty()) {
return false;
}
- }
+ }
return true;
}
-
+
/**
* Set the Constraint context and update Constraint name with new owner ownedRules if necessary
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
+ if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
Namespace context = getTarget();
- if(getSource() != null && context != null) {
+ if (getSource() != null && context != null) {
getSource().setContext(context);
String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getSource());
getSource().setName(defaultNameWithIncrementFromBase);
return CommandResult.newOKCommandResult();
- }
+ }
else {
- return CommandResult.newErrorCommandResult("Try to define Constraint context to a non Namespace element");
+ return CommandResult.newErrorCommandResult("Try to define Constraint context to a non Namespace element");
}
}
private View findView(EObject element) {
- if(element == null) {
+ if (element == null) {
return null;
}
Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(element);
- for(Setting ref : settings) {
- if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
- View view = (View)ref.getEObject();
- if(view != null) {
+ for (Setting ref : settings) {
+ if (NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
+ View view = (View) ref.getEObject();
+ if (view != null) {
return view;
}
}
}
return null;
}
-
+
/**
* Get the property Namespace in case of property typed by a Namespace
*/
@@ -130,8 +130,8 @@ public class CustomParametricContextLinkCreateCommand extends else {
targetNamespace = target;
}
- if (targetNamespace instanceof Namespace) {
- return (Namespace)targetNamespace;
+ if (targetNamespace instanceof Namespace) {
+ return (Namespace) targetNamespace;
}
else {
return null;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java index aff6d142008..15036e0772b 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java @@ -33,6 +33,7 @@ import org.eclipse.uml2.uml.Type; /**
* A context link must have a Constraint as source and a Namespace as target
+ *
* @See ContextLinkReorientCommand
*
*/
@@ -46,7 +47,7 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma protected EObject newSource;
protected EObject oldTarget;
protected EObject newTarget;
-
+
public CustomParametricContextLinkReorientCommand(
ReorientReferenceRelationshipRequestWithGraphical request) {
super(request.getLabel(), null, request);
@@ -56,9 +57,10 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma oldSource = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getOldRelationshipEnd() : request.getReferenceOwner();
newSource = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getNewRelationshipEnd() : request.getReferenceOwner();
oldTarget = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getOldRelationshipEnd();
- newTarget = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd();
+ newTarget = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd();
}
+ @Override
public boolean canExecute() {
return getNewSource() instanceof Constraint && resolveNamespace(getNewTarget()) instanceof Namespace;
}
@@ -68,12 +70,12 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma */
protected Namespace resolveNamespace(Element element) {
if (element instanceof Namespace) {
- return (Namespace)element;
+ return (Namespace) element;
}
if (element instanceof Property) {
Type type = ((Property) element).getType();
if (type instanceof Namespace) {
- return (Namespace)type;
+ return (Namespace) type;
}
}
return null;
@@ -81,13 +83,13 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma @Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
+ if (!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -105,9 +107,9 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma Namespace context = resolveNamespace(getNewTarget());
// Check name
String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getNewSource());
- ((Constraint)getNewSource()).setName(defaultNameWithIncrementFromBase);
+ ((Constraint) getNewSource()).setName(defaultNameWithIncrementFromBase);
// set the context
- ((Constraint)getNewSource()).setContext(resolveNamespace(getNewTarget()));
+ ((Constraint) getNewSource()).setContext(resolveNamespace(getNewTarget()));
return CommandResult.newOKCommandResult(referenceOwner);
}
@@ -116,11 +118,11 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma if (editPart != null) {
EObject semanticElement = ViewUtil.resolveSemanticElement((View) editPart.getModel());
if (semanticElement != null) {
- Namespace resolvedNamespace = resolveNamespace((Element)semanticElement);
+ Namespace resolvedNamespace = resolveNamespace((Element) semanticElement);
if (resolvedNamespace instanceof Namespace) {
return resolvedNamespace;
}
- return getNearestNamespace(editPart.getParent());
+ return getNearestNamespace(editPart.getParent());
}
}
return null;
@@ -134,25 +136,25 @@ public class CustomParametricContextLinkReorientCommand extends EditElementComma Namespace context = resolveNamespace(getNewTarget());
// Check name
String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getNewSource());
- ((Constraint)getNewSource()).setName(defaultNameWithIncrementFromBase);
+ ((Constraint) getNewSource()).setName(defaultNameWithIncrementFromBase);
// Set the context
- ((Constraint)getNewSource()).setContext(context);
+ ((Constraint) getNewSource()).setContext(context);
return CommandResult.newOKCommandResult(referenceOwner);
}
protected Constraint getOldSource() {
- return (Constraint)oldSource;
+ return (Constraint) oldSource;
}
protected Element getNewSource() {
- return (Element)newSource;
+ return (Element) newSource;
}
protected Element getOldTarget() {
- return (Element)oldTarget;
+ return (Element) oldTarget;
}
protected Element getNewTarget() {
- return (Element)newTarget;
+ return (Element) newTarget;
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java index d380d5af0ac..52176ed1dc2 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java @@ -24,7 +24,7 @@ import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditP /**
* This command allow to show/hide the Constraint expression of a ConstraintProperty
*/
-public class ShowHideConstraintExpressionCommand extends Command {
+public class ShowHideConstraintExpressionCommand extends Command {
private final GraphicalEditPart editPartToSwitch;
@@ -39,22 +39,22 @@ public class ShowHideConstraintExpressionCommand extends Command { @Override
public void execute() {
if (this.getEditPartToSwitch() instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart)this.getEditPartToSwitch();
+ CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart) this.getEditPartToSwitch();
// get the Constraint expression graphical label
- WrappingLabel constraintLabel = ((ConstraintBlockPropertyCompositeFigure)constraintBlockPropertyCompositeEditPart.getPrimaryShape()).getConstraintLabel();
+ WrappingLabel constraintLabel = constraintBlockPropertyCompositeEditPart.getPrimaryShape().getConstraintLabel();
ConstraintNodeLabelEditPart constraintNodeLabelEditPart = null;
// get the EditPart which contains this label
for (Object currentEditPart : constraintBlockPropertyCompositeEditPart.getChildren()) {
if (currentEditPart instanceof ConstraintNodeLabelEditPart) {
if (((ConstraintNodeLabelEditPart) currentEditPart).getFigure() == constraintLabel) {
- constraintNodeLabelEditPart = (ConstraintNodeLabelEditPart)currentEditPart;
+ constraintNodeLabelEditPart = (ConstraintNodeLabelEditPart) currentEditPart;
}
}
}
-
+
// switch visibility of this EditPart
if (constraintNodeLabelEditPart != null) {
- View constraintLabelView = (View)constraintNodeLabelEditPart.getModel();
+ View constraintLabelView = (View) constraintNodeLabelEditPart.getModel();
constraintLabelView.setVisible(!constraintLabelView.isVisible());
}
}
@@ -64,10 +64,10 @@ public class ShowHideConstraintExpressionCommand extends Command { public void undo() {
execute(); // switch
}
-
+
@Override
public void redo() {
execute(); // switch
}
-
+
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java index 7e3762ae77b..4c44753ad47 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java @@ -22,18 +22,17 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-public class ShowHideConstraintExpressionCommandHandler extends GraphicalCommandHandler {
+public class ShowHideConstraintExpressionCommandHandler extends GraphicalCommandHandler {
@Override
protected Command getCommand() {
CompoundCommand command = new CompoundCommand("Show/Hide ConstraintProperty Constraint Expression");
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for(final IGraphicalEditPart selectedElement : selectedElements) {
- if(selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- command.add(new ShowHideConstraintExpressionCommand((GraphicalEditPart)selectedElement));
+ for (final IGraphicalEditPart selectedElement : selectedElements) {
+ if (selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
+ command.add(new ShowHideConstraintExpressionCommand(selectedElement));
}
}
return command;
}
}
-
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java index ac6a0167848..3eb6b985581 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java @@ -42,11 +42,11 @@ public class SwitchConstraintPropertyRepresentationCommand extends Command { return this.editPartToSwitch;
}
-
+
@Override
public void execute() {
if (this.getEditPartToSwitch() instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart)this.getEditPartToSwitch();
+ CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart) this.getEditPartToSwitch();
ConstraintBlockPropertyCompositeFigure figure = constraintBlockPropertyCompositeEditPart.getPrimaryShape();
if (figure instanceof ConstraintBlockPropertyCompositeFigure) {
if (figure.getCorner() != 0) {
@@ -58,10 +58,10 @@ public class SwitchConstraintPropertyRepresentationCommand extends Command { }
}
}
-
+
@SuppressWarnings("unchecked")
private void switchToSquareRepresentationWithStructure(CustomConstraintBlockPropertyCompositeEditPart editPart, IFigure figure) {
-
+
// Set corner as square
int newCorner = 0;
((ConstraintBlockPropertyCompositeFigure) figure).setCorner(newCorner);
@@ -72,26 +72,26 @@ public class SwitchConstraintPropertyRepresentationCommand extends Command { structureCompartment.setVisible(true);
}
else {
- structureCompartment = ViewService.createNode((View)editPart.getModel(), SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, new PreferencesHint("org.eclipse.papyrus.sysml.diagram.parametric"));
+ structureCompartment = ViewService.createNode((View) editPart.getModel(), SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, new PreferencesHint("org.eclipse.papyrus.sysml.diagram.parametric"));
if (structureCompartment != null) {
structureCompartment.setElement(editPart.resolveSemanticElement());
}
}
-
+
// add the << constraint >> tag
editPart.getPrimaryShape().setTagLabel(String.valueOf("\u00AB") + "constraint" + String.valueOf("\u00BB"));
-
+
// set the style to persist representation
- StringValueStyle style = (StringValueStyle)((View)editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
+ StringValueStyle style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
if (style == null) {
- ((View)editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
+ ((View) editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
}
- style = (StringValueStyle)((View)editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- style.setName(CustomConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
- style.setStringValue(CustomConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
-
- // set the default style for new elements
- ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(CustomConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
+ style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
+ style.setName(ConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
+ style.setStringValue(ConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
+
+ // set the default style for new elements
+ ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(ConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
editPart.setCornerLocators(newCorner);
}
@@ -110,18 +110,18 @@ public class SwitchConstraintPropertyRepresentationCommand extends Command { // remove the << constraint >> tag
editPart.getPrimaryShape().setTagLabel("");
-
- // set the style to persist representation
- StringValueStyle style = (StringValueStyle)((View)editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
+
+ // set the style to persist representation
+ StringValueStyle style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
if (style == null) {
- ((View)editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
+ ((View) editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
}
- style = (StringValueStyle)((View)editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- style.setName(CustomConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
- style.setStringValue(CustomConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
+ style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
+ style.setName(ConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
+ style.setStringValue(ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
- // set the default style for new elements
- ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(CustomConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
+ // set the default style for new elements
+ ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
editPart.setCornerLocators(newCorner);
}
@@ -134,5 +134,5 @@ public class SwitchConstraintPropertyRepresentationCommand extends Command { public void redo() {
execute(); // switch
}
-
+
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java index e76ac601d3d..68f12cea669 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java @@ -28,15 +28,15 @@ public class SwitchConstraintPropertyRepresentationCommandHandler extends Graphi protected Command getCommand() {
CompoundCommand command = new CompoundCommand("Switch ConstraintProperty Representation");
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for(final IGraphicalEditPart selectedElement : selectedElements) {
- if(selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
+ for (final IGraphicalEditPart selectedElement : selectedElements) {
+ if (selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
if (selectedElement.getParent() instanceof GraphicalEditPart) {
- command.add(new SwitchConstraintPropertyRepresentationCommand((GraphicalEditPart)selectedElement));
+ command.add(new SwitchConstraintPropertyRepresentationCommand(selectedElement));
}
}
}
return command;
}
-
-
+
+
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java index 092e7262356..05e26dcca13 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java @@ -51,31 +51,32 @@ public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); super.createDefaultEditPolicies(); } + @Override protected IFigure createNodeShape() { return this.primaryShape = new ParametricDiagramFrameFigure(); } - + @Override public ParametricDiagramFrameFigure getPrimaryShape() { - return (ParametricDiagramFrameFigure)primaryShape; + return (ParametricDiagramFrameFigure) primaryShape; } - + @Override protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof BlockLabelNameEditPart) { - ((BlockLabelNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof BlockLabelNameEditPart) { + ((BlockLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof StructureCompartmentEditPart) { + if (childEditPart instanceof StructureCompartmentEditPart) { IFigure pane = getPrimaryShape(); setupContentPane(pane); - pane.add(((StructureCompartmentEditPart)childEditPart).getFigure()); + pane.add(((StructureCompartmentEditPart) childEditPart).getFigure()); return true; } - if(childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { + if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { IBorderItemLocator locator = new FullInsidePortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((ConstraintParameterAffixedNodeEditPart)childEditPart).getFigure(), locator); + getBorderedFigure().getBorderItemContainer().add(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure(), locator); return true; } return false; @@ -83,17 +84,17 @@ public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { @Override protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof BlockLabelNameEditPart) { + if (childEditPart instanceof BlockLabelNameEditPart) { return true; } - if(childEditPart instanceof StructureCompartmentEditPart) { + if (childEditPart instanceof StructureCompartmentEditPart) { IFigure pane = getPrimaryShape(); setupContentPane(pane); - pane.remove(((StructureCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((StructureCompartmentEditPart) childEditPart).getFigure()); return true; } - if(childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((ConstraintParameterAffixedNodeEditPart)childEditPart).getFigure()); + if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure()); return true; } return false; @@ -114,7 +115,7 @@ public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { return null; } - + @Override protected void refreshVisuals() { refreshStereotypes(); @@ -122,7 +123,7 @@ public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { } protected void refreshStereotypes() { - Element resolveSemanticElement = (Element)this.resolveSemanticElement(); + Element resolveSemanticElement = (Element) this.resolveSemanticElement(); EList<EObject> stereotypeApplications = resolveSemanticElement.getStereotypeApplications(); List<EObject> additionnalStereotypeApplications = new ArrayList<EObject>(); for (EObject currentStereotypeApplication : stereotypeApplications) { @@ -140,7 +141,7 @@ public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { } getPrimaryShape().setStereotypeLabel(stereotypeLabel.toString()); } - + private String firstLetterToLowerCase(String string) { String result = ""; if (string != null && string.length() != 0) { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java index 9c624f8d40d..fcb15dc092d 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java @@ -24,7 +24,7 @@ public class CustomBlockPropertyCompositeEditPart extends public CustomBlockPropertyCompositeEditPart(View view) { super(view); } - + @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java index d890bd90af4..e3da15a19a4 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java @@ -24,7 +24,7 @@ public class CustomConstraintBlockPropertyCompositeEditPart extends public CustomConstraintBlockPropertyCompositeEditPart(View view) { super(view); } - + @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java index 1253529362b..368d4f0b8e1 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java @@ -23,13 +23,13 @@ public class CustomBlockPropertyCompositeFigure extends protected void initTagLabel(String value) { // do nothing: we don't want a two lines element (tag + name) } - + @Override public Label getTaggedLabel() { // return a mock Label return new Label(); } - + @Override public void setNameLabelIcon(boolean displayNameLabelIcon) { getNameLabel().setIcon(null); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java index ad8c01fdc34..605e687ac70 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java @@ -31,14 +31,14 @@ public class ShowHideRelatedContentsAction extends org.eclipse.papyrus.sysml.dia public ShowHideRelatedContentsAction() { super(); } - + /** * @see org.eclipse.papyrus.diagram.common.actions.AbstractShowHideAction#initAction() */ @Override protected void initAction() { super.initAction(); - + // Only ConstraintParameter are allowed => remove Ports (and subclasses) from AffixedNode selection List<EditPartRepresentation> editPartRepresentationsToRemove = new ArrayList<EditPartRepresentation>(); Set<EObject> representedAffixedElements = new HashSet<EObject>(); @@ -57,7 +57,7 @@ public class ShowHideRelatedContentsAction extends org.eclipse.papyrus.sysml.dia for (EditPartRepresentation editPartRepresentationToRemove : editPartRepresentationsToRemove) { affixedNodeRepresentations.getPossibleElement().remove(editPartRepresentationToRemove); } - + // Remove from structure category elements which match as AffixedNode editPartRepresentationsToRemove = new ArrayList<EditPartRepresentation>(); CompartmentEditPartRepresentation compartmentEditPartRepresentation = getCompartmentEditPartRepresentation(this.representations); @@ -79,12 +79,12 @@ public class ShowHideRelatedContentsAction extends org.eclipse.papyrus.sysml.dia } /** - * + * * @param editPartRepresentations * @return */ private AffixedChildrenEditPartRepresentation getAffixedNodeRepresentation(List<EditPartRepresentation> editPartRepresentations) { - + for (EditPartRepresentation representation : editPartRepresentations) { if (representation instanceof AffixedChildrenEditPartRepresentation) { return (AffixedChildrenEditPartRepresentation) representation; @@ -99,12 +99,12 @@ public class ShowHideRelatedContentsAction extends org.eclipse.papyrus.sysml.dia } /** - * + * * @param editPartRepresentations * @return */ private CompartmentEditPartRepresentation getCompartmentEditPartRepresentation(List<EditPartRepresentation> editPartRepresentations) { - + for (EditPartRepresentation representation : editPartRepresentations) { if (representation instanceof CompartmentEditPartRepresentation && !(representation instanceof AffixedChildrenEditPartRepresentation)) { return (CompartmentEditPartRepresentation) representation; diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java index 8c5c771e40e..4bce0d50bad 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java @@ -28,9 +28,9 @@ public class ParametricFrameParser extends NamedElementLabelParser { public String getPrintString(IAdaptable element, int flags) { String elementType = null; if (element instanceof EObjectAdapter) { - Object realObject = ((EObjectAdapter)element).getRealObject(); + Object realObject = ((EObjectAdapter) element).getRealObject(); if (realObject instanceof org.eclipse.uml2.uml.Class) { - elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class)realObject), ConstraintBlock.class) != null ? "ConstraintBlock" : "Block"; + elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) realObject), ConstraintBlock.class) != null ? "ConstraintBlock" : "Block"; } } return "par [" + elementType + "] " + super.getPrintString(element, flags); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java index 9e657236f6e..3d350cadf70 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java @@ -37,7 +37,7 @@ import org.eclipse.uml2.uml.Property; /** * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables + * Customization of the DND edit policy for BlockPropertyComposite that enables * type modification, or creation of new Port and FlowPort by a drop on target. * </pre> */ @@ -68,7 +68,7 @@ public class CustomBlockCompositeDropEditPolicy extends CustomDragDropEditPolicy protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { if (UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID.equals(nodeType)) { ConstraintParameterDropHelper constraintParameterDropHelper = new ConstraintParameterDropHelper(getEditingDomain()); - Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameter((Property)droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart)getHost()); + Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameter((Property) droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart) getHost()); return new CommandProxy(commandParameterDropCommand); } @@ -83,26 +83,26 @@ public class CustomBlockCompositeDropEditPolicy extends CustomDragDropEditPolicy TypeDropHelper helper = new TypeDropHelper(getEditingDomain()); // Single drop management possible drop action list can be proposed - if(dropRequest.getObjects().size() == 1) { + if (dropRequest.getObjects().size() == 1) { // List of available drop commands final List<Command> commandChoice = new ArrayList<Command>(); // 1. Try to set the target element type with dropped object - Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart)getHost()); - if((dropAsSetType != null) && (dropAsSetType.canExecute())) { + Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart) getHost()); + if ((dropAsSetType != null) && (dropAsSetType.canExecute())) { commandChoice.add(dropAsSetType); } // 2. Build default drop command (show view of the dropped object) Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { + if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { commandChoice.add(defaultDropCommand); } // Prepare the selection command (if several command are available) or return the drop command - if(commandChoice.size() > 1) { + if (commandChoice.size() > 1) { RunnableWithResult<ICommand> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { @@ -114,7 +114,7 @@ public class CustomBlockCompositeDropEditPolicy extends CustomDragDropEditPolicy ICommand selectCommand = runnable.getResult(); return new ICommandProxy(selectCommand); - } else if(commandChoice.size() == 1) { + } else if (commandChoice.size() == 1) { return commandChoice.get(0); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java index 11b2d73ecd1..0f4522e9c93 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java @@ -37,7 +37,7 @@ import org.eclipse.uml2.uml.Property; /** * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables + * Customization of the DND edit policy for BlockPropertyComposite that enables * type modification, or creation of new Port and FlowPort by a drop on target. * </pre> */ @@ -68,7 +68,7 @@ public class CustomBlockPropertyCompositeDropEditPolicy extends CustomDragDropEd protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { if (UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID.equals(nodeType)) { ConstraintParameterDropHelper constraintParameterDropHelper = new ConstraintParameterDropHelper(getEditingDomain()); - Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameterOnPart((Property)droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart)getHost()); + Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameterOnPart((Property) droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart) getHost()); return new CommandProxy(commandParameterDropCommand); } @@ -83,26 +83,26 @@ public class CustomBlockPropertyCompositeDropEditPolicy extends CustomDragDropEd TypeDropHelper helper = new TypeDropHelper(getEditingDomain()); // Single drop management possible drop action list can be proposed - if(dropRequest.getObjects().size() == 1) { + if (dropRequest.getObjects().size() == 1) { // List of available drop commands final List<Command> commandChoice = new ArrayList<Command>(); // 1. Try to set the target element type with dropped object - Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart)getHost()); - if((dropAsSetType != null) && (dropAsSetType.canExecute())) { + Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart) getHost()); + if ((dropAsSetType != null) && (dropAsSetType.canExecute())) { commandChoice.add(dropAsSetType); } // 2. Build default drop command (show view of the dropped object) Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { + if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { commandChoice.add(defaultDropCommand); } // Prepare the selection command (if several command are available) or return the drop command - if(commandChoice.size() > 1) { + if (commandChoice.size() > 1) { RunnableWithResult<ICommand> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { @@ -114,7 +114,7 @@ public class CustomBlockPropertyCompositeDropEditPolicy extends CustomDragDropEd ICommand selectCommand = runnable.getResult(); return new ICommandProxy(selectCommand); - } else if(commandChoice.size() == 1) { + } else if (commandChoice.size() == 1) { return commandChoice.get(0); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java index cb8ca0e7538..ec32b28b181 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java @@ -35,7 +35,7 @@ import org.eclipse.ui.PlatformUI; /** * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables + * Customization of the DND edit policy for BlockPropertyComposite that enables * type modification, or creation of new Port and FlowPort by a drop on target. * </pre> */ @@ -55,63 +55,63 @@ public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy exten BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); // Single drop management possible drop action list can be proposed - if(dropRequest.getObjects().size() == 1) { + if (dropRequest.getObjects().size() == 1) { // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); + final List<Command> commandChoice = new ArrayList<Command>(); // 1. Build command to drop BlockProperty PartDropHelper partDropHelper = new PartDropHelper(getEditingDomain()); - Command dropPartOnPart = partDropHelper.getDropPartOnPart(dropRequest, (GraphicalEditPart)getHost()); - if((dropPartOnPart != null) && (dropPartOnPart.canExecute())) { + Command dropPartOnPart = partDropHelper.getDropPartOnPart(dropRequest, (GraphicalEditPart) getHost()); + if ((dropPartOnPart != null) && (dropPartOnPart.canExecute())) { commandChoice.add(dropPartOnPart); } // 2. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY); - if((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { + Command dropAsTypedPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); + if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { commandChoice.add(dropAsTypedPart); } // 3. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { + Command dropAsTypedReference = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); + if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { commandChoice.add(dropAsTypedReference); } // 4. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { + Command dropAsTypedActorPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); + if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { commandChoice.add(dropAsTypedActorPart); } // 5. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY); - if((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { + Command dropAsTypedValue = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); + if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { commandChoice.add(dropAsTypedValue); } // 6. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY); - if((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { + Command dropAsTypedProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); + if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { commandChoice.add(dropAsTypedProperty); } // 7. Try to create a Property typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { + Command dropAsTypedConstraintProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); + if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { commandChoice.add(dropAsTypedConstraintProperty); } // 8. Build default drop command (show view of the dropped object) Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { + if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { commandChoice.add(defaultDropCommand); } // Prepare the selection command (if several command are available) or return the drop command - if(commandChoice.size() > 1) { + if (commandChoice.size() > 1) { RunnableWithResult<ICommand> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { @@ -123,7 +123,7 @@ public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy exten ICommand selectCommand = runnable.getResult(); return new ICommandProxy(selectCommand); - } else if(commandChoice.size() == 1) { + } else if (commandChoice.size() == 1) { return commandChoice.get(0); } @@ -134,7 +134,7 @@ public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy exten return super.getDropObjectsCommand(dropRequest); } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java index fe30f43e272..52d3922c34a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java @@ -35,7 +35,7 @@ import org.eclipse.papyrus.uml.service.types.command.ConnectorReorientCommand; /** * <pre> * Custom semantic edit policy that replace DefaultSemanticEditPolicy - * in order to manage Class Diagram specific elements (reference + * in order to manage Class Diagram specific elements (reference * relationships COMMENT_ANNOTATED_ELEMENT and CONSTRAINT_CONSTRAINED_ELEMENT). * </pre> */ @@ -53,21 +53,21 @@ public class CustomDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy { @Override protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - if(ElementTypes.COMMENT_ANNOTATED_ELEMENT == req.getElementType()) { + if (ElementTypes.COMMENT_ANNOTATED_ELEMENT == req.getElementType()) { return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget())); } - if(ElementTypes.CONTEXT_LINK == req.getElementType()) { + if (ElementTypes.CONTEXT_LINK == req.getElementType()) { return getGEFWrapper(new CustomParametricContextLinkCreateCommand(req, req.getSource(), req.getTarget())); } String newEdgeGraphicalType = registry.getEdgeGraphicalType(req.getElementType()); - if(inheritedRegistry.isKnownEdgeType(newEdgeGraphicalType)) { + if (inheritedRegistry.isKnownEdgeType(newEdgeGraphicalType)) { return UnexecutableCommand.INSTANCE; } - if(!registry.isKnownEdgeType(newEdgeGraphicalType)) { + if (!registry.isKnownEdgeType(newEdgeGraphicalType)) { return UnexecutableCommand.INSTANCE; } @@ -80,16 +80,16 @@ public class CustomDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy { @Override protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { - View reconnectedView = (View)req.getParameter(RequestParameterConstants.GRAPHICAL_RECONNECTED_EDGE); - String reconnectedViewType = (reconnectedView != null) ? reconnectedView.getType() : IGraphicalTypeRegistry.UNDEFINED_TYPE; + View reconnectedView = (View) req.getParameter(RequestParameterConstants.GRAPHICAL_RECONNECTED_EDGE); + String reconnectedViewType = (reconnectedView != null) ? reconnectedView.getType() : org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE; - if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) { + if (ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) { return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); } - if(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(reconnectedViewType)) { + if (UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(reconnectedViewType)) { if (req instanceof ReorientReferenceRelationshipRequestWithGraphical) { - return getGEFWrapper(new CustomBindingConnectorReorientCommand((ReorientReferenceRelationshipRequestWithGraphical)req)); + return getGEFWrapper(new CustomBindingConnectorReorientCommand((ReorientReferenceRelationshipRequestWithGraphical) req)); } else { return getGEFWrapper(new ConnectorReorientCommand(req)); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java index 9156a8a03c4..fc5f6ad3a61 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java @@ -50,7 +50,7 @@ import org.eclipse.uml2.uml.util.UMLUtil; public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { private ConnectorUtils utils = new ConnectorUtils(); - + /** Default constructor. */ public CustomDragDropEditPolicy() { super(new CustomLinkMappingHelper()); @@ -74,8 +74,8 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { */ @Override protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { - if((UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(edgeType)) && (droppedEObject instanceof Connector)) { - return getConnectorDropCommand(dropRequest, (Connector)droppedEObject, edgeType); + if ((UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(edgeType)) && (droppedEObject instanceof Connector)) { + return getConnectorDropCommand(dropRequest, (Connector) droppedEObject, edgeType); } return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; @@ -84,14 +84,14 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { protected ICommand getConnectorDropCommand(DropObjectsRequest dropRequest, Connector droppedEObject, String edgeType) { // Only manage binary link during drop - if(droppedEObject.getEnds().size() != 2) { + if (droppedEObject.getEnds().size() != 2) { return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; } ConnectorEnd source = droppedEObject.getEnds().get(0); ConnectorEnd target = droppedEObject.getEnds().get(1); - // Find views in current diagram representing source and target + // Find views in current diagram representing source and target Collection<View> sourceViews = getViewsForConnectorEnd(source); Collection<View> targetViews = getViewsForConnectorEnd(target); @@ -99,32 +99,32 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { IAdaptable targetViewAdapter = null; // If either a source or target lacks create view for these elements, abort... - if(sourceViews.isEmpty() || targetViews.isEmpty()) { + if (sourceViews.isEmpty() || targetViews.isEmpty()) { return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; } View selectedSourceView = null; View selectedTargetView = null; // until a correct one is found, check that source and target views selected are correct given the current path for the connector... - for(View sourceView : sourceViews) { + for (View sourceView : sourceViews) { View targetView = getFirstValidTargetViewForSource(sourceView, targetViews, droppedEObject); - if(targetView !=null) { + if (targetView != null) { selectedSourceView = sourceView; selectedTargetView = targetView; break; } } - - + + // Create source adapter - if(selectedSourceView!=null) { // sourceViewAdapter should still be null in this case + if (selectedSourceView != null) { // sourceViewAdapter should still be null in this case sourceViewAdapter = new SemanticAdapter(null, selectedSourceView); } else { return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; } // Create target adapter - if(selectedTargetView!=null) { // targetViewAdapter should still be null in this case + if (selectedTargetView != null) { // targetViewAdapter should still be null in this case targetViewAdapter = new SemanticAdapter(null, selectedTargetView); } else { return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; @@ -143,54 +143,55 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { /** * get the first valid target view for the given source. the couple source/target is valid if the path to them from the future container is valid + * * @param sourceView * @param targetViews * @return */ private View getFirstValidTargetViewForSource(View sourceView, Collection<View> targetViews, Connector droppedConnector) { - for(View targetView : targetViews) { - if(isValidTargetViewForSource(sourceView, targetView, droppedConnector)) { + for (View targetView : targetViews) { + if (isValidTargetViewForSource(sourceView, targetView, droppedConnector)) { return targetView; } } - + return null; } - + private boolean isValidTargetViewForSource(View sourceView, View targetView, Connector droppedConnector) { - if(!(utils.isCrossingEncapsulation(sourceView, targetView))) { + if (!(utils.isCrossingEncapsulation(sourceView, targetView))) { // no encapsulation. Computes the end paths List<Property> sourceNestedPaths = utils.getNestedPropertyPath(sourceView, targetView); List<Property> targetNestedPaths = utils.getNestedPropertyPath(targetView, sourceView); - + // check this is compatible with current connector ConnectorEnd sourceConnectorEnd = utils.getSourceConnectorEnd(droppedConnector); NestedConnectorEnd nestedSourceConnectorEnd = UMLUtil.getStereotypeApplication(sourceConnectorEnd, NestedConnectorEnd.class); - if(nestedSourceConnectorEnd!=null) { + if (nestedSourceConnectorEnd != null) { List<Property> currentSourceConnectorPropertyPath = nestedSourceConnectorEnd.getPropertyPath(); // compare the 2 list - if(!sourceNestedPaths.equals(currentSourceConnectorPropertyPath)) { + if (!sourceNestedPaths.equals(currentSourceConnectorPropertyPath)) { return false; } - - } else { // no end for the current connector, so the sourceNestedPath should be empty - if(!sourceNestedPaths.isEmpty()) { + + } else { // no end for the current connector, so the sourceNestedPath should be empty + if (!sourceNestedPaths.isEmpty()) { return false; } } - - + + ConnectorEnd targetConnectorEnd = utils.getTargetConnectorEnd(droppedConnector); NestedConnectorEnd nestedTargetConnectorEnd = UMLUtil.getStereotypeApplication(targetConnectorEnd, NestedConnectorEnd.class); - if(nestedTargetConnectorEnd!=null) { + if (nestedTargetConnectorEnd != null) { List<Property> currentTargetConnectorPropertyPath = nestedTargetConnectorEnd.getPropertyPath(); // compare the 2 list - if(!targetNestedPaths.equals(currentTargetConnectorPropertyPath)) { + if (!targetNestedPaths.equals(currentTargetConnectorPropertyPath)) { return false; } - - } else { // no end for the current connector, so the targetNestedPaths should be empty - if(!targetNestedPaths.isEmpty()) { + + } else { // no end for the current connector, so the targetNestedPaths should be empty + if (!targetNestedPaths.isEmpty()) { return false; } } @@ -200,16 +201,16 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { /** * This methods looks for views representing a given {@link ConnectorEnd} in the host diagram. - * + * * @param end - * the {@link ConnectorEnd} to look for. + * the {@link ConnectorEnd} to look for. * @return the list of {@link View} representing the eObject. */ protected Set<View> getViewsForConnectorEnd(ConnectorEnd end) { Set<View> views = new HashSet<View>(); // Retrieve host diagram - View hostView = ((IGraphicalEditPart)getHost()).getNotationView(); + View hostView = ((IGraphicalEditPart) getHost()).getNotationView(); View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram(); // Retrieve all views for the ConnectorEnd role @@ -218,43 +219,43 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { Collection<View> relatedViews = EMFCoreUtil.getReferencers(end.getRole(), refs); // TODO: We should filter views not only for the current diagram, - // but also consider only views nested within the owner of the connector that are closest to the host view - // (in case there are several instances of a Part within which the connector could appear). + // but also consider only views nested within the owner of the connector that are closest to the host view + // (in case there are several instances of a Part within which the connector could appear). // Connector connector = (Connector)end.getOwner(); // StructuredClassifier connectorOwner = (StructuredClassifier)connector.getOwner(); - // Parse and select views from host diagram only + // Parse and select views from host diagram only Iterator<View> it = relatedViews.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { View currentView = it.next(); - if(currentView.getDiagram() == hostDiagram) { // FIXME: Cf TODO above. + if (currentView.getDiagram() == hostDiagram) { // FIXME: Cf TODO above. boolean isInView = false; View containerView = currentView; - while(containerView != null && !(containerView instanceof Diagram)) { - if(containerView == getReferenceViewForConnectorEnd()) { + while (containerView != null && !(containerView instanceof Diagram)) { + if (containerView == getReferenceViewForConnectorEnd()) { isInView = true; } containerView = ViewUtil.getContainerView(containerView); } - if(isInView) { + if (isInView) { EObject containerElement = ViewUtil.getContainerView(currentView).getElement(); - // If the ConnectorEnd partWithPort is not null, only select Views for which + // If the ConnectorEnd partWithPort is not null, only select Views for which // the graphical parent reference partWithPort. - if(end.getPartWithPort() != null) { - if(containerElement == end.getPartWithPort()) { + if (end.getPartWithPort() != null) { + if (containerElement == end.getPartWithPort()) { views.add(currentView); } } else { // If the role is a Port, its graphical parent is a EncapsulatedClassifier - if(end.getRole() instanceof Port) { - if(containerElement instanceof EncapsulatedClassifier) { + if (end.getRole() instanceof Port) { + if (containerElement instanceof EncapsulatedClassifier) { views.add(currentView); - } else if(containerElement instanceof Property) { - Property property = (Property)containerElement; - if(property.getType() == end.getRole().getOwner()) { + } else if (containerElement instanceof Property) { + Property property = (Property) containerElement; + if (property.getType() == end.getRole().getOwner()) { views.add(currentView); } } @@ -271,7 +272,7 @@ public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { } protected View getReferenceViewForConnectorEnd() { - return ((IGraphicalEditPart)getHost()).getNotationView(); + return ((IGraphicalEditPart) getHost()).getNotationView(); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java index 1a8188dcda6..32c432e2eb7 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java @@ -28,6 +28,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart; @@ -60,8 +61,8 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { return UnexecutableCommand.INSTANCE; } // Could not create Part/Reference/Value - if (request instanceof CreateElementRequest && ((CreateElementRequest)request).getElementType() instanceof SpecializationType) { - IElementMatcher matcher = ((SpecializationType)((CreateElementRequest)request).getElementType()).getMatcher(); + if (request instanceof CreateElementRequest && ((CreateElementRequest) request).getElementType() instanceof SpecializationType) { + IElementMatcher matcher = ((SpecializationType) ((CreateElementRequest) request).getElementType()).getMatcher(); if (matcher instanceof PartPropertyMatcher) { return UnexecutableCommand.INSTANCE; } @@ -84,16 +85,16 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { return UnexecutableCommand.INSTANCE; } if (getHost() instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; + return UnexecutableCommand.INSTANCE; } if (getHost() instanceof ConstraintParameterAffixedNodeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); + return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); } if (getHost() instanceof PortAffixedNodeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); + return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); } if (getHost() instanceof BlockPropertyCompositeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); + return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); } } return super.getCreateRelationshipCommand(req); @@ -102,25 +103,24 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { /** * Method getReorientRefRelationshipTargetCommand. Removes the reference the * ConnectionEditPart current has an add the new TargetEditPart - * + * * @param request * @return Command */ @Override - protected Command getReorientRelationshipSourceCommand( ReconnectRequest request) { - + EditPart target = request.getTarget(); if (target instanceof CustomBlockCompositeEditPartTN) { return UnexecutableCommand.INSTANCE; } if (target instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; + return UnexecutableCommand.INSTANCE; } org.eclipse.gef.ConnectionEditPart connectionEP = (request).getConnectionEditPart(); - + if (connectionEP instanceof ConnectionEditPart) { if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { return null; @@ -130,21 +130,21 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { EditPart sourceEditPart = connectionEP.getSource(); EditPart targetEditPart = connectionEP.getTarget(); EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); + .resolveSemanticElement((View) targetEditPart.getModel()); EObject oldTarget = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); + .resolveSemanticElement((View) sourceEditPart.getModel()); EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); + .resolveSemanticElement((View) request.getTarget().getModel()); + + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) + .getEditingDomain(); - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); + ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( + editingDomain, referenceOwner, newTarget, oldTarget, + ReorientRequest.REORIENT_SOURCE, + request.getTarget(), targetEditPart); - ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientReferenceRelationshipRequest.REORIENT_SOURCE, - request.getTarget(), targetEditPart); - - semRequest.addParameters(request.getExtendedData()); + semRequest.addParameters(request.getExtendedData()); return getSemanticCommand(semRequest); } @@ -153,24 +153,24 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { /** * Method getReorientRefRelationshipTargetCommand. Removes the reference the * ConnectionEditPart current has an add the new TargetEditPart - * + * * @param request * @return Command */ @Override protected Command getReorientRelationshipTargetCommand( ReconnectRequest request) { - + EditPart target = request.getTarget(); if (target instanceof CustomBlockCompositeEditPartTN) { return UnexecutableCommand.INSTANCE; } if (target instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; + return UnexecutableCommand.INSTANCE; } org.eclipse.gef.ConnectionEditPart connectionEP = (request).getConnectionEditPart(); - + if (connectionEP instanceof ConnectionEditPart) { if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { return null; @@ -180,21 +180,21 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { EditPart sourceEditPart = connectionEP.getSource(); EditPart targetEditPart = connectionEP.getTarget(); EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); + .resolveSemanticElement((View) sourceEditPart.getModel()); EObject oldTarget = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); + .resolveSemanticElement((View) targetEditPart.getModel()); EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); + .resolveSemanticElement((View) request.getTarget().getModel()); + + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) + .getEditingDomain(); - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); + ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( + editingDomain, referenceOwner, newTarget, oldTarget, + ReorientRequest.REORIENT_TARGET, + sourceEditPart, request.getTarget()); - ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientReferenceRelationshipRequest.REORIENT_TARGET, - sourceEditPart, request.getTarget()); - - semRequest.addParameters(request.getExtendedData()); + semRequest.addParameters(request.getExtendedData()); return getSemanticCommand(semRequest); } @@ -203,9 +203,9 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { protected Command getReorientRefRelationshipSourceCommand( ReconnectRequest request) { - if(request.getConnectionEditPart() instanceof ContextLinkEditPart) { + if (request.getConnectionEditPart() instanceof ContextLinkEditPart) { org.eclipse.gef.ConnectionEditPart connectionEP = request.getConnectionEditPart(); - + if (connectionEP instanceof ConnectionEditPart) { if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { return null; @@ -215,20 +215,20 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { EditPart sourceEditPart = connectionEP.getSource(); EditPart targetEditPart = connectionEP.getTarget(); EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); + .resolveSemanticElement((View) targetEditPart.getModel()); EObject oldTarget = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); + .resolveSemanticElement((View) sourceEditPart.getModel()); EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); + .resolveSemanticElement((View) request.getTarget().getModel()); - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) + .getEditingDomain(); - ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientReferenceRelationshipRequest.REORIENT_SOURCE, - sourceEditPart, targetEditPart); - return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); + ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( + editingDomain, referenceOwner, newTarget, oldTarget, + ReorientRequest.REORIENT_SOURCE, + sourceEditPart, targetEditPart); + return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); } return super.getReorientRefRelationshipTargetCommand(request); } @@ -236,9 +236,9 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { @Override protected Command getReorientRefRelationshipTargetCommand( ReconnectRequest request) { - if(request.getConnectionEditPart() instanceof ContextLinkEditPart) { + if (request.getConnectionEditPart() instanceof ContextLinkEditPart) { org.eclipse.gef.ConnectionEditPart connectionEP = request.getConnectionEditPart(); - + if (connectionEP instanceof ConnectionEditPart) { if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { return null; @@ -248,23 +248,23 @@ public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { EditPart sourceEditPart = connectionEP.getSource(); EditPart targetEditPart = connectionEP.getTarget(); EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); + .resolveSemanticElement((View) sourceEditPart.getModel()); EObject oldTarget = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); + .resolveSemanticElement((View) targetEditPart.getModel()); EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); + .resolveSemanticElement((View) request.getTarget().getModel()); - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) + .getEditingDomain(); - ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientReferenceRelationshipRequest.REORIENT_TARGET, - sourceEditPart, targetEditPart); - return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); + ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( + editingDomain, referenceOwner, newTarget, oldTarget, + ReorientRequest.REORIENT_TARGET, + sourceEditPart, targetEditPart); + return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); } return super.getReorientRefRelationshipTargetCommand(request); } - + } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java index 2a6506ae688..2b1881ab51c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java @@ -61,56 +61,56 @@ public class CustomStructureClassifierDropEditPolicy extends CustomDragDropEditP BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); // Single drop management possible drop action list can be proposed - if(dropRequest.getObjects().size() == 1) { + if (dropRequest.getObjects().size() == 1) { // List of available drop commands final List<Command> commandChoice = new ArrayList<Command>(); // 1. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY); - if((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { + Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); + if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { commandChoice.add(dropAsTypedPart); } // 2. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { + Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); + if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { commandChoice.add(dropAsTypedReference); } // 3. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { + Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); + if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { commandChoice.add(dropAsTypedActorPart); } // 4. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY); - if((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { + Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); + if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { commandChoice.add(dropAsTypedValue); } // 5. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY); - if((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { + Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); + if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { commandChoice.add(dropAsTypedProperty); } // 6. Try to create a ConstraintProperty typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { + Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); + if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { commandChoice.add(dropAsTypedConstraintProperty); } // 7. Build default drop command (show view of the dropped object) Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { + if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); commandChoice.add(defaultDropCommand); } // Prepare the selection command (if several command are available) or return the drop command - if(commandChoice.size() > 1) { + if (commandChoice.size() > 1) { RunnableWithResult<ICommand> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { @@ -123,7 +123,7 @@ public class CustomStructureClassifierDropEditPolicy extends CustomDragDropEditP return new ICommandProxy(selectCommand); - } else if(commandChoice.size() == 1) { + } else if (commandChoice.size() == 1) { return commandChoice.get(0); } @@ -145,13 +145,13 @@ public class CustomStructureClassifierDropEditPolicy extends CustomDragDropEditP @Override protected ICommand getDropObjectCommand(DropObjectsRequest dropRequest, EObject droppedObject) { - View dropTargetView = ((IGraphicalEditPart)getHost()).getNotationView(); + View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView(); EObject dropTargetElement = dropTargetView.getElement(); EObject diagramOwner = getDiagramOwner(dropTargetView); - if(UMLUtil.getStereotypeApplication((Element)diagramOwner, ConstraintBlock.class) != null) { + if (UMLUtil.getStereotypeApplication((Element) diagramOwner, ConstraintBlock.class) != null) { // ConstraintBlock - if(UMLUtil.getStereotypeApplication((Element)dropTargetElement, ConstraintProperty.class) == null) { + if (UMLUtil.getStereotypeApplication((Element) dropTargetElement, ConstraintProperty.class) == null) { // only ConstraintProperty can be dropped in structure compartment of a diagram owned by a ConstraintBlock return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java index c1379b00b91..c4687b40541 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java @@ -55,56 +55,56 @@ public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); // Single drop management possible drop action list can be proposed - if(dropRequest.getObjects().size() == 1) { + if (dropRequest.getObjects().size() == 1) { // List of available drop commands final List<Command> commandChoice = new ArrayList<Command>(); // 1. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY); - if((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { + Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); + if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { commandChoice.add(dropAsTypedPart); } // 2. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { + Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); + if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { commandChoice.add(dropAsTypedReference); } // 3. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { + Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); + if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { commandChoice.add(dropAsTypedActorPart); } // 4. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY); - if((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { + Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); + if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { commandChoice.add(dropAsTypedValue); } // 5. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY); - if((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { + Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); + if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { commandChoice.add(dropAsTypedProperty); } - + // 6. Try to create a ConstraintProperty typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { + Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); + if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { commandChoice.add(dropAsTypedConstraintProperty); } // 7. Build default drop command (show view of the dropped object) Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { + if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { commandChoice.add(defaultDropCommand); } // Prepare the selection command (if several command are available) or return the drop command - if(commandChoice.size() > 1) { + if (commandChoice.size() > 1) { RunnableWithResult<ICommand> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { @@ -117,7 +117,7 @@ public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy return new ICommandProxy(selectCommand); - } else if(commandChoice.size() == 1) { + } else if (commandChoice.size() == 1) { return commandChoice.get(0); } @@ -128,7 +128,7 @@ public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy return super.getDropObjectsCommand(dropRequest); } - + /** * {@inheritDoc} */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java index b544b1e664a..bbdd7af189a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java @@ -27,7 +27,7 @@ public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage /** Default preferences initializer */ public static void initDefaults(IPreferenceStore store) { CustomBlockPropertyCompositePreferencePage.initDefaults(store); - /*CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store);*/ + /* CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store); */ } @Override diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java index 4fd862e09a4..2ffc26dbd2c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java @@ -70,13 +70,13 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra // End of user code // Initialize default visibility for compartments in preference page. - for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentDefaultVisibilityMap.keySet()) { String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); } // Initialize default title visibility for compartments in preference page. - for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); } @@ -87,7 +87,7 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra */ @Override protected void initializeCompartmentNamesList() { - for(String name : compartmentDefaultVisibilityMap.keySet()) { + for (String name : compartmentDefaultVisibilityMap.keySet()) { this.compartmentNamesList.add(name); } } @@ -97,7 +97,7 @@ public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagra */ @Override protected void initializeCompartmentTitlesList() { - for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String name : compartmentTitleDefaultVisibilityMap.keySet()) { this.compartmentTitlesList.add(name); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java index eb59e954379..7634ef678be 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java @@ -68,13 +68,13 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD // End of user code // Initialize default visibility for compartments in preference page. - for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentDefaultVisibilityMap.keySet()) { String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); } // Initialize default title visibility for compartments in preference page. - for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); } @@ -85,7 +85,7 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD */ @Override protected void initializeCompartmentNamesList() { - for(String name : compartmentDefaultVisibilityMap.keySet()) { + for (String name : compartmentDefaultVisibilityMap.keySet()) { this.compartmentNamesList.add(name); } } @@ -95,7 +95,7 @@ public class CustomConstraintPropertyCompositePreferencePage extends ParametricD */ @Override protected void initializeCompartmentTitlesList() { - for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { + for (String name : compartmentTitleDefaultVisibilityMap.keySet()) { this.compartmentTitlesList.add(name); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java index 0bda174013c..7987ab758c1 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java @@ -57,9 +57,9 @@ public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInit * Initialize default position of a link label in preferences. * * @param parentGraphicalType - * the graphical type of the view owning the label + * the graphical type of the view owning the label * @param graphicalType - * the graphical type of the label + * the graphical type of the label * @param x * @param y */ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java index 965593ca01a..8d298bfde1a 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java @@ -64,45 +64,45 @@ public class CustomEditPolicyProvider extends ParametricDiagramEditPolicyProvide @Override public boolean provides(IOperation operation) { - CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation; - if(!(epOperation.getEditPart() instanceof IGraphicalEditPart)) { + CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation; + if (!(epOperation.getEditPart() instanceof IGraphicalEditPart)) { return false; } // Make sure this concern Parametric Diagram only - IGraphicalEditPart gep = (IGraphicalEditPart)epOperation.getEditPart(); + IGraphicalEditPart gep = (IGraphicalEditPart) epOperation.getEditPart(); String diagramType = gep.getNotationView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { + if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { return false; } // provides for the main diagram edit part - if(gep instanceof ParametricDiagramEditPart) { + if (gep instanceof ParametricDiagramEditPart) { return true; } // Provides for edit parts that represent nodes in Internal Block diagram - if(gep instanceof AbstractElementEditPart) { + if (gep instanceof AbstractElementEditPart) { return true; } - if(gep instanceof AbstractElementBorderEditPart) { + if (gep instanceof AbstractElementBorderEditPart) { return true; } // Provides for edit parts that represent edges in Internal Block diagram - if(gep instanceof AbstractElementLinkEditPart) { + if (gep instanceof AbstractElementLinkEditPart) { return true; } - if(gep instanceof ResizableCompartmentEditPart) { + if (gep instanceof ResizableCompartmentEditPart) { return true; } - if(gep instanceof ConstraintSpecificationEditPartCN) { + if (gep instanceof ConstraintSpecificationEditPartCN) { return true; } - if(gep instanceof ConstraintEditPartCN) { + if (gep instanceof ConstraintEditPartCN) { return true; } @@ -113,74 +113,74 @@ public class CustomEditPolicyProvider extends ParametricDiagramEditPolicyProvide public void createEditPolicies(EditPart editPart) { super.createEditPolicies(editPart); - if(editPart instanceof ParametricDiagramEditPart) { + if (editPart instanceof ParametricDiagramEditPart) { editPart.installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new CustomDuplicatePasteEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDropEditPolicy()); - // no installation of other policies. + // no installation of other policies. return; } editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); - if((editPart instanceof ConstraintEditPart) || (editPart instanceof ConstraintEditPartCN)) { + if ((editPart instanceof ConstraintEditPart) || (editPart instanceof ConstraintEditPartCN)) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); } - if((editPart instanceof CommentEditPart) || (editPart instanceof CommentEditPartCN)) { + if ((editPart instanceof CommentEditPart) || (editPart instanceof CommentEditPartCN)) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); } - if(editPart instanceof BlockPropertyCompositeEditPart) { + if (editPart instanceof BlockPropertyCompositeEditPart) { editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } - if(editPart instanceof BlockPropertyStructureCompartmentEditPart) { + if (editPart instanceof BlockPropertyStructureCompartmentEditPart) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockPropertyStructureCompartmentSemanticEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy()); editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy()); } - if(editPart instanceof CustomBlockCompositeEditPartTN) { + if (editPart instanceof CustomBlockCompositeEditPartTN) { editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockCompositeDropEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockCompositeSemanticEditPolicy()); } - if(editPart instanceof StructureCompartmentEditPart) { + if (editPart instanceof StructureCompartmentEditPart) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomStructureCompartmentSemanticEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStructureClassifierDropEditPolicy()); editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy()); } - if(editPart instanceof DependencyEditPart) { + if (editPart instanceof DependencyEditPart) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); } - if(editPart instanceof ConnectorEditPart) { + if (editPart instanceof ConnectorEditPart) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); } - - if(editPart instanceof CustomConstraintBlockPropertyCompositeEditPart) { + + if (editPart instanceof CustomConstraintBlockPropertyCompositeEditPart) { editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } - if(editPart instanceof ConstraintParameterAffixedNodeEditPart) { + if (editPart instanceof ConstraintParameterAffixedNodeEditPart) { editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TypedElementDropEditPolicy()); editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } - if(editPart instanceof CustomBlockCompositeEditPartTN) { + if (editPart instanceof CustomBlockCompositeEditPartTN) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } - if(editPart instanceof ConstraintSpecificationEditPartCN) { + if (editPart instanceof ConstraintSpecificationEditPartCN) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } - if(editPart instanceof ConstraintEditPartCN) { + if (editPart instanceof ConstraintEditPartCN) { editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java index 2c3beff1b44..da517cf5297 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java @@ -60,10 +60,10 @@ public class ParserProvider extends AbstractProvider implements IParserProvider * {@inheritDoc} */ public boolean provides(IOperation operation) { - if(operation instanceof GetParserOperation) { - IAdaptable hint = ((GetParserOperation)operation).getHint(); + if (operation instanceof GetParserOperation) { + IAdaptable hint = ((GetParserOperation) operation).getHint(); - if(!ElementTypes.DIAGRAM_ID.equals(getDiagramType(hint))) { + if (!ElementTypes.DIAGRAM_ID.equals(getDiagramType(hint))) { return false; } @@ -76,18 +76,18 @@ public class ParserProvider extends AbstractProvider implements IParserProvider * {@inheritDoc} */ public IParser getParser(IAdaptable hint) { - String parserHint = (String)hint.getAdapter(String.class); - if(parserHint != null) { + String parserHint = (String) hint.getAdapter(String.class); + if (parserHint != null) { IParser parser = graphicalHintToParser.get(parserHint); - if(parser != null) { + if (parser != null) { return parser; } } - View view = (View)hint.getAdapter(View.class); - if(view != null) { + View view = (View) hint.getAdapter(View.class); + if (view != null) { IParser parser = graphicalHintToParser.get(view.getType()); - if(parser != null) { + if (parser != null) { return parser; } } @@ -96,8 +96,8 @@ public class ParserProvider extends AbstractProvider implements IParserProvider } private String getDiagramType(IAdaptable hint) { - Diagram diagram = (Diagram)hint.getAdapter(Diagram.class); - if(diagram != null) { + Diagram diagram = (Diagram) hint.getAdapter(Diagram.class); + if (diagram != null) { return diagram.getType(); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java index 9c071800de2..6f7d5d57c10 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java @@ -61,75 +61,75 @@ public class BlockDropHelper extends ElementHelper { public Command getDropAsStructureItemOnPart(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) { Object droppedEObject = request.getObjects().get(0); String label = ""; - if(elementType == SysMLElementTypes.PART_PROPERTY) { + if (elementType == SysMLElementTypes.PART_PROPERTY) { label = "Create a new Part"; // Exclude ConstraintProperty if (droppedEObject instanceof Type) { - if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } // Exclude reference drop in diagram owned by a ConstraintBlock - Element editPartOwner = (Element)host.resolveSemanticElement(); + Element editPartOwner = (Element) host.resolveSemanticElement(); if (editPartOwner instanceof Property) { editPartOwner = ((Property) editPartOwner).getType(); } - if (editPartOwner != null && ((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { + if (editPartOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { return UnexecutableCommand.INSTANCE; } } - if(elementType == SysMLElementTypes.REFERENCE_PROPERTY) { + if (elementType == SysMLElementTypes.REFERENCE_PROPERTY) { label = "Create a new Reference"; // Exclude ConstraintProperty if (droppedEObject instanceof Type) { - if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } // Exclude reference drop in diagram owned by a ConstraintBlock - Element editPartOwner = (Element)host.resolveSemanticElement(); + Element editPartOwner = (Element) host.resolveSemanticElement(); if (editPartOwner instanceof Property) { editPartOwner = ((Property) editPartOwner).getType(); } - if (editPartOwner != null && ((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { + if (editPartOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { return UnexecutableCommand.INSTANCE; } } - if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { + if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { label = "Create a new ActorPart"; } - if(elementType == SysMLElementTypes.VALUE_PROPERTY) { + if (elementType == SysMLElementTypes.VALUE_PROPERTY) { label = "Create a new Value"; } - if(elementType == UMLElementTypes.PROPERTY) { + if (elementType == UMLElementTypes.PROPERTY) { label = "Create a new Property"; } // New kind of element - if(elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { + if (elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { label = "Create a new ConstraintProperty"; // Constraint Property on ConstraintBlock strictly if (droppedEObject instanceof Type) { - if (!((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (!((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } } - + CompoundCommand cc = new CompoundCommand(label); - if(!isValidStructureItemType(droppedEObject, elementType)) { + if (!isValidStructureItemType(droppedEObject, elementType)) { return UnexecutableCommand.INSTANCE; } // Verify target nature EObject target = getHostEObject(host); - if((!(target instanceof TypedElement)) || (((TypedElement)target).getType() == null)) { + if ((!(target instanceof TypedElement)) || (((TypedElement) target).getType() == null)) { return UnexecutableCommand.INSTANCE; } // The target type has to be a Block (will hold the created Port) - Type targetType = ((TypedElement)target).getType(); - if(!((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(targetType)) { + Type targetType = ((TypedElement) target).getType(); + if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(targetType)) { return UnexecutableCommand.INSTANCE; } @@ -140,13 +140,13 @@ public class BlockDropHelper extends ElementHelper { CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), targetType, elementType); createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0))); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetType); - if(provider != null) { + if (provider != null) { createElementCommand = provider.getEditCommand(createElementRequest); } IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest); // 2. Prepare the drop command - ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */ null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); + ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); createViewRequest.setLocation(request.getLocation().getCopy()); Command viewCreateCommand = host.getCommand(createViewRequest); @@ -161,59 +161,59 @@ public class BlockDropHelper extends ElementHelper { public Command getDropAsStructureItem(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) { Object droppedEObject = request.getObjects().get(0); String label = ""; - + // Filter part/reference : a property type by a ConstraintBlock MUST be a ConstraintProperty - if(elementType == SysMLElementTypes.PART_PROPERTY) { + if (elementType == SysMLElementTypes.PART_PROPERTY) { label = "Create a new Part"; // Exclude ConstraintProperty if (droppedEObject instanceof Type) { - if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } // Exclude reference drop in diagram owned by a ConstraintBlock Element diagramOwner = getDiagramOwner(host); - if (diagramOwner != null && ((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { + if (diagramOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { return UnexecutableCommand.INSTANCE; } } - if(elementType == SysMLElementTypes.REFERENCE_PROPERTY) { + if (elementType == SysMLElementTypes.REFERENCE_PROPERTY) { label = "Create a new Reference"; // Exclude ConstraintProperty if (droppedEObject instanceof Type) { - if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } // Exclude reference drop in diagram owned by a ConstraintBlock Element diagramOwner = getDiagramOwner(host); - if (diagramOwner != null && ((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { + if (diagramOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { return UnexecutableCommand.INSTANCE; } } - if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { + if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { label = "Create a new ActorPart"; } - if(elementType == SysMLElementTypes.VALUE_PROPERTY) { + if (elementType == SysMLElementTypes.VALUE_PROPERTY) { label = "Create a new Value"; } - if(elementType == UMLElementTypes.PROPERTY) { + if (elementType == UMLElementTypes.PROPERTY) { label = "Create a new Property"; } - + // New kind of element - if(elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { + if (elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { label = "Create a new ConstraintProperty"; // Constraint Property on ConstraintBlock strictly if (droppedEObject instanceof Type) { - if (!((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) { + if (!((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { return UnexecutableCommand.INSTANCE; } } } CompoundCommand cc = new CompoundCommand(label); - if(!isValidStructureItemType(droppedEObject, elementType)) { + if (!isValidStructureItemType(droppedEObject, elementType)) { return UnexecutableCommand.INSTANCE; } @@ -224,13 +224,13 @@ public class BlockDropHelper extends ElementHelper { CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), getHostEObject(host), elementType); createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0))); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getHostEObject(host)); - if(provider != null) { + if (provider != null) { createElementCommand = provider.getEditCommand(createElementRequest); } IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest); // 2. Prepare the drop command - ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */ null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); + ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); createViewRequest.setLocation(request.getLocation().getCopy()); Command viewCreateCommand = host.getCommand(createViewRequest); @@ -245,7 +245,7 @@ public class BlockDropHelper extends ElementHelper { private Element getDiagramOwner(GraphicalEditPart host) { Object model = host.getRoot().getContents().getModel(); if (model instanceof View) { - return (Element)((View) model).getElement(); + return (Element) ((View) model).getElement(); } return null; } @@ -253,34 +253,34 @@ public class BlockDropHelper extends ElementHelper { private boolean isValidStructureItemType(Object object, IElementType elementType) { boolean isValid = false; - if((object != null) && (object instanceof Type) && !(object instanceof Association)) { + if ((object != null) && (object instanceof Type) && !(object instanceof Association)) { - Type type = (Type)object; - if((elementType == SysMLElementTypes.PART_PROPERTY) || (elementType == SysMLElementTypes.REFERENCE_PROPERTY)) { - if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type)) { + Type type = (Type) object; + if ((elementType == SysMLElementTypes.PART_PROPERTY) || (elementType == SysMLElementTypes.REFERENCE_PROPERTY)) { + if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type)) { isValid = true; } } - if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { - if(type instanceof Actor) { + if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { + if (type instanceof Actor) { isValid = true; } } - if(elementType == SysMLElementTypes.VALUE_PROPERTY) { - if(((ISpecializationType)SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type) || (type instanceof DataType)) { + if (elementType == SysMLElementTypes.VALUE_PROPERTY) { + if (((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type) || (type instanceof DataType)) { isValid = true; } } - if((elementType == SysMLElementTypes.CONSTRAINT_PROPERTY)) { - if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type)) { + if ((elementType == SysMLElementTypes.CONSTRAINT_PROPERTY)) { + if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type)) { isValid = true; } } - if(elementType == UMLElementTypes.PROPERTY) { - if(!((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type) + if (elementType == UMLElementTypes.PROPERTY) { + if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type) && !(type instanceof Actor) && !(type instanceof DataType) - && !((ISpecializationType)SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type)) { + && !((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type)) { isValid = true; } } @@ -292,10 +292,10 @@ public class BlockDropHelper extends ElementHelper { /** * return the host Edit Part's semantic element, if the semantic element * is <code>null</code> or unresolvable it will return <code>null</code> - * + * * @return EObject */ protected EObject getHostEObject(GraphicalEditPart host) { - return ViewUtil.resolveSemanticElement((View)host.getModel()); + return ViewUtil.resolveSemanticElement((View) host.getModel()); } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java index 317ed34f8ff..957993c457e 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java @@ -37,7 +37,8 @@ import org.eclipse.uml2.uml.util.UMLUtil; /** * This class provides convenience methods to create Type specific drop action (Show Port on BlockPropertyComposite). - */public class ConstraintParameterDropHelper extends ElementHelper { + */ +public class ConstraintParameterDropHelper extends ElementHelper { public ConstraintParameterDropHelper(TransactionalEditingDomain editDomain) { this.editDomain = editDomain; @@ -49,12 +50,12 @@ import org.eclipse.uml2.uml.util.UMLUtil; public Command getDropConstraintParameterOnPart(Property droppedConstraintParameter, Point location, GraphicalEditPart host) { - if(!isValidConstraintParameter(droppedConstraintParameter, getHostEObject(host))) { + if (!isValidConstraintParameter(droppedConstraintParameter, getHostEObject(host))) { return UnexecutableCommand.INSTANCE; } // Prepare the view creation command - ViewDescriptor descriptor = new ViewDescriptor(new SemanticAdapter((EObject)droppedConstraintParameter, null), Node.class, /* explicit semantic hint is mandatory */ null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); + ViewDescriptor descriptor = new ViewDescriptor(new SemanticAdapter(droppedConstraintParameter, null), Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); createViewRequest.setLocation(location); Command viewCreateCommand = host.getCommand(createViewRequest); @@ -68,14 +69,14 @@ import org.eclipse.uml2.uml.util.UMLUtil; return false; } // drop on a Block/ConstraintBlock - if (dropTarget instanceof Class && UMLUtil.getStereotypeApplication((Class)dropTarget, ConstraintBlock.class) != null) { - return ((Class)dropTarget).getOwnedAttributes().contains(object); + if (dropTarget instanceof Class && UMLUtil.getStereotypeApplication((Class) dropTarget, ConstraintBlock.class) != null) { + return ((Class) dropTarget).getOwnedAttributes().contains(object); } // drop on a part - if (dropTarget instanceof Property && UMLUtil.getStereotypeApplication((Property)dropTarget, ConstraintProperty.class) != null) { - Type type = ((Property)dropTarget).getType(); - if (type instanceof Class && UMLUtil.getStereotypeApplication((Class)type, ConstraintBlock.class) != null) { - return ((Class)type).getOwnedAttributes().contains(object); + if (dropTarget instanceof Property && UMLUtil.getStereotypeApplication((Property) dropTarget, ConstraintProperty.class) != null) { + Type type = ((Property) dropTarget).getType(); + if (type instanceof Class && UMLUtil.getStereotypeApplication(type, ConstraintBlock.class) != null) { + return ((Class) type).getOwnedAttributes().contains(object); } } return false; @@ -84,10 +85,10 @@ import org.eclipse.uml2.uml.util.UMLUtil; /** * return the host Edit Part's semantic element, if the semantic element * is <code>null</code> or unresolvable it will return <code>null</code> - * + * * @return EObject */ protected EObject getHostEObject(GraphicalEditPart host) { - return ViewUtil.resolveSemanticElement((View)host.getModel()); + return ViewUtil.resolveSemanticElement((View) host.getModel()); } } |