Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-08-01 03:54:19 -0400
committerMickael Istria2019-08-02 09:22:02 -0400
commit58437abbada0e715de9c44c022e7ac1a9abc4c26 (patch)
tree12941bede5347415e66ecee5aa253970c791fbd6
parent9c6cbef8ec2954b57ab08f672742041eb615beb5 (diff)
downloadeclipse.platform.text-58437abbada0e715de9c44c022e7ac1a9abc4c26.tar.gz
eclipse.platform.text-58437abbada0e715de9c44c022e7ac1a9abc4c26.tar.xz
eclipse.platform.text-58437abbada0e715de9c44c022e7ac1a9abc4c26.zip
Bug 548518 - Improve QuickSearchDialogI20190804-1800I20190803-1800I20190802-1800
* externalize strings * Relabel Go! to Open * Make Open button default * Moved refresh button closer to request part * Remove some listeners (leverage JFace API) Change-Id: Ie7850c8277a8a4c7aa5790e3f3d7990f26e90e62 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.text.quicksearch/build.properties2
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/Messages.java8
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java60
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/messages.properties8
4 files changed, 47 insertions, 31 deletions
diff --git a/org.eclipse.text.quicksearch/build.properties b/org.eclipse.text.quicksearch/build.properties
index 31b9d2c02..42ef92962 100644
--- a/org.eclipse.text.quicksearch/build.properties
+++ b/org.eclipse.text.quicksearch/build.properties
@@ -13,9 +13,9 @@
###############################################################################
source.. = src/
output.. = bin/
+src.includes = about.html
bin.includes = plugin.xml,\
META-INF/,\
.,\
- icons/,\
about.html,\
plugin.properties
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 6eeb76f30..f5f8d1c2d 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
@@ -25,6 +25,14 @@ public class Messages extends NLS {
public static String QuickSearchPreferencesPage_6;
public static String QuickSearchPreferencesPage_7;
public static String QuickSearchPreferencesPage_8;
+ public static String QuickSearchDialog_Open;
+ public static String QuickSearchDialog_Refresh;
+ public static String QuickSearchDialog_In;
+ public static String QuickSearchDialog_InTooltip;
+ public static String QuickSearchDialog_line;
+ public static String QuickSearchDialog_text;
+ public static String QuickSearchDialog_path;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
index 64a932920..7e800cc54 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
@@ -122,6 +122,7 @@ import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.internal.quickaccess.QuickAccessMessages;
import org.eclipse.ui.progress.UIJob;
/**
@@ -133,8 +134,8 @@ import org.eclipse.ui.progress.UIJob;
@SuppressWarnings({ "rawtypes", "restriction", "unchecked" })
public class QuickSearchDialog extends SelectionStatusDialog {
- private static final int GO_BUTTON_ID = IDialogConstants.CLIENT_ID + 1;
- private static final int REFRESH_BUTTON_ID = IDialogConstants.CLIENT_ID + 2;
+ private static final int OPEN_BUTTON_ID = IDialogConstants.OK_ID;
+ private static final int REFRESH_BUTTON_ID = IDialogConstants.RETRY_ID;
public static final Styler HIGHLIGHT_STYLE = org.eclipse.search.internal.ui.text.DecoratingFileSearchLabelProvider.HIGHLIGHT_STYLE;
@@ -607,7 +608,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
Composite labels = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
- layout.numColumns = 2;
+ layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
labels.setLayout(layout);
@@ -630,6 +631,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
progressLabel = new Label(labels, SWT.RIGHT);
progressLabel.setLayoutData(gd);
+ createButton(labels, REFRESH_BUTTON_ID, Messages.QuickSearchDialog_Refresh, false);
labels.setLayoutData(gd);
return listLabel;
@@ -760,10 +762,11 @@ public class QuickSearchDialog extends SelectionStatusDialog {
Composite searchInComposite = createNestedComposite(inputRow, 2, false);
GridDataFactory.fillDefaults().span(4,1).grab(true, false).applyTo(searchInComposite);
Label searchInLabel = new Label(searchInComposite, SWT.NONE);
- searchInLabel.setText(" In: ");
+ searchInLabel.setText(Messages.QuickSearchDialog_In);
+ GridDataFactory.swtDefaults().indent(5, 0).applyTo(searchInLabel);
searchIn = new Text(searchInComposite, SWT.SINGLE | SWT.BORDER | SWT.ICON_CANCEL);
- searchIn.setToolTipText("Search in (comma-separated list of '.gitignore' style inclusion patterns)");
- GridDataFactory.fillDefaults().grab(true, false).applyTo(searchIn);
+ searchIn.setToolTipText(Messages.QuickSearchDialog_InTooltip);
+ GridDataFactory.fillDefaults().grab(true, false).indent(5, 0).applyTo(searchIn);
final Label listLabel = createLabels(content);
@@ -791,14 +794,14 @@ public class QuickSearchDialog extends SelectionStatusDialog {
TableViewerColumn col = new TableViewerColumn(list, SWT.RIGHT);
col.setLabelProvider(LINE_NUMBER_LABEL_PROVIDER);
- col.getColumn().setText("Line");
+ col.getColumn().setText(Messages.QuickSearchDialog_line);
col.getColumn().setWidth(40);
col = new TableViewerColumn(list, SWT.LEFT);
- col.getColumn().setText("Text");
+ col.getColumn().setText(Messages.QuickSearchDialog_text);
col.setLabelProvider(LINE_TEXT_LABEL_PROVIDER);
col.getColumn().setWidth(400);
col = new TableViewerColumn(list, SWT.LEFT);
- col.getColumn().setText("Path");
+ col.getColumn().setText(Messages.QuickSearchDialog_path);
col.setLabelProvider(LINE_FILE_LABEL_PROVIDER);
col.getColumn().setWidth(150);
@@ -1116,12 +1119,12 @@ public class QuickSearchDialog extends SelectionStatusDialog {
int itemCount = contentProvider.getNumberOfElements();
list.setItemCount(itemCount);
list.refresh(true, false);
- Button goButton = getButton(GO_BUTTON_ID);
- if (goButton!=null && !goButton.isDisposed()) {
+ Button openButton = getButton(OPEN_BUTTON_ID);
+ if (openButton!=null && !openButton.isDisposed()) {
//Even if no element is selected. The dialog should be have as if the first
//element in the list is selected. So the button is enabled if any
//element is available in the list.
- goButton.setEnabled(itemCount>0);
+ openButton.setEnabled(itemCount>0);
}
}
@@ -1160,39 +1163,36 @@ public class QuickSearchDialog extends SelectionStatusDialog {
* Handles double-click of items, but *also* by pressing the 'enter' key.
*/
protected void handleDoubleClick() {
- goButtonPressed();
+ okPressed();
}
protected void refreshButtonPressed() {
applyFilter(true);
}
- /**
- * Handles directly clicking the 'go' button.
- */
- protected void goButtonPressed() {
+
+ @Override
+ protected void okPressed() {
computeResult();
openSelection();
if (!toggleKeepOpenAction.isChecked()) {
+ setReturnCode(OK);
close();
}
}
@Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == REFRESH_BUTTON_ID) {
+ refreshButtonPressed();
+ } else {
+ super.buttonPressed(buttonId);
+ }
+ }
+
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- SelectionListener listener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- int buttonId = (int) ((Button)e.widget).getData();
- if (buttonId==GO_BUTTON_ID) {
- goButtonPressed();
- } else if (buttonId==REFRESH_BUTTON_ID) {
- refreshButtonPressed();
- }
- }
- };
- createButton(parent, GO_BUTTON_ID, "Go!", false).addSelectionListener(listener);
- createButton(parent, REFRESH_BUTTON_ID, "Refresh", false).addSelectionListener(listener);
+ createButton(parent, OPEN_BUTTON_ID, Messages.QuickSearchDialog_Open, true);
refreshWidgets();
}
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 5d15d07ba..ff5a6a49a 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
@@ -7,3 +7,11 @@ QuickSearchPreferencesPage_5=Enter a list of file names. Elements in the list ca
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
+QuickSearchDialog_Open=&Open
+QuickSearchDialog_Refresh=&Refresh
+QuickSearchDialog_In=in:
+QuickSearchDialog_InTooltip=Search in (comma-separated list of '.gitignore' style inclusion patterns)
+QuickSearchDialog_line=Line
+QuickSearchDialog_text=Text
+QuickSearchDialog_path=Path
+

Back to the top