Added correct labeling, added message box in case of no found matches in find function

This commit is contained in:
lucab 2023-05-09 16:00:35 +02:00
parent dc9655d61e
commit 40493ca049
3 changed files with 14 additions and 4 deletions

View File

@ -120,6 +120,7 @@ text.hostsSelected=\u00A0hosts selected
text.favorite.add=Enter the name of the new favorite
text.favorite.edit=Below you can rearrange or delete favorites
text.find=Enter the text to search for
text.found=matches were found
text.find.notFound=End of the list reached without matches.
text.find.restart=Restart from the beginning?
text.comment.edit=Comment

View File

@ -1,5 +1,6 @@
package net.azib.ipscan.gui;
import net.azib.ipscan.config.Labels;
import net.azib.ipscan.gui.util.LayoutHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
@ -32,15 +33,15 @@ public class FindDialog extends AbstractModalDialog{
indexLabel.setLayoutData(LayoutHelper.formData(new FormAttachment(0), null, new FormAttachment(messageLabel), null));
previousButton = new Button(shell, SWT.NONE);
previousButton.setText("<");
previousButton.setText(Labels.getLabel("button.left"));
previousButton.setLayoutData(LayoutHelper.formData(new FormAttachment(messageLabel), null, new FormAttachment(messageLabel), null));
nextButton = new Button(shell, SWT.NONE);
nextButton.setText(">");
nextButton.setText(Labels.getLabel("button.right"));
nextButton.setLayoutData(LayoutHelper.formData(new FormAttachment(previousButton), null, new FormAttachment(messageLabel), null));
closeButton = new Button(shell, SWT.NONE);
closeButton.setText("close");
closeButton.setText(Labels.getLabel("button.close"));
closeButton.setLayoutData(LayoutHelper.formData(new FormAttachment(nextButton), null, new FormAttachment(messageLabel), null));
nextButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

View File

@ -145,8 +145,16 @@ public class GotoMenuActions {
ArrayList<Integer> foundMatches = findMatches(text);
int selectionIndex = 0;
if(foundMatches.size() == 0){
MessageBox messageBox = new MessageBox(statusBar.getShell(), SWT.OK | SWT.ICON_INFORMATION);
messageBox.setText(Labels.getLabel("title.find"));
messageBox.setMessage(Labels.getLabel("text.find.notFound"));
messageBox.open();
return;
}
while(true){
FindDialog find = new FindDialog("Find", foundMatches.size() + " matches were found");
FindDialog find = new FindDialog(Labels.getLabel("title.find"), foundMatches.size() + " " + Labels.getLabel("text.found"));
resultTable.setSelection(selectionIndex);
resultTable.setFocus();
int flag = find.open(selectionIndex + 1, foundMatches.size());