Skip to content

Commit 5102650

Browse files
committed
Merge pull request #51 from brodykenrick/master
Fix #42 -- Bad dialog for import library from menu. Also added import source folder from Arduino menu Looks good :-)
2 parents 55063fd + 81c1e5a commit 5102650

File tree

10 files changed

+316
-195
lines changed

10 files changed

+316
-195
lines changed

it.baeyens.arduino.core/OSGI-INF/l10n/bundle.properties

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
page.name = Arduino
33
category.name = Arduino
44
wizard.name = New Arduino sketch
5-
wizard.description = Create a new Arduino sketch and import arduino core code if needed.
6-
wizard.name.0 = Import Arduino libraries in the current project
7-
wizard.description.0 = Use this import wizard to import arduino libraries to you sketch
5+
wizard.description = Create a new Arduino sketch and import Arduino core code if needed.
6+
wizard.name.0 = Import Arduino libraries into the current project
7+
wizard.description.0 = Use this import wizard to import Arduino libraries to you sketch
88
wizard.name.1 = Import a folder containing source code in the current project
9-
wizard.description.1 = Use this import wizard to add code in a folder on you local drive to this project
9+
wizard.description.1 = Use this import wizard to add code in a folder on your local drive to this project
1010
category.description = Arduino Plugin commands
1111
command.description = Upload selected project to Arduino
1212
command.name = Upload Sketch
@@ -15,17 +15,19 @@ command.name.0 = New Sketch
1515
command.description.1 = Build the sketch to find errors
1616
command.name.1 = Verify
1717
command.description.2 = Open the serial monitor
18-
command.description.3 = Open the Oscilloscope
18+
command.description.5 = Open the Oscilloscope
1919
command.name.2 = Open Serial monitor
2020
command.description.3 = Add a library to the selected project
2121
command.name.3 = Add a library to the selected project
22+
command.description.4 = Add a source folder to the selected project
23+
command.name.4 = Add a source folder to the selected project
2224
command.label = Build the sketch
2325
command.label.0 = Upload the build sketch
2426
command.label.1 = Create a new sketch
2527
command.label.2 = Open the serial monitor
2628
menu.label = A&rduino
2729
command.label.3 = verify
28-
command.tooltip = In contrast to the arduino IDE this button will not build before upload.
30+
command.tooltip = In contrast to the Arduino IDE this button will not build before upload.
2931
extension.name.0 = Arduino Build Definitions
3032
builder.name = Arduino GNU Make Builder
3133
projectType.name = Arduino sketch
@@ -68,4 +70,4 @@ tool.announcement.5 = Printing size:
6870
tool.name.5 = Arduino tool Print Size
6971
content-type.name = HEX Dump for EEPROM
7072
content-type.name.0 = HEX Dump for Flash ROM
71-
command.label.4 = Open the Oscilloscope
73+
command.label.5 = Open the Oscilloscope

it.baeyens.arduino.core/plugin.xml

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
#######################################################################################
9393
-->
9494

95-
<!-- New sketch wizar -->
95+
<!-- New sketch wizard -->
9696
<extension point="org.eclipse.ui.newWizards">
9797
<category
9898
id="it.baeyens.arduino.eclipse.newWizards"
@@ -112,8 +112,8 @@
112112
</wizard>
113113
</extension>
114114

115-
<!-- Arduino Library import wizar -->
116-
<extension point="org.eclipse.ui.importWizards">
115+
<!-- Arduino Library import wizard -->
116+
<extension point="org.eclipse.ui.importWizards">
117117
<category
118118
id="it.baeyens.arduino.eclipse.importWizards"
119119
name="%category.name">
@@ -129,8 +129,8 @@
129129
</description>
130130
<selection class="org.eclipse.core.resources.IResource"/>
131131
</wizard>
132-
133-
<!-- Source code import wizar -->
132+
133+
<!-- Source code import wizard -->
134134
<wizard
135135
id="it.baeyens.arduino.Import_Source_Folder"
136136
name="%wizard.name.1"
@@ -190,22 +190,31 @@
190190
description="%command.description.2"
191191
id="it.baeyens.arduino.actions.OpenSerialMonitorAction"
192192
name="%command.name.2"/>
193-
<command
193+
<command
194194
categoryId="it.baeyens.arduino.commands"
195195
description="%command.description.3"
196196
id="it.baeyens.arduino.actions.AddLibraryAction"
197197
name="%command.name.3">
198-
</command>
199-
<command
198+
</command>
199+
200+
<command
200201
categoryId="it.baeyens.arduino.commands"
201-
defaultHandler="it.baeyens.arduino.actions.OpenScopeHandler"
202-
description="%command.description.3"
203-
id="it.baeyens.arduino.actions.OpenScopeAction"
204-
name="%command.label.4">
205-
</command>
202+
description="%command.description.4"
203+
id="it.baeyens.arduino.actions.AddSourceFolderAction"
204+
name="%command.name.4">
205+
</command>
206+
207+
<command
208+
categoryId="it.baeyens.arduino.commands"
209+
defaultHandler="it.baeyens.arduino.actions.OpenScopeHandler"
210+
description="%command.description.5"
211+
id="it.baeyens.arduino.actions.OpenScopeAction"
212+
name="%command.label.5">
213+
</command>
214+
206215
</extension>
207216

208-
<!-- Defenition: "is this a Arduino project?"
217+
<!-- Definition: "is this a Arduino project?"
209218
<extension point="org.eclipse.core.expressions.definitions">
210219
-->
211220

@@ -296,7 +305,7 @@
296305
<command
297306
commandId="it.baeyens.arduino.actions.OpenScopeAction"
298307
icon="icons/scope.png"
299-
label="%command.label.4"
308+
label="%command.label.5"
300309
style="push">
301310
</command>
302311
</toolbar>
@@ -316,13 +325,18 @@
316325
commandId="it.baeyens.arduino.actions.AddLibraryAction"
317326
style="push">
318327
</command>
328+
329+
<command
330+
commandId="it.baeyens.arduino.actions.AddSourceFolderAction"
331+
style="push">
332+
</command>
333+
319334
</menu>
320335
</menuContribution>
321336
</extension>
322337

323338
<!-- Toolbar -->
324-
ated till here -->
325-
<!-- ******************* -->
339+
<!-- ******************* -->
326340
<!-- ******************* -->
327341
<!-- ******************* -->
328342

@@ -647,19 +661,19 @@
647661

648662
<!--
649663
#######################################################################################
650-
# AVR-G++ C++ Compiler #
664+
# AVR-G++ C++ Compiler #
651665
#######################################################################################
652666
-->
653667

654668
<!--
655669
#######################################################################################
656-
# AVR C Linker #
670+
# AVR C Linker #
657671
#######################################################################################
658672
-->
659673

660674
<!--
661675
#######################################################################################
662-
# AVR C++ Linker #
676+
# AVR C++ Linker #
663677
#######################################################################################
664678
-->
665679

@@ -757,6 +771,17 @@
757771
</count>
758772
</enabledWhen>
759773
</handler>
774+
775+
<handler
776+
class="it.baeyens.arduino.actions.AddSourceFolderAction"
777+
commandId="it.baeyens.arduino.actions.AddSourceFolderAction">
778+
<enabledWhen>
779+
<count
780+
value="+">
781+
</count>
782+
</enabledWhen>
783+
</handler>
784+
760785
</extension>
761786

762787

it.baeyens.arduino.core/src/it/baeyens/arduino/actions/AddLibraryAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
3131
.findWizard("it.baeyens.arduino.Import_Arduino_Libraries");
3232
IWizard wizard;
3333
try {
34-
wizard = wizardDescriptor.createWizard();
34+
wizard = wizardDescriptor.createWizard();
3535
} catch (CoreException e) {
36-
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Filed to find import wizard", e));
37-
return null;
36+
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Failed to find import wizard", e));
37+
return null;
3838
}
3939
WizardDialog wd = new WizardDialog(ConsolePlugin.getStandardDisplay().getActiveShell(), wizard);
4040
wd.setTitle(wizard.getWindowTitle());
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package it.baeyens.arduino.actions;
2+
3+
import it.baeyens.arduino.common.ArduinoConst;
4+
import it.baeyens.arduino.common.Common;
5+
6+
import org.eclipse.core.commands.AbstractHandler;
7+
import org.eclipse.core.commands.ExecutionEvent;
8+
import org.eclipse.core.commands.ExecutionException;
9+
import org.eclipse.core.resources.IProject;
10+
import org.eclipse.core.runtime.CoreException;
11+
import org.eclipse.core.runtime.IStatus;
12+
import org.eclipse.core.runtime.Status;
13+
import org.eclipse.jface.wizard.IWizard;
14+
import org.eclipse.jface.wizard.WizardDialog;
15+
import org.eclipse.ui.PlatformUI;
16+
import org.eclipse.ui.console.ConsolePlugin;
17+
import org.eclipse.ui.wizards.IWizardDescriptor;
18+
19+
//Brody added this to be symmetrical with AddLibrary
20+
21+
public class AddSourceFolderAction extends AbstractHandler {
22+
23+
@Override
24+
public Object execute(ExecutionEvent event) throws ExecutionException {
25+
IProject SelectedProjects[] = Common.getSelectedProjects();
26+
switch (SelectedProjects.length) {
27+
case 0:
28+
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "No project found to build"));
29+
break;
30+
case 1:
31+
//
32+
IWizardDescriptor wizardDescriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
33+
.findWizard("it.baeyens.arduino.Import_Source_Folder");
34+
IWizard wizard;
35+
try {
36+
wizard = wizardDescriptor.createWizard();
37+
} catch (CoreException e) {
38+
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Failed to find import wizard", e));
39+
return null;
40+
}
41+
WizardDialog wd = new WizardDialog(ConsolePlugin.getStandardDisplay().getActiveShell(), wizard);
42+
wd.setTitle(wizard.getWindowTitle());
43+
wd.open();
44+
break;
45+
default:
46+
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Adding a source folder to multiple projects is not supported"));
47+
}
48+
return null;
49+
}
50+
51+
}

0 commit comments

Comments
 (0)