Skip to content

Commit 4311ae4

Browse files
author
jantje
committed
#1409 Added optional toolbar but it is always visible :-( also #1427
1 parent 6511811 commit 4311ae4

File tree

6 files changed

+106
-11
lines changed

6 files changed

+106
-11
lines changed

io.sloeber.ui/icons/arrowdown.png

735 Bytes
Loading

io.sloeber.ui/icons/arrowup.png

746 Bytes
Loading

io.sloeber.ui/plugin.xml

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
<page
230230
class="io.sloeber.ui.project.properties.PropertyPage"
231231
id="io.sloeber.eclipse.propertypage.ArduinoProperty"
232-
name="Arduino">
232+
name="Sloeber">
233233
<filter
234234
name="projectNature"
235235
value="io.sloeber.arduinonature">
@@ -301,7 +301,7 @@
301301
<page
302302
class="io.sloeber.ui.preferences.PreferencePage"
303303
id="io.sloeber.eclipse.ArduinoPreferencePage"
304-
name="Arduino">
304+
name="Sloeber">
305305
</page>
306306
<page
307307
category="io.sloeber.eclipse.ArduinoPreferencePage"
@@ -333,7 +333,7 @@
333333
<category
334334
description="%category.arduino.description"
335335
id="io.sloeber.commands"
336-
name="Arduino">
336+
name="Sloeber">
337337
</category>
338338
<command
339339
categoryId="io.sloeber.commands"
@@ -443,6 +443,13 @@
443443
</equals></or>
444444
</with>
445445
</definition>
446+
<definition id="io.sloeber.definition.hide">
447+
<with variable="activeWorkbenchWindow.activePerspective">
448+
<equals
449+
value="io.sloeber.does.not.exists">
450+
</equals>
451+
</with>
452+
</definition>
446453
</extension>
447454

448455

@@ -454,7 +461,7 @@
454461
id="io.sloeber.toolbar.main"
455462
label="Sloeber">
456463
<visibleWhen
457-
checkEnabled="false">
464+
checkEnabled="true">
458465
<reference
459466
definitionId="io.sloeber.definition.isArduinoPerspective">
460467
</reference>
@@ -495,12 +502,69 @@
495502
label="%command.open.Plotter.label"
496503
style="push">
497504
</command>
505+
<separator
506+
name="io.sloeber.ui.separator2">
507+
</separator>
508+
<command
509+
commandId="io.sloeber.ui.actions.openPreferences"
510+
icon="icons/preferences.png"
511+
label="%command.preferences.label"
512+
style="push"
513+
tooltip="%command.open.sloeber.preferences.description">
514+
<parameter
515+
name="io.sloeber.ui.actions.openPreferences.pageId"
516+
value="io.sloeber.eclipse.propertypage.ArduinoProperty">
517+
</parameter>
518+
</command>
519+
</toolbar>
520+
<toolbar
521+
id="io.sloeber.toolbar.Extra"
522+
label="Sloeber Extra tools">
523+
<visibleWhen
524+
checkEnabled="true">
525+
<reference
526+
definitionId="io.sloeber.definition.hide">
527+
</reference>
528+
</visibleWhen>
529+
<command
530+
commandId="io.sloeber.actions.AddLibraryAction"
531+
icon="icons/library.png"
532+
id="AddLibraryAction"
533+
style="push"
534+
tooltip="%command.AddLibraryAction.description">
535+
</command>
536+
<command
537+
commandId="io.sloeber.actions.ProgramProjectAction"
538+
icon="icons/arrowup.png"
539+
id="ProgramProjectAction"
540+
tooltip="%command.program.tooltip">
541+
</command>
542+
<command
543+
commandId="io.sloeber.actions.BurnBootloaderAction"
544+
icon="icons/arrowdown.png"
545+
id="burnBootloaderAction"
546+
tooltip="%command.burnBootloader.tooltip">
547+
</command>
548+
<command
549+
commandId="io.sloeber.actions.AddSourceFolderAction"
550+
icon="icons/folder.png"
551+
id="AddSourceFolderAction"
552+
style="push"
553+
tooltip="%command.AddSourceFolder.description ">
554+
</command>
555+
<command
556+
commandId="io.sloeber.actions.ReattachLibraries"
557+
icon="icons/hammer.png"
558+
id="ReattachLibrariesAction"
559+
style="push"
560+
tooltip="%command.reattachLibraries.description">
561+
</command>
498562
</toolbar>
499563
</menuContribution>
500564
<menuContribution
501565
locationURI="menu:org.eclipse.ui.main.menu??after=Run">
502566
<menu
503-
label="A&amp;rduino">
567+
label="Sloebe&amp;r">
504568
<visibleWhen
505569
checkEnabled="false">
506570
<reference
@@ -666,7 +730,9 @@
666730
</perspectiveExtension>
667731
</extension>
668732
<extension
669-
point="org.eclipse.cdt.ui.cPropertyTab">
733+
id="io.sloeber.ui.project.properties.Sloeber"
734+
name="Sloeber"
735+
point="org.eclipse.cdt.ui.cPropertyTab">
670736
<tab
671737
class="io.sloeber.ui.project.properties.BoardSelectionPage"
672738
icon="platform:/plugin/io.sloeber.application/icons/logo_16.png"

