Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'toolchains/arduino/org.eclipse.cdt.arduino.ui')
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/.classpath7
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/.gitignore1
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/.project39
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF22
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/about.html24
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/build.properties6
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/arduino.pngbin0 -> 913 bytes
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/cprojects.gifbin0 -> 365 bytes
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/newcc_app.gifbin0 -> 630 bytes
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml68
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/pom.xml17
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/Activator.java83
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoDescriptorLabelProvider.java32
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoLaunchConsole.java80
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java53
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoRemoteServicesUI.java67
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java111
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizard.java72
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizardPage.java120
21 files changed, 813 insertions, 0 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/.classpath b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.classpath
new file mode 100644
index 00000000000..b9a5b1ec649
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/.gitignore b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.gitignore
new file mode 100644
index 00000000000..b83d22266ac
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/.project b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.project
new file mode 100644
index 00000000000..25563f6d13c
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.project
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.arduino.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.jdt.core.prefs b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f42de363afa
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.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.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.m2e.core.prefs b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000000..f897a7f1cb2
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF b/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..70675b0bd7c
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Arduino UI
+Bundle-SymbolicName: org.eclipse.cdt.arduino.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.arduino.ui.internal.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.expressions,
+ org.eclipse.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.ui.console,
+ org.eclipse.ui.ide,
+ org.eclipse.debug.ui,
+ org.eclipse.launchbar.core,
+ org.eclipse.launchbar.ui,
+ org.eclipse.cdt.arduino.core,
+ 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"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/about.html b/toolchains/arduino/org.eclipse.cdt.arduino.ui/about.html
new file mode 100644
index 00000000000..d7c511887d6
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
+
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 22, 2007</p>
+<h3>License</h3>
+
+<p>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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html> \ No newline at end of file
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/build.properties b/toolchains/arduino/org.eclipse.cdt.arduino.ui/build.properties
new file mode 100644
index 00000000000..1eb98901393
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/build.properties
@@ -0,0 +1,6 @@
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html
+source.. = src/
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/arduino.png b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/arduino.png
new file mode 100644
index 00000000000..2c45ddc2c1a
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/arduino.png
Binary files differ
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/cprojects.gif b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/cprojects.gif
new file mode 100644
index 00000000000..fcc08ad89c6
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/cprojects.gif
Binary files differ
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/newcc_app.gif b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/newcc_app.gif
new file mode 100644
index 00000000000..4b39411daf5
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/icons/newcc_app.gif
Binary files differ
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml
new file mode 100644
index 00000000000..3879b043204
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="org.eclipse.cdt.arduino.core.launchConfigurationType"
+ icon="icons/logo.png"
+ id="org.eclipse.cdt.arduino.ui.launchConfigurationTypeImage1">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.cdt.arduino.ui.newCategory"
+ class="org.eclipse.cdt.arduino.ui.internal.remote.NewArduinoTargetWizard"
+ hasPages="true"
+ icon="icons/arduino.png"
+ id="org.eclipse.cdt.arduino.ui.newTargetWizard"
+ name="Android Target"
+ project="false">
+ </wizard>
+ <wizard
+ category="org.eclipse.cdt.ui.newCWizards"
+ class="org.eclipse.cdt.arduino.ui.internal.project.NewArduinoProjectWizard"
+ icon="icons/newcc_app.gif"
+ id="org.eclipse.cdt.arduino.ui.newProjectWizard"
+ name="Arduino Project"
+ project="true">
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.arduino.core.consoleService">
+ <provider
+ class="org.eclipse.cdt.arduino.ui.internal.launch.ArduinoLaunchConsole">
+ </provider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.eclipse.cdt.arduino.ui.internal.remote.ArduinoTargetPropertyPage"
+ id="org.eclipse.cdt.arduino.ui.targetPropertyPage"
+ name="Arduino"
+ selectionFilter="single">
+ <enabledWhen>
+ <adapt
+ type="org.eclipse.cdt.arduino.core.remote.IArduinoRemoteConnection">
+ </adapt>
+ </enabledWhen>
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.launchbar.ui.launchBarUIContributions">
+ <descriptorUI
+ descriptorTypeId="org.eclipse.cdt.arduino.core.descriptorType"
+ labelProvider="org.eclipse.cdt.arduino.ui.internal.launch.ArduinoDescriptorLabelProvider">
+ </descriptorUI>
+ </extension>
+ <extension
+ point="org.eclipse.remote.core.remoteServices">
+ <connectionTypeService
+ connectionTypeId="org.eclipse.cdt.arduino.core.connectionType"
+ factory="org.eclipse.cdt.arduino.ui.internal.remote.ArduinoRemoteServicesUI$Factory"
+ service="org.eclipse.remote.ui.IRemoteUIConnectionService">
+ </connectionTypeService>
+ </extension>
+</plugin>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/pom.xml b/toolchains/arduino/org.eclipse.cdt.arduino.ui/pom.xml
new file mode 100644
index 00000000000..f5173c9ba76
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>cdt-parent</artifactId>
+ <version>8.6.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.cdt.arduino.ui</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/Activator.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/Activator.java
new file mode 100644
index 00000000000..d9252a18b76
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/Activator.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.arduino.ui.internal;
+
+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;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.arduino.ui"; //$NON-NLS-1$
+
+ public static final String IMG_ARDUINO = "arduino"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ ImageRegistry imageRegistry = getImageRegistry();
+ imageRegistry.put(IMG_ARDUINO, imageDescriptorFromPlugin(PLUGIN_ID, "icons/cprojects.gif")); //$NON-NLS-1$
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static BundleContext getContext() {
+ return plugin.getBundle().getBundleContext();
+ }
+
+ public static String getId() {
+ return plugin.getBundle().getSymbolicName();
+ }
+
+ public Image getImage(String id) {
+ return getImageRegistry().get(id);
+ }
+
+ public static void log(Exception e) {
+ if (e instanceof CoreException) {
+ plugin.getLog().log(((CoreException) e).getStatus());
+ } else {
+ plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+ }
+
+ 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/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoDescriptorLabelProvider.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoDescriptorLabelProvider.java
new file mode 100644
index 00000000000..08f9242861a
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoDescriptorLabelProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.arduino.ui.internal.launch;
+
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public class ArduinoDescriptorLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ return Activator.getDefault().getImage(Activator.IMG_ARDUINO);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ILaunchDescriptor)
+ return ((ILaunchDescriptor) element).getName();
+ return super.getText(element);
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoLaunchConsole.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoLaunchConsole.java
new file mode 100644
index 00000000000..9365db0edc4
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/launch/ArduinoLaunchConsole.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.arduino.ui.internal.launch;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.cdt.arduino.core.ArduinoLaunchConsoleService;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IOConsoleOutputStream;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.progress.UIJob;
+
+public class ArduinoLaunchConsole implements ArduinoLaunchConsoleService {
+
+ private static MessageConsole console;
+
+ public ArduinoLaunchConsole() {
+ if (console == null) {
+ console = new MessageConsole("Arduino Launch", null);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ }
+ }
+
+ @Override
+ public void monitor(final Process process) {
+ console.clearConsole();
+ console.activate();
+
+ new UIJob("Start Arduino Console") {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ final IOConsoleOutputStream out = console.newOutputStream();
+ out.setColor(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
+ new Thread("Arduino Launch Console Output") {
+ public void run() {
+ try (InputStream processOut = process.getInputStream()) {
+ for (int c = processOut.read(); c >= 0; c = processOut.read()) {
+ out.write(c);
+ }
+ } catch (IOException e) {
+ // Nothing. Just exit
+ }
+ }
+ }.start();
+
+ final IOConsoleOutputStream err = console.newOutputStream();
+ err.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
+ new Thread("Arduino Launch Console Output") {
+ public void run() {
+ try (InputStream processErr = process.getErrorStream()) {
+ for (int c = processErr.read(); c >= 0; c = processErr.read()) {
+ err.write(c);
+ }
+ } catch (IOException e) {
+ // Nothing. Just exit
+ }
+ }
+ }.start();
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java
new file mode 100644
index 00000000000..58fc1d2d8ca
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java
@@ -0,0 +1,53 @@
+package org.eclipse.cdt.arduino.ui.internal.project;
+
+import org.eclipse.cdt.arduino.core.ArduinoProjectGenerator;
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+
+public class NewArduinoProjectWizard extends BasicNewProjectResourceWizard {
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ }
+
+ @Override
+ public boolean performFinish() {
+ if (!super.performFinish())
+ return false;
+
+ new Job("Creating Aurdino Project") {
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final ArduinoProjectGenerator generator = new ArduinoProjectGenerator(getNewProject());
+ generator.setupArduinoProject(monitor);
+ getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IWorkbenchPage activePage = getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IDE.openEditor(activePage, generator.getSourceFile());
+ } catch (PartInitException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ }.schedule();
+
+ return true;
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoRemoteServicesUI.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoRemoteServicesUI.java
new file mode 100644
index 00000000000..39caf9f327d
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoRemoteServicesUI.java
@@ -0,0 +1,67 @@
+package org.eclipse.cdt.arduino.ui.internal.remote;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteConnectionType.Service;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
+import org.eclipse.remote.ui.IRemoteUIConnectionService;
+import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class ArduinoRemoteServicesUI extends PlatformObject implements IRemoteUIConnectionService {
+
+ private final IRemoteConnectionType connectionType;
+
+ public ArduinoRemoteServicesUI(IRemoteConnectionType connectionType) {
+ this.connectionType = connectionType;
+ }
+
+ @Override
+ public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) {
+ try {
+ context.run(false, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ connection.open(monitor);
+ } catch (RemoteConnectionException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ });
+ } catch (InvocationTargetException | InterruptedException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+ }
+
+ @Override
+ public IRemoteConnectionType getConnectionType() {
+ return connectionType;
+ }
+
+ @Override
+ public IRemoteUIConnectionWizard getConnectionWizard(Shell shell) {
+ return new NewArduinoTargetWizard();
+ }
+
+ public static class Factory implements IRemoteConnectionType.Service.Factory {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends Service> T getService(IRemoteConnectionType connectionType, Class<T> service) {
+ if (IRemoteUIConnectionService.class.equals(service)) {
+ return (T) new ArduinoRemoteServicesUI(connectionType);
+ }
+ return null;
+ }
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java
new file mode 100644
index 00000000000..3d03a76c259
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java
@@ -0,0 +1,111 @@
+package org.eclipse.cdt.arduino.ui.internal.remote;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.cdt.arduino.core.Board;
+import org.eclipse.cdt.arduino.core.IArduinoBoardManager;
+import org.eclipse.cdt.arduino.core.IArduinoRemoteConnection;
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+import org.eclipse.cdt.serial.SerialPort;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class ArduinoTargetPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
+
+ private Combo portSelector;
+ private Combo boardSelector;
+
+ private Board[] boards;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+
+ IRemoteConnection remoteConnection = (IRemoteConnection) getElement().getAdapter(IRemoteConnection.class);
+ IArduinoRemoteConnection arduinoRemote = remoteConnection.getService(IArduinoRemoteConnection.class);
+
+ Label portLabel = new Label(comp, SWT.NONE);
+ portLabel.setText("Serial Port:");
+
+ portSelector = new Combo(comp, SWT.READ_ONLY);
+ portSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ String currentPort = arduinoRemote.getPortName();
+ int i = 0, portSel = -1;
+ try {
+ for (String port : SerialPort.list()) {
+ portSelector.add(port);
+ if (port.equals(currentPort)) {
+ portSel = i;
+ } else {
+ portSel = portSel < 0 ? 0 : portSel;
+ }
+ i++;
+ }
+ } catch (IOException e) {
+ Activator.log(e);
+ }
+ if (portSel >= 0) {
+ portSelector.select(portSel);
+ } else {
+ setMessage("No serial ports", ERROR);
+ setValid(false);
+ }
+
+ Label boardLabel = new Label(comp, SWT.NONE);
+ boardLabel.setText("Board type:");
+
+ boardSelector = new Combo(comp, SWT.READ_ONLY);
+ boardSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Board currentBoard = arduinoRemote.getBoard();
+ IArduinoBoardManager boardManager = Activator.getService(IArduinoBoardManager.class);
+ Collection<Board> boardList = boardManager.getBoards();
+ boards = new Board[boardList.size()];
+ i = 0;
+ int boardSel = 0;
+ for (Board board : boardList) {
+ boards[i] = board;
+ boardSelector.add(board.getName());
+ if (board.equals(currentBoard)) {
+ boardSel = i;
+ }
+ i++;
+ }
+ boardSelector.select(boardSel);
+
+ return comp;
+ }
+
+ @Override
+ public boolean performOk() {
+ IRemoteConnection remoteConnection = (IRemoteConnection) getElement().getAdapter(IRemoteConnection.class);
+ IRemoteConnectionWorkingCopy workingCopy = remoteConnection.getWorkingCopy();
+
+ String portName = portSelector.getItem(portSelector.getSelectionIndex());
+ workingCopy.setAttribute(IArduinoRemoteConnection.PORT_NAME, portName);
+
+ Board board = boards[boardSelector.getSelectionIndex()];
+ workingCopy.setAttribute(IArduinoRemoteConnection.BOARD_ID, board.getId());
+
+ try {
+ workingCopy.save();
+ } catch (RemoteConnectionException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ return true;
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizard.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizard.java
new file mode 100644
index 00000000000..a3d905a508e
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizard.java
@@ -0,0 +1,72 @@
+package org.eclipse.cdt.arduino.ui.internal.remote;
+
+import java.util.Set;
+
+import org.eclipse.cdt.arduino.core.IArduinoRemoteConnection;
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+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;
+
+public class NewArduinoTargetWizard extends Wizard implements IRemoteUIConnectionWizard {
+
+ private NewArduinoTargetWizardPage page;
+ private IRemoteConnectionWorkingCopy workingCopy;
+
+ @Override
+ public void addPages() {
+ page = new NewArduinoTargetWizardPage();
+ addPage(page);
+ }
+
+ @Override
+ public boolean performFinish() {
+ if (getConnection() == null) {
+ return false;
+ }
+
+ workingCopy.setAttribute(IArduinoRemoteConnection.PORT_NAME, page.portName);
+ workingCopy.setAttribute(IArduinoRemoteConnection.BOARD_ID, page.board.getId());
+ return true;
+ }
+
+ @Override
+ public IRemoteConnectionWorkingCopy open() {
+ return getConnection();
+ }
+
+ @Override
+ public IRemoteConnectionWorkingCopy getConnection() {
+ if (workingCopy == null) {
+ IRemoteServicesManager remoteManager = Activator.getService(IRemoteServicesManager.class);
+ IRemoteConnectionType connectionType = remoteManager.getConnectionType(IArduinoRemoteConnection.TYPE_ID);
+ try {
+ workingCopy = connectionType.newConnection(page.name);
+ } catch (RemoteConnectionException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ return null;
+ }
+ }
+
+ return workingCopy;
+ }
+
+ @Override
+ public void setConnection(IRemoteConnectionWorkingCopy connection) {
+ workingCopy = connection;
+ }
+
+ @Override
+ public void setConnectionName(String name) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void setInvalidConnectionNames(Set<String> names) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizardPage.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizardPage.java
new file mode 100644
index 00000000000..522f4142fef
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/NewArduinoTargetWizardPage.java
@@ -0,0 +1,120 @@
+package org.eclipse.cdt.arduino.ui.internal.remote;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.arduino.core.Board;
+import org.eclipse.cdt.arduino.core.IArduinoBoardManager;
+import org.eclipse.cdt.arduino.ui.internal.Activator;
+import org.eclipse.cdt.serial.SerialPort;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class NewArduinoTargetWizardPage extends WizardPage {
+
+ String name;
+ private Text nameText;
+
+ String portName;
+ private String[] portNames;
+ private Combo portCombo;
+
+ Board board;
+ private Board[] boards;
+ private Combo boardCombo;
+
+ public NewArduinoTargetWizardPage() {
+ super("NewArduinoTargetPage");
+ setDescription("New Arduino Target settings");
+ setTitle("New Arduino Target");
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+
+ Label nameLabel = new Label(comp, SWT.NONE);
+ nameLabel.setText("Target name:");
+
+ nameText = new Text(comp, SWT.BORDER | SWT.SINGLE);
+ nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ nameText.setText("");
+ nameText.addKeyListener(new KeyListener() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ updateStatus();
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+
+ Label portLabel = new Label(comp, SWT.NONE);
+ portLabel.setText("Serial port:");
+
+ portCombo = new Combo(comp, SWT.READ_ONLY);
+ portCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ try {
+ portNames = SerialPort.list();
+ } catch (IOException e) {
+ portNames = new String[0];
+ Activator.log(e);
+ }
+ for (String portName : portNames) {
+ portCombo.add(portName);
+ }
+ portCombo.select(0);
+ portCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateStatus();
+ }
+ });
+
+ IArduinoBoardManager boardManager = Activator.getService(IArduinoBoardManager.class);
+
+ Label boardLabel = new Label(comp, SWT.NONE);
+ boardLabel.setText("Board type:");
+
+ boardCombo = new Combo(comp, SWT.READ_ONLY);
+ boardCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ boards = boardManager.getBoards().toArray(new Board[0]);
+ for (Board board : boards) {
+ boardCombo.add(board.getName());
+ }
+ boardCombo.select(0);
+ boardCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateStatus();
+ }
+ });
+
+ setControl(comp);
+ setPageComplete(false);
+ }
+
+ private void updateStatus() {
+ name = nameText.getText();
+
+ int portIndex = portCombo.getSelectionIndex();
+ portName = portIndex < 0 ? null : portNames[portIndex];
+
+ int boardIndex = boardCombo.getSelectionIndex();
+ board = boardIndex < 0 ? null : boards[boardIndex];
+
+ setPageComplete(!name.isEmpty() && portName != null && board != null);
+ }
+
+}

Back to the top