1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Bug 491062: [Launchbar] Add preference to control Build button

https://bugs.eclipse.org/bugs/show_bug.cgi?id=491062

Signed-off-by: Vincent Guignot <vincent.guignot@ingenico.com>
Change-Id: I4de5a684b4d694db81c6cd782bdbc9c03b4a4747
This commit is contained in:
Vincent Guignot 2016-04-05 11:31:51 +02:00 committed by Gerrit Code Review @ Eclipse.org
parent c3f9546a47
commit 3ad5cd3e42
7 changed files with 35 additions and 19 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
@ -59,6 +60,7 @@ public class Activator extends AbstractUIPlugin {
// Preference ids
public static final String PREF_ENABLE_LAUNCHBAR = "enableLaunchBar"; //$NON-NLS-1$
public static final String PREF_ENABLE_TARGETSELECTOR = "enableTargetSelector"; //$NON-NLS-1$
public static final String PREF_ENABLE_BUILDBUTTON = "enableBuildButton"; //$NON-NLS-1$
public static final String PREF_LAUNCH_HISTORY_SIZE = "launchHistorySize"; //$NON-NLS-1$
// The shared instance

View file

@ -8,6 +8,7 @@
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
@ -36,16 +37,16 @@ public class LaunchBarInjector {
@Inject
MApplication application;
@Inject
IEventBroker eventBroker;
@Execute
void execute() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR);
injectIntoAll(enabled);
// Watch for new trimmed windows and inject there too.
eventBroker.subscribe(UIEvents.TrimmedWindow.TOPIC_TRIMBARS, new EventHandler() {
@Override
@ -72,13 +73,13 @@ public class LaunchBarInjector {
boolean enabled = Boolean.parseBoolean(event.getNewValue().toString());
injectIntoAll(enabled);
}
if (event.getProperty().equals(Activator.PREF_ENABLE_TARGETSELECTOR)) {
if (event.getProperty().equals(Activator.PREF_ENABLE_TARGETSELECTOR)|| event.getProperty().equals(Activator.PREF_ENABLE_BUILDBUTTON)) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR);
boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR);
if (enabled){
injectIntoAll(false);
injectIntoAll(true);
}
}
}
}
});
@ -99,7 +100,7 @@ public class LaunchBarInjector {
private void injectLaunchBar(MTrimBar trimBar, boolean enabled) {
// are we enabled or not
// Search for control in trimbar
MTrimElement launchBarElement = null;
for (MTrimElement trimElement : trimBar.getChildren()) {
@ -129,5 +130,5 @@ public class LaunchBarInjector {
trimBar.getChildren().add(0, launchBar);
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2015 QNX Software Systems and others.
* Copyright (c) 2014, 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
@ -7,7 +7,8 @@
*
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
@ -19,6 +20,7 @@ public class LaunchBarPreferenceInitializer extends AbstractPreferenceInitialize
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setDefault(Activator.PREF_ENABLE_BUILDBUTTON, true);
store.setDefault(Activator.PREF_ENABLE_LAUNCHBAR, true);
store.setDefault(Activator.PREF_ENABLE_TARGETSELECTOR, true);
store.setDefault(Activator.PREF_LAUNCH_HISTORY_SIZE, 3);

View file

@ -8,6 +8,7 @@
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
@ -33,6 +34,7 @@ public class LaunchBarPreferencePage extends FieldEditorPreferencePage implement
protected void createFieldEditors() {
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_LAUNCHBAR, Messages.LaunchBarPreferencePage_1, getFieldEditorParent()));
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_TARGETSELECTOR, Messages.LaunchBarPreferencePage_EnableTargetSelector, getFieldEditorParent()));
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_BUILDBUTTON, Messages.LaunchBarPreferencePage_EnableBuildButton, getFieldEditorParent()));
}
}

View file

@ -7,7 +7,8 @@
*
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
@ -34,6 +35,7 @@ public class Messages extends NLS {
public static String LaunchBarPreferencePage_0;
public static String LaunchBarPreferencePage_1;
public static String LaunchBarPreferencePage_EnableTargetSelector;
public static String LaunchBarPreferencePage_EnableBuildButton;
public static String LaunchConfigurationEditDialog_0;
public static String LaunchConfigurationEditDialog_1;
public static String LaunchConfigurationEditDialog_2;

View file

@ -8,6 +8,7 @@
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.internal.controls;
@ -66,7 +67,12 @@ public class LaunchBarControl implements ILaunchBarListener {
});
ToolBar toolBar = new ToolBar(container, SWT.FLAT);
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean buildEnabled = store.getBoolean(Activator.PREF_ENABLE_BUILDBUTTON);
if (buildEnabled) {
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
}
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
createButton(toolBar, Activator.IMG_BUTTON_STOP, Messages.LaunchBarControl_Stop, Activator.CMD_STOP);
@ -78,7 +84,7 @@ public class LaunchBarControl implements ILaunchBarListener {
configSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
configSelector.setInput(manager);
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean enabled = store.getBoolean(Activator.PREF_ENABLE_TARGETSELECTOR);
if (enabled) {
Label label = new Label(container, SWT.NONE);

View file

@ -14,14 +14,15 @@ LaunchBarControl_Build=Build
LaunchBarControl_Launch=Launch
LaunchBarControl_Stop=Stop
LaunchBarListViewer_0=Increase/Decrease size of recently used elements pane
LaunchBarPreferencePage_0=Preferences for the Launch Bar.
LaunchBarPreferencePage_1=Enable the Launch Bar.
LaunchBarPreferencePage_EnableTargetSelector=Enable the target selector.
LaunchBarPreferencePage_0=Preferences for the Launch Bar
LaunchBarPreferencePage_1=Enable the Launch Bar
LaunchBarPreferencePage_EnableTargetSelector=Enable the target selector
LaunchBarPreferencePage_EnableBuildButton=Enable the Build button
LaunchConfigurationEditDialog_0=Delete
LaunchConfigurationEditDialog_1=Duplicate
LaunchConfigurationEditDialog_2=Launch
LaunchConfigurationEditDialog_3=Confirm Delete
LaunchConfigurationEditDialog_4=Are you sure you want to delete
LaunchConfigurationEditDialog_4=Are you sure you want to delete
LaunchConfigurationEditDialog_5=Deleting launch configuration
LaunchConfigurationEditDialog_6=Duplicating launch configuration
ModeSelector_0=Launch Mode
@ -53,7 +54,7 @@ NoActiveTargetDesc=You must create a target to edit this launch configuration.
NoLaunchConfigType=No launch configuration type matches selected launch descriptor.
CannotEditLaunchConfiguration=Cannot edit this configuration.
NoLaunchModeSelected=No launch mode selected.
NoLaunchGroupSelected=No launch group found for the current selection.
NoLaunchGroupSelected=No launch group found for the current selection.
LaunchConfigurationNotFound=Launch Configuration Not Found
LaunchConfigurationNotFoundDesc=No launch configuration is found for the given launch descriptor and target.
NoLaunchTabsDefined=No launch tabs defined.