1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22: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:
Doug Schaefer 2014-06-19 15:32:16 -04:00
parent 359c8976c8
commit e35ccf64a8
3 changed files with 12 additions and 8 deletions

View file

@ -27,6 +27,7 @@ import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Widget;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
@ -103,12 +104,9 @@ public class LaunchBarInjector {
if (!enabled) {
// remove it if we're disabled
trimBar.getChildren().remove(launchBarElement);
for (MTrimElement trimElement : trimBar.getChildren()) {
if (LaunchBarControl.ID.equals(trimElement.getElementId())) {
launchBarElement = trimElement;
break;
}
}
// This seems to be a bug in the platform but for now, dispose of the widget
Widget widget = (Widget)launchBarElement.getWidget();
widget.dispose();
}
// either way, we're done
return;

View file

@ -20,7 +20,7 @@ public class LaunchBarPreferencePage extends FieldEditorPreferencePage implement
@Override
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()));
}
}

View file

@ -52,6 +52,12 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
container.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
GridLayout layout = new GridLayout(7, false);
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_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
@ -84,7 +90,7 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
}
@PreDestroy
public void shutdown() {
public void dispose() {
manager.removeListener(this);
}