mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fixed up the disable of the LaunchBar so it really removes it.
Not sure if it's a bug, but I had to dispose of the control myself.
This commit is contained in:
parent
359c8976c8
commit
e35ccf64a8
3 changed files with 12 additions and 8 deletions
|
@ -27,6 +27,7 @@ import org.eclipse.e4.ui.workbench.UIEvents;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
|
@ -103,12 +104,9 @@ public class LaunchBarInjector {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
// remove it if we're disabled
|
// remove it if we're disabled
|
||||||
trimBar.getChildren().remove(launchBarElement);
|
trimBar.getChildren().remove(launchBarElement);
|
||||||
for (MTrimElement trimElement : trimBar.getChildren()) {
|
// This seems to be a bug in the platform but for now, dispose of the widget
|
||||||
if (LaunchBarControl.ID.equals(trimElement.getElementId())) {
|
Widget widget = (Widget)launchBarElement.getWidget();
|
||||||
launchBarElement = trimElement;
|
widget.dispose();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// either way, we're done
|
// either way, we're done
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class LaunchBarPreferencePage extends FieldEditorPreferencePage implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_LAUNCHBAR, "Enable the Launch Bar (may require restart).", getFieldEditorParent()));
|
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_LAUNCHBAR, "Enable the Launch Bar.", getFieldEditorParent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,12 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
|
||||||
container.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
container.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||||
GridLayout layout = new GridLayout(7, false);
|
GridLayout layout = new GridLayout(7, false);
|
||||||
container.setLayout(layout);
|
container.setLayout(layout);
|
||||||
|
container.addDisposeListener(new DisposeListener() {
|
||||||
|
@Override
|
||||||
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
|
LaunchBarControl.this.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
createButton(container, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
createButton(container, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||||
createButton(container, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
createButton(container, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
||||||
|
@ -84,7 +90,7 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
public void shutdown() {
|
public void dispose() {
|
||||||
manager.removeListener(this);
|
manager.removeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue