Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-08-29 23:09:38 +0000
committerJuergen Haug2015-09-02 10:33:33 +0000
commit809e06ff8f688fa4c466242b74de78ae6f9d5ee9 (patch)
tree2609c9bdf2e09f1de173ac288835d9f5edfea9b4 /plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice
parent8b3deeba0905f3a7cc5f8db26e39c47f7986306e (diff)
downloadorg.eclipse.etrice-809e06ff8f688fa4c466242b74de78ae6f9d5ee9.tar.gz
org.eclipse.etrice-809e06ff8f688fa4c466242b74de78ae6f9d5ee9.tar.xz
org.eclipse.etrice-809e06ff8f688fa4c466242b74de78ae6f9d5ee9.zip
[ui] updated wizards + fixed c library order
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice')
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java262
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/NewSetOfModelsWizard.java7
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectCreator.java6
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend179
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingBuilder.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingCreationPage.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingCreationPage.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingWizard.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingWizard.java)3
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/ModelCreationPage.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ModelCreationPage.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/RoomValidationHelper.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/RoomValidationHelper.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SaveMappingPage.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SaveMappingPage.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SelectRoomPage.java (renamed from plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SelectRoomPage.java)2
12 files changed, 204 insertions, 275 deletions
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java
index 20a8748bc..e017ccb76 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java
@@ -12,7 +12,6 @@
package org.eclipse.etrice.generator.ui.wizard;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
import org.eclipse.jface.dialogs.Dialog;
@@ -32,7 +31,6 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
*/
class EmptyProjectConfigPage extends WizardPage {
- private IProject runtimeProject;
private Button jdtBuild;
private Button mvnBuild;
private boolean useJDTBuild;
@@ -40,9 +38,8 @@ class EmptyProjectConfigPage extends WizardPage {
/**
* @param pageName
*/
- EmptyProjectConfigPage(String pageName, IProject runtimeProject) {
+ EmptyProjectConfigPage(String pageName) {
super(pageName);
- this.runtimeProject = runtimeProject;
}
@Override
@@ -86,11 +83,6 @@ class EmptyProjectConfigPage extends WizardPage {
}
protected boolean validatePage() {
- if (jdtBuild.getSelection() && (runtimeProject==null || !runtimeProject.exists() || !runtimeProject.isAccessible())) {
- setErrorMessage("for JDT build the project 'org.eclipse.etrice.runtime.java' must be in the workspace");
- return false;
- }
-
useJDTBuild = jdtBuild==null || jdtBuild.getSelection();
setErrorMessage(null);
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
index 58bb96053..a194c354b 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
@@ -7,47 +7,63 @@
*******************************************************************************/
package org.eclipse.etrice.generator.ui.wizard;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import java.util.zip.ZipFile;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
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.core.runtime.SubProgressMonitor;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.etrice.generator.ui.Activator;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.ISetSelectionTarget;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
/**
* @author Henrik Rentz-Reichert (initial contribution and API)
*
*/
public class EmptyProjectWizard extends Wizard implements INewWizard {
+
+ final static String MODEL_NAME = "TemplateModel";
+ final static String PROJECT_CONTENT_ZIP = "/content/org.eclipse.etrice.template.java.zip";
+
+ final static String ROOM_EDITOR_ID = "org.eclipse.etrice.core.Room";
+ final static String MODELLIB_WIZARD_ID = "org.eclipse.etrice.ui.runtime.NewJavaModelLibWizard";
+
protected IWorkbench workbench;
protected IPath projectLocation;
protected IPath sourcePath;
@@ -56,63 +72,51 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
protected IProject runtimeProject;
protected IProject modellibProject;
protected String initialProjectName;
- protected URI modelURI;
- protected RoomValidationHelper roomValidator;
private EmptyProjectConfigPage config;
-
- private static final String[] additionalLaunchConfigLines = new String[] {
- "<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"${workspace}\"/>"
- };
+
+ private static final String[] additionalLaunchConfigLines = new String[] { "<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"${workspace}\"/>" };
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.workbench = workbench;
setDefaultPageImageDescriptor(ProjectCreator.getImageDescriptor("icons/NewETriceProjectWizban.gif"));
- setWindowTitle("New Empty eTrice Project");
+ setWindowTitle("eTrice Java Template Project");
IWorkspace workspace = ResourcesPlugin.getWorkspace();
runtimeProject = workspace.getRoot().getProject("org.eclipse.etrice.runtime.java");
modellibProject = workspace.getRoot().getProject("org.eclipse.etrice.modellib.java");
-
- roomValidator = RoomValidationHelper.createInstance();
}
@Override
public void addPages() {
- WizardNewProjectCreationPage newProjectCreationPage = new WizardNewProjectCreationPage(
- "NewProjectCreationPage") {
+ WizardNewProjectCreationPage newProjectCreationPage = new WizardNewProjectCreationPage("NewProjectCreationPage") {
@Override
protected boolean validatePage() {
if (super.validatePage()) {
-
- String projectName = getProjectName();
- if(!roomValidator.isValidFQN(projectName))
- setMessage("RoomModel name will be invalid ("+roomValidator.getMessage()+")", WizardPage.WARNING);
-
+
IPath locationPath = getLocationPath();
- projectLocation = Platform.getLocation().equals(
- locationPath) ? null : locationPath;
+ projectLocation = Platform.getLocation().equals(locationPath) ? null : locationPath;
IPath projectPath = getProjectHandle().getFullPath();
sourcePath = projectPath.append("src");
sourceGenPath = projectPath.append("src-gen");
return true;
- } else {
+ }
+ else {
return false;
}
}
};
newProjectCreationPage.setInitialProjectName(initialProjectName);
- newProjectCreationPage.setTitle("Empty eTrice Project");
- newProjectCreationPage
- .setDescription("Create an empty Java project with eTrice dependencies");
+ newProjectCreationPage.setTitle("Template eTrice Project");
+ newProjectCreationPage.setDescription("Create the template Java project with eTrice dependencies");
addPage(newProjectCreationPage);
-
- config = new EmptyProjectConfigPage("config", runtimeProject);
+
+ config = new EmptyProjectConfigPage("config");
config.setTitle("Project Configuration");
config.setDescription("Choose a build type for the project");
addPage(config);
}
-
+
@Override
public boolean performFinish() {
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@@ -121,13 +125,13 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
protected void execute(IProgressMonitor progressMonitor) {
try {
List<IProject> referencedProjects = new ArrayList<IProject>();
- if (config.useJDTBuild()){
- if(runtimeProject != null)
+ if (config.useJDTBuild()) {
+ if (runtimeProject != null)
referencedProjects.add(runtimeProject);
- if(modellibProject != null)
+ if (modellibProject != null)
referencedProjects.add(modellibProject);
}
-
+
ArrayList<String> natures = new ArrayList<String>(ProjectCreator.getCommonNatureIDs());
if (config.useMVNBuild())
natures.add("org.eclipse.m2e.core.maven2Nature");
@@ -135,90 +139,46 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
ArrayList<String> builders = new ArrayList<String>(ProjectCreator.getCommonBuilderIDs());
if (config.useMVNBuild())
builders.add("org.eclipse.m2e.core.maven2Builder");
-
+
ArrayList<IClasspathEntry> pathEntries = new ArrayList<IClasspathEntry>();
if (config.useMVNBuild()) {
- IClasspathEntry mvnContainer = JavaCore.newContainerEntry(
- new Path("org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"),
- new IAccessRule[] {},
- new IClasspathAttribute[] {JavaCore.newClasspathAttribute("maven.pomderived", "true")},
- false);
+ IClasspathEntry mvnContainer = JavaCore
+ .newContainerEntry(new Path("org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"),
+ new IAccessRule[] {}, new IClasspathAttribute[] { JavaCore
+ .newClasspathAttribute("maven.pomderived", "true") }, false);
pathEntries.add(mvnContainer);
}
-
- URI modelProjectURI = (projectLocation==null) ? null : URI.createFileURI(projectLocation.toOSString());
- project = ProjectCreator.createETriceProject(
- new Path(sourcePath.toString()),
- new Path(sourceGenPath.toString()),
- modelProjectURI,
- referencedProjects,
- natures,
- builders,
- pathEntries,
- BasicMonitor.toMonitor(progressMonitor)
- );
- String baseName = sourcePath.segment(0);
- ProjectCreator.findOrCreateContainer(new Path("/"
- + baseName + "/model"),
- true, projectLocation, progressMonitor);
- modelURI = URI.createPlatformResourceURI("/"
- + baseName
- + "/model/"+baseName+".room", true);
- ProjectCreator.createModel(modelURI,
- baseName);
+ URI modelProjectURI = (projectLocation == null) ? null : URI.createFileURI(projectLocation
+ .toOSString());
+ project = ProjectCreator.createETriceProject(new Path(sourcePath.toString()), new Path(
+ sourceGenPath.toString()), modelProjectURI, referencedProjects, natures, builders,
+ pathEntries, BasicMonitor.toMonitor(progressMonitor));
-// URI physModelURI = URI.createPlatformResourceURI("/"
-// + baseName
-// + "/model/"+baseName+".etphys", true);
-// ProjectCreator.createPhysicalModel(physModelURI,
-// baseName);
-
- URI mapModelURI = URI.createPlatformResourceURI("/"
- + baseName
- + "/model/Mapping.etmap", true);
- ProjectCreator.createMappingModel(mapModelURI,
- baseName);
+ String projectName = project.getName();
+ URI projectURI = URI.createPlatformResourceURI(projectName, true);
+ String modelName = MODEL_NAME;
- ProjectCreator.createBuildProperties(URI.createPlatformResourceURI("/"
- +baseName+"/build.properties", true),
- baseName);
+ ProjectCreator.createBuildProperties(projectURI.appendSegment("build.properties"), modelName);
- ProjectCreator.createLaunchGeneratorConfig(URI.createPlatformResourceURI("/"
- +baseName+"/generate_"+baseName+".launch", true),
- "java",
- "/"+baseName+"/model",
- baseName,
- additionalLaunchConfigLines);
+ ProjectCreator.createLaunchGeneratorConfig(projectURI.appendSegment("generate_" + modelName + ".launch"),
+ "java", "/" + projectName + "/model", modelName, additionalLaunchConfigLines);
- ProjectCreator.createLaunchJavaApplicationConfig(URI.createPlatformResourceURI("/"
- +baseName+"/run_"+baseName+".launch", true),
- baseName,
- baseName,
- "Node_node_subSystemRefRunner");
+ ProjectCreator.createLaunchJavaApplicationConfig(projectURI.appendSegment("run_" + modelName + ".launch"),
+ projectName, MODEL_NAME, "Node_node_subSystemRefRunner");
- ProjectCreator.findOrCreateContainer(new Path("/"
- + baseName + "/log"),
- true, projectLocation, progressMonitor);
-
if (config.useMVNBuild()) {
- ProjectCreator.createMavenPOM(URI.createPlatformResourceURI("/"
- +baseName+"/pom.xml", true),
- baseName,
- baseName,
- "Node_node_subSystemRefRunner");
- ProjectCreator.createMavenBuilder(URI.createPlatformResourceURI("/"
- +baseName+"/build_"+baseName+".launch", true),
- baseName);
- ProjectCreator.createMavenLauncher(URI.createPlatformResourceURI("/"
- +baseName+"/runjar_"+baseName+".launch", true),
- baseName,
- baseName);
+ ProjectCreator.createMavenPOM(projectURI.appendSegment("pom.xml"), projectName, MODEL_NAME, "Node_node_subSystemRefRunner");
+ ProjectCreator.createMavenBuilder(projectURI.appendSegment("build_" + modelName + ".launch"), projectName);
+ ProjectCreator.createMavenLauncher(projectURI.appendSegment("runjar_" + modelName + ".launch"), projectName, MODEL_NAME);
}
- } catch (Exception e) {
+ importContent(project, progressMonitor);
+ }
+ catch (Exception e) {
Logger.getLogger(getClass()).error(e.getMessage(), e);
- } finally {
+ }
+ finally {
progressMonitor.done();
}
}
@@ -226,30 +186,23 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
try {
getContainer().run(false, false, operation);
- } catch (Exception e) {
+ }
+ catch (Exception e) {
Logger.getLogger(getClass()).error(e.getMessage(), e);
return false;
}
+
+ if (config.useJDTBuild())
+ invokeLibraryWizard();
- if (project != null) {
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow()
- .getActivePage();
- final IWorkbenchPart activePart = page.getActivePart();
- if (activePart instanceof ISetSelectionTarget) {
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IFile model = workspaceRoot.getFile(new Path(modelURI.toPlatformString(true)));
- final ISelection targetSelection = new StructuredSelection(model);
- final IFileEditorInput input = new FileEditorInput(model);
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- ((ISetSelectionTarget) activePart)
- .selectReveal(targetSelection);
- try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, "org.eclipse.etrice.core.Room");
- } catch (PartInitException e) {
- }
- }
- });
+ IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IFile roomFile = project.getFile("/model/" + MODEL_NAME + ".room");
+ if(roomFile != null && roomFile.exists()){
+ BasicNewProjectResourceWizard.selectAndReveal(roomFile, activeWindow);
+ try {
+ activeWindow.getActivePage().openEditor(new FileEditorInput(roomFile), ROOM_EDITOR_ID, true, IWorkbenchPage.MATCH_ID);
+ }
+ catch (PartInitException e) {
}
}
@@ -259,4 +212,61 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
public void setInitialProjectName(String value) {
initialProjectName = value;
}
+
+ private void invokeLibraryWizard() {
+ if(runtimeProject != null && runtimeProject.exists() && modellibProject != null && modellibProject.exists())
+ return;
+
+ IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(MODELLIB_WIZARD_ID);
+ if (descriptor == null)
+ return;
+
+ try {
+ IWizard wizard = descriptor.createWizard();
+ WizardDialog wd = new WizardDialog(getShell(), wizard);
+ wd.setTitle(wizard.getWindowTitle());
+ wd.open();
+ } catch (CoreException e) {
+ }
+ }
+
+ protected static final IOverwriteQuery OVERWRITE_ALL_QUERY = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return IOverwriteQuery.ALL;
+ }
+ };
+
+ private void importContent(IProject project, IProgressMonitor progressMonitor) {
+ URL contentURL = Activator.getInstance().getBundle().getEntry(PROJECT_CONTENT_ZIP);
+
+ ZipFile zipFile = null;
+ try {
+ ImportOperation importOperation = null;
+ File file = new File(FileLocator.resolve(contentURL).toURI());
+ if (file.isFile() && file.canRead()) {
+ zipFile = new ZipFile(file);
+ if (zipFile != null) {
+ ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(zipFile);
+ importOperation = new ImportOperation(project.getFullPath(), structureProvider.getRoot(),
+ structureProvider, OVERWRITE_ALL_QUERY);
+ }
+ }
+
+ if(importOperation != null){
+ importOperation.setContext(getShell());
+ importOperation.run(new SubProgressMonitor(progressMonitor, 1));
+ }
+ }
+ catch (Exception e) {
+ }
+ finally {
+ if (zipFile != null) {
+ try {
+ zipFile.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/NewSetOfModelsWizard.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/NewSetOfModelsWizard.java
index e3da107cb..f7eff95b4 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/NewSetOfModelsWizard.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/NewSetOfModelsWizard.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.etrice.generator.ui.configurator.ProjectConfigurationDelegator;
+import org.eclipse.etrice.generator.ui.wizard.deprecated.ModelCreationPage;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -90,9 +91,9 @@ public class NewSetOfModelsWizard extends Wizard implements INewWizard {
modelURI = URI.createPlatformResourceURI(file.toString(), true);
ProjectCreator.createModel(modelURI, baseName);
-// file = page.getPath().append(baseName).addFileExtension("etphys");
-// URI physModelURI = URI.createPlatformResourceURI(file.toString(), true);
-// ProjectCreator.createPhysicalModel(physModelURI, baseName);
+ file = page.getPath().append(baseName).addFileExtension("etphys");
+ URI physModelURI = URI.createPlatformResourceURI(file.toString(), true);
+ ProjectCreator.createPhysicalModel(physModelURI, baseName);
file = page.getPath().append(baseName).addFileExtension("etmap");
URI mapModelURI = URI.createPlatformResourceURI(file.toString(), true);
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectCreator.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectCreator.java
index d7ba496af..b6546e00b 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectCreator.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectCreator.java
@@ -340,9 +340,9 @@ public class ProjectCreator {
writeFile(uri, ProjectFileFragments.getBasicRoomModel(baseName));
}
-// public static void createPhysicalModel(URI uri, String baseName) {
-// writeFile(uri, ProjectFileFragments.getBasicPhysicalModel(baseName));
-// }
+ public static void createPhysicalModel(URI uri, String baseName) {
+ writeFile(uri, ProjectFileFragments.getBasicPhysicalModel(baseName));
+ }
public static void createMappingModel(URI uri, String baseName) {
writeFile(uri, ProjectFileFragments.getBasicMappingModel(baseName));
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
index 2523ebafa..190d81207 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
@@ -22,143 +22,68 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore
*/
class ProjectFileFragments {
- def static String getBasicRoomModel(String baseName)'''
- /*
- * Shortkeys:
- * Ctrl+Space - content assist
- * F3 - open declaration of selected element
- * Alt+S - open structure diagram
- * Alt+B - open behavior diagram
- * Alt+M - open textual editor (in diagrams)
- */
- RoomModel «baseName» {
-
- import room.basic.types.* from "../../org.eclipse.etrice.modellib.java/model/Types.room"
- import room.basic.service.timing.* from "../../org.eclipse.etrice.modellib.java/model/TimingService.room"
-
- LogicalSystem LogSys {
- SubSystemRef subSystemRef: SubSysClass
- }
-
- SubSystemClass SubSysClass {
- ActorRef topActor: TopActor
- ActorRef timingService: ATimingService
- LayerConnection ref topActor satisfied_by timingService.timer
- LogicalThread defaultThread
- }
-
- // - build your application from here
- ActorClass TopActor {
- Structure {
-
- }
- Behavior {
- StateMachine {
- Transition init: initial -> helloState
- State helloState {
- entry {
- "System.out.println(\"### Hello World! ###\");"
- }
- }
- }
- }
- }
-
- // - PingPong building kit
-
- ActorClass Sender {
- Interface {
- conjugated Port sendPort: PingPongProtocol
+ def static String getBasicRoomModel(String baseName) {
+ '''
+ RoomModel «baseName» {
+ LogicalSystem «baseName» {
+ SubSystemRef main: MainSubSystem
}
- Structure {
- external Port sendPort
+ SubSystemClass MainSubSystem {
+ ActorRef appl: Application
+ LogicalThread defaultThread
}
- Behavior {
- StateMachine {
- Transition init: initial -> sendingPing
- Transition tr0: sendingPing -> receivedPong {
- triggers {
- <pong: sendPort>
- }
- }
- State sendingPing {
- entry {
- "sendPort.ping();"
- }
- }
- State receivedPong
- }
+ ActorClass Application {
}
}
-
- ActorClass Receiver {
- Interface {
- Port recvPort: PingPongProtocol
- }
- Structure {
- external Port recvPort
- SAP timingService: PTimer
+ '''
+ }
+
+ /**
+ * @see ETPhysUtil
+ */
+ def static String getBasicPhysicalModel(String baseName) {
+ '''
+ PhysicalModel «baseName» {
+
+ PhysicalSystem PhysSys1 {
+ NodeRef nodeRef1 : NodeClass1
}
- Behavior {
- StateMachine {
- Transition init: initial -> waitingForPing
- Transition tr0: waitingForPing -> receivedPing {
- triggers {
- <ping: recvPort>
- }
- }
- Transition tr1: receivedPing -> sentPong {
- triggers {
- <timeout: timingService>
- }
- }
- State waitingForPing
- State receivedPing {
- entry {
- "timingService.startTimeout(500);"
- }
- }
- State sentPong {
- entry {
- "recvPort.pong();"
- }
- }
+
+ NodeClass NodeClass1 {
+ runtime = RuntimeClass1
+ priomin = -10
+ priomax = 10
+
+ DefaultThread PhysicalThread1 {
+ execmode = mixed
+ interval = 100ms
+ prio = 0
+ stacksize = 1024
+ msgblocksize = 32
+ msgpoolsize = 10
}
}
+
+ RuntimeClass RuntimeClass1 {
+ model = multiThreaded
+ }
}
-
- ProtocolClass PingPongProtocol {
- incoming {
- Message ping()
- }
- outgoing {
- Message pong()
- }
- }
-
- }
- '''
+ '''
+ }
- def static String getBasicMappingModel(String baseName)'''
- /*
- * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads).
- *
- * <p>Hint: Press F3 to open declaration of selected element or import</p>
- */
- MappingModel «baseName»Mapping {
-
- import room.generic.physical.* from "../../org.eclipse.etrice.modellib.java/model/GenericPhysical.etphys"
- import «baseName».* from "«baseName».room"
-
- Mapping LogSys -> GenericPhysicalSystem {
- SubSystemMapping subSystemRef -> node {
- ThreadMapping defaultThread -> DefaultPhysicalThread
+ def static String getBasicMappingModel(String baseName) {
+ '''
+ MappingModel «baseName» {
+ import «baseName».* from "«baseName».room"
+ import «baseName».* from "«baseName».etphys"
+ Mapping «baseName» -> PhysSys1 {
+ SubSystemMapping main -> nodeRef1 {
+ ThreadMapping defaultThread -> PhysicalThread1
+ }
}
}
-
- }
- '''
-
+ '''
+ }
def static String getGeneratorLaunchConfig(String targetLanguage, String modelPath, String baseName, String[] addLines) {
val prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
@@ -169,7 +94,7 @@ class ProjectFileFragments {
<booleanAttribute key="MSC" value="true"/>
<booleanAttribute key="UseTranslation" value="«useTranslation»"/>
<listAttribute key="ModelFiles">
- <listEntry value="${workspace_loc:«modelPath»/Mapping.etmap}"/>
+ <listEntry value="${workspace_loc:«modelPath»/«baseName».etmap}"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingBuilder.java
index 905fb8c19..7e9801891 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingBuilder.java
@@ -9,7 +9,7 @@
* Juergen Haug (initial contribution)
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
@Deprecated
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingCreationPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingCreationPage.java
index dfe34f0e0..91b3a8b2f 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingCreationPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingCreationPage.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingWizard.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingWizard.java
index 245199827..2731a305c 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingWizard.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/MappingWizard.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import java.io.IOException;
@@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.etmap.ui.internal.ETMapActivator;
import org.eclipse.etrice.core.etphys.ui.internal.ETPhysActivator;
import org.eclipse.etrice.core.ui.internal.RoomActivator;
+import org.eclipse.etrice.generator.ui.wizard.ProjectCreator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ModelCreationPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/ModelCreationPage.java
index 0dd1d79df..fce89907e 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ModelCreationPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/ModelCreationPage.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import java.util.Iterator;
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/RoomValidationHelper.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/RoomValidationHelper.java
index e62f3df93..9e327c7a0 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/RoomValidationHelper.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/RoomValidationHelper.java
@@ -1,4 +1,4 @@
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import java.io.Reader;
import java.io.StringReader;
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SaveMappingPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SaveMappingPage.java
index 74b61f892..7c161b953 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SaveMappingPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SaveMappingPage.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SelectRoomPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SelectRoomPage.java
index 333c04dac..aa8d03940 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/SelectRoomPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/deprecated/SelectRoomPage.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.ui.wizard;
+package org.eclipse.etrice.generator.ui.wizard.deprecated;
import java.util.ArrayList;
import java.util.List;

Back to the top