Skip to content

Commit

Permalink
Merge pull request #4729 from nadment/4721
Browse files Browse the repository at this point in the history
Do not start the search if no search term is provided. #4721
  • Loading branch information
hansva authored Dec 24, 2024
2 parents 60d02cf + 1080a92 commit d11e081
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hop.core.search.ISearchablesLocation;
import org.apache.hop.core.search.SearchQuery;
import org.apache.hop.core.search.SearchableAnalyserPluginType;
import org.apache.hop.core.util.Utils;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.ErrorDialog;
Expand Down Expand Up @@ -281,6 +282,10 @@ public void initialize(HopGui hopGui, Composite parent) {
wbSearch.addListener(SWT.Selection, this::search);
lastControl = wbSearch;

// Disable search button if nothing to search
wSearchString.addListener(
SWT.Modify, e -> wbSearch.setEnabled(!Utils.isEmpty(wSearchString.getText())));

Button wbOpen = new Button(composite, SWT.PUSH);
PropsUi.setLook(wbOpen);
wbOpen.setText(BaseMessages.getString(PKG, "HopSearchPerspective.Open.Button.Label"));
Expand Down Expand Up @@ -378,6 +383,9 @@ private void open(Event event) {

private void search(Event event) {

// Nothing to search
if (Utils.isEmpty(wSearchString.getText())) return;

// Find the search location using the combo
// Get the list of searchables.
//
Expand Down

0 comments on commit d11e081

Please sign in to comment.