Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.CursorLinePainter;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.source.CompositeRuler;
Expand Down Expand Up @@ -688,7 +689,6 @@ private Label createLabels(Composite parent) {
progressLabel = new Label(labels, SWT.RIGHT);
gd = new GridData(GridData.FILL_HORIZONTAL);
progressLabel.setLayoutData(gd);
createButton(labels, REFRESH_BUTTON_ID, Messages.QuickSearchDialog_Refresh, false);

labels.setLayoutData(gd);
return listLabel;
Expand Down Expand Up @@ -813,14 +813,20 @@ public void getName(AccessibleEvent e) {
GridDataFactory.fillDefaults().span(6,1).grab(true, false).applyTo(pattern);

Composite searchInComposite = createNestedComposite(inputRow, 2, false);
GridDataFactory.fillDefaults().span(4,1).grab(true, false).applyTo(searchInComposite);
GridDataFactory.fillDefaults().span(3,1).grab(true, false).applyTo(searchInComposite);
Label searchInLabel = new Label(searchInComposite, SWT.NONE);
searchInLabel.setText(Messages.QuickSearchDialog_In);
GridDataFactory.swtDefaults().indent(5, 0).applyTo(searchInLabel);
searchIn = new Combo(searchInComposite, SWT.SINGLE | SWT.BORDER | SWT.ICON_CANCEL);
searchIn.setToolTipText(Messages.QuickSearchDialog_InTooltip);
GridDataFactory.fillDefaults().grab(true, false).indent(5, 0).applyTo(searchIn);

// Refresh button next to pattern field towards extreme right
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we use something like:

Button refreshButton = createButton(inputRow, REFRESH_BUTTON_ID, Messages.QuickSearchDialog_Refresh, false); GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(false, false).applyTo(refreshButton); refreshButton.addListener(SWT.Selection, e -> refreshButtonPressed())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button refreshButton = createButton(inputRow, REFRESH_BUTTON_ID, Messages.QuickSearchDialog_Refresh, false); GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(false, false).applyTo(refreshButton); refreshButton.addListener(SWT.Selection, e -> refreshButtonPressed())

I just tried your suggestion as is and thinking this is more lesser lines of code(looks more appealing and readable for me too.). But when i tested i am seeing this small behavior change where alignment is lost.

quick_search

In the image, 1st section corresponds to createButton() kind of creation of button.
2nd section as per the existing pr change.

But thanks for letting me know various ways of thinking to address the same issue. Hope i have answered all the concerns raised. If i have missed any please do let me know.

Thanks alot @BeckerWdf in advance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok undestood.
pls. check what was done with the "REFRESH_BUTTON_ID" ?

Copy link
Member

@BeckerWdf BeckerWdf Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the usage of "REFRESH_BUTTON_ID" in line 1362. As you don't do
refreshButton.setData(Integer.valueOf(REFRESH_BUTTON_ID));
code in line 1362 is now dead.

I think you don't need the REFRESH_BUTTON_ID stuff and the buttonPressed implementation when you do:
refreshButton.addListener(SWT.Selection, e -> refreshButtonPressed());
So I think you can remove that.

Button refreshButton = new Button(inputRow, SWT.PUSH);
refreshButton.setText(Messages.QuickSearchDialog_Refresh);
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(false, false).applyTo(refreshButton);
refreshButton.addListener(SWT.Selection, e -> refreshButtonPressed());

listLabel = createLabels(content);

sashForm = new SashForm(content, SWT.VERTICAL);
Expand Down Expand Up @@ -1173,6 +1179,9 @@ private void refreshDetails() {
viewer.revealRange(rangeStart, rangeEnd - rangeStart);

var targetLineFirstMatch = getQuery().findFirst(document.get(item.getOffset(), contextLenght - (item.getOffset() - start)));
if (targetLineFirstMatch == null) {
return; // nothing to refresh
}
int targetLineFirstMatchStart = item.getOffset() + targetLineFirstMatch.getOffset();
// sets caret position
viewer.setSelectedRange(targetLineFirstMatchStart, 0);
Expand Down Expand Up @@ -1289,6 +1298,10 @@ public void refreshWidgets() {
//element is available in the list.
openButton.setEnabled(itemCount>0);
}
//Auto-select the first search result for preview to be shown.
if (itemCount >= 1 && list.getSelection().isEmpty()) {
list.getTable().select(0);
}
refreshDetails();
}
}
Expand Down Expand Up @@ -1484,6 +1497,14 @@ public void update(LineItem match) {
} else {
//The QuickTextSearcher is already active update the query
this.searcher.setQuery(newFilter, force);
if(newFilter.getPatternString().trim().isEmpty()) {
//When pattern is cleared, clear the preview section
viewer.setDocument(new Document("")); //$NON-NLS-1$
if (lineNumberColumn != null) {
viewer.removeVerticalRulerColumn(lineNumberColumn);
viewer.addVerticalRulerColumn(lineNumberColumn);
}
}
}
if (progressJob!=null) {
progressJob.schedule();
Expand Down
Loading