mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
scan start confirmation configuration option added and dialog implemented
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@166 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
05cde2c45d
commit
da39ae484e
@ -77,6 +77,8 @@ text.favorite.edit=Below you can rearrange or delete favorites
|
||||
text.find=Enter the text to search for
|
||||
text.find.notFound=Nothing was found.
|
||||
text.find.restart=Would you like to start from the beginning?
|
||||
text.scan.new=New scan
|
||||
text.scan.confirmation=Are you sure that you want to discard previous scanning results?
|
||||
text.scan.finished=Scanning completed
|
||||
text.scan.incomplete=Scanning incomplete
|
||||
text.scan.time.total=Total time:
|
||||
@ -197,8 +199,9 @@ options.display.list.PORTS=Hosts with open ports only
|
||||
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):
|
||||
options.display.stats=Statistics
|
||||
options.display.stats.show=Show info dialog after each scan
|
||||
options.display.confirmation=Confirmation
|
||||
options.display.confirmation.newScan=Ask for confirmation before starting a new scan
|
||||
options.display.confirmation.showInfo=Show info dialog after each scan
|
||||
exporter.txt=Text file (txt)
|
||||
exporter.txt.generated=Generated by
|
||||
exporter.txt.scanned=Scanned %INFO
|
||||
|
||||
@ -31,6 +31,7 @@ public final class GlobalConfig {
|
||||
public String notScannedText;
|
||||
public DisplayMethod displayMethod;
|
||||
public boolean showScanStats;
|
||||
public boolean askScanConfirmation;
|
||||
|
||||
public static enum DisplayMethod {ALL, ALIVE, PORTS}
|
||||
|
||||
@ -57,6 +58,7 @@ public final class GlobalConfig {
|
||||
notScannedText = preferences.get("notScannedText", Labels.getLabel("fetcher.value.notScanned"));
|
||||
displayMethod = DisplayMethod.valueOf(preferences.get("displayMethod", DisplayMethod.ALL.toString()));
|
||||
showScanStats = preferences.getBoolean("showScanStats", true);
|
||||
askScanConfirmation = preferences.getBoolean("askScanConfirmation", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,6 +79,7 @@ public final class GlobalConfig {
|
||||
preferences.put("notAvailableText", notAvailableText);
|
||||
preferences.put("notScannedText", notScannedText);
|
||||
preferences.put("displayMethod", displayMethod.toString());
|
||||
preferences.putBoolean("showScanStats", showScanStats);
|
||||
preferences.putBoolean("showScanStats", showScanStats);
|
||||
preferences.putBoolean("askScanConfirmation", askScanConfirmation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
private Text notAvailableText;
|
||||
private Text notScannedText;
|
||||
private Button[] displayMethod;
|
||||
private Button showStatisticsCheckbox;
|
||||
private Button showInfoCheckbox;
|
||||
private Button askConfirmationCheckbox;
|
||||
|
||||
public OptionsDialog(PingerRegistry pingerRegistry, GlobalConfig globalConfig) {
|
||||
this.pingerRegistry = pingerRegistry;
|
||||
@ -276,15 +277,16 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
notScannedText = new Text(labelsGroup, SWT.BORDER);
|
||||
notScannedText.setLayoutData(gridData);
|
||||
|
||||
groupLayout = new GridLayout();
|
||||
groupLayout.numColumns = 1;
|
||||
Group showStatsGroup = new Group(displayTab, SWT.NONE);
|
||||
showStatsGroup.setLayout(groupLayout);
|
||||
showStatsGroup.setText(Labels.getLabel("options.display.stats"));
|
||||
showStatsGroup.setText(Labels.getLabel("options.display.confirmation"));
|
||||
|
||||
showStatisticsCheckbox = new Button(showStatsGroup, SWT.CHECK);
|
||||
showStatisticsCheckbox.setText(Labels.getLabel("options.display.stats.show"));
|
||||
GridData gridDataWithSpan2 = new GridData();
|
||||
gridDataWithSpan2.horizontalSpan = 2;
|
||||
showStatisticsCheckbox.setLayoutData(gridDataWithSpan2);
|
||||
askConfirmationCheckbox = new Button(showStatsGroup, SWT.CHECK);
|
||||
askConfirmationCheckbox.setText(Labels.getLabel("options.display.confirmation.newScan"));
|
||||
showInfoCheckbox = new Button(showStatsGroup, SWT.CHECK);
|
||||
showInfoCheckbox.setText(Labels.getLabel("options.display.confirmation.showInfo"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -377,7 +379,8 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
notAvailableText.setText(globalConfig.notAvailableText);
|
||||
notScannedText.setText(globalConfig.notScannedText);
|
||||
displayMethod[globalConfig.displayMethod.ordinal()].setSelection(true);
|
||||
showStatisticsCheckbox.setSelection(globalConfig.showScanStats);
|
||||
showInfoCheckbox.setSelection(globalConfig.showScanStats);
|
||||
askConfirmationCheckbox.setSelection(globalConfig.askScanConfirmation);
|
||||
}
|
||||
|
||||
private void saveOptions() {
|
||||
@ -407,7 +410,8 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
if (displayMethod[i].getSelection())
|
||||
globalConfig.displayMethod = DisplayMethod.values()[i];
|
||||
}
|
||||
globalConfig.showScanStats = showStatisticsCheckbox.getSelection();
|
||||
globalConfig.showScanStats = showInfoCheckbox.getSelection();
|
||||
globalConfig.askScanConfirmation = askConfirmationCheckbox.getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -22,11 +22,13 @@ import net.azib.ipscan.gui.ResultTable;
|
||||
import net.azib.ipscan.gui.StatusBar;
|
||||
import net.azib.ipscan.gui.feeders.FeederGUIRegistry;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
||||
/**
|
||||
* Start/Stop button action class.
|
||||
@ -105,6 +107,15 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
* Called when scanning button is clicked
|
||||
*/
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
// ask for confirmation before erasing scanning results
|
||||
if (stateMachine.inState(ScanningState.IDLE) && globalConfig.askScanConfirmation && resultTable.getItemCount() > 0) {
|
||||
MessageBox box = new MessageBox(e.display.getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
|
||||
box.setText(Labels.getLabel("text.scan.new"));
|
||||
box.setMessage(Labels.getLabel("text.scan.confirmation"));
|
||||
if (box.open() != SWT.YES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
stateMachine.transitionToNext();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user