mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New Qt templates using new templates framework. Arduino fixes.
Change-Id: Ib50fb439ba248965286242e476728bb9f36ac18b
This commit is contained in:
parent
e3f7a7dd7f
commit
d1dda291d9
26 changed files with 326 additions and 115 deletions
|
@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.cdt.build.core;bundle-version="1.0.0",
|
||||
org.eclipse.cdt.build.gcc.core;bundle-version="1.0.0",
|
||||
org.eclipse.cdt.dsf.gdb;bundle-version="5.0.0",
|
||||
org.eclipse.cdt.dsf;bundle-version="2.6.0"
|
||||
org.eclipse.cdt.dsf;bundle-version="2.6.0",
|
||||
org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -19,12 +19,16 @@ import org.eclipse.cdt.core.index.IIndexLinkage;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.index.CIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.qt.core.build.QtBuilder;
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IProjectNature;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class QtNature implements IProjectNature {
|
||||
|
@ -57,8 +61,15 @@ public class QtNature implements IProjectNature {
|
|||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
IProjectDescription projDesc = project.getDescription();
|
||||
ICommand command = projDesc.newCommand();
|
||||
command.setBuilderName(QtBuilder.ID);
|
||||
command.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
|
||||
projDesc.setBuildSpec(new ICommand[] { command });
|
||||
project.setDescription(projDesc, new NullProgressMonitor());
|
||||
}
|
||||
|
||||
// TODO no longer needed?
|
||||
public void configurex() throws CoreException {
|
||||
ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
|
||||
if (cProject == null)
|
||||
|
|
|
@ -56,7 +56,7 @@ public class QtBuilder extends IncrementalProjectBuilder {
|
|||
command.add(config);
|
||||
}
|
||||
|
||||
IFile projectFile = qtConfig.getProject().getFile("main.pro"); //$NON-NLS-1$
|
||||
IFile projectFile = qtConfig.getProject().getFile(project.getName() + ".pro"); //$NON-NLS-1$
|
||||
command.add(projectFile.getLocation().toOSString());
|
||||
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
|
||||
|
|
|
@ -7,72 +7,60 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.qt.core.project;
|
||||
|
||||
import java.util.HashMap;
|
||||
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.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.QtNature;
|
||||
import org.eclipse.cdt.internal.qt.core.QtTemplateGenerator;
|
||||
import org.eclipse.cdt.internal.qt.core.build.QtBuilder;
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
|
||||
import org.eclipse.tools.templates.freemarker.SourceRoot;
|
||||
|
||||
public class QtProjectGenerator {
|
||||
public class QtProjectGenerator extends FMProjectGenerator {
|
||||
|
||||
private final IProject project;
|
||||
@Override
|
||||
protected void initProjectDescription(IProjectDescription description) {
|
||||
// Natures
|
||||
description
|
||||
.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, QtNature.ID });
|
||||
|
||||
public QtProjectGenerator(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public void generate(IProgressMonitor monitor) throws CoreException {
|
||||
// Generate the files
|
||||
IFolder sourceFolder = project.getFolder("src"); //$NON-NLS-1$
|
||||
if (!sourceFolder.exists()) {
|
||||
sourceFolder.create(true, true, monitor);
|
||||
}
|
||||
|
||||
QtTemplateGenerator templateGen = new QtTemplateGenerator();
|
||||
Map<String, Object> fmModel = new HashMap<>();
|
||||
fmModel.put("projectName", project.getName()); //$NON-NLS-1$
|
||||
|
||||
IFile sourceFile = sourceFolder.getFile("main.cpp"); //$NON-NLS-1$
|
||||
templateGen.generateFile(fmModel, "project2/appProject/main.cpp", sourceFile, monitor); //$NON-NLS-1$
|
||||
sourceFile = project.getFile("main.qml"); //$NON-NLS-1$
|
||||
templateGen.generateFile(fmModel, "project2/appProject/main.qml", sourceFile, monitor); //$NON-NLS-1$
|
||||
sourceFile = project.getFile("main.qrc"); //$NON-NLS-1$
|
||||
templateGen.generateFile(fmModel, "project2/appProject/main.qrc", sourceFile, monitor); //$NON-NLS-1$
|
||||
sourceFile = project.getFile("main.pro"); //$NON-NLS-1$
|
||||
templateGen.generateFile(fmModel, "project2/appProject/main.pro", sourceFile, monitor); //$NON-NLS-1$
|
||||
|
||||
// Set up the project
|
||||
IProjectDescription projDesc = project.getDescription();
|
||||
String[] oldIds = projDesc.getNatureIds();
|
||||
String[] newIds = new String[oldIds.length + 3];
|
||||
System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
|
||||
newIds[newIds.length - 3] = CProjectNature.C_NATURE_ID;
|
||||
newIds[newIds.length - 2] = CCProjectNature.CC_NATURE_ID;
|
||||
newIds[newIds.length - 1] = QtNature.ID;
|
||||
projDesc.setNatureIds(newIds);
|
||||
|
||||
ICommand command = projDesc.newCommand();
|
||||
// Builders
|
||||
ICommand command = description.newCommand();
|
||||
command.setBuilderName(QtBuilder.ID);
|
||||
command.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
|
||||
projDesc.setBuildSpec(new ICommand[] { command });
|
||||
description.setBuildSpec(new ICommand[] { command });
|
||||
}
|
||||
|
||||
project.setDescription(projDesc, monitor);
|
||||
@Override
|
||||
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
|
||||
setBundle(Activator.getDefault().getBundle());
|
||||
super.generate(model, monitor);
|
||||
|
||||
IPathEntry[] entries = new IPathEntry[] { CoreModel.newOutputEntry(sourceFolder.getFullPath()) };
|
||||
CoreModel.getDefault().create(project).setRawPathEntries(entries, monitor);
|
||||
// Create the sourcefolders
|
||||
IProject project = getProject();
|
||||
List<IPathEntry> entries = new ArrayList<>();
|
||||
for (SourceRoot srcRoot : getManifest().getSrcRoots()) {
|
||||
IFolder sourceFolder = project.getFolder(srcRoot.getDir());
|
||||
if (!sourceFolder.exists()) {
|
||||
sourceFolder.create(true, true, monitor);
|
||||
}
|
||||
|
||||
entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath()));
|
||||
}
|
||||
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
||||
monitor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ int main(int argc, char *argv[])
|
|||
QGuiApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
engine.load(QUrl(QStringLiteral("qrc:/src/${projectName}.qml")));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -3,4 +3,6 @@ TEMPLATE = app
|
|||
QT += qml quick
|
||||
CONFIG += c++11
|
||||
|
||||
RESOURCES += main.qrc
|
||||
RESOURCES += ${projectName}.qrc
|
||||
|
||||
qml.files = src/${projectName}.qml
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>src/${projectName}.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<templateManifest>
|
||||
<srcRoot dir="src"/>
|
||||
<file src="/templates/project2/appProject/main.cpp"
|
||||
dest="/${projectName}/src/${projectName}.cpp"/>
|
||||
<file src="/templates/project2/appProject/main.qml"
|
||||
dest="/${projectName}/src/${projectName}.qml"/>
|
||||
<file src="/templates/project2/appProject/main.pro"
|
||||
dest="/${projectName}/${projectName}.pro"/>
|
||||
<file src="/templates/project2/appProject/main.qrc"
|
||||
dest="/${projectName}/${projectName}.qrc"/>
|
||||
</templateManifest>
|
|
@ -17,7 +17,11 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.debug.ui;bundle-version="3.11.100",
|
||||
org.eclipse.cdt.ui,
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.cdt.qt.core
|
||||
org.eclipse.cdt.qt.core,
|
||||
org.eclipse.tools.templates.ui;bundle-version="1.0.0",
|
||||
org.eclipse.launchbar.core;bundle-version="2.0.0",
|
||||
org.eclipse.launchbar.ui;bundle-version="2.0.0",
|
||||
org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.cdt.internal.qt.ui.assist;x-friends:="org.eclipse.cdt.qt.ui.tests",
|
||||
|
|
BIN
qt/org.eclipse.cdt.qt.ui/icons/HelloWorld48.png
Normal file
BIN
qt/org.eclipse.cdt.qt.ui/icons/HelloWorld48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
qt/org.eclipse.cdt.qt.ui/icons/qt16.png
Normal file
BIN
qt/org.eclipse.cdt.qt.ui/icons/qt16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 983 B |
|
@ -39,9 +39,9 @@
|
|||
point="org.eclipse.ui.newWizards">
|
||||
<wizard
|
||||
category="org.eclipse.cdt.ui.newCWizards"
|
||||
class="org.eclipse.cdt.internal.qt.ui.NewQtProjectWizard"
|
||||
class="org.eclipse.cdt.internal.qt.ui.wizards.NewQtProjectWizard"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
icon="icons/newcc_app.gif"
|
||||
icon="icons/qt16.png"
|
||||
id="org.eclipse.cdt.qt.ui.newProject"
|
||||
name="%newProject.name"
|
||||
project="true">
|
||||
|
@ -124,4 +124,30 @@
|
|||
targetId="org.eclipse.cdt.qt.ui.qml">
|
||||
</hyperlinkDetector>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.tools.templates.ui.templates">
|
||||
<tag
|
||||
id="org.eclipse.cdt.qt.ui.tag"
|
||||
label="Qt">
|
||||
</tag>
|
||||
<template
|
||||
icon="icons/HelloWorld48.png"
|
||||
id="org.eclipse.cdt.qt.ui.template.helloWorld"
|
||||
label="C++/QML HelloWorld"
|
||||
wizard="org.eclipse.cdt.internal.qt.ui.wizards.HelloWorldWizard">
|
||||
<tagReference
|
||||
id="org.eclipse.cdt.qt.ui.tag">
|
||||
</tagReference>
|
||||
<description>
|
||||
A simple Hello World App with main function in C++ and the UI in QML.
|
||||
</description>
|
||||
</template>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.launchbar.ui.launchBarUIContributions">
|
||||
<descriptorUI
|
||||
descriptorTypeId="org.eclipse.cdt.qt.core.launchDescriptorType"
|
||||
labelProvider="org.eclipse.cdt.internal.qt.ui.launch.QtLaunchDescriptorLabelProvider">
|
||||
</descriptorUI>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
@ -29,15 +30,11 @@ public class Activator extends AbstractUIPlugin {
|
|||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.eclipse.cdt.qt.ui"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_QT_16 = "qt16"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
public static Image getQtLogo() {
|
||||
return null;
|
||||
}
|
||||
|
@ -51,12 +48,14 @@ public class Activator extends AbstractUIPlugin {
|
|||
super.start(context);
|
||||
plugin = this;
|
||||
|
||||
ImageRegistry imageRegistry = getImageRegistry();
|
||||
imageRegistry.put(IMG_QT_16, imageDescriptorFromPlugin(PLUGIN_ID, "icons/qt16.png")); //$NON-NLS-1$
|
||||
|
||||
// Use a save participant to grab any changed resources while this
|
||||
// plugin was inactive
|
||||
QtResourceChangeListener resourceManager = new QtResourceChangeListener();
|
||||
ISaveParticipant saveParticipant = new QtWorkspaceSaveParticipant();
|
||||
ISavedState lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(Activator.PLUGIN_ID,
|
||||
saveParticipant);
|
||||
ISavedState lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(Activator.PLUGIN_ID, saveParticipant);
|
||||
if (lastState != null) {
|
||||
lastState.processResourceChangeEvents(resourceManager);
|
||||
}
|
||||
|
@ -125,4 +124,8 @@ public class Activator extends AbstractUIPlugin {
|
|||
return ref != null ? context.getService(ref) : null;
|
||||
}
|
||||
|
||||
public static Image getImage(String key) {
|
||||
return plugin.getImageRegistry().get(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 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.internal.qt.ui;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.project.QtProjectGenerator;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||
|
||||
public class NewQtProjectWizard extends BasicNewProjectResourceWizard {
|
||||
|
||||
@Override
|
||||
public boolean performFinish() {
|
||||
if (!super.performFinish()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
monitor.beginTask("Generating project", 1);
|
||||
QtProjectGenerator generator = new QtProjectGenerator(getNewProject());
|
||||
generator.generate(monitor);
|
||||
monitor.done();
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
getContainer().run(false, true, op);
|
||||
} catch (InvocationTargetException | InterruptedException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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.internal.qt.ui.launch;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.ui.Activator;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.launchbar.core.ILaunchDescriptor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
public class QtLaunchDescriptorLabelProvider extends LabelProvider {
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof ILaunchDescriptor) {
|
||||
return ((ILaunchDescriptor) element).getName();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
return Activator.getImage(Activator.IMG_QT_16);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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.internal.qt.ui.wizards;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.project.QtProjectGenerator;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyOperation;
|
||||
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||
|
||||
public class HelloWorldWizard extends BasicNewResourceWizard {
|
||||
|
||||
private WizardNewProjectCreationPage mainPage;
|
||||
|
||||
@Override
|
||||
public void addPages() {
|
||||
mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
|
||||
@Override
|
||||
public void createControl(Composite parent) {
|
||||
super.createControl(parent);
|
||||
createWorkingSetGroup((Composite) getControl(), getSelection(),
|
||||
new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
|
||||
Dialog.applyDialogFont(getControl());
|
||||
}
|
||||
};
|
||||
mainPage.setTitle("New Qt Project"); //$NON-NLS-1$
|
||||
mainPage.setDescription("Specify properties of new Qt project."); //$NON-NLS-1$
|
||||
this.addPage(mainPage);
|
||||
}
|
||||
|
||||
protected String getTemplateManifestPath() {
|
||||
return "templates/project2/appProject/manifest.xml"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performFinish() {
|
||||
QtProjectGenerator generator = new QtProjectGenerator();
|
||||
generator.setTemplateManifestPath(getTemplateManifestPath());
|
||||
generator.setProjectName(mainPage.getProjectName());
|
||||
if (!mainPage.useDefaults()) {
|
||||
generator.setLocationURI(mainPage.getLocationURI());
|
||||
}
|
||||
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
|
||||
try {
|
||||
getContainer().run(true, true, new WorkspaceModifyOperation() {
|
||||
@Override
|
||||
protected void execute(IProgressMonitor monitor)
|
||||
throws CoreException, InvocationTargetException, InterruptedException {
|
||||
monitor.beginTask("Generating project", 1); //$NON-NLS-1$
|
||||
generator.generate(model, monitor);
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISchedulingRule getRule() {
|
||||
return ResourcesPlugin.getWorkspace().getRoot();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench theWorkbench, IStructuredSelection currentSelection) {
|
||||
super.init(theWorkbench, currentSelection);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2016 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.internal.qt.ui.wizards;
|
||||
|
||||
import org.eclipse.tools.templates.ui.TemplateSelectionPage;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||
|
||||
public class NewQtProjectWizard extends BasicNewResourceWizard {
|
||||
|
||||
private static final String QT_TAG_ID = "org.eclipse.cdt.qt.ui.tag"; //$NON-NLS-1$
|
||||
|
||||
private TemplateSelectionPage templateSelectionPage;
|
||||
|
||||
@Override
|
||||
public void addPages() {
|
||||
templateSelectionPage = new TemplateSelectionPage("templateSelection", QT_TAG_ID); //$NON-NLS-1$
|
||||
templateSelectionPage.setTitle("Template for New Qt Project");
|
||||
this.addPage(templateSelectionPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performFinish() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -94,6 +94,7 @@
|
|||
</feature>
|
||||
<feature id="org.eclipse.cdt.arduino">
|
||||
</feature>
|
||||
<iu id="org.freemarker" version="0.0.0">
|
||||
</iu>
|
||||
<iu id="org.freemarker" version="0.0.0"/>
|
||||
<iu id="org.eclipse.tools.templates.freemarker" version="0.0.0"/>
|
||||
<iu id="org.eclipse.tools.templates.ui" version="0.0.0"/>
|
||||
</site>
|
||||
|
|
|
@ -67,6 +67,11 @@
|
|||
<unit id="org.eclipse.wst.xml_ui.feature.feature.group" version="0.0.0"/>
|
||||
<repository location="http://download.eclipse.org/releases/neon/"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.tools.templates.freemarker" version="0.0.0"/>
|
||||
<unit id="org.eclipse.tools.templates.ui" version="0.0.0"/>
|
||||
<repository location="https://hudson.eclipse.org/cdt/job/tools-templates-master/lastSuccessfulBuild/artifact/repo/target/repository/"/>
|
||||
</location>
|
||||
</locations>
|
||||
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<launcherArgs>
|
||||
|
|
|
@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.remote.serial.core;bundle-version="1.0.0",
|
||||
com.google.gson;bundle-version="2.2.4",
|
||||
org.apache.commons.compress;bundle-version="1.6.0",
|
||||
org.freemarker;bundle-version="2.3.22"
|
||||
org.freemarker;bundle-version="2.3.22",
|
||||
org.eclipse.launchbar.remote.core;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
|
|
@ -109,4 +109,11 @@
|
|||
</adapter>
|
||||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.launchbar.core.launchTargetTypes">
|
||||
<launchTargetType
|
||||
id="org.eclipse.cdt.arduino.core.connectionType"
|
||||
provider="org.eclipse.cdt.arduino.core.internal.remote.ArduinoLaunchTargetProvider">
|
||||
</launchTargetType>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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.arduino.core.internal.remote;
|
||||
|
||||
import org.eclipse.launchbar.remote.core.RemoteLaunchTargetProvider;
|
||||
|
||||
public class ArduinoLaunchTargetProvider extends RemoteLaunchTargetProvider {
|
||||
|
||||
@Override
|
||||
protected String getTypeId() {
|
||||
return ArduinoRemoteConnection.TYPE_ID;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.remote.core;bundle-version="2.0.0",
|
||||
org.eclipse.remote.ui;bundle-version="2.0.0",
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.cdt.native.serial;bundle-version="1.0.0"
|
||||
org.eclipse.cdt.native.serial;bundle-version="1.0.0",
|
||||
org.eclipse.launchbar.remote.ui;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Vendor: %providerName
|
||||
|
|
|
@ -136,4 +136,17 @@
|
|||
type="org.eclipse.cdt.arduino.core.launchConfigurationType">
|
||||
</launchConfigurationTabGroup>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.launchbar.ui.launchTargetTypeUI">
|
||||
<launchTargetTypeUI
|
||||
id="org.eclipse.cdt.arduino.core.connectionType"
|
||||
labelProvider="org.eclipse.launchbar.remote.ui.RemoteLaunchTargetLabelProvider">
|
||||
</launchTargetTypeUI>
|
||||
<wizard
|
||||
class="org.eclipse.cdt.arduino.ui.internal.remote.NewArduinoTargetWizard"
|
||||
icon="icons/arduino.png"
|
||||
id="org.eclipse.cdt.arduino.ui.launchTargetWizard"
|
||||
name="Arduino">
|
||||
</wizard>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -11,17 +11,26 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.cdt.arduino.core.internal.remote.ArduinoRemoteConnection;
|
||||
import org.eclipse.cdt.arduino.ui.internal.Activator;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
import org.eclipse.remote.core.IRemoteConnectionType;
|
||||
import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
|
||||
import org.eclipse.remote.core.IRemoteServicesManager;
|
||||
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||
import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
|
||||
import org.eclipse.ui.INewWizard;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
|
||||
public class NewArduinoTargetWizard extends Wizard implements IRemoteUIConnectionWizard {
|
||||
public class NewArduinoTargetWizard extends Wizard implements IRemoteUIConnectionWizard, INewWizard {
|
||||
|
||||
private NewArduinoTargetWizardPage page;
|
||||
private IRemoteConnectionWorkingCopy workingCopy;
|
||||
private boolean isNewWizard;
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
||||
isNewWizard = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPages() {
|
||||
|
@ -36,6 +45,16 @@ public class NewArduinoTargetWizard extends Wizard implements IRemoteUIConnectio
|
|||
}
|
||||
|
||||
page.performFinish(workingCopy);
|
||||
|
||||
if (isNewWizard) {
|
||||
// if called as a new wizard, we need to do the save
|
||||
try {
|
||||
workingCopy.save();
|
||||
} catch (RemoteConnectionException e) {
|
||||
Activator.log(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue