Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-08-14 03:21:59 -0400
committerMichael Keppler2019-08-15 01:36:05 -0400
commitce1aa6faf4b4057c5a9f303448c84a3b90d8721f (patch)
treec179e5f6d353a6c06b5564bf210da340625e8ff4
parent6b953d64a09f18571ccfe6b8e528eafd736b0f55 (diff)
downloadeclipse.platform.text-ce1aa6faf4b4057c5a9f303448c84a3b90d8721f.tar.gz
eclipse.platform.text-ce1aa6faf4b4057c5a9f303448c84a3b90d8721f.tar.xz
eclipse.platform.text-ce1aa6faf4b4057c5a9f303448c84a3b90d8721f.zip
Fix layout of quicksearch preference page
The multi-line preferences for ignored names/prefixes/extensions do not resize and therefore have a different size than the maxLineLength preference at the top of the page. Remove the character width limitation, and set a layout data width instead. This makes the field editors resize as expected, such that all field editors have the same size. Change-Id: I8e5c7b186e7058e14949ee528f336011953a786d Signed-off-by: Michael Keppler <michael.keppler@gmx.de>
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java17
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchPreferencesPage.java34
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties17
3 files changed, 38 insertions, 30 deletions
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java
index f5f8d1c2d..e62a02509 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java
@@ -16,15 +16,14 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.text.quicksearch.internal.ui.messages"; //$NON-NLS-1$
- public static String QuickSearchPreferencesPage_0;
- public static String QuickSearchPreferencesPage_1;
- public static String QuickSearchPreferencesPage_2;
- public static String QuickSearchPreferencesPage_3;
- public static String QuickSearchPreferencesPage_4;
- public static String QuickSearchPreferencesPage_5;
- public static String QuickSearchPreferencesPage_6;
- public static String QuickSearchPreferencesPage_7;
- public static String QuickSearchPreferencesPage_8;
+ public static String QuickSearchPreferencesPage_Tooltip_Extensions;
+ public static String QuickSearchPreferencesPage_Tooltip_Prefixes;
+ public static String QuickSearchPreferencesPage_Tooltip_Names;
+ public static String QuickSearchPreferencesPage_MaxLineLength;
+ public static String QuickSearchPreferencesPage_Tooltip_MaxLineLength;
+ public static String QuickSearchPreferencesPage_Ignored_Extensions;
+ public static String QuickSearchPreferencesPage_Ignored_Prefixes;
+ public static String QuickSearchPreferencesPage_Ignored_Names;
public static String QuickSearchDialog_Open;
public static String QuickSearchDialog_Refresh;
public static String QuickSearchDialog_In;
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchPreferencesPage.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchPreferencesPage.java
index d13e96064..60a9cb999 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchPreferencesPage.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchPreferencesPage.java
@@ -15,6 +15,7 @@ package org.eclipse.text.quicksearch.internal.ui;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.text.quicksearch.internal.core.preferences.QuickSearchPreferences;
@@ -30,7 +31,7 @@ public class QuickSearchPreferencesPage extends FieldEditorPreferencePage implem
}
@Override
- public void init(IWorkbench arg0) {
+ public void init(IWorkbench workbench) {
}
private static final String[] prefsKeys = {
@@ -39,34 +40,43 @@ public class QuickSearchPreferencesPage extends FieldEditorPreferencePage implem
QuickSearchPreferences.IGNORED_NAMES
};
- private static final String[] fieldNames = {
- Messages.QuickSearchPreferencesPage_0, Messages.QuickSearchPreferencesPage_1, Messages.QuickSearchPreferencesPage_2
+ private static final String[] fieldLabels = {
+ Messages.QuickSearchPreferencesPage_Ignored_Extensions, Messages.QuickSearchPreferencesPage_Ignored_Prefixes, Messages.QuickSearchPreferencesPage_Ignored_Names
};
private static final String[] toolTips = {
- Messages.QuickSearchPreferencesPage_3
+ Messages.QuickSearchPreferencesPage_Tooltip_Extensions
,
- Messages.QuickSearchPreferencesPage_4
+ Messages.QuickSearchPreferencesPage_Tooltip_Prefixes
,
- Messages.QuickSearchPreferencesPage_5
+ Messages.QuickSearchPreferencesPage_Tooltip_Names
};
@Override
protected void createFieldEditors() {
- IntegerFieldEditor field_maxLineLen = new IntegerFieldEditor(QuickSearchPreferences.MAX_LINE_LEN, Messages.QuickSearchPreferencesPage_6, getFieldEditorParent());
- field_maxLineLen.getTextControl(getFieldEditorParent()).setToolTipText(
- Messages.QuickSearchPreferencesPage_7);
- addField(field_maxLineLen);
+ IntegerFieldEditor fieldMaxLineLen = new IntegerFieldEditor(QuickSearchPreferences.MAX_LINE_LEN, Messages.QuickSearchPreferencesPage_MaxLineLength, getFieldEditorParent());
+ fieldMaxLineLen.getTextControl(getFieldEditorParent()).setToolTipText(
+ Messages.QuickSearchPreferencesPage_Tooltip_MaxLineLength);
+ addField(fieldMaxLineLen);
- for (int i = 0; i < fieldNames.length; i++) {
+ for (int i = 0; i < fieldLabels.length; i++) {
final String tooltip = toolTips[i];
- StringFieldEditor field = new StringFieldEditor(prefsKeys[i], Messages.QuickSearchPreferencesPage_8+" "+fieldNames[i], 45, 5, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, getFieldEditorParent()) {
+ StringFieldEditor field = new StringFieldEditor(prefsKeys[i], fieldLabels[i], StringFieldEditor.UNLIMITED, 5, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, getFieldEditorParent()) {
@Override
protected Text createTextWidget(Composite parent) {
Text w = super.createTextWidget(parent);
w.setToolTipText(tooltip);
return w;
}
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ super.doFillIntoGrid(parent, numColumns);
+ Text text = getTextControl();
+ GridData layout = (GridData) text.getLayoutData();
+ layout.widthHint = 400;
+ layout.minimumWidth = 100;
+ }
};
addField(field);
}
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties
index 1108b0b2a..e5c2b1c12 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties
@@ -1,12 +1,11 @@
-QuickSearchPreferencesPage_0=Extensions
-QuickSearchPreferencesPage_1=Prefixes
-QuickSearchPreferencesPage_2=Names
-QuickSearchPreferencesPage_3=Enter a list of file extensions. Elements in the list can be separated by commas or newlines. Any file or folder ending with one of the extensions will be ignored.
-QuickSearchPreferencesPage_4=Enter a list of file prefixes. Elements in the list can be separated by commas or newlines. Any file or folder who's name begins with one of the prefixes will be ignored.
-QuickSearchPreferencesPage_5=Enter a list of file names. Elements in the list can be separated by commas or newlines. Any file or folder who's name equals one of the listed names will be ignored.
-QuickSearchPreferencesPage_6=Max Line Length
-QuickSearchPreferencesPage_7=When QuickSearch encounters a line of text longer than 'Max Line Length' it stops searching the current file. This is meant to avoid searching in machine generated text files, such as minified JavaScript.
-QuickSearchPreferencesPage_8=Ignore
+QuickSearchPreferencesPage_Tooltip_Extensions=Enter a list of file extensions. Elements in the list can be separated by commas or newlines. Any file or folder ending with one of the extensions will be ignored.
+QuickSearchPreferencesPage_Tooltip_Prefixes=Enter a list of file prefixes. Elements in the list can be separated by commas or newlines. Any file or folder who's name begins with one of the prefixes will be ignored.
+QuickSearchPreferencesPage_Tooltip_Names=Enter a list of file names. Elements in the list can be separated by commas or newlines. Any file or folder who's name equals one of the listed names will be ignored.
+QuickSearchPreferencesPage_MaxLineLength=Max Line Length
+QuickSearchPreferencesPage_Tooltip_MaxLineLength=When QuickSearch encounters a line of text longer than 'Max Line Length' it stops searching the current file. This is meant to avoid searching in machine generated text files, such as minified JavaScript.
+QuickSearchPreferencesPage_Ignored_Extensions=Ignored Extensions
+QuickSearchPreferencesPage_Ignored_Prefixes=Ignored Prefixes
+QuickSearchPreferencesPage_Ignored_Names=Ignored Names
QuickSearchDialog_Open=&Open
QuickSearchDialog_Refresh=&Refresh
QuickSearchDialog_In=in:

Back to the top