mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
Some usability improvements:
* Del button resets the status bar text * Tools->Select menu now focuses the result table * /-based netmask options are now reversed, to go from smaller ranges to bigger ones * Start button is now focused when Enter is pressed in the Netmask combo git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@257 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
912ad127ec
commit
e36b248ced
@ -44,3 +44,4 @@ preload
|
||||
tm
|
||||
locale
|
||||
int
|
||||
keypress
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -140,6 +140,7 @@ public class ToolsActions {
|
||||
}
|
||||
event.widget = resultTable;
|
||||
tableSelectionListener.handleEvent(event);
|
||||
resultTable.forceFocus();
|
||||
}
|
||||
|
||||
abstract boolean isDesired(ResultType type);
|
||||
|
||||
@ -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"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user