From 04095e14f7718d6ea4eb650310d754d7c4247fbc Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Thu, 15 May 2014 23:30:54 +0300 Subject: [PATCH] disable loading during scanning, so no need for showing any messages --- resources/messages.properties | 14 +++----------- src/net/azib/ipscan/gui/MainMenu.java | 2 +- .../ipscan/gui/actions/ScanMenuActions.java | 17 ----------------- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/resources/messages.properties b/resources/messages.properties index 278b0d09..14da7384 100644 --- a/resources/messages.properties +++ b/resources/messages.properties @@ -11,13 +11,8 @@ language.lt=Lithuanian language.ku=Kurdish preferences.csv=CSV preferences.csv.separator=CSV separator -menu.scan.save=&Save to file -menu.scan.load=&Load from file -title.save=Save -title.load=Load -text.progress.ipProgressBar=IP status: +text.progress.ipProgressBar=IP status: text.progress.portProgressBar=Port status: -exception.ExporterException.scanningInProgress2=Scanning is in progress, you have to stop it before loading. icon=images/icon.png menu.scan=&Scan menu.scan.newWindow=&New window @@ -26,8 +21,7 @@ menu.scan.exportSelection=Export se&lection... menu.scan.exportPreferences=Export &preferences... menu.scan.importPreferences=&Import preferences... menu.scan.quit=&Quit -menu.scan.save=&Save to file -menu.scan.load=&Load from file +menu.scan.load=&Load from file... menu.goto=&Go to menu.goto.next.aliveHost=&Next alive host menu.goto.next.deadHost=Next &dead host @@ -96,7 +90,6 @@ title.openers.edit=Edit Openers title.fetchers.select=Select Fetchers title.rename=Rename title.save=Save -title.load=Load title.find=Find title.commandline=Command-Line Usage text.error=Error @@ -298,8 +291,7 @@ exception.ExporterException.exporter.unknown=Unknown file type, please specify c exception.ExporterException.xml.noAppend=Appending to XML files is not supported. exception.ExporterException.fetcher.notFound=Not enough data in the scanning results to export to this file type. exception.ExporterException.scanningInProgress=Scanning is not finished yet. Do you really want to export incomplete results now? -exception.ExporterException.scanningInProgress2=Scanning is in progress, you have to stop it before loading. -exception.UserErrorException.openURL.failed=Unable to launch your default browser, sorry.\nURL: +exception.UserErrorException.openURL.failed=Unable to launch your default browser, sorry.\nURL: exception.UserErrorException.openTerminal.failed=Unable to launch the terminal, sorry\n exception.UserErrorException.opener.failed=Unable to launch an external process, sorry.\nCommand-line: exception.UserErrorException.opener.unknownFetcher=The referenced fetcher cannot be resolved in the current scanning result. Cannot execute the opener with parameter: diff --git a/src/net/azib/ipscan/gui/MainMenu.java b/src/net/azib/ipscan/gui/MainMenu.java index 8aa4185f..c7f98297 100644 --- a/src/net/azib/ipscan/gui/MainMenu.java +++ b/src/net/azib/ipscan/gui/MainMenu.java @@ -68,7 +68,7 @@ public class MainMenu implements Startable { Menu subMenu = initMenu(menu, "menu.scan"); // initMenuItem(subMenu, "menu.scan.newWindow", "Ctrl+N", new Integer(SWT.MOD1 | 'N'), initListener(FileActions.NewWindow.class)); // initMenuItem(subMenu, null, null, null, null); - initMenuItem(subMenu, "menu.scan.load", "", SWT.MOD1 | 'O', initListener(ScanMenuActions.LoadFromFile.class), false); + initMenuItem(subMenu, "menu.scan.load", "", SWT.MOD1 | 'O', initListener(ScanMenuActions.LoadFromFile.class), true); initMenuItem(subMenu, "menu.scan.exportAll", "Ctrl+S", SWT.MOD1 | 'S', initListener(ScanMenuActions.SaveAll.class), false); initMenuItem(subMenu, "menu.scan.exportSelection", null, null, initListener(ScanMenuActions.SaveSelection.class), false); // initMenuItem(subMenu, null, null, null, null); diff --git a/src/net/azib/ipscan/gui/actions/ScanMenuActions.java b/src/net/azib/ipscan/gui/actions/ScanMenuActions.java index efa958cb..019555cc 100644 --- a/src/net/azib/ipscan/gui/actions/ScanMenuActions.java +++ b/src/net/azib/ipscan/gui/actions/ScanMenuActions.java @@ -60,16 +60,6 @@ public class ScanMenuActions { } public void handleEvent(Event event) { - - if (!stateMachine.inState(ScanningState.IDLE)) { - // ask the user whether to save incomplete results - MessageBox box = new MessageBox(resultTable.getShell(), SWT.ICON_WARNING); - box.setText(Version.NAME); - box.setMessage(Labels.getLabel("exception.ExporterException.scanningInProgress2")); - box.open(); - } - - // create the file dialog FileDialog fileDialog = new FileDialog(resultTable.getShell(), SWT.OPEN); // gather lists of extensions and exporter names @@ -81,12 +71,10 @@ public class ScanMenuActions { List extensions = new ArrayList(); extensions.add(extensions2.get(0)); - // initialize other stuff fileDialog.setText(labelBuffer.toString()); fileDialog.setFilterExtensions(extensions.toArray(new String[extensions.size()])); fileDialog.setFilterNames(descriptions.toArray(new String[descriptions.size()])); - // show the dialog and receive the filename String fileName = fileDialog.open(); int i = 0; @@ -205,7 +193,6 @@ public class ScanMenuActions { return; } - // create the file dialog FileDialog fileDialog = new FileDialog(resultTable.getShell(), SWT.SAVE); // gather lists of extensions and exporter names @@ -214,15 +201,11 @@ public class ScanMenuActions { StringBuffer labelBuffer = new StringBuffer(Labels.getLabel(isSelection ? "title.exportSelection" : "title.exportAll")); addFileExtensions(extensions, descriptions, labelBuffer); - // initialize other stuff fileDialog.setText(labelBuffer.toString()); fileDialog.setFilterExtensions(extensions.toArray(new String[extensions.size()])); fileDialog.setFilterNames(descriptions.toArray(new String[descriptions.size()])); - // show the dialog and receive the filename String fileName = fileDialog.open(); - - // check the received file name if (fileName != null) { Exporter exporter = exporterRegistry.createExporter(fileName);