Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-25 14:00:03 +0000
committerCamille Letavernier2014-03-25 14:53:33 +0000
commit27f98ef73686a769876ec348bd7ddafb5fe593a1 (patch)
treea7b1150952a5ac99edd263e0753b096f201f5c69 /extraplugins/robotml
parentdc77de9cf2fafb73d8513b6d592eab9667dfc697 (diff)
downloadorg.eclipse.papyrus-27f98ef73686a769876ec348bd7ddafb5fe593a1.tar.gz
org.eclipse.papyrus-27f98ef73686a769876ec348bd7ddafb5fe593a1.tar.xz
org.eclipse.papyrus-27f98ef73686a769876ec348bd7ddafb5fe593a1.zip
[Trivial] Remove useless dependency and logged exception
Diffstat (limited to 'extraplugins/robotml')
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/META-INF/MANIFEST.MF1
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/migration/MigrateDiagramsHandler.java84
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java35
3 files changed, 56 insertions, 64 deletions
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/META-INF/MANIFEST.MF b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/META-INF/MANIFEST.MF
index 6125663fdff..99851fd2b52 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/META-INF/MANIFEST.MF
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/META-INF/MANIFEST.MF
@@ -21,7 +21,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.facet.infra.browser.uicore,
org.eclipse.ui.ide;bundle-version="3.9.0",
org.eclipse.gmf.runtime.notation.edit,
- org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="1.0.0",
org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.0.0"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/migration/MigrateDiagramsHandler.java b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/migration/MigrateDiagramsHandler.java
index 712d5f2b1f4..1aab6f97b4e 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/migration/MigrateDiagramsHandler.java
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/migration/MigrateDiagramsHandler.java
@@ -1,7 +1,6 @@
package org.eclipse.papyrus.robotml.diagram.common.migration;
import java.io.IOException;
-
import java.util.Iterator;
import org.eclipse.core.commands.AbstractHandler;
@@ -17,6 +16,7 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
@@ -24,13 +24,11 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelsReader;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.robotml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
-
import org.eclipse.ui.handlers.HandlerUtil;
public class MigrateDiagramsHandler extends AbstractHandler {
@@ -47,8 +45,8 @@ public class MigrateDiagramsHandler extends AbstractHandler {
Object selectedAdapter = Platform.getAdapterManager().getAdapter(selectedElement, IFile.class);
-
-
+
+
if(selectedAdapter instanceof IFile) {
final IFile selectedFile = (IFile)selectedAdapter;
@@ -61,7 +59,7 @@ public class MigrateDiagramsHandler extends AbstractHandler {
ModelSet modelSet = new ModelSet();
ModelsReader reader = new ModelsReader();
reader.readModel(modelSet);
-
+
IPath workspacePath = selectedFile.getFullPath();
@@ -71,22 +69,22 @@ public class MigrateDiagramsHandler extends AbstractHandler {
ViewPrototype protoDatatypeDef = null;
ViewPrototype protoInterfaceDef = null;
ViewPrototype protoComponentDef = null;
- for (ViewPrototype proto : PolicyChecker.getCurrent().getAllPrototypes()) {
- if (proto.getLabel().contains("RobotML Architecture"))
+ for(ViewPrototype proto : PolicyChecker.getCurrent().getAllPrototypes()) {
+ if(proto.getLabel().contains("RobotML Architecture")) {
protoArchitecture = proto;
- else if (proto.getLabel().contains("RobotML Component")){
+ } else if(proto.getLabel().contains("RobotML Component")) {
protoComponentDef = proto;
- }else if (proto.getLabel().contains("RobotML Interface")){
+ } else if(proto.getLabel().contains("RobotML Interface")) {
protoInterfaceDef = proto;
-
- }else if (proto.getLabel().contains("RobotML Datatype")){
+
+ } else if(proto.getLabel().contains("RobotML Datatype")) {
protoDatatypeDef = proto;
}
}
-
-
+
+
try {
- modelSet.loadModels(workspaceURI);
+ modelSet.loadModels(workspaceURI);
//do the diagrams migration
NotationModel notationModel = (NotationModel)modelSet.getModel(NotationModel.MODEL_ID);
if(notationModel != null) {
@@ -96,47 +94,45 @@ public class MigrateDiagramsHandler extends AbstractHandler {
while(allContents.hasNext()) {
EObject currentElement = allContents.next();
-
- if (currentElement instanceof CSSDiagramImpl){
+
+ if(currentElement instanceof Diagram) {
// 1. Changing the type of the diagram
//System.err.println(currentElement);
- if (((CSSDiagramImpl) currentElement).getType().equalsIgnoreCase("architecture") )
- {
- ((CSSDiagramImpl) currentElement).setType(CompositeStructureDiagramEditPart.MODEL_ID);
- DiagramUtils.setPrototype((CSSDiagramImpl) currentElement, protoArchitecture);
- DiagramUtils.setOwner(((CSSDiagramImpl) currentElement), ((CSSDiagramImpl) currentElement).getElement());
-
- }else if(((CSSDiagramImpl) currentElement).getType().equalsIgnoreCase("componentdef")){
- ((CSSDiagramImpl) currentElement).setType(CompositeStructureDiagramEditPart.MODEL_ID);
- DiagramUtils.setPrototype((CSSDiagramImpl) currentElement, protoComponentDef);
- DiagramUtils.setOwner(((CSSDiagramImpl) currentElement), ((CSSDiagramImpl) currentElement).getElement());
+ if(((Diagram)currentElement).getType().equalsIgnoreCase("architecture")) {
+ ((Diagram)currentElement).setType(CompositeStructureDiagramEditPart.MODEL_ID);
+ DiagramUtils.setPrototype((Diagram)currentElement, protoArchitecture);
+ DiagramUtils.setOwner(((Diagram)currentElement), ((Diagram)currentElement).getElement());
+
+ } else if(((Diagram)currentElement).getType().equalsIgnoreCase("componentdef")) {
+ ((Diagram)currentElement).setType(CompositeStructureDiagramEditPart.MODEL_ID);
+ DiagramUtils.setPrototype((Diagram)currentElement, protoComponentDef);
+ DiagramUtils.setOwner(((Diagram)currentElement), ((Diagram)currentElement).getElement());
}
-
- else if (((CSSDiagramImpl) currentElement).getType().equalsIgnoreCase("datatypedef") )
- {
- ((CSSDiagramImpl) currentElement).setType(ModelEditPart.MODEL_ID);
- DiagramUtils.setPrototype((CSSDiagramImpl) currentElement, protoDatatypeDef);
- DiagramUtils.setOwner(((CSSDiagramImpl) currentElement), ((CSSDiagramImpl) currentElement).getElement());
-
- }else if(((CSSDiagramImpl) currentElement).getType().equalsIgnoreCase("interfacedef")){
- ((CSSDiagramImpl) currentElement).setType(ModelEditPart.MODEL_ID);
- DiagramUtils.setPrototype((CSSDiagramImpl) currentElement, protoInterfaceDef);
- DiagramUtils.setOwner(((CSSDiagramImpl) currentElement), ((CSSDiagramImpl) currentElement).getElement());
- }
-
+
+ else if(((Diagram)currentElement).getType().equalsIgnoreCase("datatypedef")) {
+ ((Diagram)currentElement).setType(ModelEditPart.MODEL_ID);
+ DiagramUtils.setPrototype((Diagram)currentElement, protoDatatypeDef);
+ DiagramUtils.setOwner(((Diagram)currentElement), ((Diagram)currentElement).getElement());
+
+ } else if(((Diagram)currentElement).getType().equalsIgnoreCase("interfacedef")) {
+ ((Diagram)currentElement).setType(ModelEditPart.MODEL_ID);
+ DiagramUtils.setPrototype((Diagram)currentElement, protoInterfaceDef);
+ DiagramUtils.setOwner(((Diagram)currentElement), ((Diagram)currentElement).getElement());
+ }
+
}
-
+
}//end while
mainNotationResource.save(null);
-
+
}
-
+
} catch (ModelMultiException e) {
Activator.log.error(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
} catch (IOException e) {
-
+
Activator.log.error(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
}
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
index 20f490570c1..2036ba9f8e1 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
@@ -19,7 +19,6 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.RobotML.RobotMLPackage;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -27,9 +26,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelsReader;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.robotml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -40,7 +37,7 @@ import org.eclipse.uml2.uml.Package;
* This class is used in order to create test for deciding whether a diagram creation command should be visible or not.
* This property tester assumes that currently active editor is Papyrus, it should be used with care (simultaneously with a test to ensure Papyrus is
* currently opened and active).
- *
+ *
*/
public class RobotmlSelectionTester extends PropertyTester {
@@ -78,7 +75,7 @@ public class RobotmlSelectionTester extends PropertyTester {
boolean isRobotmlModel = false;
-
+
EObject root = getRoot(receiver);
if(root instanceof Package) {
return (((Package)root).getAppliedProfile("RobotML") != null);
@@ -114,35 +111,35 @@ public class RobotmlSelectionTester extends PropertyTester {
Object selectedElement = selectionstructured.getFirstElement();
Object selectedAdapter = Platform.getAdapterManager().getAdapter(selectedElement, IFile.class);
-
-
+
+
if(selectedAdapter instanceof IFile) {
final IFile selectedFile = (IFile)selectedAdapter;
ModelSet modelSet = new ModelSet();
ModelsReader reader = new ModelsReader();
reader.readModel(modelSet);
-
+
IPath workspacePath = selectedFile.getFullPath();
URI workspaceURI = URI.createPlatformResourceURI(workspacePath.toString(), true);
- modelSet.loadModels(workspaceURI);
-
+ modelSet.loadModels(workspaceURI);
+
UmlModel openedModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID);
if(openedModel != null) {
root = openedModel.lookupRoot();
}
- }else{
+ } else {
//this is the case where the selection is on the Model Explorer
- ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance();
- UmlModel openedModel = (UmlModel)serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID);
- if(openedModel != null) {
- root = openedModel.lookupRoot();
- }}
-
+ ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance();
+ UmlModel openedModel = (UmlModel)serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID);
+ if(openedModel != null) {
+ root = openedModel.lookupRoot();
+ }
+ }
+
} catch (ServiceException e) {
- //The selection cannot be used to retrieve the ServicesRegistry
- Activator.log.error(e);
+ //Ignored: The selection cannot be used to retrieve the ServicesRegistry
} catch (NotFoundException e) {
Activator.log.error(e);
} catch (ModelMultiException e) {

Back to the top