From 3c9243ab355c00c5ea41566e85f7db98aa53afad Mon Sep 17 00:00:00 2001 From: Henrik Rentz-Reichert Date: Thu, 17 Oct 2013 11:49:37 +0200 Subject: [generator.java, generator, generator.ui, core.room.ui] re-factoring of wizards --- plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF') diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF index 877623e84..a416efe46 100644 --- a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF @@ -6,7 +6,15 @@ Bundle-Version: 0.4.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: Eclipse eTrice (Incubation) Require-Bundle: org.eclipse.core.runtime, - org.eclipse.ui + org.eclipse.ui, + org.apache.log4j;bundle-version="1.2.15", + org.eclipse.core.resources;bundle-version="3.8.101", + org.eclipse.emf.common;bundle-version="2.9.1", + org.eclipse.emf.ecore;bundle-version="2.9.1", + org.eclipse.etrice.core.room.ui;bundle-version="0.4.0", + org.eclipse.jdt.core;bundle-version="3.9.1", + org.eclipse.jdt.launching;bundle-version="3.7.0", + org.eclipse.ui.ide;bundle-version="3.9.1" Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.etrice.generator.ui.Activator Export-Package: org.eclipse.etrice.generator.ui.preferences -- cgit v1.2.3 From f7bda43431d2a50ad75c50ed5cfcf5c1dc2db5fe Mon Sep 17 00:00:00 2001 From: Henrik Rentz-Reichert Date: Fri, 18 Oct 2013 11:20:26 +0200 Subject: [generator.ui] Bug 419819: for C projects the new model files wizard should add include paths https://bugs.eclipse.org/419819 --- .../META-INF/MANIFEST.MF | 4 +- .../generator/ui/wizard/NewSetOfModelsWizard.java | 6 +- .../etrice/generator/ui/wizard/ProjectCreator.java | 86 +++++++++++++++++++++- 3 files changed, 92 insertions(+), 4 deletions(-) (limited to 'plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF') diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF index a416efe46..cf0868f4d 100644 --- a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF @@ -14,7 +14,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.etrice.core.room.ui;bundle-version="0.4.0", org.eclipse.jdt.core;bundle-version="3.9.1", org.eclipse.jdt.launching;bundle-version="3.7.0", - org.eclipse.ui.ide;bundle-version="3.9.1" + org.eclipse.cdt.core;bundle-version="5.5.0", + org.eclipse.ui.ide;bundle-version="3.9.1", + org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1" Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.etrice.generator.ui.Activator Export-Package: org.eclipse.etrice.generator.ui.preferences 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 53128692e..50b2919b2 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 @@ -98,10 +98,12 @@ public class NewSetOfModelsWizard extends Wizard implements INewWizard { ProjectCreator.createMappingModel(mapModelURI, baseName); IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IProject project = workspace.getRoot().getFolder(page.getPath()).getProject(); + IProject project = (page.getPath().segmentCount()==1)? + workspace.getRoot().getProject(page.getPath().lastSegment()) + : workspace.getRoot().getFolder(page.getPath()).getProject(); ProjectCreator.createRunAndLaunchConfigurations(baseName, project, page.getPath().toString(), additionalLaunchConfigLines); - + ProjectCreator.addIncludePathsAndLibraries(project); ProjectCreator.addXtextNature(project, progressMonitor); } catch (Exception e) { 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 f026880c5..b7caad7ce 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 @@ -21,6 +21,17 @@ import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.CIncludePathEntry; +import org.eclipse.cdt.core.settings.model.CLibraryFileEntry; +import org.eclipse.cdt.core.settings.model.CLibraryPathEntry; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICFolderDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSetting; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -484,7 +495,80 @@ public class ProjectCreator { } public static void addIncludePathsAndLibraries(IProject project) { - //IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProject runtime = workspace.getRoot().getProject("org.eclipse.etrice.runtime.c"); + IFolder common = runtime.getFolder("src/common"); + IFolder config = runtime.getFolder("src/config"); + IFolder posix = runtime.getFolder("src/platforms/MT_POSIX_GENERIC_GCC"); + IFolder mingw = runtime.getFolder("src/platforms/MT_WIN_MinGW"); + IFolder src_gen = project.getFolder("src-gen"); + IFolder mingw_debug = project.getFolder("MinGWDebug"); + IFolder mingw_release = project.getFolder("MinGWRelease"); + IFolder posix_debug = project.getFolder("PosixDebug"); + IFolder posix_release = project.getFolder("PosixRelease"); + + ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, true); + ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations(); + + for (ICConfigurationDescription configDescription : configDecriptions) { + ICFolderDescription projectRoot = configDescription.getRootFolderDescription(); + ICLanguageSetting[] settings = projectRoot.getLanguageSettings(); + for (ICLanguageSetting setting : settings) { + if (!"org.eclipse.cdt.core.gcc".equals(setting.getLanguageId())) { + continue; + } + + ICTargetPlatformSetting tgt = configDescription.getTargetPlatformSetting(); + String id = tgt.getId(); + + ArrayList includes = new ArrayList(); + includes.add(new CIncludePathEntry(src_gen, ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(common, ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(config, ICSettingEntry.LOCAL)); + if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe")) { + includes.add(new CIncludePathEntry(mingw, ICSettingEntry.LOCAL)); + } + else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe")) { + includes.add(new CIncludePathEntry(posix, ICSettingEntry.LOCAL)); + } + addSettings(setting, ICSettingEntry.INCLUDE_PATH, includes); + + List libPaths = null; + if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.debug")) { + libPaths = Collections.singletonList(new CLibraryPathEntry(mingw_debug, ICSettingEntry.LOCAL)); + } + else if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry(mingw_release, ICSettingEntry.LOCAL)); + } + else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.debug")) { + libPaths = Collections.singletonList(new CLibraryPathEntry(posix_debug, ICSettingEntry.LOCAL)); + } + else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry(posix_release, ICSettingEntry.LOCAL)); + } + if (libPaths!=null) + addSettings(setting, ICSettingEntry.LIBRARY_PATH, libPaths); + + List libs = Collections.singletonList(new CLibraryFileEntry("org.eclipse.etrice.runtime.c", 0)); + addSettings(setting, ICSettingEntry.LIBRARY_FILE, libs); + } + } + try { + CoreModel.getDefault().setProjectDescription(project, projectDescription); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + private static void addSettings(ICLanguageSetting setting, int kind, List entries) { + HashMap newEntries = new HashMap(); + for (ICLanguageSettingEntry entry : setting.getSettingEntriesList(kind)) { + newEntries.put(entry.getName(), entry); + } + for (ICLanguageSettingEntry entry : entries) { + newEntries.put(entry.getName(), entry); + } + setting.setSettingEntries(kind, new ArrayList(newEntries.values())); } public static void createRunAndLaunchConfigurations(String baseName, -- cgit v1.2.3 From 619bc3be673c49a45856aa739f196f4703867f6f Mon Sep 17 00:00:00 2001 From: Henrik Rentz-Reichert Date: Tue, 29 Oct 2013 14:40:16 +0100 Subject: [generator.ui] Bug 420608: add Maven support for Java projects https://bugs.eclipse.org/420608 --- plugins/org.eclipse.etrice.generator.ui/.classpath | 1 + plugins/org.eclipse.etrice.generator.ui/.project | 6 + .../META-INF/MANIFEST.MF | 3 +- .../ui/wizard/EmptyProjectConfigPage.java | 100 ++++ .../generator/ui/wizard/EmptyProjectWizard.java | 57 ++- .../etrice/generator/ui/wizard/ProjectCreator.java | 528 +++++++++----------- .../generator/ui/wizard/ProjectFileFragments.xtend | 232 +++++++++ .../ui/wizard/.ProjectFileFragments.java._trace | Bin 0 -> 10650 bytes .../generator/ui/wizard/ProjectFileFragments.java | 545 +++++++++++++++++++++ .../contents/org.eclipse.etrice.modellib.java.zip | Bin 401204 -> 484369 bytes .../contents/org.eclipse.etrice.runtime.c.zip | Bin 6193386 -> 6193352 bytes .../contents/org.eclipse.etrice.runtime.java.zip | Bin 64791 -> 66410 bytes .../org.eclipse.etrice.modellib.java/.classpath | 22 +- .../org.eclipse.etrice.modellib.java/.gitignore | 1 + runtime/org.eclipse.etrice.modellib.java/.project | 6 + .../.settings/org.eclipse.jdt.core.prefs | 6 + .../.settings/org.eclipse.m2e.core.prefs | 4 + ...install_org.eclipse.etrice.modellib.java.launch | 15 + .../jgen_modellib.launch | 2 +- runtime/org.eclipse.etrice.modellib.java/pom.xml | 37 ++ runtime/org.eclipse.etrice.runtime.java/.gitignore | 1 + runtime/org.eclipse.etrice.runtime.java/.project | 6 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../install_org.eclipse.etrice.runtime.java.launch | 15 + runtime/org.eclipse.etrice.runtime.java/pom.xml | 74 +++ 25 files changed, 1363 insertions(+), 302 deletions(-) create mode 100644 plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java create mode 100644 plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend create mode 100644 plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/.ProjectFileFragments.java._trace create mode 100644 plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java create mode 100644 runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.m2e.core.prefs create mode 100644 runtime/org.eclipse.etrice.modellib.java/install_org.eclipse.etrice.modellib.java.launch create mode 100644 runtime/org.eclipse.etrice.modellib.java/pom.xml create mode 100644 runtime/org.eclipse.etrice.runtime.java/.settings/org.eclipse.m2e.core.prefs create mode 100644 runtime/org.eclipse.etrice.runtime.java/install_org.eclipse.etrice.runtime.java.launch create mode 100644 runtime/org.eclipse.etrice.runtime.java/pom.xml (limited to 'plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF') diff --git a/plugins/org.eclipse.etrice.generator.ui/.classpath b/plugins/org.eclipse.etrice.generator.ui/.classpath index ad32c83a7..358df1bc1 100644 --- a/plugins/org.eclipse.etrice.generator.ui/.classpath +++ b/plugins/org.eclipse.etrice.generator.ui/.classpath @@ -1,5 +1,6 @@ + diff --git a/plugins/org.eclipse.etrice.generator.ui/.project b/plugins/org.eclipse.etrice.generator.ui/.project index 8a6ea3232..be4c5c7d6 100644 --- a/plugins/org.eclipse.etrice.generator.ui/.project +++ b/plugins/org.eclipse.etrice.generator.ui/.project @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.jdt.core.javabuilder @@ -24,5 +29,6 @@ org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.xtext.ui.shared.xtextNature diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF index cf0868f4d..0fa183448 100644 --- a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.jdt.launching;bundle-version="3.7.0", org.eclipse.cdt.core;bundle-version="5.5.0", org.eclipse.ui.ide;bundle-version="3.9.1", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1" + org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1", + org.eclipse.xtext.xbase.lib;bundle-version="2.4.3" Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.etrice.generator.ui.Activator Export-Package: org.eclipse.etrice.generator.ui.preferences 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 new file mode 100644 index 000000000..96c8af642 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectConfigPage.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.ui.wizard; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +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; + +/** + * @author Henrik Rentz-Reichert + * + */ +class EmptyProjectConfigPage extends WizardPage { + + private IProject runtimeProject; + private Button jdtBuild; + private Button mvnBuild; + private boolean useJDTBuild; + + /** + * @param pageName + */ + EmptyProjectConfigPage(String pageName, IProject runtimeProject) { + super(pageName); + this.runtimeProject = runtimeProject; + } + + @Override + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NULL); + + initializeDialogUnits(parent); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + jdtBuild = new Button(composite, SWT.RADIO); + jdtBuild.setText("use &Eclipse JDT build"); + jdtBuild.setSelection(true); + jdtBuild.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + setPageComplete(validatePage()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + }); + mvnBuild = new Button(composite, SWT.RADIO); + mvnBuild.setText("use &Maven build"); + + // Show description on opening + setErrorMessage(null); + setMessage(null); + setControl(composite); + Dialog.applyDialogFont(composite); + + setPageComplete(validatePage()); + } + + 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); + + return true; + } + + public boolean useJDTBuild() { + return useJDTBuild; + } + + public boolean useMVNBuild() { + return !useJDTBuild; + } +} \ No newline at end of file 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 0e965479b..422bde58e 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,6 +7,8 @@ *******************************************************************************/ package org.eclipse.etrice.generator.ui.wizard; +import java.util.ArrayList; + import org.apache.log4j.Logger; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -19,6 +21,10 @@ 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.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; @@ -48,6 +54,7 @@ public class EmptyProjectWizard extends Wizard implements INewWizard { protected IProject runtimeProject; protected String initialProjectName; protected URI modelURI; + private EmptyProjectConfigPage config; private static final String[] additionalLaunchConfigLines = new String[] { "" @@ -69,10 +76,6 @@ public class EmptyProjectWizard extends Wizard implements INewWizard { @Override protected boolean validatePage() { if (super.validatePage()) { - if (runtimeProject==null || !runtimeProject.exists()) { - setErrorMessage("the project 'org.eclipse.etrice.runtime.java' must be in the workspace"); - return false; - } IPath locationPath = getLocationPath(); projectLocation = Platform.getLocation().equals( locationPath) ? null : locationPath; @@ -91,6 +94,11 @@ public class EmptyProjectWizard extends Wizard implements INewWizard { newProjectCreationPage .setDescription("Create an empty Java project with eTrice dependencies"); addPage(newProjectCreationPage); + + config = new EmptyProjectConfigPage("config", runtimeProject); + config.setTitle("Project Configuration"); + config.setDescription("Choose a build type for the project"); + addPage(config); } @Override @@ -100,14 +108,36 @@ public class EmptyProjectWizard extends Wizard implements INewWizard { @Override protected void execute(IProgressMonitor progressMonitor) { try { + if (!config.useJDTBuild()) + runtimeProject = null; + + ArrayList natures = new ArrayList(ProjectCreator.getCommonNatureIDs()); + if (config.useMVNBuild()) + natures.add("org.eclipse.m2e.core.maven2Nature"); + + ArrayList builders = new ArrayList(ProjectCreator.getCommonBuilderIDs()); + if (config.useMVNBuild()) + builders.add("org.eclipse.m2e.core.maven2Builder"); + + ArrayList pathEntries = new ArrayList(); + 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); + pathEntries.add(mvnContainer); + } + URI modelProjectURI = (projectLocation==null) ? null : URI.createFileURI(projectLocation.toOSString()); project = ProjectCreator.createETriceProject( new Path(sourcePath.toString()), new Path(sourceGenPath.toString()), modelProjectURI, runtimeProject, - ProjectCreator.getCommonNatureIDs(), - ProjectCreator.getCommonBuilderIDs(), + natures, + builders, + pathEntries, BasicMonitor.toMonitor(progressMonitor) ); @@ -154,6 +184,21 @@ public class EmptyProjectWizard extends Wizard implements INewWizard { + baseName + "/tmp/log"), true, projectLocation, progressMonitor); + if (config.useMVNBuild()) { + ProjectCreator.createMavenPOM(URI.createPlatformResourceURI("/" + +baseName+"/pom.xml", true), + baseName, + baseName, + "Node_nodeRef1_subSysRef1Runner"); + ProjectCreator.createMavenBuilder(URI.createPlatformResourceURI("/" + +baseName+"/build_"+baseName+".launch", true), + baseName); + ProjectCreator.createMavenLauncher(URI.createPlatformResourceURI("/" + +baseName+"/runjar_"+baseName+".launch", true), + baseName, + baseName); + } + } catch (Exception e) { Logger.getLogger(getClass()).error(e.getMessage(), e); } finally { 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 d148b3cff..4fed12af5 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 @@ -63,8 +63,9 @@ import org.eclipse.jface.resource.ImageDescriptor; */ public class ProjectCreator { - private static final String[] commonNatureIDs = { JavaCore.NATURE_ID, "org.eclipse.xtext.ui.shared.xtextNature" }; - private static final String[] commonBuilderIDs = { "org.eclipse.xtext.ui.shared.xtextBuilder", }; + private static final String[] commonNatureIDs = {JavaCore.NATURE_ID, + "org.eclipse.xtext.ui.shared.xtextNature"}; + private static final String[] commonBuilderIDs = {"org.eclipse.xtext.ui.shared.xtextBuilder",}; public static List getCommonNatureIDs() { return Arrays.asList(commonNatureIDs); @@ -74,17 +75,23 @@ public class ProjectCreator { return Arrays.asList(commonBuilderIDs); } - public static IProject createETriceProject(IPath javaSource, IPath javaSourceGen, URI projectLocationURI, - IProject runtimeProject, List naturesToAdd, List buildersToAdd, Monitor monitor) { - IProgressMonitor progressMonitor = BasicMonitor.toIProgressMonitor(monitor); + public static IProject createETriceProject(IPath javaSource, + IPath javaSourceGen, URI projectLocationURI, + IProject runtimeProject, List naturesToAdd, + List buildersToAdd, List pathEntries, Monitor monitor) { + IProgressMonitor progressMonitor = BasicMonitor + .toIProgressMonitor(monitor); String projectName = javaSource.segment(0); IProject project = null; try { List classpathEntries = new UniqueEList(); progressMonitor.beginTask("", 10); - progressMonitor.subTask("Creating eTrice project " + projectName + " (" - + (projectLocationURI != null ? projectLocationURI.toString() : projectName) + ")"); + progressMonitor.subTask("Creating eTrice project " + + projectName + + " (" + + (projectLocationURI != null ? projectLocationURI + .toString() : projectName) + ")"); IWorkspace workspace = ResourcesPlugin.getWorkspace(); project = workspace.getRoot().getProject(projectName); @@ -93,30 +100,35 @@ public class ProjectCreator { if (!project.exists()) { URI location = projectLocationURI; if (location == null) { - location = URI.createFileURI(workspace.getRoot().getLocation().append(projectName).toOSString()); + location = URI.createFileURI(workspace.getRoot() + .getLocation().append(projectName).toOSString()); } location = location.appendSegment(".project"); File projectFile = new File(location.toString()); if (projectFile.exists()) { - projectFile.renameTo(new File(location.toString() + ".old")); + projectFile + .renameTo(new File(location.toString() + ".old")); } } IJavaProject javaProject = JavaCore.create(project); IProjectDescription projectDescription = null; if (!project.exists()) { - projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); + projectDescription = ResourcesPlugin.getWorkspace() + .newProjectDescription(projectName); if (projectLocationURI != null) { - projectDescription.setLocationURI(new java.net.URI(projectLocationURI.toString())); + projectDescription.setLocationURI(new java.net.URI( + projectLocationURI.toString())); } - project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1)); + project.create(projectDescription, new SubProgressMonitor( + progressMonitor, 1)); project.open(new SubProgressMonitor(progressMonitor, 1)); - } - else { + } else { projectDescription = project.getDescription(); project.open(new SubProgressMonitor(progressMonitor, 1)); if (project.hasNature(JavaCore.NATURE_ID)) { - classpathEntries.addAll(Arrays.asList(javaProject.getRawClasspath())); + classpathEntries.addAll(Arrays.asList(javaProject + .getRawClasspath())); } } @@ -127,11 +139,12 @@ public class ProjectCreator { if (runtimeProject != null) referencedProjects.add(runtimeProject); if (!referencedProjects.isEmpty()) { - projectDescription.setReferencedProjects(referencedProjects.toArray(new IProject[referencedProjects - .size()])); + projectDescription.setReferencedProjects(referencedProjects + .toArray(new IProject[referencedProjects.size()])); for (IProject referencedProject : referencedProjects) { - IClasspathEntry referencedProjectClasspathEntry = JavaCore.newProjectEntry(referencedProject - .getFullPath()); + IClasspathEntry referencedProjectClasspathEntry = JavaCore + .newProjectEntry(referencedProject + .getFullPath()); classpathEntries.add(referencedProjectClasspathEntry); } } @@ -141,49 +154,63 @@ public class ProjectCreator { addNatures(projectDescription, naturesToAdd); addBuilders(projectDescription, buildersToAdd); - project.setDescription(projectDescription, new SubProgressMonitor(progressMonitor, 1)); + project.setDescription(projectDescription, + new SubProgressMonitor(progressMonitor, 1)); - createSrcFolder(progressMonitor, project, classpathEntries, javaSource); - createSrcFolder(progressMonitor, project, classpathEntries, javaSourceGen); + createSrcFolder(progressMonitor, project, classpathEntries, + javaSource); + createSrcFolder(progressMonitor, project, classpathEntries, + javaSourceGen); if (isInitiallyEmpty) { - IClasspathEntry jreClasspathEntry = JavaCore.newVariableEntry( - new Path(JavaRuntime.JRELIB_VARIABLE), new Path(JavaRuntime.JRESRC_VARIABLE), new Path( + IClasspathEntry jreClasspathEntry = JavaCore + .newVariableEntry(new Path( + JavaRuntime.JRELIB_VARIABLE), new Path( + JavaRuntime.JRESRC_VARIABLE), new Path( JavaRuntime.JRESRCROOT_VARIABLE)); - for (Iterator i = classpathEntries.iterator(); i.hasNext();) { + for (Iterator i = classpathEntries + .iterator(); i.hasNext();) { IClasspathEntry classpathEntry = i.next(); - if (classpathEntry.getPath().isPrefixOf(jreClasspathEntry.getPath())) { + if (classpathEntry.getPath().isPrefixOf( + jreClasspathEntry.getPath())) { i.remove(); } } String jreContainer = JavaRuntime.JRE_CONTAINER; jreContainer += "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"; - classpathEntries.add(JavaCore.newContainerEntry(new Path(jreContainer))); + classpathEntries.add(JavaCore.newContainerEntry(new Path( + jreContainer))); } - javaProject.setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), + for (IClasspathEntry pathEntry : pathEntries) { + classpathEntries.add(pathEntry); + } + + javaProject.setRawClasspath(classpathEntries + .toArray(new IClasspathEntry[classpathEntries.size()]), new SubProgressMonitor(progressMonitor, 1)); } if (isInitiallyEmpty) { - javaProject.setOutputLocation(new Path("/" + javaSource.segment(0) + "/bin"), new SubProgressMonitor( - progressMonitor, 1)); + javaProject.setOutputLocation( + new Path("/" + javaSource.segment(0) + "/bin"), + new SubProgressMonitor(progressMonitor, 1)); } - javaProject.setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), + javaProject.setRawClasspath(classpathEntries + .toArray(new IClasspathEntry[classpathEntries.size()]), new SubProgressMonitor(progressMonitor, 1)); if (isInitiallyEmpty) { - javaProject.setOutputLocation(new Path("/" + javaSource.segment(0) + "/bin"), new SubProgressMonitor( - progressMonitor, 1)); + javaProject.setOutputLocation( + new Path("/" + javaSource.segment(0) + "/bin"), + new SubProgressMonitor(progressMonitor, 1)); } - } - catch (Exception e) { + } catch (Exception e) { Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - finally { + } finally { progressMonitor.done(); } @@ -194,23 +221,25 @@ public class ProjectCreator { * @param desc * @param naturesToAdd */ - public static void addNatures(IProjectDescription desc, List naturesToAdd) { - HashSet natures = new HashSet(); + public static void addNatures(IProjectDescription desc, + List naturesToAdd) { + HashSet natures = new HashSet(); String[] ids = desc.getNatureIds(); - if (ids!=null) + if (ids != null) for (String id : ids) { natures.add(id); } - + natures.addAll(naturesToAdd); - + ids = new String[natures.size()]; ids = natures.toArray(ids); - + desc.setNatureIds(ids); } - public static void addBuilders(IProjectDescription desc, List buildersToAdd) { + public static void addBuilders(IProjectDescription desc, + List buildersToAdd) { HashMap builders = new HashMap(); ICommand[] buildSpecs = desc.getBuildSpec(); for (ICommand spec : buildSpecs) { @@ -223,10 +252,10 @@ public class ProjectCreator { builders.put(builder, cmd); } } - + buildSpecs = new ICommand[builders.size()]; buildSpecs = builders.values().toArray(buildSpecs); - + desc.setBuildSpec(buildSpecs); } @@ -237,22 +266,27 @@ public class ProjectCreator { * @param src * @throws CoreException */ - private static void createSrcFolder(IProgressMonitor progressMonitor, IProject project, - List classpathEntries, IPath src) throws CoreException { + private static void createSrcFolder(IProgressMonitor progressMonitor, + IProject project, List classpathEntries, IPath src) + throws CoreException { if (src.segmentCount() > 1) { - IPath sourceContainerPath = src.removeFirstSegments(1).makeAbsolute(); + IPath sourceContainerPath = src.removeFirstSegments(1) + .makeAbsolute(); IFolder sourceContainer = project.getFolder(sourceContainerPath); if (!sourceContainer.exists()) { for (int i = sourceContainerPath.segmentCount() - 1; i >= 0; i--) { - sourceContainer = project.getFolder(sourceContainerPath.removeLastSegments(i)); + sourceContainer = project.getFolder(sourceContainerPath + .removeLastSegments(i)); if (!sourceContainer.exists()) { - ((IFolder) sourceContainer).create(false, true, new SubProgressMonitor(progressMonitor, 1)); + ((IFolder) sourceContainer).create(false, true, + new SubProgressMonitor(progressMonitor, 1)); } } } IClasspathEntry sourceClasspathEntry = JavaCore.newSourceEntry(src); - for (Iterator i = classpathEntries.iterator(); i.hasNext();) { + for (Iterator i = classpathEntries.iterator(); i + .hasNext();) { IClasspathEntry classpathEntry = i.next(); if (classpathEntry.getPath().isPrefixOf(src)) { i.remove(); @@ -262,16 +296,20 @@ public class ProjectCreator { } } - public static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, IPath localLocation, + public static IContainer findOrCreateContainer(IPath path, + boolean forceRefresh, IPath localLocation, IProgressMonitor progressMonitor) throws CoreException { String projectName = path.segment(0); - IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); + IProjectDescription projectDescription = ResourcesPlugin.getWorkspace() + .newProjectDescription(projectName); projectDescription.setLocation(localLocation); - return findOrCreateContainer(path, forceRefresh, projectDescription, progressMonitor); + return findOrCreateContainer(path, forceRefresh, projectDescription, + progressMonitor); } - public static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, - IProjectDescription projectDescription, IProgressMonitor progressMonitor) throws CoreException { + public static IContainer findOrCreateContainer(IPath path, + boolean forceRefresh, IProjectDescription projectDescription, + IProgressMonitor progressMonitor) throws CoreException { try { String projectName = path.segment(0); progressMonitor.beginTask("", path.segmentCount() + 3); @@ -280,17 +318,17 @@ public class ProjectCreator { IProject project = workspace.getRoot().getProject(path.segment(0)); if (forceRefresh) { - project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(progressMonitor, 1)); - } - else { + project.refreshLocal(IResource.DEPTH_INFINITE, + new SubProgressMonitor(progressMonitor, 1)); + } else { progressMonitor.worked(1); } if (!project.exists()) { - project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1)); + project.create(projectDescription, new SubProgressMonitor( + progressMonitor, 1)); project.open(new SubProgressMonitor(progressMonitor, 1)); - } - else { + } else { project.open(new SubProgressMonitor(progressMonitor, 2)); } @@ -298,9 +336,9 @@ public class ProjectCreator { for (int i = 1, length = path.segmentCount(); i < length; ++i) { IFolder folder = container.getFolder(new Path(path.segment(i))); if (!folder.exists()) { - folder.create(false, true, new SubProgressMonitor(progressMonitor, 1)); - } - else { + folder.create(false, true, new SubProgressMonitor( + progressMonitor, 1)); + } else { progressMonitor.worked(1); } @@ -308,198 +346,60 @@ public class ProjectCreator { } return container; - } - finally { + } finally { progressMonitor.done(); } } public static void createModel(URI uri, String baseName) { - try { - PrintStream model = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); - model.println("RoomModel " + baseName + " {"); - model.println("\tLogicalSystem LogSys1 {"); - model.println("\t\tSubSystemRef subSysRef1:SubSysClass1"); - model.println("\t}"); - model.println("\tSubSystemClass SubSysClass1 {"); - model.println("\t\tActorRef actorRef1:ActorClass1"); - model.println("\t\tLogicalThread defaultThread"); - model.println("\t}"); - model.println("\tActorClass ActorClass1 {"); - model.println("\t}"); - model.println("}"); - model.close(); - } - catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + writeFile(uri, ProjectFileFragments.getBasicRoomModel(baseName)); } public static void createPhysicalModel(URI uri, String baseName) { - try { - PrintStream model = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); - model.println("PhysicalModel " + baseName + " {"); - model.println("\t"); - model.println("\tPhysicalSystem PhysSys1 {"); - model.println("\t\tNodeRef nodeRef1 : NodeClass1"); - model.println("\t}"); - model.println("\t"); - model.println("\tNodeClass NodeClass1 {"); - model.println("\t\truntime = RuntimeClass1"); - model.println("\t\tpriomin = -10"); - model.println("\t\tpriomax = 10"); - model.println("\t\t"); - model.println("\t\tDefaultThread PhysicalThread1 {"); - model.println("\t\t\texecmode = mixed"); - model.println("\t\t\tinterval = 100ms"); - model.println("\t\t\tprio = 0"); - model.println("\t\t\tstacksize = 1024"); - model.println("\t\t\tmsgblocksize = 32"); - model.println("\t\t\tmsgpoolsize = 10"); - model.println("\t\t}"); - model.println("\t}"); - model.println(""); - model.println("\tRuntimeClass RuntimeClass1 {"); - model.println("\t\tmodel = multiThreaded"); - model.println("\t} "); - model.println("}"); - model.close(); - } - catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + writeFile(uri, ProjectFileFragments.getBasicPhysicalModel(baseName)); } public static void createMappingModel(URI uri, String baseName) { - try { - PrintStream model = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); - model.println("MappingModel " + baseName + " {"); - model.println("\timport "+baseName+".* from \""+baseName+".room\""); - model.println("\timport "+baseName+".* from \""+baseName+".etphys\""); - model.println("\tMapping LogSys1 -> PhysSys1 {"); - model.println("\t\tSubSystemMapping subSysRef1 -> nodeRef1 {"); - model.println("\t\t\tThreadMapping defaultThread -> PhysicalThread1"); - model.println("\t\t}"); - model.println("\t}"); - model.println("}"); - model.close(); - } - catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + writeFile(uri, ProjectFileFragments.getBasicMappingModel(baseName)); } public static void createBuildProperties(URI uri, String baseName) { try { - PrintStream prop = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); + PrintStream prop = new PrintStream( + URIConverter.INSTANCE.createOutputStream(uri, null), false, + "UTF-8"); prop.println("source.. = src/,\\"); prop.println("src-gen/"); prop.close(); - } - catch (UnsupportedEncodingException e) { + } catch (UnsupportedEncodingException e) { Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { + } catch (IOException e) { Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); } } - public static void createLaunchGeneratorConfig(URI uri, String targetLanguage, String modelPath, String baseName, String[] addLines) { - try { - PrintStream launch = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - for (String line : addLines) { - launch.println(line); - } - launch.println(""); - launch.close(); - } - catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + public static void createLaunchGeneratorConfig(URI uri, + String targetLanguage, String modelPath, String baseName, String[] addLines) { + writeFile(uri, ProjectFileFragments.getGeneratorLaunchConfig(targetLanguage, modelPath, baseName, addLines)); } - public static void createLaunchJavaApplicationConfig(URI uri, String project, String mdlName, String mainClass) { - try { - PrintStream launch = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.close(); - } - catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } - catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + public static void createLaunchJavaApplicationConfig(URI uri, + String project, String mdlName, String mainClass) { + writeFile(uri, ProjectFileFragments.getLaunchJavaApplicationConfig(project, mdlName, mainClass)); } - public static void createLaunchCApplicationConfig(URI uri, String project, - String mainClass) { - try { - PrintStream launch = new PrintStream( - URIConverter.INSTANCE.createOutputStream(uri, null), false, - "UTF-8"); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - launch.println(""); - - launch.close(); - } catch (UnsupportedEncodingException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } catch (IOException e) { - Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); - } + public static void createLaunchCApplicationConfig(URI uri, String project) { + writeFile(uri, ProjectFileFragments.getLaunchCApplicationConfig(project)); } - - public static void addIncludePathsAndLibraries(IProject project) throws CoreException { - if (project.getNature("org.eclipse.cdt.core.cnature")==null) + + public static void addIncludePathsAndLibraries(IProject project) + throws CoreException { + if (project.getNature("org.eclipse.cdt.core.cnature") == null) return; - + IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IProject runtime = workspace.getRoot().getProject("org.eclipse.etrice.runtime.c"); + IProject runtime = workspace.getRoot().getProject( + "org.eclipse.etrice.runtime.c"); IFolder common = runtime.getFolder("src/common"); IFolder config = runtime.getFolder("src/config"); IFolder posix = runtime.getFolder("src/platforms/MT_POSIX_GENERIC_GCC"); @@ -509,61 +409,76 @@ public class ProjectCreator { IFolder mingw_release = project.getFolder("MinGWRelease"); IFolder posix_debug = project.getFolder("PosixDebug"); IFolder posix_release = project.getFolder("PosixRelease"); - - ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, true); - ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations(); - + + ICProjectDescription projectDescription = CoreModel.getDefault() + .getProjectDescription(project, true); + ICConfigurationDescription configDecriptions[] = projectDescription + .getConfigurations(); + for (ICConfigurationDescription configDescription : configDecriptions) { - ICFolderDescription projectRoot = configDescription.getRootFolderDescription(); + ICFolderDescription projectRoot = configDescription + .getRootFolderDescription(); ICLanguageSetting[] settings = projectRoot.getLanguageSettings(); for (ICLanguageSetting setting : settings) { if (!"org.eclipse.cdt.core.gcc".equals(setting.getLanguageId())) { continue; } - - ICTargetPlatformSetting tgt = configDescription.getTargetPlatformSetting(); + + ICTargetPlatformSetting tgt = configDescription + .getTargetPlatformSetting(); String id = tgt.getId(); - + ArrayList includes = new ArrayList(); - includes.add(new CIncludePathEntry(src_gen, ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(src_gen, + ICSettingEntry.LOCAL)); includes.add(new CIncludePathEntry(common, ICSettingEntry.LOCAL)); includes.add(new CIncludePathEntry(config, ICSettingEntry.LOCAL)); if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe")) { - includes.add(new CIncludePathEntry(mingw, ICSettingEntry.LOCAL)); - } - else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe")) { - includes.add(new CIncludePathEntry(posix, ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(mingw, + ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe")) { + includes.add(new CIncludePathEntry(posix, + ICSettingEntry.LOCAL)); } addSettings(setting, ICSettingEntry.INCLUDE_PATH, includes); List libPaths = null; if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.debug")) { - libPaths = Collections.singletonList(new CLibraryPathEntry(mingw_debug, ICSettingEntry.LOCAL)); - } - else if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.release")) { - libPaths = Collections.singletonList(new CLibraryPathEntry(mingw_release, ICSettingEntry.LOCAL)); + libPaths = Collections.singletonList(new CLibraryPathEntry( + mingw_debug, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + mingw_release, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.debug")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + posix_debug, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + posix_release, ICSettingEntry.LOCAL)); } - else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.debug")) { - libPaths = Collections.singletonList(new CLibraryPathEntry(posix_debug, ICSettingEntry.LOCAL)); - } - else if (id.startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.release")) { - libPaths = Collections.singletonList(new CLibraryPathEntry(posix_release, ICSettingEntry.LOCAL)); - } - if (libPaths!=null) + if (libPaths != null) addSettings(setting, ICSettingEntry.LIBRARY_PATH, libPaths); - - List libs = Collections.singletonList(new CLibraryFileEntry("org.eclipse.etrice.runtime.c", 0)); + + List libs = Collections + .singletonList(new CLibraryFileEntry( + "org.eclipse.etrice.runtime.c", 0)); addSettings(setting, ICSettingEntry.LIBRARY_FILE, libs); } } try { - CoreModel.getDefault().setProjectDescription(project, projectDescription); + CoreModel.getDefault().setProjectDescription(project, + projectDescription); } catch (CoreException e) { e.printStackTrace(); } } - - private static void addSettings(ICLanguageSetting setting, int kind, List entries) { + + private static void addSettings(ICLanguageSetting setting, int kind, + List entries) { HashMap newEntries = new HashMap(); for (ICLanguageSettingEntry entry : setting.getSettingEntriesList(kind)) { newEntries.put(entry.getName(), entry); @@ -571,50 +486,63 @@ public class ProjectCreator { for (ICLanguageSettingEntry entry : entries) { newEntries.put(entry.getName(), entry); } - setting.setSettingEntries(kind, new ArrayList(newEntries.values())); + setting.setSettingEntries(kind, new ArrayList( + newEntries.values())); } - + public static void createRunAndLaunchConfigurations(String baseName, - IProject project, String mdlPath, String[] additionalLaunchConfigLines) throws CoreException { - - if (project.getNature(JavaCore.NATURE_ID)!=null) { - ProjectCreator.createLaunchGeneratorConfig(URI.createPlatformResourceURI( - "/"+project.getName()+"/gen_"+baseName+".launch", true), - "java", - mdlPath, - baseName, - additionalLaunchConfigLines); - ProjectCreator.createLaunchJavaApplicationConfig(URI.createPlatformResourceURI( - "/"+project.getName()+"/run_"+baseName+".launch", true), - project.getName(), - baseName, - "Node_nodeRef1_subSysRef1Runner"); - } - else if (project.getNature("org.eclipse.cdt.core.cnature")!=null) { - ProjectCreator.createLaunchGeneratorConfig(URI.createPlatformResourceURI( - "/"+project.getName()+"/gen_"+baseName+".launch", true), - "c", - mdlPath, - baseName, - additionalLaunchConfigLines); - ProjectCreator.createLaunchCApplicationConfig(URI.createPlatformResourceURI( - "/"+project.getName()+"/run_"+baseName+".launch", true), - project.getName(), + IProject project, String mdlPath, + String[] additionalLaunchConfigLines) throws CoreException { + + if (project.getNature(JavaCore.NATURE_ID) != null) { + ProjectCreator.createLaunchGeneratorConfig( + URI.createPlatformResourceURI("/" + project.getName() + + "/gen_" + baseName + ".launch", true), "java", + mdlPath, baseName, additionalLaunchConfigLines); + ProjectCreator.createLaunchJavaApplicationConfig( + URI.createPlatformResourceURI("/" + project.getName() + + "/run_" + baseName + ".launch", true), + project.getName(), baseName, "Node_nodeRef1_subSysRef1Runner"); + } else if (project.getNature("org.eclipse.cdt.core.cnature") != null) { + ProjectCreator.createLaunchGeneratorConfig( + URI.createPlatformResourceURI("/" + project.getName() + + "/gen_" + baseName + ".launch", true), "c", + mdlPath, baseName, additionalLaunchConfigLines); + ProjectCreator.createLaunchCApplicationConfig( + URI.createPlatformResourceURI("/" + project.getName() + + "/run_" + baseName + ".launch", true), + project.getName()); } } + public static void createMavenPOM(URI uri, String project, String mdlName, String mainClass) { + writeFile(uri, ProjectFileFragments.getMavenPOM(project, mdlName, mainClass)); + } + + public static void createMavenBuilder(URI uri, String project) { + writeFile(uri, ProjectFileFragments.getMavenBuilder(project)); + } + + public static void createMavenLauncher(URI uri, String project, String mdlName) { + writeFile(uri, ProjectFileFragments.getMavenLauncher(project, mdlName)); + } + /** * @param project * @param progressMonitor * @throws CoreException */ - public static void addXtextNature(IProject project, IProgressMonitor progressMonitor) throws CoreException { + public static void addXtextNature(IProject project, + IProgressMonitor progressMonitor) throws CoreException { IProjectDescription description = project.getDescription(); - ProjectCreator.addNatures(description, Collections.singletonList("org.eclipse.xtext.ui.shared.xtextNature")); - ProjectCreator.addBuilders(description, Collections.singletonList("org.eclipse.xtext.ui.shared.xtextBuilder")); - - project.setDescription(description, new SubProgressMonitor(progressMonitor, 1)); + ProjectCreator.addNatures(description, Collections + .singletonList("org.eclipse.xtext.ui.shared.xtextNature")); + ProjectCreator.addBuilders(description, Collections + .singletonList("org.eclipse.xtext.ui.shared.xtextBuilder")); + + project.setDescription(description, new SubProgressMonitor( + progressMonitor, 1)); } /** @@ -626,9 +554,11 @@ public class ProjectCreator { * @return the image descriptor */ public static ImageDescriptor getImageDescriptor(String path) { - ImageDescriptor desc = RoomUiActivator.getDefault().getImageRegistry().getDescriptor(path); + ImageDescriptor desc = RoomUiActivator.getDefault().getImageRegistry() + .getDescriptor(path); if (desc == null) { - desc = RoomUiActivator.imageDescriptorFromPlugin("org.eclipse.etrice.core.room.ui", path); + desc = RoomUiActivator.imageDescriptorFromPlugin( + "org.eclipse.etrice.core.room.ui", path); if (desc == null) System.err.println("image not found: " + path); else { @@ -638,4 +568,20 @@ public class ProjectCreator { } return desc; } + + /** + * @param uri + * @param contents + */ + private static void writeFile(URI uri, String contents) { + try { + PrintStream model = new PrintStream(URIConverter.INSTANCE.createOutputStream(uri, null), false, "UTF-8"); + model.print(contents); + model.close(); + } catch (UnsupportedEncodingException e) { + Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); + } catch (IOException e) { + Logger.getLogger(ProjectCreator.class).error(e.getMessage(), e); + } + } } 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 new file mode 100644 index 000000000..28fe946a5 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.ui.wizard + +/** + * @author Henrik Rentz-Reichert + * + */ +class ProjectFileFragments { + + def static String getBasicRoomModel(String baseName) { + ''' + RoomModel «baseName» { + LogicalSystem LogSys1 { + SubSystemRef subSysRef1:SubSysClass1 + } + SubSystemClass SubSysClass1 { + ActorRef actorRef1:ActorClass1 + LogicalThread defaultThread + } + ActorClass ActorClass1 { + } + } + ''' + } + + def static String getBasicPhysicalModel(String baseName) { + ''' + PhysicalModel «baseName» { + + PhysicalSystem PhysSys1 { + NodeRef nodeRef1 : NodeClass1 + } + + 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 + } + } + ''' + } + + def static String getBasicMappingModel(String baseName) { + ''' + MappingModel «baseName» { + import «baseName».* from "«baseName».room" + import «baseName».* from "«baseName».etphys" + Mapping LogSys1 -> PhysSys1 { + SubSystemMapping subSysRef1 -> nodeRef1 { + ThreadMapping defaultThread -> PhysicalThread1 + } + } + } + ''' + } + + def static String getGeneratorLaunchConfig(String targetLanguage, String modelPath, String baseName, String[] addLines) { + ''' + + + + + + + + + + «FOR line : addLines» + «line» + «ENDFOR» + + ''' + } + + def static String getLaunchJavaApplicationConfig(String project, String mdlName, String mainClass) { + ''' + + + + + + + + + + + + + ''' + } + + def static String getLaunchCApplicationConfig(String project) { + ''' + + + + + + + + + + + + + + + + ''' + } + + def static String getMavenPOM(String project, String mdlName, String mainClass) { + ''' + + 4.0.0 + «project» + «mdlName» + 0.0.1 + + src-gen + + + src-gen + + **/*.java + + + + + + maven-compiler-plugin + 3.1 + + + + + + + maven-assembly-plugin + + + package + + single + + + + + + jar-with-dependencies + + + + «mdlName».«mainClass» + + + + + + + + + org.eclipse.etrice.runtime.java + org.eclipse.etrice.runtime.java + 0.0.4 + + + org.eclipse.etrice.modellib.java + org.eclipse.etrice.modellib.java + 0.0.4 + + + " + ''' + } + + def static String getMavenBuilder(String project) { + ''' + + + + + + + + + + + + + + + + ''' + } + + def static String getMavenLauncher(String project, String mdlName) { + ''' + + + + + + + ''' + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/.ProjectFileFragments.java._trace b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/.ProjectFileFragments.java._trace new file mode 100644 index 000000000..9f6c5d90f Binary files /dev/null and b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/.ProjectFileFragments.java._trace differ diff --git a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java new file mode 100644 index 000000000..231fccf40 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java @@ -0,0 +1,545 @@ +/** + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + */ +package org.eclipse.etrice.generator.ui.wizard; + +import org.eclipse.xtend2.lib.StringConcatenation; + +/** + * @author Henrik Rentz-Reichert + */ +@SuppressWarnings("all") +public class ProjectFileFragments { + public static String getBasicRoomModel(final String baseName) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("RoomModel "); + _builder.append(baseName, ""); + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("LogicalSystem LogSys1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("SubSystemRef subSysRef1:SubSysClass1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("SubSystemClass SubSysClass1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("ActorRef actorRef1:ActorClass1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("LogicalThread defaultThread"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("ActorClass ActorClass1 {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + return _builder.toString(); + } + + public static String getBasicPhysicalModel(final String baseName) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("PhysicalModel "); + _builder.append(baseName, ""); + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("PhysicalSystem PhysSys1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("NodeRef nodeRef1 : NodeClass1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("NodeClass NodeClass1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("runtime = RuntimeClass1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("priomin = -10"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("priomax = 10"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("DefaultThread PhysicalThread1 {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("execmode = mixed"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("interval = 100ms"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("prio = 0"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("stacksize = 1024"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("msgblocksize = 32"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("msgpoolsize = 10"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("RuntimeClass RuntimeClass1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("model = multiThreaded"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("} "); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + return _builder.toString(); + } + + public static String getBasicMappingModel(final String baseName) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("MappingModel "); + _builder.append(baseName, ""); + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("import "); + _builder.append(baseName, " "); + _builder.append(".* from \""); + _builder.append(baseName, " "); + _builder.append(".room\""); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("import "); + _builder.append(baseName, " "); + _builder.append(".* from \""); + _builder.append(baseName, " "); + _builder.append(".etphys\""); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("Mapping LogSys1 -> PhysSys1 {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("SubSystemMapping subSysRef1 -> nodeRef1 {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("ThreadMapping defaultThread -> PhysicalThread1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + return _builder.toString(); + } + + public static String getGeneratorLaunchConfig(final String targetLanguage, final String modelPath, final String baseName, final String[] addLines) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + { + for(final String line : addLines) { + _builder.append(line, ""); + _builder.newLineIfNotEmpty(); + } + } + _builder.append(""); + _builder.newLine(); + return _builder.toString(); + } + + public static String getLaunchJavaApplicationConfig(final String project, final String mdlName, final String mainClass) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + return _builder.toString(); + } + + public static String getLaunchCApplicationConfig(final String project) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + return _builder.toString(); + } + + public static String getMavenPOM(final String project, final String mdlName, final String mainClass) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append("\t"); + _builder.append("4.0.0"); + _builder.newLine(); + _builder.append("\t"); + _builder.append(""); + _builder.append(project, " "); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(""); + _builder.append(mdlName, " "); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("0.0.1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("src-gen"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("src-gen"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append("**/*.java"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("maven-compiler-plugin"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("3.1"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("maven-assembly-plugin"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t"); + _builder.append("package"); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t\t"); + _builder.append("single"); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t"); + _builder.append("jar-with-dependencies"); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t\t\t"); + _builder.append(""); + _builder.append(mdlName, " "); + _builder.append("."); + _builder.append(mainClass, " "); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("org.eclipse.etrice.runtime.java"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("org.eclipse.etrice.runtime.java"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("0.0.4"); + _builder.newLine(); + _builder.append("\t \t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t \t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t \t\t"); + _builder.append("org.eclipse.etrice.modellib.java"); + _builder.newLine(); + _builder.append("\t \t\t"); + _builder.append("org.eclipse.etrice.modellib.java"); + _builder.newLine(); + _builder.append("\t \t\t"); + _builder.append("0.0.4"); + _builder.newLine(); + _builder.append("\t \t"); + _builder.append(""); + _builder.newLine(); + _builder.append("\t "); + _builder.append(""); + _builder.newLine(); + _builder.append("\t "); + _builder.append("\""); + _builder.newLine(); + return _builder.toString(); + } + + public static String getMavenBuilder(final String project) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + return _builder.toString(); + } + + public static String getMavenLauncher(final String project, final String mdlName) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLine(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLineIfNotEmpty(); + _builder.append(""); + _builder.newLine(); + return _builder.toString(); + } +} diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip index e14f4ec94..2ca86633d 100644 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip and b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip index 6fe91b67d..5253f93a6 100644 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip and b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip index 69e841f9b..cb190e242 100644 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip and b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip differ diff --git a/runtime/org.eclipse.etrice.modellib.java/.classpath b/runtime/org.eclipse.etrice.modellib.java/.classpath index b00bea082..6288d5e04 100644 --- a/runtime/org.eclipse.etrice.modellib.java/.classpath +++ b/runtime/org.eclipse.etrice.modellib.java/.classpath @@ -1,8 +1,24 @@ - - + + + + + + - + + + + + + + + + + + + + diff --git a/runtime/org.eclipse.etrice.modellib.java/.gitignore b/runtime/org.eclipse.etrice.modellib.java/.gitignore index 32c04467f..3137ce920 100644 --- a/runtime/org.eclipse.etrice.modellib.java/.gitignore +++ b/runtime/org.eclipse.etrice.modellib.java/.gitignore @@ -1,5 +1,6 @@ bin doc-gen +target src-gen/* !src-gen/readme.txt src-gen-info/* diff --git a/runtime/org.eclipse.etrice.modellib.java/.project b/runtime/org.eclipse.etrice.modellib.java/.project index 97b74e3e7..14aa86a37 100644 --- a/runtime/org.eclipse.etrice.modellib.java/.project +++ b/runtime/org.eclipse.etrice.modellib.java/.project @@ -25,8 +25,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature org.eclipse.xtext.ui.shared.xtextNature org.eclipse.pde.PluginNature diff --git a/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.jdt.core.prefs b/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.jdt.core.prefs index 54ea56b8b..3c082d56e 100644 --- a/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.jdt.core.prefs +++ b/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,10 @@ #Mon Sep 19 09:34:05 CEST 2011 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning @@ -9,6 +13,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -69,3 +74,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.m2e.core.prefs b/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.java/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/runtime/org.eclipse.etrice.modellib.java/install_org.eclipse.etrice.modellib.java.launch b/runtime/org.eclipse.etrice.modellib.java/install_org.eclipse.etrice.modellib.java.launch new file mode 100644 index 000000000..583282196 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.java/install_org.eclipse.etrice.modellib.java.launch @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/runtime/org.eclipse.etrice.modellib.java/jgen_modellib.launch b/runtime/org.eclipse.etrice.modellib.java/jgen_modellib.launch index 2f396c405..3e6df2d98 100644 --- a/runtime/org.eclipse.etrice.modellib.java/jgen_modellib.launch +++ b/runtime/org.eclipse.etrice.modellib.java/jgen_modellib.launch @@ -7,6 +7,6 @@ - + diff --git a/runtime/org.eclipse.etrice.modellib.java/pom.xml b/runtime/org.eclipse.etrice.modellib.java/pom.xml new file mode 100644 index 000000000..2d34ba11c --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.java/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + org.eclipse.etrice.modellib.java + org.eclipse.etrice.modellib.java + 0.0.4 + + src-gen + + + src-gen + + **/*.java + + + + model + + + + + maven-compiler-plugin + 3.1 + + + + + + + + + + org.eclipse.etrice.runtime.java + org.eclipse.etrice.runtime.java + 0.0.4 + + + \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.java/.gitignore b/runtime/org.eclipse.etrice.runtime.java/.gitignore index ba077a403..d567ba01e 100644 --- a/runtime/org.eclipse.etrice.runtime.java/.gitignore +++ b/runtime/org.eclipse.etrice.runtime.java/.gitignore @@ -1 +1,2 @@ bin +target diff --git a/runtime/org.eclipse.etrice.runtime.java/.project b/runtime/org.eclipse.etrice.runtime.java/.project index 0ed9a059f..ada7ec23d 100644 --- a/runtime/org.eclipse.etrice.runtime.java/.project +++ b/runtime/org.eclipse.etrice.runtime.java/.project @@ -20,8 +20,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature diff --git a/runtime/org.eclipse.etrice.runtime.java/.settings/org.eclipse.m2e.core.prefs b/runtime/org.eclipse.etrice.runtime.java/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/runtime/org.eclipse.etrice.runtime.java/install_org.eclipse.etrice.runtime.java.launch b/runtime/org.eclipse.etrice.runtime.java/install_org.eclipse.etrice.runtime.java.launch new file mode 100644 index 000000000..5e11784fa --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/install_org.eclipse.etrice.runtime.java.launch @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/runtime/org.eclipse.etrice.runtime.java/pom.xml b/runtime/org.eclipse.etrice.runtime.java/pom.xml new file mode 100644 index 000000000..a49661e9a --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + org.eclipse.etrice.runtime.java + org.eclipse.etrice.runtime.java + 0.0.4 + + src + + + org.codehaus.mojo + build-helper-maven-plugin + 1.4 + + + add-generated-source + generate-sources + + add-source + + + + ${basedir}/src-gen + + + + + + + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.codehaus.mojo + + + build-helper-maven-plugin + + + [1.4,) + + + add-source + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 774e232a6aa9fa36f94fbab0eabc160c33a69ee9 Mon Sep 17 00:00:00 2001 From: Henrik Rentz-Reichert Date: Wed, 30 Oct 2013 17:45:45 +0100 Subject: [generator.ui, site, new feature and plug-in] Bug 420133: make CDT dependency optional https://bugs.eclipse.org/420133 --- .../.project | 17 +++ .../about.html | 28 ++++ .../about.ini | 15 +++ .../about.mappings | 6 + .../about.properties | 28 ++++ .../build.properties | 9 ++ .../eTrice32.png | Bin 0 -> 955 bytes .../feature.properties | 7 + .../feature.xml | 59 +++++++++ .../org.eclipse.etrice.generator.ui.cdt/.classpath | 7 + .../org.eclipse.etrice.generator.ui.cdt/.gitignore | 1 + .../org.eclipse.etrice.generator.ui.cdt/.project | 28 ++++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 12 ++ .../org.eclipse.etrice.generator.ui.cdt/about.html | 28 ++++ .../build.properties | 5 + .../org.eclipse.etrice.generator.ui.cdt/plugin.xml | 12 ++ .../generator/ui/cdt/ProjectConfigurator.java | 141 +++++++++++++++++++++ .../META-INF/MANIFEST.MF | 6 +- plugins/org.eclipse.etrice.generator.ui/plugin.xml | 1 + ...e.etrice.generator.ui.project_configurator.exsd | 109 ++++++++++++++++ .../ui/configurator/IProjectConfigurator.java | 31 +++++ .../ProjectConfigurationDelegator.java | 105 +++++++++++++++ .../generator/ui/wizard/NewSetOfModelsWizard.java | 4 +- .../etrice/generator/ui/wizard/ProjectCreator.java | 121 +----------------- releng/org.eclipse.etrice.releng/buckminster.cspec | 5 +- releng/org.eclipse.etrice.site/feature.xml | 4 + 27 files changed, 674 insertions(+), 122 deletions(-) create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/.project create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/about.html create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/about.ini create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/about.mappings create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/about.properties create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/build.properties create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/eTrice32.png create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/feature.properties create mode 100644 features/org.eclipse.etrice.cdt-integration.feature/feature.xml create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/.classpath create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/.gitignore create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/.project create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/META-INF/MANIFEST.MF create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/about.html create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/build.properties create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/plugin.xml create mode 100644 plugins/org.eclipse.etrice.generator.ui.cdt/src/org/eclipse/etrice/generator/ui/cdt/ProjectConfigurator.java create mode 100644 plugins/org.eclipse.etrice.generator.ui/schema/org.eclipse.etrice.generator.ui.project_configurator.exsd create mode 100644 plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/IProjectConfigurator.java create mode 100644 plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/ProjectConfigurationDelegator.java (limited to 'plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF') diff --git a/features/org.eclipse.etrice.cdt-integration.feature/.project b/features/org.eclipse.etrice.cdt-integration.feature/.project new file mode 100644 index 000000000..527438fc4 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/.project @@ -0,0 +1,17 @@ + + + org.eclipse.etrice.cdt-integration.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/features/org.eclipse.etrice.cdt-integration.feature/about.html b/features/org.eclipse.etrice.cdt-integration.feature/about.html new file mode 100644 index 000000000..d35d5aed6 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/features/org.eclipse.etrice.cdt-integration.feature/about.ini b/features/org.eclipse.etrice.cdt-integration.feature/about.ini new file mode 100644 index 000000000..a2c20bc25 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/about.ini @@ -0,0 +1,15 @@ +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%featureText + +# Property "featureImage" contains path to feature image (32x32) +featureImage=eTrice32.png + +# Property "appName" contains name of the application (translated) +appName=%featureName + diff --git a/features/org.eclipse.etrice.cdt-integration.feature/about.mappings b/features/org.eclipse.etrice.cdt-integration.feature/about.mappings new file mode 100644 index 000000000..bddaab431 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/about.mappings @@ -0,0 +1,6 @@ +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +0=@build@ \ No newline at end of file diff --git a/features/org.eclipse.etrice.cdt-integration.feature/about.properties b/features/org.eclipse.etrice.cdt-integration.feature/about.properties new file mode 100644 index 000000000..0b1231599 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/about.properties @@ -0,0 +1,28 @@ +# NLS_MESSAGEFORMAT_VAR + +# ============================================================================== +# Do not change the properties between this line and the last line containing: +# %%% END OF TRANSLATED PROPERTIES %%% +# Instead, either redefine an existing property, or create a new property, +# append it to the end of the file, and change the code to use the new name. +# ============================================================================== + +# about.properties +# contains externalized strings for about.ini +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# fill-ins are supplied by about.mappings +# This file should be translated. + +featureName=eTrice CDT integration + +featureText=eTrice CDT integration \n\ +Version: {featureVersion}\n\ +Build id: {0}\n\ +\n\ +(c) Copyright Eclipse contributors and others. 2010-2013. All rights reserved.\n\ +Visit http://www.eclipse.org/etrice + +# ============================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# The above properties have been shipped for translation. +# ============================================================================== diff --git a/features/org.eclipse.etrice.cdt-integration.feature/build.properties b/features/org.eclipse.etrice.cdt-integration.feature/build.properties new file mode 100644 index 000000000..724093182 --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/build.properties @@ -0,0 +1,9 @@ +bin.includes = feature.xml,\ + about.html,\ + about.ini,\ + about.mappings,\ + about.properties,\ + build.properties,\ + feature.properties,\ + modeling32.png,\ + eTrice32.png diff --git a/features/org.eclipse.etrice.cdt-integration.feature/eTrice32.png b/features/org.eclipse.etrice.cdt-integration.feature/eTrice32.png new file mode 100644 index 000000000..1670cce38 Binary files /dev/null and b/features/org.eclipse.etrice.cdt-integration.feature/eTrice32.png differ diff --git a/features/org.eclipse.etrice.cdt-integration.feature/feature.properties b/features/org.eclipse.etrice.cdt-integration.feature/feature.properties new file mode 100644 index 000000000..999582bea --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/feature.properties @@ -0,0 +1,7 @@ +featureName=eTrice CDT Integration Feature +# "providerName" property - name of the company that provides the feature +providerName=Eclipse eTrice (Incubation) +description=The eTrice CDT integration adds include paths and other settings to eTrice C projects + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" diff --git a/features/org.eclipse.etrice.cdt-integration.feature/feature.xml b/features/org.eclipse.etrice.cdt-integration.feature/feature.xml new file mode 100644 index 000000000..4e9e5c93b --- /dev/null +++ b/features/org.eclipse.etrice.cdt-integration.feature/feature.xml @@ -0,0 +1,59 @@ + + + + + + %description + + + + (c) 2010 - 2011 Protos Software GmbH. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License +v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + + + + %license + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/.classpath b/plugins/org.eclipse.etrice.generator.ui.cdt/.classpath new file mode 100644 index 000000000..ad32c83a7 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/.gitignore b/plugins/org.eclipse.etrice.generator.ui.cdt/.gitignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/.gitignore @@ -0,0 +1 @@ +bin diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/.project b/plugins/org.eclipse.etrice.generator.ui.cdt/.project new file mode 100644 index 000000000..7bb78bd4b --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/.project @@ -0,0 +1,28 @@ + + + org.eclipse.etrice.generator.ui.cdt + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.generator.ui.cdt/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..c537b6306 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui.cdt/META-INF/MANIFEST.MF new file mode 100644 index 000000000..41bb9bfce --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: CDT integration of eTrice +Bundle-SymbolicName: org.eclipse.etrice.generator.ui.cdt;singleton:=true +Bundle-Version: 0.4.0.qualifier +Bundle-Vendor: Eclipse eTrice (Incubation) +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.eclipse.etrice.generator.ui;bundle-version="0.4.0", + org.eclipse.cdt.core;bundle-version="5.5.0", + org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1", + org.eclipse.equinox.common;bundle-version="3.6.200" +Import-Package: org.eclipse.core.resources diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/about.html b/plugins/org.eclipse.etrice.generator.ui.cdt/about.html new file mode 100644 index 000000000..c258ef55d --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2006

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/build.properties b/plugins/org.eclipse.etrice.generator.ui.cdt/build.properties new file mode 100644 index 000000000..e9863e281 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/plugin.xml b/plugins/org.eclipse.etrice.generator.ui.cdt/plugin.xml new file mode 100644 index 000000000..84f1d343e --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/plugin.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/plugins/org.eclipse.etrice.generator.ui.cdt/src/org/eclipse/etrice/generator/ui/cdt/ProjectConfigurator.java b/plugins/org.eclipse.etrice.generator.ui.cdt/src/org/eclipse/etrice/generator/ui/cdt/ProjectConfigurator.java new file mode 100644 index 000000000..5ca450426 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui.cdt/src/org/eclipse/etrice/generator/ui/cdt/ProjectConfigurator.java @@ -0,0 +1,141 @@ +package org.eclipse.etrice.generator.ui.cdt; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.CIncludePathEntry; +import org.eclipse.cdt.core.settings.model.CLibraryFileEntry; +import org.eclipse.cdt.core.settings.model.CLibraryPathEntry; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICFolderDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSetting; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.etrice.generator.ui.configurator.IProjectConfigurator; + +public class ProjectConfigurator implements IProjectConfigurator { + + public ProjectConfigurator() { + } + + /* (non-Javadoc) + * @see org.eclipse.etrice.generator.ui.configurator.IProjectConfigurator#configure(org.eclipse.etrice.generator.ui.configurator.IProject) + */ + @Override + public void configure(IProject project) { + try { + addIncludePathsAndLibraries(project); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + public static void addIncludePathsAndLibraries(IProject project) + throws CoreException { + if (!project.hasNature("org.eclipse.cdt.core.cnature")) + return; + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProject runtime = workspace.getRoot().getProject( + "org.eclipse.etrice.runtime.c"); + IFolder common = runtime.getFolder("src/common"); + IFolder config = runtime.getFolder("src/config"); + IFolder posix = runtime.getFolder("src/platforms/MT_POSIX_GENERIC_GCC"); + IFolder mingw = runtime.getFolder("src/platforms/MT_WIN_MinGW"); + IFolder src_gen = project.getFolder("src-gen"); + IFolder mingw_debug = project.getFolder("MinGWDebug"); + IFolder mingw_release = project.getFolder("MinGWRelease"); + IFolder posix_debug = project.getFolder("PosixDebug"); + IFolder posix_release = project.getFolder("PosixRelease"); + + ICProjectDescription projectDescription = CoreModel.getDefault() + .getProjectDescription(project, true); + ICConfigurationDescription configDecriptions[] = projectDescription + .getConfigurations(); + + for (ICConfigurationDescription configDescription : configDecriptions) { + ICFolderDescription projectRoot = configDescription + .getRootFolderDescription(); + ICLanguageSetting[] settings = projectRoot.getLanguageSettings(); + for (ICLanguageSetting setting : settings) { + if (!"org.eclipse.cdt.core.gcc".equals(setting.getLanguageId())) { + continue; + } + + ICTargetPlatformSetting tgt = configDescription + .getTargetPlatformSetting(); + String id = tgt.getId(); + + ArrayList includes = new ArrayList(); + includes.add(new CIncludePathEntry(src_gen, + ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(common, ICSettingEntry.LOCAL)); + includes.add(new CIncludePathEntry(config, ICSettingEntry.LOCAL)); + if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe")) { + includes.add(new CIncludePathEntry(mingw, + ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe")) { + includes.add(new CIncludePathEntry(posix, + ICSettingEntry.LOCAL)); + } + addSettings(setting, ICSettingEntry.INCLUDE_PATH, includes); + + List libPaths = null; + if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.debug")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + mingw_debug, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + mingw_release, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.debug")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + posix_debug, ICSettingEntry.LOCAL)); + } else if (id + .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.release")) { + libPaths = Collections.singletonList(new CLibraryPathEntry( + posix_release, ICSettingEntry.LOCAL)); + } + if (libPaths != null) + addSettings(setting, ICSettingEntry.LIBRARY_PATH, libPaths); + + List libs = Collections + .singletonList(new CLibraryFileEntry( + "org.eclipse.etrice.runtime.c", 0)); + addSettings(setting, ICSettingEntry.LIBRARY_FILE, libs); + } + } + try { + CoreModel.getDefault().setProjectDescription(project, + projectDescription); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + private static void addSettings(ICLanguageSetting setting, int kind, + List entries) { + HashMap newEntries = new HashMap(); + for (ICLanguageSettingEntry entry : setting.getSettingEntriesList(kind)) { + newEntries.put(entry.getName(), entry); + } + for (ICLanguageSettingEntry entry : entries) { + newEntries.put(entry.getName(), entry); + } + setting.setSettingEntries(kind, new ArrayList( + newEntries.values())); + } + +} diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF index 0fa183448..1b79a905d 100644 --- a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF @@ -9,15 +9,13 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, org.apache.log4j;bundle-version="1.2.15", org.eclipse.core.resources;bundle-version="3.8.101", - org.eclipse.emf.common;bundle-version="2.9.1", org.eclipse.emf.ecore;bundle-version="2.9.1", org.eclipse.etrice.core.room.ui;bundle-version="0.4.0", org.eclipse.jdt.core;bundle-version="3.9.1", org.eclipse.jdt.launching;bundle-version="3.7.0", - org.eclipse.cdt.core;bundle-version="5.5.0", org.eclipse.ui.ide;bundle-version="3.9.1", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1", org.eclipse.xtext.xbase.lib;bundle-version="2.4.3" Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.etrice.generator.ui.Activator -Export-Package: org.eclipse.etrice.generator.ui.preferences +Export-Package: org.eclipse.etrice.generator.ui.configurator, + org.eclipse.etrice.generator.ui.preferences diff --git a/plugins/org.eclipse.etrice.generator.ui/plugin.xml b/plugins/org.eclipse.etrice.generator.ui/plugin.xml index d35a6f71e..b17e3239b 100644 --- a/plugins/org.eclipse.etrice.generator.ui/plugin.xml +++ b/plugins/org.eclipse.etrice.generator.ui/plugin.xml @@ -1,6 +1,7 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/IProjectConfigurator.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/IProjectConfigurator.java new file mode 100644 index 000000000..a0f5bb23b --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/IProjectConfigurator.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.ui.configurator; + +import org.eclipse.core.resources.IProject; +import org.eclipse.etrice.generator.ui.wizard.NewSetOfModelsWizard; + +/** + * This interface is used by the org.eclipse.etrice.generator.ui.project_configurator extension point. + * The method is called when a new set of models is created by the {@link NewSetOfModelsWizard}. + * + * @author Henrik Rentz-Reichert + * + */ +public interface IProjectConfigurator { + + /** + * @param project the project to be configured + */ + void configure(IProject project); +} diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/ProjectConfigurationDelegator.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/ProjectConfigurationDelegator.java new file mode 100644 index 000000000..7d325b540 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/configurator/ProjectConfigurationDelegator.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.ui.configurator; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map.Entry; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.etrice.generator.ui.wizard.NewSetOfModelsWizard; + +/** + * This singleton collects the extensions registered with {@link #ICONFIGURATOR_ID}. + * It is called by the {@link NewSetOfModelsWizard} and applies all configured project configurators + * if the project has the specified nature. + * + * @author Henrik Rentz-Reichert + * + */ +public class ProjectConfigurationDelegator implements IProjectConfigurator { + + private static final String ICONFIGURATOR_ID = "org.eclipse.etrice.generator.ui.project_configurator"; + + private static ProjectConfigurationDelegator instance = null; + + private HashMap> nature2configurators = new HashMap>(); + + /** + * @return the singleton instance of this class + */ + public static ProjectConfigurationDelegator getInstance() { + if (instance==null) + instance = new ProjectConfigurationDelegator(); + + return instance; + } + + /** + * The constructor instantiates the configured extensions. + */ + private ProjectConfigurationDelegator() { + IConfigurationElement[] config = Platform.getExtensionRegistry() + .getConfigurationElementsFor(ICONFIGURATOR_ID); + for (IConfigurationElement e : config) { + try { + final Object ext = e.createExecutableExtension("class"); + if (ext instanceof IProjectConfigurator) { + IProjectConfigurator configurator = (IProjectConfigurator) ext; + String nature = e.getAttribute("appliesToNature"); + addConfigurator(nature, configurator); + } + } + catch (CoreException ex) { + System.out.println(ex.getMessage()); + } + } + } + + /** + * This helper method adds the configurator to our hash map + * @param nature the nature to which this configurator is applicable + * @param configurator the project configurator + */ + private void addConfigurator(String nature, IProjectConfigurator configurator) { + ArrayList configurators = nature2configurators.get(nature); + if (configurators==null) + nature2configurators.put(nature, configurators = new ArrayList()); + + configurators.add(configurator); + } + + /** + * This method applies all configurators configured with the {@link #ICONFIGURATOR_ID} extension point. + * + * @see org.eclipse.etrice.generator.ui.configurator.IProjectConfigurator#configure(org.eclipse.core.resources.IProject) + */ + @Override + public void configure(IProject project) { + for (Entry> entry : nature2configurators.entrySet()) { + try { + if (project.hasNature(entry.getKey())) { + for (IProjectConfigurator configurator : entry.getValue()) { + configurator.configure(project); + } + } + } catch (CoreException e) { + e.printStackTrace(); + } + } + } + +} 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 50b2919b2..fff67e8f5 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 @@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IPath; 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.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -103,9 +104,10 @@ public class NewSetOfModelsWizard extends Wizard implements INewWizard { : workspace.getRoot().getFolder(page.getPath()).getProject(); ProjectCreator.createRunAndLaunchConfigurations(baseName, project, page.getPath().toString(), additionalLaunchConfigLines); - ProjectCreator.addIncludePathsAndLibraries(project); ProjectCreator.addXtextNature(project, progressMonitor); + ProjectConfigurationDelegator.getInstance().configure(project); + } catch (Exception e) { Logger.getLogger(getClass()).error(e.getMessage(), e); } finally { 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 4fed12af5..03383d9e9 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 @@ -21,17 +21,6 @@ import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.CIncludePathEntry; -import org.eclipse.cdt.core.settings.model.CLibraryFileEntry; -import org.eclipse.cdt.core.settings.model.CLibraryPathEntry; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICFolderDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSetting; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -221,7 +210,7 @@ public class ProjectCreator { * @param desc * @param naturesToAdd */ - public static void addNatures(IProjectDescription desc, + private static void addNatures(IProjectDescription desc, List naturesToAdd) { HashSet natures = new HashSet(); String[] ids = desc.getNatureIds(); @@ -238,7 +227,7 @@ public class ProjectCreator { desc.setNatureIds(ids); } - public static void addBuilders(IProjectDescription desc, + private static void addBuilders(IProjectDescription desc, List buildersToAdd) { HashMap builders = new HashMap(); ICommand[] buildSpecs = desc.getBuildSpec(); @@ -296,7 +285,7 @@ public class ProjectCreator { } } - public static IContainer findOrCreateContainer(IPath path, + protected static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, IPath localLocation, IProgressMonitor progressMonitor) throws CoreException { String projectName = path.segment(0); @@ -307,7 +296,7 @@ public class ProjectCreator { progressMonitor); } - public static IContainer findOrCreateContainer(IPath path, + protected static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, IProjectDescription projectDescription, IProgressMonitor progressMonitor) throws CoreException { try { @@ -392,109 +381,11 @@ public class ProjectCreator { writeFile(uri, ProjectFileFragments.getLaunchCApplicationConfig(project)); } - public static void addIncludePathsAndLibraries(IProject project) - throws CoreException { - if (project.getNature("org.eclipse.cdt.core.cnature") == null) - return; - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IProject runtime = workspace.getRoot().getProject( - "org.eclipse.etrice.runtime.c"); - IFolder common = runtime.getFolder("src/common"); - IFolder config = runtime.getFolder("src/config"); - IFolder posix = runtime.getFolder("src/platforms/MT_POSIX_GENERIC_GCC"); - IFolder mingw = runtime.getFolder("src/platforms/MT_WIN_MinGW"); - IFolder src_gen = project.getFolder("src-gen"); - IFolder mingw_debug = project.getFolder("MinGWDebug"); - IFolder mingw_release = project.getFolder("MinGWRelease"); - IFolder posix_debug = project.getFolder("PosixDebug"); - IFolder posix_release = project.getFolder("PosixRelease"); - - ICProjectDescription projectDescription = CoreModel.getDefault() - .getProjectDescription(project, true); - ICConfigurationDescription configDecriptions[] = projectDescription - .getConfigurations(); - - for (ICConfigurationDescription configDescription : configDecriptions) { - ICFolderDescription projectRoot = configDescription - .getRootFolderDescription(); - ICLanguageSetting[] settings = projectRoot.getLanguageSettings(); - for (ICLanguageSetting setting : settings) { - if (!"org.eclipse.cdt.core.gcc".equals(setting.getLanguageId())) { - continue; - } - - ICTargetPlatformSetting tgt = configDescription - .getTargetPlatformSetting(); - String id = tgt.getId(); - - ArrayList includes = new ArrayList(); - includes.add(new CIncludePathEntry(src_gen, - ICSettingEntry.LOCAL)); - includes.add(new CIncludePathEntry(common, ICSettingEntry.LOCAL)); - includes.add(new CIncludePathEntry(config, ICSettingEntry.LOCAL)); - if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe")) { - includes.add(new CIncludePathEntry(mingw, - ICSettingEntry.LOCAL)); - } else if (id - .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe")) { - includes.add(new CIncludePathEntry(posix, - ICSettingEntry.LOCAL)); - } - addSettings(setting, ICSettingEntry.INCLUDE_PATH, includes); - - List libPaths = null; - if (id.startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.debug")) { - libPaths = Collections.singletonList(new CLibraryPathEntry( - mingw_debug, ICSettingEntry.LOCAL)); - } else if (id - .startsWith("cdt.managedbuild.target.gnu.platform.mingw.exe.release")) { - libPaths = Collections.singletonList(new CLibraryPathEntry( - mingw_release, ICSettingEntry.LOCAL)); - } else if (id - .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.debug")) { - libPaths = Collections.singletonList(new CLibraryPathEntry( - posix_debug, ICSettingEntry.LOCAL)); - } else if (id - .startsWith("cdt.managedbuild.target.gnu.platform.posix.exe.release")) { - libPaths = Collections.singletonList(new CLibraryPathEntry( - posix_release, ICSettingEntry.LOCAL)); - } - if (libPaths != null) - addSettings(setting, ICSettingEntry.LIBRARY_PATH, libPaths); - - List libs = Collections - .singletonList(new CLibraryFileEntry( - "org.eclipse.etrice.runtime.c", 0)); - addSettings(setting, ICSettingEntry.LIBRARY_FILE, libs); - } - } - try { - CoreModel.getDefault().setProjectDescription(project, - projectDescription); - } catch (CoreException e) { - e.printStackTrace(); - } - } - - private static void addSettings(ICLanguageSetting setting, int kind, - List entries) { - HashMap newEntries = new HashMap(); - for (ICLanguageSettingEntry entry : setting.getSettingEntriesList(kind)) { - newEntries.put(entry.getName(), entry); - } - for (ICLanguageSettingEntry entry : entries) { - newEntries.put(entry.getName(), entry); - } - setting.setSettingEntries(kind, new ArrayList( - newEntries.values())); - } - public static void createRunAndLaunchConfigurations(String baseName, IProject project, String mdlPath, String[] additionalLaunchConfigLines) throws CoreException { - if (project.getNature(JavaCore.NATURE_ID) != null) { + if (project.hasNature(JavaCore.NATURE_ID)) { ProjectCreator.createLaunchGeneratorConfig( URI.createPlatformResourceURI("/" + project.getName() + "/gen_" + baseName + ".launch", true), "java", @@ -504,7 +395,7 @@ public class ProjectCreator { + "/run_" + baseName + ".launch", true), project.getName(), baseName, "Node_nodeRef1_subSysRef1Runner"); - } else if (project.getNature("org.eclipse.cdt.core.cnature") != null) { + } else if (project.hasNature("org.eclipse.cdt.core.cnature")) { ProjectCreator.createLaunchGeneratorConfig( URI.createPlatformResourceURI("/" + project.getName() + "/gen_" + baseName + ".launch", true), "c", diff --git a/releng/org.eclipse.etrice.releng/buckminster.cspec b/releng/org.eclipse.etrice.releng/buckminster.cspec index fe86fc688..b8088653a 100644 --- a/releng/org.eclipse.etrice.releng/buckminster.cspec +++ b/releng/org.eclipse.etrice.releng/buckminster.cspec @@ -10,12 +10,13 @@ + - + @@ -41,8 +42,8 @@ - + diff --git a/releng/org.eclipse.etrice.site/feature.xml b/releng/org.eclipse.etrice.site/feature.xml index 58cc5be84..2472ed0e5 100644 --- a/releng/org.eclipse.etrice.site/feature.xml +++ b/releng/org.eclipse.etrice.site/feature.xml @@ -46,4 +46,8 @@ http://www.eclipse.org/legal/epl-v10.html id="org.eclipse.etrice.kieler.feature" version="0.0.0"/> + + -- cgit v1.2.3