Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java38
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java9
-rw-r--r--build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.pngbin0 -> 3654 bytes
-rw-r--r--build/org.eclipse.cdt.core.autotools.ui/plugin.xml1
-rw-r--r--build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF6
-rw-r--r--build/org.eclipse.cdt.make.core/plugin.xml8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java89
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakefileBuildConfigurationProvider.java66
-rw-r--r--build/org.eclipse.cdt.make.core/templates/simple/Makefile12
-rw-r--r--build/org.eclipse.cdt.make.core/templates/simple/main.cpp4
-rw-r--r--build/org.eclipse.cdt.make.core/templates/simple/manifest.xml7
-rw-r--r--build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF4
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.pngbin0 -> 3654 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.xml22
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java78
16 files changed, 332 insertions, 23 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 1b61d1a7b14..c922c4e32c2 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -288,11 +288,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
// Change source file to a tmp file (needs to be empty)
Path tmpFile = null;
for (int i = 1; i < commandLine.size(); ++i) {
- if (!commandLine.get(i).startsWith("-")) { //$NON-NLS-1$
- // TODO optimize by dealing with multi arg options like -o
+ String arg = commandLine.get(i);
+ if (!arg.startsWith("-")) { //$NON-NLS-1$
Path filePath;
try {
- filePath = buildDirectory.resolve(commandLine.get(i));
+ filePath = buildDirectory.resolve(commandLine.get(i)).normalize();
} catch (InvalidPathException e) {
continue;
}
@@ -312,6 +312,10 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
tmpFile = Files.createTempFile(parentPath, ".sc", extension); //$NON-NLS-1$
commandLine.set(i, tmpFile.toString());
}
+ } else if (arg.equals("-o")) { //$NON-NLS-1$
+ // skip over the next arg
+ // TODO handle other args like this
+ i++;
}
}
if (tmpFile == null) {
@@ -486,7 +490,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
if (cCommand.contains("gcc")) { //$NON-NLS-1$
cppCommand = cCommand.replace("gcc", "g++"); //$NON-NLS-1$ //$NON-NLS-2$
// Also recognize c++ as an alias for g++
- commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++") }; //$NON-NLS-1$ //$NON-NLS-2$
+ commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++"), "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} else if (cCommand.contains("clang")) { //$NON-NLS-1$
cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$
commands = new String[] { cCommand, cppCommand };
@@ -529,21 +533,21 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
// ran into an option, we're done.
break;
}
- Path srcPath = Paths.get(arg);
- URI uri;
- if (srcPath.isAbsolute()) {
- uri = srcPath.toUri();
- } else {
- try {
- uri = buildDirectoryURI.resolve(arg);
- } catch (IllegalArgumentException e) {
- // Bad URI
- continue;
+ try {
+ Path srcPath = Paths.get(arg);
+ URI uri;
+ if (srcPath.isAbsolute()) {
+ uri = srcPath.toUri();
+ } else {
+ uri = Paths.get(buildDirectoryURI).resolve(srcPath).toUri().normalize();
}
- }
- for (IFile resource : root.findFilesForLocationURI(uri)) {
- resources.add(resource);
+ for (IFile resource : root.findFilesForLocationURI(uri)) {
+ resources.add(resource);
+ }
+ } catch (IllegalArgumentException e) {
+ // Bad URI
+ continue;
}
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
index de95869895d..45de6077e6a 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
@@ -58,7 +58,9 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
List<IPathEntry> entries = new ArrayList<>();
IProject project = getProject();
- // Create the source folders
+ // Create the source and output folders
+ IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
+
TemplateManifest manifest = getManifest();
if (manifest != null) {
List<SourceRoot> srcRoots = getManifest().getSrcRoots();
@@ -69,14 +71,15 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
sourceFolder.create(true, true, monitor);
}
- entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath()));
+ entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
+ new IPath[] { buildFolder.getFullPath() }));
}
} else {
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
}
}
- entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath(), //$NON-NLS-1$
+ entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath(), // $NON-NLS-1$
new IPath[] { new Path("**/CMakeFiles/**") })); //$NON-NLS-1$
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
monitor);
diff --git a/build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png b/build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png
new file mode 100644
index 00000000000..4f2aecee517
--- /dev/null
+++ b/build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png
Binary files differ
diff --git a/build/org.eclipse.cdt.core.autotools.ui/plugin.xml b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml
index e4abf4678a7..0437944c565 100644
--- a/build/org.eclipse.cdt.core.autotools.ui/plugin.xml
+++ b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml
@@ -4,6 +4,7 @@
<extension
point="org.eclipse.tools.templates.ui.templates">
<template
+ icon="icons/cdt_logo_48.png"
id="org.eclipse.cdt.core.autotools.ui.template1"
label="%autotoolsTemplate.label"
wizard="org.eclipse.cdt.core.autotools.ui.internal.NewAutotoolsProjectWizard">
diff --git a/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
index fe09b183aba..7ccc94d0104 100644
--- a/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.make.core; singleton:=true
-Bundle-Version: 7.3.0.qualifier
+Bundle-Version: 7.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.make.core.MakeCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.filesystem;bundle-version="1.2.0"
+ org.eclipse.core.filesystem;bundle-version="1.2.0",
+ org.eclipse.tools.templates.core;bundle-version="1.1.0",
+ org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.ibm.icu.text
diff --git a/build/org.eclipse.cdt.make.core/plugin.xml b/build/org.eclipse.cdt.make.core/plugin.xml
index 2eded824313..63816b70211 100644
--- a/build/org.eclipse.cdt.make.core/plugin.xml
+++ b/build/org.eclipse.cdt.make.core/plugin.xml
@@ -194,5 +194,13 @@
<simple name="buildArguments" external="true" nullable="true"/>
</processType>
</extension>
+ <extension
+ point="org.eclipse.cdt.core.buildConfigProvider">
+ <provider
+ class="org.eclipse.cdt.make.internal.core.MakefileBuildConfigurationProvider"
+ id="org.eclipse.cdt.make.core.provider"
+ natureId="org.eclipse.cdt.make.core.makeNature">
+ </provider>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
index d3fd83f8620..19e7a942ecb 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
@@ -57,6 +57,7 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The main plugin class to be used in the desktop.
@@ -427,4 +428,14 @@ public class MakeCorePlugin extends Plugin {
}
}
}
+
+ /**
+ * @since 7.4
+ */
+ public static <T> T getService(Class<T> service) {
+ BundleContext context = plugin.getBundle().getBundleContext();
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
new file mode 100644
index 00000000000..69f6b544f4c
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.build.CBuilder;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
+import org.eclipse.tools.templates.freemarker.SourceRoot;
+import org.eclipse.tools.templates.freemarker.TemplateManifest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Generator for Makefile projects.
+ *
+ * @since 7.4
+ */
+public class MakefileProjectGenerator extends FMProjectGenerator {
+
+ public MakefileProjectGenerator(String manifestPath) {
+ super(manifestPath);
+ }
+
+ @Override
+ protected Bundle getSourceBundle() {
+ return MakeCorePlugin.getDefault().getBundle();
+ }
+
+ @Override
+ protected void initProjectDescription(IProjectDescription description) throws CoreException {
+ description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
+ MakeProjectNature.NATURE_ID });
+ ICommand command = description.newCommand();
+ CBuilder.setupBuilder(command);
+ description.setBuildSpec(new ICommand[] { command });
+ }
+
+ @Override
+ public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
+ super.generate(model, monitor);
+
+ List<IPathEntry> entries = new ArrayList<>();
+ IProject project = getProject();
+
+ // Create the source and output folders
+ IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
+
+ TemplateManifest manifest = getManifest();
+ if (manifest != null) {
+ List<SourceRoot> srcRoots = getManifest().getSrcRoots();
+ if (srcRoots != null && !srcRoots.isEmpty()) {
+ for (SourceRoot srcRoot : srcRoots) {
+ IFolder sourceFolder = project.getFolder(srcRoot.getDir());
+ if (!sourceFolder.exists()) {
+ sourceFolder.create(true, true, monitor);
+ }
+
+ entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
+ new IPath[] { buildFolder.getFullPath() }));
+ }
+ } else {
+ entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
+ }
+ }
+
+ entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
+ CoreModel.getDefault().create(project)
+ .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakefileBuildConfigurationProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakefileBuildConfigurationProvider.java
new file mode 100644
index 00000000000..f820c4eb7e9
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakefileBuildConfigurationProvider.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.core;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.StandardBuildConfiguration;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
+
+ public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
+ throws CoreException {
+ return new StandardBuildConfiguration(config, name);
+ }
+
+ @Override
+ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
+ String launchMode, IProgressMonitor monitor) throws CoreException {
+ ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
+
+ StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
+ configName.append(launchMode);
+ String os = toolChain.getProperty(IToolChain.ATTR_OS);
+ if (os != null) {
+ configName.append('.');
+ configName.append(os);
+ }
+ String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
+ if (arch != null && !arch.isEmpty()) {
+ configName.append('.');
+ configName.append(arch);
+ }
+ String name = configName.toString();
+ int i = 0;
+ while (configManager.hasConfiguration(this, project, name)) {
+ name = configName.toString() + '.' + (++i);
+ }
+
+ IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
+ StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
+ launchMode);
+ configManager.addBuildConfiguration(config, makeConfig);
+ return makeConfig;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/templates/simple/Makefile b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
new file mode 100644
index 00000000000..02622849e17
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
@@ -0,0 +1,12 @@
+OBJS = ${projectName}.o
+
+all: ${projectName}
+
+${projectName}: $(OBJS)
+ $(CC) -o $@ $^
+
+%.o: ../../%.cpp
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+
+clean:
+ rm -fr ${projectName} $(OBJS)
diff --git a/build/org.eclipse.cdt.make.core/templates/simple/main.cpp b/build/org.eclipse.cdt.make.core/templates/simple/main.cpp
new file mode 100644
index 00000000000..c493b4a5566
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/templates/simple/main.cpp
@@ -0,0 +1,4 @@
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/build/org.eclipse.cdt.make.core/templates/simple/manifest.xml b/build/org.eclipse.cdt.make.core/templates/simple/manifest.xml
new file mode 100644
index 00000000000..22491fe313a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/templates/simple/manifest.xml
@@ -0,0 +1,7 @@
+<templateManifest>
+ <file src="/templates/simple/Makefile"
+ dest="/${projectName}/Makefile"/>
+ <file src="/templates/simple/main.cpp"
+ dest="/${projectName}/${projectName}.cpp"
+ open="true"/>
+</templateManifest> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
index 69cc08e6ad7..aa7adc5bd1d 100644
--- a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
@@ -35,7 +35,9 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.core.filesystem;bundle-version="1.2.0"
+ org.eclipse.core.filesystem;bundle-version="1.2.0",
+ org.eclipse.tools.templates.ui;bundle-version="1.1.1",
+ org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.ibm.icu.text
diff --git a/build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png b/build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png
new file mode 100644
index 00000000000..4f2aecee517
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index 0554661e404..430a7a35fd2 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -629,4 +629,26 @@
</includes>
</viewerActionBinding>
</extension>
+ <extension
+ point="org.eclipse.tools.templates.ui.templates">
+ <template
+ icon="icons/cdt_logo_48.png"
+ id="org.eclipse.cdt.make.ui.template"
+ label="Makefile Project"
+ wizard="org.eclipse.cdt.make.internal.ui.wizards.NewMakefileProjectWizard">
+ <description>
+ Create a new project that builds with the &apos;make&apos; build tool.
+ </description>
+ <tagReference
+ id="org.eclipse.cdt.ui.cdtTag">
+ </tagReference>
+ <tagReference
+ id="org.eclipse.cdt.make.ui.tag">
+ </tagReference>
+ </template>
+ <tag
+ id="org.eclipse.cdt.make.ui.tag"
+ label="Make">
+ </tag>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java
new file mode 100644
index 00000000000..183556dfe68
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui.wizards;
+
+import org.eclipse.cdt.make.core.MakefileProjectGenerator;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tools.templates.core.IGenerator;
+import org.eclipse.tools.templates.ui.TemplateWizard;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+public class NewMakefileProjectWizard extends TemplateWizard {
+
+ private WizardNewProjectCreationPage mainPage;
+ private boolean generateSource = true;
+
+ @Override
+ public void setContainer(IWizardContainer wizardContainer) {
+ super.setContainer(wizardContainer);
+ setWindowTitle("New Makefile Project");
+ }
+
+ @Override
+ public void addPages() {
+ mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ Composite comp = (Composite) getControl();
+ createWorkingSetGroup(comp, getSelection(),
+ new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
+
+ Composite buttonComp = new Composite(comp, SWT.NONE);
+ buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ buttonComp.setLayout(new GridLayout());
+
+ Button genSourceButton = new Button(buttonComp, SWT.CHECK);
+ genSourceButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ genSourceButton.setText("Generate Source and Makefile");
+ genSourceButton.setSelection(generateSource);
+ genSourceButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ generateSource = genSourceButton.getSelection();
+ }
+ });
+ Dialog.applyDialogFont(getControl());
+ }
+ };
+ mainPage.setTitle("New Makefile Project");
+ mainPage.setDescription("Specify properties of new Makefile project.");
+ this.addPage(mainPage);
+ }
+
+ @Override
+ protected IGenerator getGenerator() {
+ String manifest = generateSource ? "templates/simple/manifest.xml" : null; //$NON-NLS-1$
+ MakefileProjectGenerator generator = new MakefileProjectGenerator(manifest);
+ generator.setProjectName(mainPage.getProjectName());
+ if (!mainPage.useDefaults()) {
+ generator.setLocationURI(mainPage.getLocationURI());
+ }
+ return generator;
+ }
+
+}

Back to the top