Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2010-04-22 10:12:42 -0400
committerDarin Wright2010-04-22 10:12:42 -0400
commit11fd3a4ffe4d12b244c99caf48e88ac877f2330d (patch)
treee33f22f94d6bef0fe65f86d2a0075518805b8d2a
parenta59f1fa8bc05bfbb2b5ed0c54a1be45a91b59add (diff)
downloadeclipse.platform.debug-11fd3a4ffe4d12b244c99caf48e88ac877f2330d.tar.gz
eclipse.platform.debug-11fd3a4ffe4d12b244c99caf48e88ac877f2330d.tar.xz
eclipse.platform.debug-11fd3a4ffe4d12b244c99caf48e88ac877f2330d.zip
Bug 304752 - Improve UI for String variable selection dialog filters
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.properties5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java44
3 files changed, 42 insertions, 10 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.java
index 4bfdc578c..6cad26fb0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.java
@@ -50,6 +50,9 @@ public class StringSubstitutionMessages extends NLS {
public static String StringVariableSelectionDialog_8;
public static String StringVariableSelectionDialog_0;
public static String StringVariableSelectionDialog_9;
+ public static String StringVariableSelectionDialog_10;
+ public static String StringVariableSelectionDialog_11;
+
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.properties
index cff2c6fc5..eb56586d8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringSubstitutionMessages.properties
@@ -41,6 +41,9 @@ StringVariableSelectionDialog_6=&Argument:
StringVariableSelectionDialog_7=C&onfigure...
StringVariableSelectionDialog_8=&Variable Description:
StringVariableSelectionDialog_0=&Edit Variables...
-StringVariableSelectionDialog_9=&Hide non applicable
+StringVariableSelectionDialog_9=&Show All
+StringVariableSelectionDialog_10=Only the most common variables are shown.
+StringVariableSelectionDialog_11=Some variables may not work in this context.
+
SystemPropertyArgumentSelector_0=Select System Property
SystemPropertyArgumentSelector_1=Select a system property (? = any character, * = any String):
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
index 49acb6fc7..74c2fb310 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
@@ -35,6 +35,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
@@ -59,7 +60,8 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
private Text fArgumentText;
private String fArgumentValue;
private Button fEditVariablesButton;
- private Button fHideNonApplicableButton;
+ private Button fShowAllButton;
+ private Label fShowAllDescription;
/**
* Base class for custom variable filters. Clients may extend this class
@@ -164,6 +166,16 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
});
}
+ private void updateDescription() {
+ if((fShowAllDescription != null) && !fShowAllDescription.isDisposed()) {
+ if(fShowAllSelected) {
+ fShowAllDescription.setText(StringSubstitutionMessages.StringVariableSelectionDialog_11);
+ } else {
+ fShowAllDescription.setText(StringSubstitutionMessages.StringVariableSelectionDialog_10);
+ }
+ }
+ }
+
protected void setListElements(Object[] elements) {
ArrayList filtered = new ArrayList();
filtered.addAll(Arrays.asList(elements));
@@ -181,9 +193,6 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
}
}
}
- if((fHideNonApplicableButton != null) && !fHideNonApplicableButton.isDisposed()) {
- fHideNonApplicableButton.setEnabled(!fShowAllSelected || (elements.length == filtered.size()));
- }
super.setListElements(filtered.toArray());
}
@@ -215,14 +224,31 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
Composite container = SWTFactory.createComposite(parent, parent.getFont(), 2, 1, GridData.FILL_HORIZONTAL, 0, 0);
Composite btnContainer = SWTFactory.createComposite(container, parent.getFont(), 3, 2, GridData.FILL_HORIZONTAL, 0, 0);
- if (!fFilters.isEmpty()) {
- fHideNonApplicableButton = SWTFactory.createCheckButton(btnContainer, StringSubstitutionMessages.StringVariableSelectionDialog_9, null, !fShowAllSelected, 1);
- fHideNonApplicableButton.setEnabled(!fFilters.isEmpty());
- fHideNonApplicableButton.addSelectionListener(new SelectionAdapter() {
+ boolean bNeedShowAll = false;
+ if(!fFilters.isEmpty()) {
+ Object[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
+ for (int i = 0;(i < elements.length) && !bNeedShowAll; i++) {
+ if(elements[i] instanceof IDynamicVariable) {
+ for (int j = 0; (j < fFilters.size()) && !bNeedShowAll; j++) {
+ VariableFilter filter = (VariableFilter)fFilters.get(j);
+ if(filter.isFiltered((IDynamicVariable)elements[i])) {
+ bNeedShowAll = true;
+ }
+ }
+ }
+ }
+ }
+ if (bNeedShowAll) {
+ fShowAllDescription = SWTFactory.createLabel(btnContainer, "", 3); //$NON-NLS-1$
+ updateDescription();
+ fShowAllButton = SWTFactory.createCheckButton(btnContainer, StringSubstitutionMessages.StringVariableSelectionDialog_9, null, fShowAllSelected, 1);
+ fShowAllButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- fShowAllSelected = !fHideNonApplicableButton.getSelection();
+ fShowAllSelected = fShowAllButton.getSelection();
+ updateDescription();
updateElements();
}
+
});
SWTFactory.createHorizontalSpacer(btnContainer, 1);
} else {

Back to the top