Lines 58-63
Link Here
|
58 |
import org.netbeans.modules.nativeexecution.TerminalLocalNativeProcess; |
58 |
import org.netbeans.modules.nativeexecution.TerminalLocalNativeProcess; |
59 |
import org.netbeans.modules.nativeexecution.api.pty.PtySupport; |
59 |
import org.netbeans.modules.nativeexecution.api.pty.PtySupport; |
60 |
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager; |
60 |
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager; |
|
|
61 |
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager.CancellationException; |
61 |
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminal; |
62 |
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminal; |
62 |
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminalProvider; |
63 |
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminalProvider; |
63 |
import org.netbeans.modules.nativeexecution.api.util.MacroMap; |
64 |
import org.netbeans.modules.nativeexecution.api.util.MacroMap; |
Lines 65-70
Link Here
|
65 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport; |
66 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport; |
66 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus; |
67 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus; |
67 |
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport; |
68 |
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport; |
|
|
69 |
import org.openide.util.Exceptions; |
70 |
import org.openide.util.UserQuestionException; |
68 |
|
71 |
|
69 |
/** |
72 |
/** |
70 |
* Utility class for the {@link NativeProcess external native process} creation. |
73 |
* Utility class for the {@link NativeProcess external native process} creation. |
Lines 164-182
Link Here
|
164 |
* @return new {@link NativeProcess} based on the properties configured |
167 |
* @return new {@link NativeProcess} based on the properties configured |
165 |
* in this builder |
168 |
* in this builder |
166 |
* @throws IOException if the process could not be created |
169 |
* @throws IOException if the process could not be created |
|
|
170 |
* @throws UserQuestionException in case the system is not yet connected |
167 |
*/ |
171 |
*/ |
|
|
172 |
@NbBundle.Messages({ |
173 |
"#{0} - display name of execution environment", |
174 |
"EXC_NotConnectedQuestion=No connection to {0}. Connect now?" |
175 |
}) |
168 |
@Override |
176 |
@Override |
169 |
public NativeProcess call() throws IOException { |
177 |
public NativeProcess call() throws IOException { |
170 |
AbstractNativeProcess process = null; |
178 |
AbstractNativeProcess process = null; |
171 |
|
179 |
|
172 |
ExecutionEnvironment execEnv = info.getExecutionEnvironment(); |
180 |
final ExecutionEnvironment execEnv = info.getExecutionEnvironment(); |
173 |
|
181 |
|
174 |
if (info.getCommand() == null) { |
182 |
if (info.getCommand() == null) { |
175 |
throw new IllegalStateException("No executable nor command line is specified"); // NOI18N |
183 |
throw new IllegalStateException("No executable nor command line is specified"); // NOI18N |
176 |
} |
184 |
} |
177 |
|
185 |
|
178 |
if (!ConnectionManager.getInstance().isConnectedTo(execEnv)) { |
186 |
if (!ConnectionManager.getInstance().isConnectedTo(execEnv)) { |
179 |
throw new IOException("No connection to " + execEnv.getDisplayName()); // NOI18N |
187 |
throw new UserQuestionException("No connection to " + execEnv.getDisplayName()) { |
|
|
188 |
@Override |
189 |
public void confirmed() throws IOException { |
190 |
try { |
191 |
ConnectionManager.getInstance().connectTo(execEnv); |
192 |
} catch (CancellationException ex) { |
193 |
throw new IOException(ex); |
194 |
} |
195 |
} |
196 |
@Override |
197 |
public String getLocalizedMessage() { |
198 |
return Bundle.EXC_NotConnectedQuestion(execEnv.getDisplayName()); |
199 |
} |
200 |
}; |
180 |
} |
201 |
} |
181 |
|
202 |
|
182 |
if (info.isPtyMode() && PtySupport.isSupportedFor(info.getExecutionEnvironment())) { |
203 |
if (info.isPtyMode() && PtySupport.isSupportedFor(info.getExecutionEnvironment())) { |