diff --git a/dictionary.txt b/dictionary.txt index 46a73002..98407558 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -44,3 +44,4 @@ preload tm locale int +keypress diff --git a/src/net/azib/ipscan/gui/ResultTable.java b/src/net/azib/ipscan/gui/ResultTable.java index 4bff1245..fb4f4453 100755 --- a/src/net/azib/ipscan/gui/ResultTable.java +++ b/src/net/azib/ipscan/gui/ResultTable.java @@ -68,7 +68,7 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener addListener(SWT.Traverse, detailsListener); addListener(SWT.MouseDoubleClick, detailsListener); addListener(SWT.Selection, selectionListener); - addListener(SWT.KeyDown, new CommandsActions.Delete(this, stateMachine)); + addListener(SWT.KeyDown, new CommandsActions.Delete(this, stateMachine, selectionListener)); addListener(SWT.KeyDown, new CommandsActions.CopyIP(this)); // this one populates table dynamically, taking data from ScanningResultList diff --git a/src/net/azib/ipscan/gui/actions/CommandsActions.java b/src/net/azib/ipscan/gui/actions/CommandsActions.java index f13cb70d..508fb69a 100755 --- a/src/net/azib/ipscan/gui/actions/CommandsActions.java +++ b/src/net/azib/ipscan/gui/actions/CommandsActions.java @@ -23,6 +23,7 @@ import net.azib.ipscan.gui.EditOpenersDialog; import net.azib.ipscan.gui.InputDialog; import net.azib.ipscan.gui.ResultTable; import net.azib.ipscan.gui.StatusBar; +import net.azib.ipscan.gui.actions.ToolsActions.TableSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; @@ -71,10 +72,12 @@ public class CommandsActions { public static final class Delete implements Listener { private final ResultTable resultTable; private final StateMachine stateMachine; + private final TableSelection selectionListener; - public Delete(ResultTable resultTable, StateMachine stateMachine) { + public Delete(ResultTable resultTable, StateMachine stateMachine, TableSelection selectionListener) { this.resultTable = resultTable; this.stateMachine = stateMachine; + this.selectionListener = selectionListener; } public void handleEvent(Event event) { @@ -90,6 +93,9 @@ public class CommandsActions { int firstSelection = resultTable.getSelectionIndex(); resultTable.remove(resultTable.getSelectionIndices()); resultTable.setSelection(firstSelection); + // reset status text about multiple selection + event.widget = resultTable; + selectionListener.handleEvent(event); } } diff --git a/src/net/azib/ipscan/gui/actions/ToolsActions.java b/src/net/azib/ipscan/gui/actions/ToolsActions.java index a9f94149..23c78ee6 100755 --- a/src/net/azib/ipscan/gui/actions/ToolsActions.java +++ b/src/net/azib/ipscan/gui/actions/ToolsActions.java @@ -140,6 +140,7 @@ public class ToolsActions { } event.widget = resultTable; tableSelectionListener.handleEvent(event); + resultTable.forceFocus(); } abstract boolean isDesired(ResultType type); diff --git a/src/net/azib/ipscan/gui/feeders/RangeFeederGUI.java b/src/net/azib/ipscan/gui/feeders/RangeFeederGUI.java index 773ed6b3..e035221a 100755 --- a/src/net/azib/ipscan/gui/feeders/RangeFeederGUI.java +++ b/src/net/azib/ipscan/gui/feeders/RangeFeederGUI.java @@ -140,9 +140,9 @@ public class RangeFeederGUI extends AbstractFeederGUI { netmaskCombo.setText(getStringLabel("netmask")); netmaskCombo.setVisibleItemCount(10); - netmaskCombo.add("/16"); - netmaskCombo.add("/24"); netmaskCombo.add("/26"); + netmaskCombo.add("/24"); + netmaskCombo.add("/16"); // Warning: IPv4 specific netmasks netmaskCombo.add("255...192"); netmaskCombo.add("255...128"); @@ -222,7 +222,7 @@ public class RangeFeederGUI extends AbstractFeederGUI { event.doit = false; } if (event.type == SWT.Selection) { - // this is a workaround for a strange bug: if text is just typed in the combo, + // this is a workaround for a strange bug in GTK: if text is just typed in the combo, // then this event is sent after each keypress, but we want it to be fired // only if something is selected from the drop down if (netmaskCombo.indexOf(netmaskCombo.getText()) < 0) @@ -237,13 +237,19 @@ public class RangeFeederGUI extends AbstractFeederGUI { startIPText.setText(InetAddressUtils.startRangeByNetmask(startIP, netmask).getHostAddress()); endIPText.setText(InetAddressUtils.endRangeByNetmask(startIP, netmask).getHostAddress()); isEndIPUnedited = false; - - netmaskCombo.forceFocus(); } catch (UnknownHostException e) { throw new FeederException("invalidNetmask"); } + + if (event.type == SWT.Traverse) { + // try to focus the start button + getParent().forceFocus(); + } + else { + netmaskCombo.forceFocus(); + } } } -} // @jve:decl-index=0:visual-constraint="10,10" +}