do not show dialog unless COOJA is visualized

This commit is contained in:
fros4943 2009-10-21 16:43:24 +00:00
parent a25a3a45b5
commit 4c1706bebb

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: NativeIPGateway.java,v 1.10 2009/10/20 09:22:07 fros4943 Exp $ * $Id: NativeIPGateway.java,v 1.11 2009/10/21 16:43:24 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -542,10 +542,15 @@ public class NativeIPGateway extends VisPlugin {
private void createTunInterfaceLinux() { private void createTunInterfaceLinux() {
/* Show progress bar while compiling */ /* Show progress bar while compiling */
final JDialog progressDialog = new JDialog( final JDialog progressDialog;
(Window)GUI.getTopParentContainer(), if (GUI.isVisualized()) {
"Starting Native IP Gateway plugin" progressDialog = new JDialog(
); (Window)GUI.getTopParentContainer(),
"Starting Native IP Gateway plugin"
);
} else {
progressDialog = null;
}
final MessageList output = new MessageList(); final MessageList output = new MessageList();
if (GUI.isVisualized()) { if (GUI.isVisualized()) {
new RunnableInEDT<Boolean>() { new RunnableInEDT<Boolean>() {
@ -586,8 +591,10 @@ public class NativeIPGateway extends VisPlugin {
true true
); );
if (p.exitValue() != 0) { if (p.exitValue() != 0) {
progressDialog.setVisible(false); if (GUI.isVisualized()) {
progressDialog.dispose(); progressDialog.setVisible(false);
progressDialog.dispose();
}
throw new Exception("Compile failed: " + tunContikiApp.getPath()); throw new Exception("Compile failed: " + tunContikiApp.getPath());
} }