Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-12-10 12:47:31 -0500
committerHenrik Rentz-Reichert2012-12-10 12:47:31 -0500
commitc05dac7e5abe8b1c6ccd7397d0cb2807a64cecd8 (patch)
tree853655bc653f317860013705ad2a2c168ac01aaa /plugins
parent35222929e316b6dab71f531f0d225fa44b4795c4 (diff)
downloadorg.eclipse.etrice-c05dac7e5abe8b1c6ccd7397d0cb2807a64cecd8.tar.gz
org.eclipse.etrice-c05dac7e5abe8b1c6ccd7397d0cb2807a64cecd8.tar.xz
org.eclipse.etrice-c05dac7e5abe8b1c6ccd7397d0cb2807a64cecd8.zip
[generator.launch.*] added possibility to add further controls
cpp with etUnit flag
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorMainTab.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java201
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java6
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorMainTab.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java23
5 files changed, 46 insertions, 194 deletions
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorMainTab.java b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorMainTab.java
index 9d39aef9d..b67abc2d8 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorMainTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorMainTab.java
@@ -26,7 +26,10 @@ public class CGeneratorMainTab extends GeneratorMainTab {
*/
@Override
protected boolean isValidModelFile(IResource resource) {
- return resource.getName().endsWith(".room");
+ return resource.getName().endsWith(".room")
+ || resource.getName().endsWith(".config")
+ || resource.getName().endsWith(".etphys")
+ || resource.getName().endsWith(".etmap");
}
}
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java
index 35ea59bd6..5ae373e25 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java
@@ -12,41 +12,24 @@
package org.eclipse.etrice.generator.launch.cpp;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.etrice.generator.launch.GeneratorConfigTab;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
/**
* @author Henrik Rentz-Reichert
*
*/
-public class CppGeneratorConfigTab extends AbstractLaunchConfigurationTab {
+public class CppGeneratorConfigTab extends GeneratorConfigTab {
- public static final String GEN_INSTANCE_DIAGRAM = "GenInstanceDiagram";
- public static final String GEN_MODEL_PATH = "GenModelPath";
- public static final String SAVE_GEN_MODEL = "SaveGenModel";
- public static final String LIB = "Lib";
-
- private Button libButton;
- private Button instanceDiagramButton;
- private Button saveGenModel;
- private Text genModelPath;
- private Button browsePath;
+ public static final String ETUNIT = "etUnit";
+
+ private Button useEtUnit;
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
@@ -56,181 +39,29 @@ public class CppGeneratorConfigTab extends AbstractLaunchConfigurationTab {
return "C++ Generator";
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- // Create main composite
- Composite mainComposite = new Composite(parent,SWT.NONE);
- setControl(mainComposite);
-
- GridLayout layout= new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 10;
- layout.marginWidth = 10;
- mainComposite.setLayout(layout);
-
- libButton = createCheckButton(mainComposite, "generate all classes as library");
- libButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
- libButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setDirty(true);
- updateLaunchConfigurationDialog();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- saveGenModel = createCheckButton(mainComposite, "save generator model");
- saveGenModel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
- saveGenModel.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSaveGenModelSelected();
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- handleSaveGenModelSelected();
- }
-
- });
- genModelPath = new Text(mainComposite, SWT.SINGLE | SWT.BORDER);
- genModelPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- genModelPath.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- setDirty(true);
- updateLaunchConfigurationDialog();
- }
- });
- browsePath = createPushButton(mainComposite, "Browse...", null);
- //browsePath.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 1, 1));
- browsePath.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handlePathButtonSelected();
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- handlePathButtonSelected();
- }
- });
- instanceDiagramButton = createCheckButton(mainComposite, "generate instance diagram");
- instanceDiagramButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
- instanceDiagramButton.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- validate();
- setDirty(true);
- updateLaunchConfigurationDialog();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- }
-
- /**
- *
- */
- protected void handleSaveGenModelSelected() {
- boolean save = saveGenModel.getSelection();
- genModelPath.setEnabled(save);
- browsePath.setEnabled(save);
- validate();
- setDirty(true);
- updateLaunchConfigurationDialog();
- }
+ protected void addFurtherControls(Composite mainComposite) {
- /**
- *
- */
- private void validate() {
- if (saveGenModel.getSelection())
- if (genModelPath.getText().trim().isEmpty()) {
- setErrorMessage("generator model path must not be empty");
- return;
- }
- setErrorMessage(null);
+ useEtUnit = createCheckButton(mainComposite, "use etUnit");
+ useEtUnit.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
+ useEtUnit.addSelectionListener(new UpdateConfig());
}
-
- /**
- *
- */
- protected void handlePathButtonSelected() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
- ResourcesPlugin.getWorkspace().getRoot(),
- false,
- "select a container for the generator model");
- dialog.showClosedProjects(false);
- dialog.open();
- Object[] results = dialog.getResult();
- if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
- IPath path = (IPath)results[0];
- //path = path.append("genmodel.rim");
- String fname = path.toString();
- fname = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", fname);
- genModelPath.setText(fname);
- setErrorMessage(null);
- setDirty(true);
- updateLaunchConfigurationDialog();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
+
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
+ super.initializeFrom(configuration);
+
try {
- libButton.setSelection(configuration.getAttribute(LIB, false));
- boolean save = configuration.getAttribute(SAVE_GEN_MODEL, false);
- saveGenModel.setSelection(save);
- genModelPath.setEnabled(save);
- browsePath.setEnabled(save);
- genModelPath.setText(configuration.getAttribute(GEN_MODEL_PATH, ""));
- instanceDiagramButton.setSelection(configuration.getAttribute(GEN_INSTANCE_DIAGRAM, false));
+ useEtUnit.setSelection(configuration.getAttribute(ETUNIT, false));
}
catch (CoreException e) {
e.printStackTrace();
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
+
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(LIB, libButton.getSelection());
- configuration.setAttribute(SAVE_GEN_MODEL, saveGenModel.getSelection());
- configuration.setAttribute(GEN_MODEL_PATH, genModelPath.getText());
- configuration.setAttribute(GEN_INSTANCE_DIAGRAM, instanceDiagramButton.getSelection());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#canSave()
- */
- @Override
- public boolean canSave() {
- if (saveGenModel.getSelection())
- return !genModelPath.getText().trim().isEmpty();
+ super.performApply(configuration);
- return true;
+ configuration.setAttribute(ETUNIT, useEtUnit.getSelection());
}
}
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
index afe0c36d9..b7906d526 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
@@ -27,6 +27,7 @@ public class CppGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConf
/* (non-Javadoc)
* @see org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate#addArguments(org.eclipse.debug.core.ILaunchConfiguration, java.lang.StringBuffer)
*/
+ @SuppressWarnings("deprecation")
@Override
protected void addArguments(ILaunchConfiguration configuration, StringBuffer argString) throws CoreException {
if (configuration.getAttribute(CppGeneratorConfigTab.LIB, false)) {
@@ -36,8 +37,11 @@ public class CppGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConf
argString.append(" "+Main.OPTION_SAVE_GEN_MODEL);
argString.append(" "+configuration.getAttribute(CppGeneratorConfigTab.GEN_MODEL_PATH, "?"));
}
- if (configuration.getAttribute(CppGeneratorConfigTab.GEN_INSTANCE_DIAGRAM, false))
+ if (configuration.getAttribute(CppGeneratorConfigTab.GEN_DOCUMENTATION, false)
+ || configuration.getAttribute(CppGeneratorConfigTab.GEN_INSTANCE_DIAGRAM, false))
argString.append(" "+Main.OPTION_DOCUMENTATION);
+ if (configuration.getAttribute(CppGeneratorConfigTab.ETUNIT, false))
+ argString.append(" "+Main.OPTION_ETUNIT);
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorMainTab.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorMainTab.java
index bbf846c2c..052b62a5f 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorMainTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorMainTab.java
@@ -26,7 +26,10 @@ public class CppGeneratorMainTab extends GeneratorMainTab {
*/
@Override
protected boolean isValidModelFile(IResource resource) {
- return resource.getName().endsWith(".room");
+ return resource.getName().endsWith(".room")
+ || resource.getName().endsWith(".config")
+ || resource.getName().endsWith(".etphys")
+ || resource.getName().endsWith(".etmap");
}
}
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
index 71b8cb415..a77348eec 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
@@ -38,6 +38,9 @@ import org.eclipse.ui.dialogs.ContainerSelectionDialog;
public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab {
protected class UpdateConfig implements SelectionListener {
+ public UpdateConfig() {
+ }
+
@Override
public void widgetSelected(SelectionEvent e) {
validate();
@@ -63,12 +66,12 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
public static final String LIB = "Lib";
public static final String DEBUG = "Debug";
- protected Button libButton;
- protected Button documentationButton;
- protected Button saveGenModel;
- protected Text genModelPath;
- protected Button browsePath;
- protected Button debugButton;
+ private Button libButton;
+ private Button documentationButton;
+ private Button saveGenModel;
+ private Text genModelPath;
+ private Button browsePath;
+ private Button debugButton;
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
@@ -131,6 +134,14 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
debugButton = createCheckButton(mainComposite, "debug output");
debugButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
debugButton.addSelectionListener(new UpdateConfig());
+
+ addFurtherControls(mainComposite);
+ }
+
+ /**
+ * @param mainComposite
+ */
+ protected void addFurtherControls(Composite mainComposite) {
}
/**

Back to the top