diff -r a6a34b314d4b dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilder.java --- a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilder.java Mon Sep 03 09:51:52 2012 +0200 +++ b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilder.java Wed Sep 05 11:53:30 2012 +0200 @@ -58,6 +58,7 @@ import org.netbeans.modules.nativeexecution.TerminalLocalNativeProcess; import org.netbeans.modules.nativeexecution.api.pty.PtySupport; import org.netbeans.modules.nativeexecution.api.util.ConnectionManager; +import org.netbeans.modules.nativeexecution.api.util.ConnectionManager.CancellationException; import org.netbeans.modules.nativeexecution.api.util.ExternalTerminal; import org.netbeans.modules.nativeexecution.api.util.ExternalTerminalProvider; import org.netbeans.modules.nativeexecution.api.util.MacroMap; @@ -65,6 +66,8 @@ import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport; import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus; import org.netbeans.modules.nativeexecution.api.util.WindowsSupport; +import org.openide.util.Exceptions; +import org.openide.util.UserQuestionException; /** * Utility class for the {@link NativeProcess external native process} creation. @@ -160,18 +163,35 @@ * in this builder * @throws IOException if the process could not be created */ + @NbBundle.Messages({ + "#{0} - display name of execution environment", + "EXC_NotConnectedQuestion=No connection to {0}. Connect now?" + }) @Override public NativeProcess call() throws IOException { AbstractNativeProcess process = null; - ExecutionEnvironment execEnv = info.getExecutionEnvironment(); + final ExecutionEnvironment execEnv = info.getExecutionEnvironment(); if (info.getCommand() == null) { throw new IllegalStateException("No executable nor command line is specified"); // NOI18N } if (!ConnectionManager.getInstance().isConnectedTo(execEnv)) { - throw new IOException("No connection to " + execEnv.getDisplayName()); // NOI18N + throw new UserQuestionException("No connection to " + execEnv.getDisplayName()) { + @Override + public void confirmed() throws IOException { + try { + ConnectionManager.getInstance().connectTo(execEnv); + } catch (CancellationException ex) { + throw new IOException(ex); + } + } + @Override + public String getLocalizedMessage() { + return Bundle.EXC_NotConnectedQuestion(execEnv.getDisplayName()); + } + }; } if (info.isPtyMode() && PtySupport.isSupportedFor(info.getExecutionEnvironment())) { diff -r a6a34b314d4b dlight.nativeexecution/test/unit/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilderTest.java --- a/dlight.nativeexecution/test/unit/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilderTest.java Mon Sep 03 09:51:52 2012 +0200 +++ b/dlight.nativeexecution/test/unit/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilderTest.java Wed Sep 05 11:53:30 2012 +0200 @@ -64,6 +64,7 @@ import org.netbeans.modules.nativeexecution.test.NativeExecutionBaseTestSuite; import org.openide.util.Exceptions; import org.openide.util.RequestProcessor; +import org.openide.util.UserQuestionException; public class NativeProcessBuilderTest extends NativeExecutionBaseTestCase { @@ -203,6 +204,27 @@ public void testSetCommandLine() throws Exception { doTestSetCommandLine(getTestExecutionEnvironment()); } + + public void testAsksForconnection() { + ExecutionEnvironment ee = ExecutionEnvironmentFactory.createNew("never", "existed.com"); + NativeProcessBuilder b = NativeProcessBuilder.newProcessBuilder(ee); + b.setExecutable("ade"); + b.setArguments("lsviews"); + try { + b.call(); + fail("The previous call should thrown an exception"); + } catch (UserQuestionException ex) { + // OK, expected + assertEquals( + "Localized message as expected", + Bundle.EXC_NotConnectedQuestion(ee.getDisplayName()), + ex.getLocalizedMessage() + ); + assertEquals("No connection to never@existed.com", ex.getMessage()); + } catch (IOException ex) { + fail("we should not get IOException: " + ex); + } + } private void doTestSetCommandLine(ExecutionEnvironment execEnv) throws Exception { HostInfo hostinfo = HostInfoUtils.getHostInfo(execEnv); diff -r a6a34b314d4b dlight.remote.impl/nbproject/project.properties --- a/dlight.remote.impl/nbproject/project.properties Mon Sep 03 09:51:52 2012 +0200 +++ b/dlight.remote.impl/nbproject/project.properties Wed Sep 05 11:53:30 2012 +0200 @@ -1,7 +1,7 @@ is.autoload=true javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial -spec.version.base=1.14.0 +spec.version.base=1.15.0 test.config.stableBTD.includes=**/*Test.class test.config.stableBTD.excludes=**/RemoteFSTCKTest.class diff -r a6a34b314d4b dlight.remote.impl/nbproject/project.xml --- a/dlight.remote.impl/nbproject/project.xml Mon Sep 03 09:51:52 2012 +0200 +++ b/dlight.remote.impl/nbproject/project.xml Wed Sep 05 11:53:30 2012 +0200 @@ -44,7 +44,7 @@ - 1.9.4 + 1.15 diff -r a6a34b314d4b dlight.remote/nbproject/project.properties --- a/dlight.remote/nbproject/project.properties Mon Sep 03 09:51:52 2012 +0200 +++ b/dlight.remote/nbproject/project.properties Wed Sep 05 11:53:30 2012 +0200 @@ -1,5 +1,5 @@ is.autoload=true javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial -spec.version.base=1.14.0 +spec.version.base=1.15.0