Skip to content

Commit

Permalink
Changed layout for close button
Browse files Browse the repository at this point in the history
Changed size of dialog to not be fixed
Fixed incorrect caseSensitive option
  • Loading branch information
sebHollersbacher committed Aug 1, 2023
1 parent 4c62bb8 commit 489bf30
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ public NodeSearchDialog(Shell parent, List<GraphNode> nodes) {
}

private void createDialog(Shell parentShell) {
dialog = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.MAX);
dialog = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.MAX | SWT.RESIZE);
dialog.setText("Find");
dialog.setSize(300, 200);
GridLayout layout = new GridLayout(2, false);
dialog.setLayout(layout);

Expand All @@ -66,6 +65,7 @@ public void focusLost(FocusEvent e) {
}
});
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.minimumWidth = 200;
text.setLayoutData(gridData);

// 2nd row
Expand All @@ -89,8 +89,7 @@ public void focusLost(FocusEvent e) {
new Label(dialog, SWT.NULL);

Composite comp = new Composite(dialog, SWT.NONE);
comp.setLayout(new GridLayout(3, false));
comp.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true));
comp.setLayout(new GridLayout(2, false));

nextButton = new Button(comp, SWT.PUSH);
nextButton.setText("Next");
Expand All @@ -102,11 +101,18 @@ public void focusLost(FocusEvent e) {
prevButton.setEnabled(false);
prevButton.addListener(SWT.Selection, e -> changeNode(false));

// 6th row
new Label(dialog, SWT.NULL);
comp = new Composite(dialog, SWT.NONE);
comp.setLayout(new GridLayout(1, false));
comp.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true));

Button closeButton = new Button(comp, SWT.PUSH);
closeButton.setText("Close");
closeButton.addListener(SWT.Selection, e -> dialog.close());

dialog.addDisposeListener(e -> isDisposed = true);
dialog.pack();
}

private void searchForNodes() {
Expand All @@ -122,11 +128,11 @@ private void searchForNodes() {
String nodeText;
String search;
if (caseSensitive) {
nodeText = node.getText().toLowerCase();
search = text.getText().toLowerCase();
} else {
nodeText = node.getText();
search = text.getText();
} else {
nodeText = node.getText().toLowerCase();
search = text.getText().toLowerCase();
}

if (searchWhole && nodeText.equals(search) || !searchWhole && nodeText.contains(search)) {
Expand Down

0 comments on commit 489bf30

Please sign in to comment.