diff --git a/build.xml b/build.xml
index 535adc00..81de2379 100755
--- a/build.xml
+++ b/build.xml
@@ -33,8 +33,8 @@
-
-
+
+
@@ -112,14 +112,14 @@
-->
-
+
-
+
-
+
diff --git a/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java b/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java
index 1d9e88ae..a4dc5a90 100755
--- a/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java
+++ b/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java
@@ -58,13 +58,15 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
/**
* Creates internal stuff independent from all other external dependencies
*/
- StartStopScanningAction() {
+ StartStopScanningAction(Display display) {
+ this.display = display;
+
// preload button images
- buttonImages[ScanningState.IDLE.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.start.img"));
- buttonImages[ScanningState.SCANNING.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.stop.img"));
+ buttonImages[ScanningState.IDLE.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.start.img"));
+ buttonImages[ScanningState.SCANNING.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.stop.img"));
buttonImages[ScanningState.STARTING.ordinal()] = buttonImages[ScanningState.SCANNING.ordinal()];
buttonImages[ScanningState.RESTARTING.ordinal()] = buttonImages[ScanningState.SCANNING.ordinal()];
- buttonImages[ScanningState.STOPPING.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.kill.img"));
+ buttonImages[ScanningState.STOPPING.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.kill.img"));
buttonImages[ScanningState.KILLING.ordinal()] = buttonImages[ScanningState.STOPPING.ordinal()];
// preload button texts
@@ -77,7 +79,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
}
public StartStopScanningAction(ScannerThreadFactory scannerThreadFactory, StateMachine stateMachine, ResultTable resultTable, StatusBar statusBar, FeederGUIRegistry feederRegistry, PingerRegistry pingerRegistry, Button startStopButton, GUIConfig guiConfig) {
- this();
+ this(startStopButton.getDisplay());
this.scannerThreadFactory = scannerThreadFactory;
this.resultTable = resultTable;
@@ -85,7 +87,6 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
this.feederRegistry = feederRegistry;
this.pingerRegistry = pingerRegistry;
this.button = startStopButton;
- this.display = button.getDisplay();
this.stateMachine = stateMachine;
this.guiConfig = guiConfig;
diff --git a/test/net/azib/ipscan/gui/actions/StartStopScanningActionTest.java b/test/net/azib/ipscan/gui/actions/StartStopScanningActionTest.java
index 64e86688..9220cbea 100644
--- a/test/net/azib/ipscan/gui/actions/StartStopScanningActionTest.java
+++ b/test/net/azib/ipscan/gui/actions/StartStopScanningActionTest.java
@@ -9,6 +9,7 @@ package net.azib.ipscan.gui.actions;
import static org.junit.Assert.assertNotNull;
import net.azib.ipscan.core.state.ScanningState;
+import org.eclipse.swt.widgets.Display;
import org.junit.Test;
@@ -21,7 +22,7 @@ public class StartStopScanningActionTest {
@Test
public void testAllImagesAreDefined() throws Exception {
- StartStopScanningAction action = new StartStopScanningAction();
+ StartStopScanningAction action = new StartStopScanningAction(Display.getDefault());
for (ScanningState state : ScanningState.values()) {
assertNotNull(action.buttonImages[state.ordinal()]);
assertNotNull(action.buttonTexts[state.ordinal()]);