Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-07-25 16:43:06 +0000
committerCamille Letavernier2013-07-25 16:43:06 +0000
commit0f6f86b482afe273b51a006ca054a3ae0d28c28b (patch)
tree7d8f4fd96b81bc1e4f646e76d4b34024cbdf0762 /extraplugins/robotml/generators/rtmaps
parent6263634e2387d4b3c94cf69296ad5d8b76435945 (diff)
downloadorg.eclipse.papyrus-0f6f86b482afe273b51a006ca054a3ae0d28c28b.tar.gz
org.eclipse.papyrus-0f6f86b482afe273b51a006ca054a3ae0d28c28b.tar.xz
org.eclipse.papyrus-0f6f86b482afe273b51a006ca054a3ae0d28c28b.zip
413755: [RobotML] Add RobotML code generators
https://bugs.eclipse.org/bugs/show_bug.cgi?id=413755 Apply Papyrus formatter; remove unused imports
Diffstat (limited to 'extraplugins/robotml/generators/rtmaps')
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/Activator.java16
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/common/GenerateAll.java48
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/AcceleoGenerateRTMapsCommandHandler.java72
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/GenerateRTMapsCodeCommand.java56
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/popupMenus/AcceleoGenerateRTMapsAction.java27
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Activator.java80
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java327
-rw-r--r--extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/RTMapsDataTypeQueries.java248
8 files changed, 396 insertions, 478 deletions
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/Activator.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/Activator.java
index a3a6868aabe..22c66a25e45 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/Activator.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/Activator.java
@@ -28,17 +28,18 @@ public class Activator extends AbstractUIPlugin {
* The shared instance.
*/
private static Activator plugin;
-
+
public static LogHelper log;
-
+
/**
* The constructor.
*/
public Activator() {
}
- /**{@inheritDoc}
- *
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
* @generated
*/
@@ -48,8 +49,9 @@ public class Activator extends AbstractUIPlugin {
log = new LogHelper(this);
}
- /**{@inheritDoc}
- *
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
* @generated
*/
@@ -60,7 +62,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance.
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/common/GenerateAll.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/common/GenerateAll.java
index f97d1ac1bba..3c70c28f64c 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/common/GenerateAll.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/common/GenerateAll.java
@@ -16,15 +16,15 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
-import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.robotml.generators.intempora.rtmaps.Generate_rtmaps;
import org.osgi.framework.Bundle;
-import org.eclipse.papyrus.robotml.generators.intempora.rtmaps.*;
/**
* Main entry point of the 'RTMaps' generation module.
@@ -50,13 +50,13 @@ public class GenerateAll {
* Constructor.
*
* @param modelURI
- * is the URI of the model.
+ * is the URI of the model.
* @param targetFolder
- * is the output folder
+ * is the output folder
* @param arguments
- * are the other arguments
+ * are the other arguments
* @throws IOException
- * Thrown when the output cannot be saved.
+ * Thrown when the output cannot be saved.
* @generated
*/
public GenerateAll(URI modelURI, IContainer targetFolder, List<? extends Object> arguments) {
@@ -67,18 +67,18 @@ public class GenerateAll {
/**
* Launches the generation.
- *
+ *
* @param monitor
- * This will be used to display progress information to the user.
+ * This will be used to display progress information to the user.
* @throws IOException
- * Thrown when the output cannot be saved.
+ * Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
- if (!targetFolder.getLocation().toFile().exists()) {
+ if(!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
-
+
// final URI template0 = getTemplateURI("org.eclipse.papyrus.robotml.generators.intempora.rtmaps", new Path("/org/eclipse/robotml/generators/acceleo/rtmaps/main/generate_rtmaps.emtl"));
// org.eclipse.papyrus.robotml.generators.intempora.rtmaps.main.Generate_rtmaps gen0 = new org.eclipse.papyrus.robotml.generators.intempora.rtmaps.main.Generate_rtmaps(modelURI, targetFolder.getLocation().toFile(), arguments) {
// protected URI createTemplateURI(String entry) {
@@ -92,17 +92,17 @@ public class GenerateAll {
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.papyrus.robotml.generators.intempora.rtmaps", "org.eclipse.papyrus.robotml.generators.intempora.rtmaps.main.Generate_rtmaps", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
-
-
+
+
}
-
+
/**
* Finds the template in the plug-in. Returns the template plug-in URI.
*
* @param bundleID
- * is the plug-in ID
+ * is the plug-in ID
* @param relativePath
- * is the relative path of the template in the plug-in
+ * is the relative path of the template in the plug-in
* @return the template URI
* @throws IOException
* @generated
@@ -110,34 +110,34 @@ public class GenerateAll {
@SuppressWarnings({ "unused" })
private URI getTemplateURI(String bundleID, IPath relativePath) throws IOException {
Bundle bundle = Platform.getBundle(bundleID);
- if (bundle == null) {
+ if(bundle == null) {
// no need to go any further
return URI.createPlatformResourceURI(new Path(bundleID).append(relativePath).toString(), false);
}
URL url = bundle.getEntry(relativePath.toString());
- if (url == null && relativePath.segmentCount() > 1) {
+ if(url == null && relativePath.segmentCount() > 1) {
Enumeration<URL> entries = bundle.findEntries("/", "*.emtl", true);
- if (entries != null) {
+ if(entries != null) {
String[] segmentsRelativePath = relativePath.segments();
- while (url == null && entries.hasMoreElements()) {
+ while(url == null && entries.hasMoreElements()) {
URL entry = entries.nextElement();
IPath path = new Path(entry.getPath());
- if (path.segmentCount() > relativePath.segmentCount()) {
+ if(path.segmentCount() > relativePath.segmentCount()) {
path = path.removeFirstSegments(path.segmentCount() - relativePath.segmentCount());
}
String[] segmentsPath = path.segments();
boolean equals = segmentsPath.length == segmentsRelativePath.length;
- for (int i = 0; equals && i < segmentsPath.length; i++) {
+ for(int i = 0; equals && i < segmentsPath.length; i++) {
equals = segmentsPath[i].equals(segmentsRelativePath[i]);
}
- if (equals) {
+ if(equals) {
url = bundle.getEntry(entry.getPath());
}
}
}
}
URI result;
- if (url != null) {
+ if(url != null) {
result = URI.createPlatformPluginURI(new Path(bundleID).append(new Path(url.getPath())).toString(), false);
} else {
result = URI.createPlatformResourceURI(new Path(bundleID).append(relativePath).toString(), false);
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/AcceleoGenerateRTMapsCommandHandler.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/AcceleoGenerateRTMapsCommandHandler.java
index 4e52de073cb..39022163990 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/AcceleoGenerateRTMapsCommandHandler.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/AcceleoGenerateRTMapsCommandHandler.java
@@ -40,59 +40,59 @@ public class AcceleoGenerateRTMapsCommandHandler extends AbstractHandler {
/** The rtmaps folder. */
private final String rtmapsFolder = "/rtmaps-generated-files";
-// /**
-// * @see org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler#getCommand()
-// *
-// * @return
-// */
-//
-// @Override
-// protected Command getCommand() {
-// List<EObject> selectedObjects = getSelectedElements();
-// EObject selectedElement = getSelectedElement();
-// List<?> selection = getSelection();
-// TransactionalEditingDomain editingDomain = getEditingDomain();
-// if ((selectedObjects != null) && (selectedObjects.size()>0)){
-// EObject selectedObject = selectedObjects.get(0);
-// URI targetFolderURI = selectedObject.eResource().getURI();
-// int lastindex = targetFolderURI.toPlatformString(false).lastIndexOf("/");
-// String targetPath = targetFolderURI.toPlatformString(false).substring(0, lastindex);
-// return new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(new GenerateRTMapsCodeCommand("Generate RTMaps code command", editingDomain, selectedObject, targetPath + rtmapsFolder));
-// }
-//
-//
-//return null;
-//
-//
-// }
+ // /**
+ // * @see org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ // *
+ // * @return
+ // */
+ //
+ // @Override
+ // protected Command getCommand() {
+ // List<EObject> selectedObjects = getSelectedElements();
+ // EObject selectedElement = getSelectedElement();
+ // List<?> selection = getSelection();
+ // TransactionalEditingDomain editingDomain = getEditingDomain();
+ // if ((selectedObjects != null) && (selectedObjects.size()>0)){
+ // EObject selectedObject = selectedObjects.get(0);
+ // URI targetFolderURI = selectedObject.eResource().getURI();
+ // int lastindex = targetFolderURI.toPlatformString(false).lastIndexOf("/");
+ // String targetPath = targetFolderURI.toPlatformString(false).substring(0, lastindex);
+ // return new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(new GenerateRTMapsCodeCommand("Generate RTMaps code command", editingDomain, selectedObject, targetPath + rtmapsFolder));
+ // }
+ //
+ //
+ //return null;
+ //
+ //
+ // }
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- if (selection instanceof IStructuredSelection){
+
+ if(selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection)selection;
EObject selectedElement = EMFHelper.getEObject(structuredSelection.getFirstElement());
- if (selectedElement == null){
+ if(selectedElement == null) {
return null;
}
-
+
URI resourceURI = selectedElement.eResource().getURI();
- int lastSegment = resourceURI.segmentCount()-1;
+ int lastSegment = resourceURI.segmentCount() - 1;
URI targetFolderURI = resourceURI.trimSegments(lastSegment).appendSegment(rtmapsFolder);
-
+
try {
TransactionalEditingDomain editingDomain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(selectedElement);
-
+
ICommand generationCommand = new GenerateRTMapsCodeCommand("Generate RTMaps code command", editingDomain, selectedElement, targetFolderURI.toPlatformString(true));
-
- if (generationCommand.canExecute()){
+
+ if(generationCommand.canExecute()) {
generationCommand.execute(new NullProgressMonitor(), null);
}
- } catch (ServiceException ex){
+ } catch (ServiceException ex) {
Activator.log.error(ex);
}
}
-
+
return null;
}
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/GenerateRTMapsCodeCommand.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/GenerateRTMapsCodeCommand.java
index 25481af9981..c1a8e623cb6 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/GenerateRTMapsCodeCommand.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/handler/GenerateRTMapsCodeCommand.java
@@ -11,9 +11,8 @@
* Saadia DHOUIB (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui.handler;
+package org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui.handler;
-import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import org.eclipse.core.commands.ExecutionException;
@@ -23,11 +22,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.omg.CORBA.UNKNOWN;
// TODO: Auto-generated Javadoc
@@ -82,34 +78,36 @@ public class GenerateRTMapsCodeCommand extends AbstractTransactionalCommand {
//System.err.println("Model Exlorer generation menu RTMaps");
-
+
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
//final ProgressMonitorDialog monitordialog = new ProgressMonitorDialog(shell);
AcceleoRTMapsCodeGenerator codeGenerator = new AcceleoRTMapsCodeGenerator();
codeGenerator.runAcceleoTransformation(selectedElement, rtmapsTargetFolderPath);
- /*try {
- *
- * monitordialog.run(true, true, new IRunnableWithProgress() {
-
-
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- monitor.beginTask("Generating Acceleo files", 100);
- AcceleoRTMapsCodeGenerator codeGenerator = new AcceleoRTMapsCodeGenerator();
- codeGenerator.runAcceleoTransformation(selectedElement, rtmapsTargetFolderPath);
- monitor.done();
- }
-
- });
- *
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }*/
-
+ /*
+ * try {
+ *
+ * monitordialog.run(true, true, new IRunnableWithProgress() {
+ *
+ *
+ * public void run(IProgressMonitor monitor)
+ * throws InvocationTargetException, InterruptedException {
+ * monitor.beginTask("Generating Acceleo files", 100);
+ * AcceleoRTMapsCodeGenerator codeGenerator = new AcceleoRTMapsCodeGenerator();
+ * codeGenerator.runAcceleoTransformation(selectedElement, rtmapsTargetFolderPath);
+ * monitor.done();
+ * }
+ *
+ * });
+ *
+ * } catch (InvocationTargetException e) {
+ * // TODO Auto-generated catch block
+ * e.printStackTrace();
+ * } catch (InterruptedException e) {
+ * // TODO Auto-generated catch block
+ * e.printStackTrace();
+ * }
+ */
+
return CommandResult.newOKCommandResult();
}
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/popupMenus/AcceleoGenerateRTMapsAction.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/popupMenus/AcceleoGenerateRTMapsAction.java
index 0126531522c..4214fd7c1c2 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/popupMenus/AcceleoGenerateRTMapsAction.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/ui/popupMenus/AcceleoGenerateRTMapsAction.java
@@ -12,12 +12,12 @@ package org.eclipse.papyrus.robotml.generators.intempora.rtmaps.ui.popupMenus;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -38,36 +38,39 @@ import org.eclipse.ui.actions.ActionDelegate;
* RTMaps code generation.
*/
public class AcceleoGenerateRTMapsAction extends ActionDelegate implements IActionDelegate {
-
+
/**
* Selected model files.
*/
protected List<IFile> files;
- /**{@inheritDoc}
- *
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
* @generated
*/
@SuppressWarnings("unchecked")
public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- files = ((IStructuredSelection) selection).toList();
+ if(selection instanceof IStructuredSelection) {
+ files = ((IStructuredSelection)selection).toList();
}
}
- /**{@inheritDoc}
- *
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction)
* @generated
*/
public void run(IAction action) {
- if (files != null) {
+ if(files != null) {
IRunnableWithProgress operation = new IRunnableWithProgress() {
+
public void run(IProgressMonitor monitor) {
try {
Iterator<IFile> filesIt = files.iterator();
- while (filesIt.hasNext()) {
+ while(filesIt.hasNext()) {
IFile model = (IFile)filesIt.next();
URI modelURI = URI.createPlatformResourceURI(model.getFullPath().toString(), true);
try {
@@ -109,4 +112,4 @@ public class AcceleoGenerateRTMapsAction extends ActionDelegate implements IActi
return new ArrayList<String>();
}
-} \ No newline at end of file
+}
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Activator.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Activator.java
index f1e76eabe93..1487e38f02a 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Activator.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Activator.java
@@ -18,49 +18,49 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends Plugin {
- /**
- * The plug-in ID.
- */
- public static final String PLUGIN_ID = "org.eclipse.papyrus.robotml.generators.intempora.rtmaps";
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.robotml.generators.intempora.rtmaps";
- /**
- * The shared instance.
- */
- private static Activator plugin;
-
- /**
- * The constructor.
- */
- public Activator() {
- }
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
- /**
- * Returns the shared instance.
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
}
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java
index fa7e6b6f049..677a4b3198d 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java
@@ -25,7 +25,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.resource.UMLResource;
/**
@@ -68,8 +67,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
* @generated
*/
public Generate_rtmaps() {
- // Empty implementation
- }
+ // Empty implementation
+ }
/**
* This allows clients to instantiates a generator with all required information.
@@ -88,8 +87,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
* @generated
*/
public Generate_rtmaps(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
- initialize(modelURI, targetFolder, arguments);
- }
+ initialize(modelURI, targetFolder, arguments);
+ }
/**
* This allows clients to instantiates a generator with all required information.
@@ -108,8 +107,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
* @generated
*/
public Generate_rtmaps(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
- initialize(model, targetFolder, arguments);
- }
+ initialize(model, targetFolder, arguments);
+ }
/**
* This can be used to launch the generation from a standalone application.
@@ -119,50 +118,50 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
* @generated
*/
public static void main(String[] args) {
- try {
- if (args.length < 2) {
- System.out.println("Arguments not valid : {model, folder}.");
- } else {
- URI modelURI = URI.createFileURI(args[0]);
- File folder = new File(args[1]);
-
- List<String> arguments = new ArrayList<String>();
-
- /*
- * If you want to change the content of this method, do NOT forget to change the "@generated"
- * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
- * of the Acceleo module with the main template that has caused the creation of this class will
- * revert your modifications.
- */
-
- /*
- * Add in this list all the arguments used by the starting point of the generation
- * If your main template is called on an element of your model and a String, you can
- * add in "arguments" this "String" attribute.
- */
-
- Generate_rtmaps generator = new Generate_rtmaps(modelURI, folder, arguments);
-
- /*
- * Add the properties from the launch arguments.
- * If you want to programmatically add new properties, add them in "propertiesFiles"
- * You can add the absolute path of a properties files, or even a project relative path.
- * If you want to add another "protocol" for your properties files, please override
- * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
- * The behavior of the properties loader service is explained in the Acceleo documentation
- * (Help -> Help Contents).
- */
-
- for (int i = 2; i < args.length; i++) {
- generator.addPropertiesFile(args[i]);
- }
-
- generator.doGenerate(new BasicMonitor());
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ try {
+ if(args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+
+ List<String> arguments = new ArrayList<String>();
+
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * Add in this list all the arguments used by the starting point of the generation
+ * If your main template is called on an element of your model and a String, you can
+ * add in "arguments" this "String" attribute.
+ */
+
+ Generate_rtmaps generator = new Generate_rtmaps(modelURI, folder, arguments);
+
+ /*
+ * Add the properties from the launch arguments.
+ * If you want to programmatically add new properties, add them in "propertiesFiles"
+ * You can add the absolute path of a properties files, or even a project relative path.
+ * If you want to add another "protocol" for your properties files, please override
+ * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
+ * The behavior of the properties loader service is explained in the Acceleo documentation
+ * (Help -> Help Contents).
+ */
+
+ for(int i = 2; i < args.length; i++) {
+ generator.addPropertiesFile(args[i]);
+ }
+
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**
* Launches the generation described by this instance.
@@ -175,32 +174,32 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
- /*
- * TODO if you wish to change the generation as a whole, override this. The default behavior should
- * be sufficient in most cases. If you want to change the content of this method, do NOT forget to
- * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
- * any compilation of the Acceleo module with the main template that has caused the creation of this
- * class will revert your modifications. If you encounter a problem with an unresolved proxy during the
- * generation, you can remove the comments in the following instructions to check for problems. Please
- * note that those instructions may have a significant impact on the performances.
- */
-
- //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
-
- /*
- * If you want to check for potential errors in your models before the launch of the generation, you
- * use the code below.
- */
-
- //if (model != null && model.eResource() != null) {
- // List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
- // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
- // System.err.println(diagnostic.toString());
- // }
- //}
-
- super.doGenerate(monitor);
- }
+ /*
+ * TODO if you wish to change the generation as a whole, override this. The default behavior should
+ * be sufficient in most cases. If you want to change the content of this method, do NOT forget to
+ * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
+ * any compilation of the Acceleo module with the main template that has caused the creation of this
+ * class will revert your modifications. If you encounter a problem with an unresolved proxy during the
+ * generation, you can remove the comments in the following instructions to check for problems. Please
+ * note that those instructions may have a significant impact on the performances.
+ */
+
+ //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
+
+ /*
+ * If you want to check for potential errors in your models before the launch of the generation, you
+ * use the code below.
+ */
+
+ //if (model != null && model.eResource() != null) {
+ // List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
+ // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
+ // System.err.println(diagnostic.toString());
+ // }
+ //}
+
+ super.doGenerate(monitor);
+ }
/**
* If this generator needs to listen to text generation events, listeners can be returned from here.
@@ -210,15 +209,15 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public List<IAcceleoTextGenerationListener> getGenerationListeners() {
- List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
- /*
- * TODO if you need to listen to generation event, add listeners to the list here. If you want to change
- * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
- * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
- * that has caused the creation of this class will revert your modifications.
- */
- return listeners;
- }
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ /*
+ * TODO if you need to listen to generation event, add listeners to the list here. If you want to change
+ * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
+ * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
+ * that has caused the creation of this class will revert your modifications.
+ */
+ return listeners;
+ }
/**
* If you need to change the way files are generated, this is your entry point.
@@ -242,8 +241,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public IAcceleoGenerationStrategy getGenerationStrategy() {
- return super.getGenerationStrategy();
- }
+ return super.getGenerationStrategy();
+ }
/**
* This will be called in order to find and load the module that will be launched through this launcher.
@@ -254,8 +253,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public String getModuleName() {
- return MODULE_FILE_NAME;
- }
+ return MODULE_FILE_NAME;
+ }
/**
* If the module(s) called by this launcher require properties files, return their qualified path from
@@ -273,42 +272,42 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public List<String> getProperties() {
- /*
- * If you want to change the content of this method, do NOT forget to change the "@generated"
- * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
- * of the Acceleo module with the main template that has caused the creation of this class will
- * revert your modifications.
- */
-
- /*
- * TODO if your generation module requires access to properties files, add their qualified path to the list here.
- *
- * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
- * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
- * files to the "propertiesFiles" list:
- *
- * final String prefix = "platform:/plugin/";
- * final String pluginName = "org.eclipse.acceleo.module.sample";
- * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
- * final String fileName = "default.properties";
- * propertiesFiles.add(prefix + pluginName + packagePath + fileName);
- *
- * With this mechanism, you can load properties files from your plugin or from another plugin.
- *
- * You may want to load properties files from the file system, for that you need to add the absolute path of the file:
- *
- * propertiesFiles.add("C:\Users\MyName\MyFile.properties");
- *
- * If you want to let your users add properties files located in the same folder as the model:
- *
- * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
- * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
- * }
- *
- * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
- */
- return propertiesFiles;
- }
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO if your generation module requires access to properties files, add their qualified path to the list here.
+ *
+ * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
+ * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
+ * files to the "propertiesFiles" list:
+ *
+ * final String prefix = "platform:/plugin/";
+ * final String pluginName = "org.eclipse.acceleo.module.sample";
+ * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
+ * final String fileName = "default.properties";
+ * propertiesFiles.add(prefix + pluginName + packagePath + fileName);
+ *
+ * With this mechanism, you can load properties files from your plugin or from another plugin.
+ *
+ * You may want to load properties files from the file system, for that you need to add the absolute path of the file:
+ *
+ * propertiesFiles.add("C:\Users\MyName\MyFile.properties");
+ *
+ * If you want to let your users add properties files located in the same folder as the model:
+ *
+ * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
+ * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
+ * }
+ *
+ * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+ return propertiesFiles;
+ }
/**
* Adds a properties file in the list of properties files.
@@ -320,8 +319,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public void addPropertiesFile(String propertiesFile) {
- this.propertiesFiles.add(propertiesFile);
- }
+ this.propertiesFiles.add(propertiesFile);
+ }
/**
* This will be used to get the list of templates that are to be launched by this launcher.
@@ -331,8 +330,8 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public String[] getTemplateNames() {
- return TEMPLATE_NAMES;
- }
+ return TEMPLATE_NAMES;
+ }
/**
* This can be used to update the resource set's package registry with all needed EPackages.
@@ -356,9 +355,9 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
factoryRegistry.getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}
- if (!isInWorkspace(org.eclipse.papyrus.RobotML.RobotMLPackage.class)) {
- resourceSet.getPackageRegistry().put(org.eclipse.papyrus.RobotML.RobotMLPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.RobotML.RobotMLPackage.eINSTANCE);
- }
+ if(!isInWorkspace(org.eclipse.papyrus.RobotML.RobotMLPackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.papyrus.RobotML.RobotMLPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.RobotML.RobotMLPackage.eINSTANCE);
+ }
/*
* TODO If you need additional package registrations, you can register them here. The following line
@@ -380,18 +379,18 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
//
-
-// try {
-// URI uri = URI.createPlatformPluginURI("org.eclipse.papyrus.robotml/model/ProteusProfile.profile.uml", true);
-//
-// Resource res = resourceSet.getResource(uri, true);
-// Profile profile = (Profile)res.getContents().get(0);
-// EPackage epackage = profile.getDefinition();
-// packageRegistry.put(epackage.getNsURI(), epackage);
-// } catch (Exception e) {
-// System.out.println("---- error loading profile: " + e);
-// e.printStackTrace();
-// }
+
+ // try {
+ // URI uri = URI.createPlatformPluginURI("org.eclipse.papyrus.robotml/model/ProteusProfile.profile.uml", true);
+ //
+ // Resource res = resourceSet.getResource(uri, true);
+ // Profile profile = (Profile)res.getContents().get(0);
+ // EPackage epackage = profile.getDefinition();
+ // packageRegistry.put(epackage.getNsURI(), epackage);
+ // } catch (Exception e) {
+ // System.out.println("---- error loading profile: " + e);
+ // e.printStackTrace();
+ // }
}
/**
@@ -403,24 +402,24 @@ public class Generate_rtmaps extends AbstractAcceleoGenerator {
*/
@Override
public void registerResourceFactories(ResourceSet resourceSet) {
- super.registerResourceFactories(resourceSet);
- /*
- * If you want to change the content of this method, do NOT forget to change the "@generated"
- * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
- * of the Acceleo module with the main template that has caused the creation of this class will
- * revert your modifications.
- */
-
- /*
- * TODO If you need additional resource factories registrations, you can register them here. the following line
- * (in comment) is an example of the resource factory registration for UML.
- *
- * If you want to use the generator in stand alone, the resource factory registration will be required.
- *
- * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents).
- */
-
- // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
- }
+ super.registerResourceFactories(resourceSet);
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO If you need additional resource factories registrations, you can register them here. the following line
+ * (in comment) is an example of the resource factory registration for UML.
+ *
+ * If you want to use the generator in stand alone, the resource factory registration will be required.
+ *
+ * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
}
diff --git a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/RTMapsDataTypeQueries.java b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/RTMapsDataTypeQueries.java
index b9c6e305738..06bb3d63239 100644
--- a/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/RTMapsDataTypeQueries.java
+++ b/extraplugins/robotml/generators/rtmaps/org.eclipse.papyrus.robotml.generators.intempora.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/RTMapsDataTypeQueries.java
@@ -16,229 +16,145 @@
package org.eclipse.papyrus.robotml.generators.intempora.rtmaps;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.papyrus.RobotML.Platform;
-import org.eclipse.papyrus.RobotML.util.*;
import org.eclipse.papyrus.robotml.generators.common.mmqueries.ArchitectureQueries;
public class RTMapsDataTypeQueries {
public String getNbElementsInVector(String type_name, String ioelt_name, String return_value_name) {
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0 ||
- type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0 ||
- type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0 ||
- type_name.compareTo("Float32")==0 ||
- type_name.compareTo("Float64")==0)
-
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0 || type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0 || type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0 || type_name.compareTo("Float32") == 0 || type_name.compareTo("Float64") == 0)
+
{
- return "int " + return_value_name + " = " + ioelt_name + "->VectorSize();";
- } else if (type_name.compareTo("String") == 0) {
+ return "int " + return_value_name + " = " + ioelt_name + "->VectorSize();";
+ } else if(type_name.compareTo("String") == 0) {
return "[Strings are not supported yet.]";
} else {
- return "int " + return_value_name + " = " + ioelt_name + "->VectorSize() / sizeof(" + type_name + ");";
+ return "int " + return_value_name + " = " + ioelt_name + "->VectorSize() / sizeof(" + type_name + ");";
}
}
-
+
public String setVectorSizeForVector(String type_name, int nb_elements, String ioelt_name) {
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0 ||
- type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0 ||
- type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0 ||
- type_name.compareTo("Float32")==0 ||
- type_name.compareTo("Float64")==0)
-
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0 || type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0 || type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0 || type_name.compareTo("Float32") == 0 || type_name.compareTo("Float64") == 0)
+
{
- return ioelt_name + "->VectorSize() = " + nb_elements + ";";
- } else if (type_name.compareTo("String") == 0) {
+ return ioelt_name + "->VectorSize() = " + nb_elements + ";";
+ } else if(type_name.compareTo("String") == 0) {
return "[Strings are not supported yet.]";
} else {
- return ioelt_name + "->VectorSize() = " + nb_elements + " * sizeof(" + type_name + ");";
+ return ioelt_name + "->VectorSize() = " + nb_elements + " * sizeof(" + type_name + ");";
}
}
-
- public String getMAPSIOEltAccessFunction(String type_name, String ioelt_name, String return_var_name)
- {
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0)
- {
- return "MAPSInt32* "+ return_var_name +" = &" + ioelt_name + "->Integer32();";
- } else if (type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0) {
- return "char* " +return_var_name + " = " + ioelt_name + "->Stream8();";
- } else if (type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0)
- {
- return "MAPSInt64* "+ return_var_name +" = &" + ioelt_name + "->Integer64();";
- } else if (type_name.compareTo("Float32")==0) {
- return "MAPSFloat32* "+ return_var_name +" = &" + ioelt_name + "->Float32();";
- } else if (type_name.compareTo("Float64")==0) {
- return "MAPSFloat64* "+ return_var_name +" = &" + ioelt_name + "->Float64();";
- } else if (type_name.compareTo("String") == 0) {
+
+ public String getMAPSIOEltAccessFunction(String type_name, String ioelt_name, String return_var_name) {
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0) {
+ return "MAPSInt32* " + return_var_name + " = &" + ioelt_name + "->Integer32();";
+ } else if(type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0) {
+ return "char* " + return_var_name + " = " + ioelt_name + "->Stream8();";
+ } else if(type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0) {
+ return "MAPSInt64* " + return_var_name + " = &" + ioelt_name + "->Integer64();";
+ } else if(type_name.compareTo("Float32") == 0) {
+ return "MAPSFloat32* " + return_var_name + " = &" + ioelt_name + "->Float32();";
+ } else if(type_name.compareTo("Float64") == 0) {
+ return "MAPSFloat64* " + return_var_name + " = &" + ioelt_name + "->Float64();";
+ } else if(type_name.compareTo("String") == 0) {
return "[Strings are not supported yet.]";
} else {
return type_name + "* " + return_var_name + " = (" + type_name + "*)" + ioelt_name + "->Data();";
}
}
-
- public String getMAPSIOEltReturnType(String type_name)
- {
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0)
- {
- return "MAPSInt32*";
- } else if (type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0) {
+
+ public String getMAPSIOEltReturnType(String type_name) {
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0) {
+ return "MAPSInt32*";
+ } else if(type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0) {
return "MAPSUInt8*";
- } else if (type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0)
- {
+ } else if(type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0) {
return "MAPSInt64*";
- } else if (type_name.compareTo("Float32")==0) {
+ } else if(type_name.compareTo("Float32") == 0) {
return "MAPSFloat32* ";
- } else if (type_name.compareTo("Float64")==0) {
+ } else if(type_name.compareTo("Float64") == 0) {
return "MAPSFloat64*";
- } else if (type_name.compareTo("String") == 0) {
+ } else if(type_name.compareTo("String") == 0) {
return "MAPSRobotMLString*";
} else {
return type_name + "*";
}
-
+
}
-
+
public String getRTMapsOutputDefForPrimitiveType(String output_name, String type_name, int multiplicity) {
String s = "MAPS_OUTPUT(\"" + output_name + "\",";
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0)
- {
- s+= "MAPS::Integer32";
- } else if (type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0) {
- s+= "MAPS::Stream8";
- } else if (type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0)
- {
- s+= "MAPS::Integer64";
- } else if (type_name.compareTo("Float32")==0) {
- s+= "MAPS::Float32";
- } else if (type_name.compareTo("Float64")==0) {
- s+= "MAPS::Float64";
- } else if (type_name.compareTo("String") == 0) {
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0) {
+ s += "MAPS::Integer32";
+ } else if(type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0) {
+ s += "MAPS::Stream8";
+ } else if(type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0) {
+ s += "MAPS::Integer64";
+ } else if(type_name.compareTo("Float32") == 0) {
+ s += "MAPS::Float32";
+ } else if(type_name.compareTo("Float64") == 0) {
+ s += "MAPS::Float64";
+ } else if(type_name.compareTo("String") == 0) {
return "MAPS_OUTPUT_USER_STRUCTURE(" + output_name + ",MAPSRobotMLString)";
}
- s+= ",NULL,NULL,";
- if (multiplicity <= 0)
- s+= "DEFAULT_MAX_OUTPUT_VECTOR_SIZE";
+ s += ",NULL,NULL,";
+ if(multiplicity <= 0)
+ s += "DEFAULT_MAX_OUTPUT_VECTOR_SIZE";
else
- s+= multiplicity;
- s+= ")";
+ s += multiplicity;
+ s += ")";
return s;
}
-
+
public String getRTMapsInputDefForPrimitiveType(String input_name, String type_name) {
String s = "MAPS_INPUT(\"" + input_name + "\",";
- if (type_name.compareTo("Bool") == 0 ||
- type_name.compareTo("Int8") == 0 ||
- type_name.compareTo("UInt8") == 0 ||
- type_name.compareTo("Int16") == 0 ||
- type_name.compareTo("UInt16") == 0 ||
- type_name.compareTo("Int32") == 0)
- {
- s+= "MAPS::FilterInteger32";
- } else if (type_name.compareTo("Byte") == 0 ||
- type_name.compareTo("Char") == 0) {
- s+= "MAPS::FilterStream8";
- } else if (type_name.compareTo("UInt32") == 0 ||
- type_name.compareTo("Int64") == 0 ||
- type_name.compareTo("UInt64") == 0 ||
- type_name.compareTo("Time") == 0 ||
- type_name.compareTo("Duration")==0)
- {
- s+= "MAPS::FilterInteger64";
- } else if (type_name.compareTo("Float32")==0) {
- s+= "MAPS::FilterFloat32";
- } else if (type_name.compareTo("Float64")==0) {
- s+= "MAPS::FilterFloat64";
- } else if (type_name.compareTo("String") == 0) {
- s+= "MAPSFilterRobotMLString";
+ if(type_name.compareTo("Bool") == 0 || type_name.compareTo("Int8") == 0 || type_name.compareTo("UInt8") == 0 || type_name.compareTo("Int16") == 0 || type_name.compareTo("UInt16") == 0 || type_name.compareTo("Int32") == 0) {
+ s += "MAPS::FilterInteger32";
+ } else if(type_name.compareTo("Byte") == 0 || type_name.compareTo("Char") == 0) {
+ s += "MAPS::FilterStream8";
+ } else if(type_name.compareTo("UInt32") == 0 || type_name.compareTo("Int64") == 0 || type_name.compareTo("UInt64") == 0 || type_name.compareTo("Time") == 0 || type_name.compareTo("Duration") == 0) {
+ s += "MAPS::FilterInteger64";
+ } else if(type_name.compareTo("Float32") == 0) {
+ s += "MAPS::FilterFloat32";
+ } else if(type_name.compareTo("Float64") == 0) {
+ s += "MAPS::FilterFloat64";
+ } else if(type_name.compareTo("String") == 0) {
+ s += "MAPSFilterRobotMLString";
}
- s+= ",MAPS::FifoReader)";
+ s += ",MAPS::FifoReader)";
return s;
}
-
+
public String getPckOutputDir(String dummy) {
String os = System.getProperty("os.name");
- if (os.toLowerCase().startsWith("linux"))
+ if(os.toLowerCase().startsWith("linux"))
return "packages/linux_x86/";
else
return "packages/";
}
-
- public boolean hasRTMapsNativeImplementation(org.eclipse.uml2.uml.Class c)
- {
- if (ArchitectureQueries.hasNativeImplementation(c)) {
- if (getRTMapsNativeLibraryPathFromGenericAttribute(c) != null && getRTMapsNativeComponentNameFromGenericAttribute(c) != null) {
+
+ public boolean hasRTMapsNativeImplementation(org.eclipse.uml2.uml.Class c) {
+ if(ArchitectureQueries.hasNativeImplementation(c)) {
+ if(getRTMapsNativeLibraryPathFromGenericAttribute(c) != null && getRTMapsNativeComponentNameFromGenericAttribute(c) != null) {
return true;
}
}
return false;
}
-
- public String getRTMapsNativeLibraryPathFromGenericAttribute(org.eclipse.uml2.uml.Class c)
- {
- if (ArchitectureQueries.hasNativeImplementation(c)) {
+
+ public String getRTMapsNativeLibraryPathFromGenericAttribute(org.eclipse.uml2.uml.Class c) {
+ if(ArchitectureQueries.hasNativeImplementation(c)) {
String native_libs = ArchitectureQueries.getNativeLibraryPathForComponent(c);
- if (native_libs == null)
+ if(native_libs == null)
return null;
return getRTMapsSpecificValueFromStringAttribute(native_libs);
}
return null;
}
-
- public String getRTMapsNativeComponentNameFromGenericAttribute(org.eclipse.uml2.uml.Class c)
- {
- if (ArchitectureQueries.hasNativeImplementation(c)) {
+
+ public String getRTMapsNativeComponentNameFromGenericAttribute(org.eclipse.uml2.uml.Class c) {
+ if(ArchitectureQueries.hasNativeImplementation(c)) {
String native_comps = ArchitectureQueries.getNativeComponentNameForComponent(c);
- if (native_comps == null)
+ if(native_comps == null)
return null;
return getRTMapsSpecificValueFromStringAttribute(native_comps);
}
@@ -247,13 +163,13 @@ public class RTMapsDataTypeQueries {
public String getRTMapsSpecificValueFromStringAttribute(String attribute) {
String[] sections = attribute.split(";");
- for (int i=0; i<sections.length; i++) {
+ for(int i = 0; i < sections.length; i++) {
String[] key_value = sections[i].split("=");
- if (key_value[0].equalsIgnoreCase("rtmaps")) {
+ if(key_value[0].equalsIgnoreCase("rtmaps")) {
return key_value[1];
}
}
return null;
}
-
+
}

Back to the top