io.sloeber.ui/src/io/sloeber/ui/actions/OpenPreferencesHandler.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,53 @@
1010
*******************************************************************************/
1111
package io.sloeber.ui.actions;
1212

13+
import static io.sloeber.ui.Activator.*;
14+
1315
import org.eclipse.core.commands.AbstractHandler;
1416
import org.eclipse.core.commands.ExecutionEvent;
1517
import org.eclipse.core.commands.ExecutionException;
18+
import org.eclipse.core.resources.IProject;
19+
import org.eclipse.core.runtime.IStatus;
20+
import org.eclipse.core.runtime.Status;
1621
import org.eclipse.jface.preference.PreferenceDialog;
1722
import org.eclipse.swt.widgets.Shell;
1823
import org.eclipse.ui.PlatformUI;
1924
import org.eclipse.ui.dialogs.PreferencesUtil;
2025

26+
import io.sloeber.ui.Messages;
27+
import io.sloeber.ui.listeners.ProjectExplorerListener;
2128
import io.sloeber.ui.preferences.PreferenceUtils;
22-
@SuppressWarnings({"unused"})
29+
30+
@SuppressWarnings({ "unused" })
2331
public class OpenPreferencesHandler extends AbstractHandler {
2432

2533
@Override
2634
public Object execute(ExecutionEvent event) throws ExecutionException {
2735
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
2836
String pageId = event.getParameter(PreferenceUtils.PREFERENCE_PARAMETER1);
2937
String[] pages = PreferenceUtils.getPreferencePages("io.sloeber"); //$NON-NLS-1$
30-
PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, pageId, pages, null);
38+
PreferenceDialog dialog = null;
39+
if (pageId.startsWith("io.sloeber.eclipse.propertypage")) { //$NON-NLS-1$
40+
IProject projects[] = ProjectExplorerListener.getSelectedProjects();
41+
switch (projects.length) {
42+
case 0:
43+
log(new Status(IStatus.ERROR, PLUGIN_ID, Messages.no_project_found));
44+
break;
45+
case 1:
46+
dialog = PreferencesUtil.createPropertyDialogOn(shell, projects[0], pageId, null, null);
47+
break;
48+
default:
49+
log(new Status(IStatus.ERROR, PLUGIN_ID,
50+
Messages.arduino_upload_project_handler_multiple_projects_found
51+
.replace(Messages.NUMBER, Integer.toString(projects.length))
52+
.replace(Messages.PROJECT_LIST, projects.toString())));
53+
}
54+
} else {
55+
dialog = PreferencesUtil.createPreferenceDialogOn(shell, pageId, pages, null);
56+
}
57+
if (dialog == null) {
58+
return null;
59+
}
3160
try {
3261
dialog.getTreeViewer().getTree().getItems()[1].setExpanded(true);
3362
} catch (RuntimeException e) {

io.sloeber.ui/src/io/sloeber/ui/messages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ BoardSelectionPage_board=Board
33
BoardSelectionPage_failed_to_find_platform=failed to find the platform {PLATFORM}\\nDid you deinstall the platform?\\nDid you import a project and did not install the platform?
44
BoardSelectionPage_platform_folder=Platform folder
55
BoardSelectionPage_platform_you_want_to_use=The platform you want to use
6-
BoardSelectionPage_upload_protocol=Upload Protocol
6+
BoardSelectionPage_upload_protocol=Programmer protocol
77
PlatformSelectionPage_hide_third_party_url=Hide 3th party json files
88
always=Always
99
arduino_upload_project_handler_build_failed=The build failed\!
@@ -127,7 +127,7 @@ ui_select_folder=Select the folder containing the source
127127
ui_show_all_warnings=show all warnings?
128128
ui_url_for_index_file=Enter URLs for package_index.json or library_index.json files one per line.
129129
ui_use_arduino_toolchain_selection=Select the toolchain like the Arduino IDE.
130-
ui_workspace_settings=Arduino Settings for this workspace:
130+
ui_workspace_settings=Sloeber Settings for this workspace:
131131
yes=Yes
132132
Invalid_Private_Hardware_folder=You can not add [sloeber]/arduinoPlugin to the private Hardware folders.
133133
Invalid_Private_Library_folder=You can not add [sloeber]/arduinoPlugin to the private Libraries folders.

io.sloeber.ui/src/io/sloeber/ui/messages_nl.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ BoardSelectionPage_board=Bord
33
BoardSelectionPage_failed_to_find_platform=Het platform " {PLATFORM}" werd niet gevonden\\nHeb je het verwijderd?\\nIs dit een geïmporteerd project(installeer dan het platform)?
44
BoardSelectionPage_platform_folder=Platform map
55
BoardSelectionPage_platform_you_want_to_use=Het platform dat je wil gebruiken
6-
BoardSelectionPage_upload_protocol=Oplaad Protocol
6+
BoardSelectionPage_upload_protocol=Programmeer Protocol
77
PlatformSelectionPage_hide_third_party_url=Verberg de json bestanden
88
always=Altijd
99
arduino_upload_project_handler_build_failed=Het bouwen is mislukt\!

0 commit comments

Comments
 (0)