mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
OptionsDialog now uses form layout.
Display tab now has some options in it: NotScannedValue and NotAvailableValue can now be configured. git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@123 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
9842de3e22
commit
68e76fb92d
@ -172,6 +172,13 @@ options.ports.timing.timeout=Default port connect timeout (in ms):
|
||||
options.ports.timing.adaptTimeout=Adapt timeout to ping roundtrip time (if available)
|
||||
options.ports.ports=Port selection
|
||||
options.ports.portsDescription=Specify ports to scan here. Ranges are supported.\nExample: 1-3,5,7,10-15,6000-6100\nIf many ports are specified, scanning can take a lot of time.
|
||||
options.display.list=Display in the results list (not implemented)
|
||||
options.display.list.all=All scanned hosts
|
||||
options.display.list.alive=Alive hosts (responding to pings)
|
||||
options.display.list.ports=Hosts with open ports
|
||||
options.display.labels=Labels displayed in the results list
|
||||
options.display.labels.notAvailable=The value is not available (no results):
|
||||
options.display.labels.notScanned=The actual value was not scanned (unknown):
|
||||
exporter.txt=Text file (txt)
|
||||
exporter.txt.generated=Generated by
|
||||
exporter.txt.scanned=Scanned %INFO
|
||||
|
||||
@ -27,6 +27,8 @@ public final class GlobalConfig {
|
||||
public int portTimeout;
|
||||
public boolean adaptPortTimeout;
|
||||
public String portString;
|
||||
public String notAvailableText;
|
||||
public String notScannedText;
|
||||
|
||||
/**
|
||||
* Package local constructor.
|
||||
@ -47,6 +49,8 @@ public final class GlobalConfig {
|
||||
portTimeout = preferences.getInt("portTimeout", 3000);
|
||||
adaptPortTimeout = preferences.getBoolean("adaptPortTimeout", true);
|
||||
portString = preferences.get("portString", "");
|
||||
notAvailableText = preferences.get("notAvailableText", Labels.getLabel("fetcher.value.notAvailable"));
|
||||
notScannedText = preferences.get("notScannedText", Labels.getLabel("fetcher.value.notScanned"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,5 +68,7 @@ public final class GlobalConfig {
|
||||
preferences.putInt("portTimeout", portTimeout);
|
||||
preferences.putBoolean("adaptPortTimeout", adaptPortTimeout);
|
||||
preferences.put("portString", portString);
|
||||
preferences.put("notAvailableText", notAvailableText);
|
||||
preferences.put("notScannedText", notScannedText);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public class Version {
|
||||
|
||||
public static final String FULL_NAME = NAME + " " + VERSION;
|
||||
|
||||
public static final String COPYLEFT = "\u00A9 1998-2007 Anton Keks";
|
||||
public static final String COPYLEFT = "\u00A9 2007 Anton Keks";
|
||||
|
||||
public static final String WEBSITE = "http://www.azib.net/ipscan/";
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.core.values;
|
||||
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.Config;
|
||||
|
||||
/**
|
||||
* The value for displaying in the result list, meaning that the actual value is unknown,
|
||||
@ -21,8 +21,7 @@ public class NotAvailableValue implements Comparable {
|
||||
* Displays a user-friendly text string :-)
|
||||
*/
|
||||
public String toString() {
|
||||
// TODO: make this configurable
|
||||
return Labels.getLabel("fetcher.value.notAvailable");
|
||||
return Config.getGlobal().notAvailableText;
|
||||
}
|
||||
|
||||
public int compareTo(Object obj) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.core.values;
|
||||
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.Config;
|
||||
|
||||
/**
|
||||
* The value for displaying in the result list, meaning that the actual value is unknown,
|
||||
@ -21,8 +21,7 @@ public class NotScannedValue implements Comparable {
|
||||
* Displays a user-friendly text string :-)
|
||||
*/
|
||||
public String toString() {
|
||||
// TODO: make this configurable
|
||||
return Labels.getLabel("fetcher.value.notScanned");
|
||||
return Config.getGlobal().notScannedText;
|
||||
}
|
||||
|
||||
public int compareTo(Object obj) {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.net.PingerRegistry;
|
||||
@ -35,7 +34,8 @@ import org.eclipse.swt.widgets.Text;
|
||||
public class OptionsDialog extends AbstractModalDialog {
|
||||
|
||||
private PingerRegistry pingerRegistry;
|
||||
|
||||
private GlobalConfig globalConfig;
|
||||
|
||||
private TabFolder tabFolder;
|
||||
private Composite scanningTab;
|
||||
private Composite displayTab;
|
||||
@ -53,9 +53,12 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
private Text portTimeoutText;
|
||||
private Button adaptTimeoutCheckbox;
|
||||
private Text portsText;
|
||||
private Text notAvailableText;
|
||||
private Text notScannedText;
|
||||
|
||||
public OptionsDialog(PingerRegistry pingerRegistry) {
|
||||
public OptionsDialog(PingerRegistry pingerRegistry, GlobalConfig globalConfig) {
|
||||
this.pingerRegistry = pingerRegistry;
|
||||
this.globalConfig = globalConfig;
|
||||
}
|
||||
|
||||
public void open() {
|
||||
@ -95,6 +98,7 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
positionButtonsInFormLayout(okButton, cancelButton, tabFolder);
|
||||
|
||||
shell.pack();
|
||||
okButton.setFocus();
|
||||
|
||||
okButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
|
||||
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
|
||||
@ -193,11 +197,11 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
pingingTimeoutText = new Text(pingingGroup, SWT.BORDER);
|
||||
pingingTimeoutText.setLayoutData(gridData);
|
||||
|
||||
GridData gridData1 = new GridData();
|
||||
gridData1.horizontalSpan = 2;
|
||||
GridData gridDataWithSpan = new GridData();
|
||||
gridDataWithSpan.horizontalSpan = 2;
|
||||
deadHostsCheckbox = new Button(pingingGroup, SWT.CHECK);
|
||||
deadHostsCheckbox.setText(Labels.getLabel("options.pinging.deadHosts"));
|
||||
deadHostsCheckbox.setLayoutData(gridData1);
|
||||
deadHostsCheckbox.setLayoutData(gridDataWithSpan);
|
||||
|
||||
Group broadcastGroup = new Group(scanningTab, SWT.NONE);
|
||||
broadcastGroup.setLayout(groupLayout);
|
||||
@ -205,15 +209,55 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
|
||||
skipBroadcastsCheckbox = new Button(broadcastGroup, SWT.CHECK);
|
||||
skipBroadcastsCheckbox.setText(Labels.getLabel("options.broadcast.skip"));
|
||||
skipBroadcastsCheckbox.setLayoutData(gridData1);
|
||||
GridData gridDataWithSpan2 = new GridData();
|
||||
gridDataWithSpan2.horizontalSpan = 2;
|
||||
skipBroadcastsCheckbox.setLayoutData(gridDataWithSpan2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes displayTab
|
||||
*/
|
||||
private void createDisplayTab() {
|
||||
RowLayout rowLayout = createRowLayout();
|
||||
displayTab = new Composite(tabFolder, SWT.NONE);
|
||||
displayTab.setLayout(new GridLayout());
|
||||
displayTab.setLayout(rowLayout);
|
||||
|
||||
GridLayout groupLayout = new GridLayout();
|
||||
groupLayout.numColumns = 1;
|
||||
Group listGroup = new Group(displayTab, SWT.NONE);
|
||||
listGroup.setText(Labels.getLabel("options.display.list"));
|
||||
listGroup.setLayout(groupLayout);
|
||||
listGroup.setLayoutData(new RowData(260, SWT.DEFAULT));
|
||||
|
||||
// TODO: make these options work
|
||||
Button allRadio = new Button(listGroup, SWT.RADIO);
|
||||
allRadio.setText(Labels.getLabel("options.display.list.all"));
|
||||
allRadio.setEnabled(false);
|
||||
Button aliveRadio = new Button(listGroup, SWT.RADIO);
|
||||
aliveRadio.setText(Labels.getLabel("options.display.list.alive"));
|
||||
aliveRadio.setEnabled(false);
|
||||
Button portsRadio = new Button(listGroup, SWT.RADIO);
|
||||
portsRadio.setText(Labels.getLabel("options.display.list.ports"));
|
||||
portsRadio.setEnabled(false);
|
||||
|
||||
groupLayout = new GridLayout();
|
||||
groupLayout.numColumns = 2;
|
||||
Group labelsGroup = new Group(displayTab, SWT.NONE);
|
||||
labelsGroup.setText(Labels.getLabel("options.display.labels"));
|
||||
labelsGroup.setLayout(groupLayout);
|
||||
|
||||
GridData gridData = new GridData();
|
||||
gridData.widthHint = 50;
|
||||
|
||||
Label label = new Label(labelsGroup, SWT.NONE);
|
||||
label.setText(Labels.getLabel("options.display.labels.notAvailable"));
|
||||
notAvailableText = new Text(labelsGroup, SWT.BORDER);
|
||||
notAvailableText.setLayoutData(gridData);
|
||||
|
||||
label = new Label(labelsGroup, SWT.NONE);
|
||||
label.setText(Labels.getLabel("options.display.labels.notScanned"));
|
||||
notScannedText = new Text(labelsGroup, SWT.BORDER);
|
||||
notScannedText.setLayoutData(gridData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -289,36 +333,38 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
}
|
||||
|
||||
private void loadOptions() {
|
||||
GlobalConfig global = Config.getGlobal();
|
||||
maxThreadsText.setText(Integer.toString(global.maxThreads));
|
||||
threadDelayText.setText(Integer.toString(global.threadDelay));
|
||||
maxThreadsText.setText(Integer.toString(globalConfig.maxThreads));
|
||||
threadDelayText.setText(Integer.toString(globalConfig.threadDelay));
|
||||
String[] pingerNames = pingerRegistry.getRegisteredNames();
|
||||
for (int i = 0; i < pingerNames.length; i++) {
|
||||
if (global.selectedPinger.equals(pingerNames[i])) {
|
||||
if (globalConfig.selectedPinger.equals(pingerNames[i])) {
|
||||
pingersCombo.select(i);
|
||||
}
|
||||
}
|
||||
pingingCountText.setText(Integer.toString(global.pingCount));
|
||||
pingingTimeoutText.setText(Integer.toString(global.pingTimeout));
|
||||
deadHostsCheckbox.setSelection(global.scanDeadHosts);
|
||||
skipBroadcastsCheckbox.setSelection(global.skipBroadcastAddresses);
|
||||
portTimeoutText.setText(Integer.toString(global.portTimeout));
|
||||
adaptTimeoutCheckbox.setSelection(global.adaptPortTimeout);
|
||||
portsText.setText(global.portString);
|
||||
pingingCountText.setText(Integer.toString(globalConfig.pingCount));
|
||||
pingingTimeoutText.setText(Integer.toString(globalConfig.pingTimeout));
|
||||
deadHostsCheckbox.setSelection(globalConfig.scanDeadHosts);
|
||||
skipBroadcastsCheckbox.setSelection(globalConfig.skipBroadcastAddresses);
|
||||
portTimeoutText.setText(Integer.toString(globalConfig.portTimeout));
|
||||
adaptTimeoutCheckbox.setSelection(globalConfig.adaptPortTimeout);
|
||||
portsText.setText(globalConfig.portString);
|
||||
notAvailableText.setText(globalConfig.notAvailableText);
|
||||
notScannedText.setText(globalConfig.notScannedText);
|
||||
}
|
||||
|
||||
private void saveOptions() {
|
||||
GlobalConfig global = Config.getGlobal();
|
||||
global.maxThreads = parseIntValue(maxThreadsText);
|
||||
global.threadDelay = parseIntValue(threadDelayText);
|
||||
global.selectedPinger = (String) pingersCombo.getData(Integer.toString(pingersCombo.getSelectionIndex()));
|
||||
global.pingCount = parseIntValue(pingingCountText);
|
||||
global.pingTimeout = parseIntValue(pingingTimeoutText);
|
||||
global.scanDeadHosts = deadHostsCheckbox.getSelection();
|
||||
global.skipBroadcastAddresses = skipBroadcastsCheckbox.getSelection();
|
||||
global.portTimeout = parseIntValue(portTimeoutText);
|
||||
global.adaptPortTimeout = adaptTimeoutCheckbox.getSelection();
|
||||
global.portString = portsText.getText();
|
||||
globalConfig.maxThreads = parseIntValue(maxThreadsText);
|
||||
globalConfig.threadDelay = parseIntValue(threadDelayText);
|
||||
globalConfig.selectedPinger = (String) pingersCombo.getData(Integer.toString(pingersCombo.getSelectionIndex()));
|
||||
globalConfig.pingCount = parseIntValue(pingingCountText);
|
||||
globalConfig.pingTimeout = parseIntValue(pingingTimeoutText);
|
||||
globalConfig.scanDeadHosts = deadHostsCheckbox.getSelection();
|
||||
globalConfig.skipBroadcastAddresses = skipBroadcastsCheckbox.getSelection();
|
||||
globalConfig.portTimeout = parseIntValue(portTimeoutText);
|
||||
globalConfig.adaptPortTimeout = adaptTimeoutCheckbox.getSelection();
|
||||
globalConfig.portString = portsText.getText();
|
||||
globalConfig.notAvailableText = notAvailableText.getText();
|
||||
globalConfig.notScannedText = notScannedText.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -126,6 +126,11 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the specified element to be redrawn.
|
||||
* This method can be called from any thread.
|
||||
* @param index
|
||||
*/
|
||||
public void updateResults(final int index) {
|
||||
if (isDisposed())
|
||||
return;
|
||||
@ -136,6 +141,13 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces all elements to be redrawn
|
||||
*/
|
||||
public void updateResults() {
|
||||
clearAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the details about the currently selected IP address
|
||||
|
||||
@ -9,6 +9,7 @@ import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
|
||||
import net.azib.ipscan.gui.OptionsDialog;
|
||||
import net.azib.ipscan.gui.ResultTable;
|
||||
import net.azib.ipscan.gui.SelectFetchersDialog;
|
||||
|
||||
/**
|
||||
@ -21,13 +22,19 @@ public class ToolsActions {
|
||||
public static class Options implements Listener {
|
||||
|
||||
private OptionsDialog optionsDialog;
|
||||
private ResultTable resultTable;
|
||||
|
||||
public Options(OptionsDialog optionsDialog) {
|
||||
public Options(OptionsDialog optionsDialog, ResultTable resultTable) {
|
||||
this.optionsDialog = optionsDialog;
|
||||
this.resultTable = resultTable;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
// show the options dialog
|
||||
optionsDialog.open();
|
||||
|
||||
// refresh the results in case anything was changed
|
||||
resultTable.updateResults();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user