1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-11 19:15:22 +02:00

480248: [LaunchBar] Add preference to disable launch bar "target

selector" 

Change-Id: I26d74addc779786403077978f9a44bc88a33b999
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=480248
Signed-off-by: Torkild U. Resheim <torkildr@gmail.com>
This commit is contained in:
Torkild U. Resheim 2015-10-21 14:32:08 +02:00
parent 50e08bc7d5
commit edd5f69a87
7 changed files with 38 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2014 QNX Software Systems and others. * Copyright (c) 2014, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
*******************************************************************************/ *******************************************************************************/
package org.eclipse.launchbar.ui.internal; package org.eclipse.launchbar.ui.internal;
@ -53,6 +54,7 @@ public class Activator extends AbstractUIPlugin {
// Preference ids // Preference ids
public static final String PREF_ENABLE_LAUNCHBAR = "enableLaunchBar"; //$NON-NLS-1$ 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_LAUNCH_HISTORY_SIZE = "launchHistorySize"; //$NON-NLS-1$ public static final String PREF_LAUNCH_HISTORY_SIZE = "launchHistorySize"; //$NON-NLS-1$
// The shared instance // The shared instance

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2014 QNX Software Systems and others. * Copyright (c) 2014, 2014 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
*******************************************************************************/ *******************************************************************************/
package org.eclipse.launchbar.ui.internal; package org.eclipse.launchbar.ui.internal;
@ -71,6 +72,14 @@ public class LaunchBarInjector {
boolean enabled = Boolean.parseBoolean(event.getNewValue().toString()); boolean enabled = Boolean.parseBoolean(event.getNewValue().toString());
injectIntoAll(enabled); injectIntoAll(enabled);
} }
if (event.getProperty().equals(Activator.PREF_ENABLE_TARGETSELECTOR)) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR);
if (enabled){
injectIntoAll(false);
injectIntoAll(true);
}
}
} }
}); });
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
*******************************************************************************/ *******************************************************************************/
package org.eclipse.launchbar.ui.internal; package org.eclipse.launchbar.ui.internal;
@ -19,6 +20,7 @@ public class LaunchBarPreferenceInitializer extends AbstractPreferenceInitialize
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setDefault(Activator.PREF_ENABLE_LAUNCHBAR, true); store.setDefault(Activator.PREF_ENABLE_LAUNCHBAR, true);
store.setDefault(Activator.PREF_ENABLE_TARGETSELECTOR, true);
store.setDefault(Activator.PREF_LAUNCH_HISTORY_SIZE, 3); store.setDefault(Activator.PREF_LAUNCH_HISTORY_SIZE, 3);
} }

View file

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

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2014 QNX Software Systems and others. * Copyright (c) 2014, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
*******************************************************************************/ *******************************************************************************/
package org.eclipse.launchbar.ui.internal; package org.eclipse.launchbar.ui.internal;
@ -32,6 +33,7 @@ public class Messages extends NLS {
public static String LaunchBarListViewer_0; public static String LaunchBarListViewer_0;
public static String LaunchBarPreferencePage_0; public static String LaunchBarPreferencePage_0;
public static String LaunchBarPreferencePage_1; public static String LaunchBarPreferencePage_1;
public static String LaunchBarPreferencePage_EnableTargetSelector;
public static String LaunchConfigurationEditDialog_0; public static String LaunchConfigurationEditDialog_0;
public static String LaunchConfigurationEditDialog_1; public static String LaunchConfigurationEditDialog_1;
public static String LaunchConfigurationEditDialog_2; public static String LaunchConfigurationEditDialog_2;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2014 QNX Software Systems and others. * Copyright (c) 2014, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
*******************************************************************************/ *******************************************************************************/
package org.eclipse.launchbar.ui.internal.controls; package org.eclipse.launchbar.ui.internal.controls;
@ -14,7 +15,7 @@ import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import org.eclipse.debug.core.ILaunchMode; import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.launchbar.core.ILaunchDescriptor; import org.eclipse.launchbar.core.ILaunchDescriptor;
import org.eclipse.launchbar.core.internal.LaunchBarManager; import org.eclipse.launchbar.core.internal.LaunchBarManager;
import org.eclipse.launchbar.core.internal.LaunchBarManager.Listener; import org.eclipse.launchbar.core.internal.LaunchBarManager.Listener;
@ -75,13 +76,17 @@ public class LaunchBarControl implements Listener {
configSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); configSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
configSelector.setInput(manager); configSelector.setInput(manager);
Label label = new Label(container, SWT.NONE); IPreferenceStore store = Activator.getDefault().getPreferenceStore();
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_TARGETSELECTOR);
label.setText(Messages.LaunchBarControl_0 + ":"); //$NON-NLS-1$ if (enabled) {
Label label = new Label(container, SWT.NONE);
targetSelector = new TargetSelector(container, SWT.NONE); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
targetSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label.setText(Messages.LaunchBarControl_0 + ":"); //$NON-NLS-1$
targetSelector.setInput(manager);
targetSelector = new TargetSelector(container, SWT.NONE);
targetSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
targetSelector.setInput(manager);
}
syncSelectors(); syncSelectors();
} }
@ -147,7 +152,9 @@ public class LaunchBarControl implements Listener {
@Override @Override
public void launchTargetsChanged() { public void launchTargetsChanged() {
targetSelector.refresh(); if (targetSelector!=null){
targetSelector.refresh();
}
} }
public ConfigSelector getConfigSelector() { public ConfigSelector getConfigSelector() {

View file

@ -16,6 +16,7 @@ LaunchBarControl_Stop=Stop
LaunchBarListViewer_0=Increase/Decrease size of recently used elements pane LaunchBarListViewer_0=Increase/Decrease size of recently used elements pane
LaunchBarPreferencePage_0=Preferences for the Launch Bar. LaunchBarPreferencePage_0=Preferences for the Launch Bar.
LaunchBarPreferencePage_1=Enable the Launch Bar. LaunchBarPreferencePage_1=Enable the Launch Bar.
LaunchBarPreferencePage_EnableTargetSelector=Enable the target selector.
LaunchConfigurationEditDialog_0=Delete LaunchConfigurationEditDialog_0=Delete
LaunchConfigurationEditDialog_1=Duplicate LaunchConfigurationEditDialog_1=Duplicate
LaunchConfigurationEditDialog_2=Launch LaunchConfigurationEditDialog_2=Launch