commit e56af8b3a6992ce1b2dffe40f170ffd09327d6ac
parent 6095a8e234384eb4d9ba028998e1bdc1be147533
Author: Dan Amlund <dan@danamlund.dk>
Date: Sat, 21 Oct 2017 14:40:08 +0200
fix okbutton being disabled sometimes, remember previous result
Diffstat:
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dk.danamlund.quicklaunch/META-INF/MANIFEST.MF b/dk.danamlund.quicklaunch/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quick Launch Configuration
Bundle-SymbolicName: dk.danamlund.quicklaunch;singleton:=true
-Bundle-Version: 1.1
+Bundle-Version: 1.2
Require-Bundle: org.eclipse.ui,
org.eclipse.debug.core;bundle-version="3.10.100",
org.eclipse.equinox.common;bundle-version="3.8.0",
diff --git a/dk.danamlund.quicklaunch/src/dk/danamlund/quicklaunch/QuickLaunchConfigurationDialog.java b/dk.danamlund.quicklaunch/src/dk/danamlund/quicklaunch/QuickLaunchConfigurationDialog.java
@@ -7,6 +7,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.FilteredList;
@@ -14,6 +15,7 @@ import org.eclipse.ui.dialogs.FilteredList.FilterMatcher;
public class QuickLaunchConfigurationDialog extends ElementListSelectionDialog {
private final String runMode;
+ private Object previousSelection = null;
public QuickLaunchConfigurationDialog(String runMode) {
super(null, new QuickLaunchConfigurationLabelProvider());
@@ -23,6 +25,25 @@ public class QuickLaunchConfigurationDialog extends ElementListSelectionDialog {
}
@Override
+ public int open() {
+ int output = super.open();
+
+ // Running initially selected element caused ok button to be disabled
+ // on next run until you search for something.
+ // This fixes that, without me having to understand why it happens.
+ Button okButton = getOkButton();
+ if (okButton != null) {
+ okButton.setEnabled(true);
+ }
+
+ if (previousSelection != null) {
+ setSelection(new Object[] { previousSelection });
+ }
+
+ return output;
+ }
+
+ @Override
protected FilteredList createFilteredList(Composite parent) {
FilteredList list = super.createFilteredList(parent);
list.setFilterMatcher(new FuzzyFilterMatcher());
@@ -40,6 +61,7 @@ public class QuickLaunchConfigurationDialog extends ElementListSelectionDialog {
} catch (CoreException e) {
throw new IllegalStateException(e);
}
+ previousSelection = launchConfiguration;
}
}