Lines 60-66
Link Here
|
60 |
import org.netbeans.api.extexecution.startup.StartupExtender; |
60 |
import org.netbeans.api.extexecution.startup.StartupExtender; |
61 |
import org.netbeans.api.java.platform.JavaPlatform; |
61 |
import org.netbeans.api.java.platform.JavaPlatform; |
62 |
import org.netbeans.api.java.platform.JavaPlatformManager; |
62 |
import org.netbeans.api.java.platform.JavaPlatformManager; |
63 |
import org.netbeans.api.project.FileOwnerQuery; |
|
|
64 |
import org.netbeans.api.project.Project; |
63 |
import org.netbeans.api.project.Project; |
65 |
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants; |
64 |
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants; |
66 |
import org.netbeans.modules.javaee.project.api.ant.DeployOnSaveUtils; |
65 |
import org.netbeans.modules.javaee.project.api.ant.DeployOnSaveUtils; |
Lines 81-94
Link Here
|
81 |
import org.netbeans.spi.project.ActionProvider; |
80 |
import org.netbeans.spi.project.ActionProvider; |
82 |
import org.netbeans.spi.project.SubprojectProvider; |
81 |
import org.netbeans.spi.project.SubprojectProvider; |
83 |
import org.netbeans.spi.project.ui.support.DefaultProjectOperations; |
82 |
import org.netbeans.spi.project.ui.support.DefaultProjectOperations; |
84 |
import org.openide.DialogDisplayer; |
|
|
85 |
import org.openide.NotifyDescriptor; |
86 |
import org.openide.execution.ExecutorTask; |
83 |
import org.openide.execution.ExecutorTask; |
87 |
import org.openide.filesystems.FileObject; |
84 |
import org.openide.filesystems.FileObject; |
88 |
import org.openide.filesystems.FileUtil; |
85 |
import org.openide.filesystems.FileUtil; |
89 |
import org.openide.util.Exceptions; |
86 |
import org.openide.util.Exceptions; |
90 |
import org.openide.util.Lookup; |
87 |
import org.openide.util.Lookup; |
91 |
import org.openide.util.NbBundle; |
|
|
92 |
import org.openide.util.Task; |
88 |
import org.openide.util.Task; |
93 |
import org.openide.util.TaskListener; |
89 |
import org.openide.util.TaskListener; |
94 |
import org.openide.util.lookup.Lookups; |
90 |
import org.openide.util.lookup.Lookups; |
Lines 247-258
Link Here
|
247 |
|
243 |
|
248 |
//EXECUTION PART |
244 |
//EXECUTION PART |
249 |
if (command.equals (COMMAND_RUN) || command.equals (EjbProjectConstants.COMMAND_REDEPLOY)) { // || command.equals (COMMAND_DEBUG)) { |
245 |
if (command.equals (COMMAND_RUN) || command.equals (EjbProjectConstants.COMMAND_REDEPLOY)) { // || command.equals (COMMAND_DEBUG)) { |
250 |
if (!isSelectedServer ()) { |
246 |
if (!checkSelectedServer (false, false, false)) { |
251 |
// no selected server => warning |
|
|
252 |
String msg = NbBundle.getMessage( |
253 |
EarActionProvider.class, "MSG_No_Server_Selected"); // NOI18N |
254 |
DialogDisplayer.getDefault().notify( |
255 |
new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE)); |
256 |
return null; |
247 |
return null; |
257 |
} |
248 |
} |
258 |
if (command.equals (COMMAND_RUN) && isDebugged()) { |
249 |
if (command.equals (COMMAND_RUN) && isDebugged()) { |
Lines 266-277
Link Here
|
266 |
setDirectoryDeploymentProperty(p); |
257 |
setDirectoryDeploymentProperty(p); |
267 |
//DEBUGGING PART |
258 |
//DEBUGGING PART |
268 |
} else if (command.equals (COMMAND_DEBUG)) { |
259 |
} else if (command.equals (COMMAND_DEBUG)) { |
269 |
if (!isSelectedServer ()) { |
260 |
if (!checkSelectedServer (true, false, false)) { |
270 |
// no selected server => warning |
|
|
271 |
String msg = NbBundle.getMessage( |
272 |
EarActionProvider.class, "MSG_No_Server_Selected"); // NOI18N |
273 |
DialogDisplayer.getDefault().notify( |
274 |
new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE)); |
275 |
return null; |
261 |
return null; |
276 |
} |
262 |
} |
277 |
setDirectoryDeploymentProperty(p); |
263 |
setDirectoryDeploymentProperty(p); |
Lines 304-315
Link Here
|
304 |
} else if (command.equals (COMMAND_PROFILE)) { |
290 |
} else if (command.equals (COMMAND_PROFILE)) { |
305 |
// TODO This is basically a copy of the debugging part for now. Figure out what to do here! |
291 |
// TODO This is basically a copy of the debugging part for now. Figure out what to do here! |
306 |
|
292 |
|
307 |
if (!isSelectedServer ()) { |
293 |
if (!checkSelectedServer (false, true, false)) { |
308 |
// no selected server => warning |
|
|
309 |
String msg = NbBundle.getMessage( |
310 |
EarActionProvider.class, "MSG_No_Server_Selected"); // NOI18N |
311 |
DialogDisplayer.getDefault().notify( |
312 |
new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE)); |
313 |
return null; |
294 |
return null; |
314 |
} |
295 |
} |
315 |
setDirectoryDeploymentProperty(p); |
296 |
setDirectoryDeploymentProperty(p); |
Lines 380-386
Link Here
|
380 |
//see issue #92895 |
361 |
//see issue #92895 |
381 |
//XXX - replace this method with a call to API as soon as issue 109895 will be fixed |
362 |
//XXX - replace this method with a call to API as soon as issue 109895 will be fixed |
382 |
boolean isAppClientSelected = project.evaluator().getProperty("app.client") != null; //NOI18N |
363 |
boolean isAppClientSelected = project.evaluator().getProperty("app.client") != null; //NOI18N |
383 |
return isSelectedServer() && !(isAppClientSelected && isTargetServerRemote()); |
364 |
return checkSelectedServer(false, false, true) && !(isAppClientSelected && isTargetServerRemote()); |
384 |
} |
365 |
} |
385 |
// other actions are global |
366 |
// other actions are global |
386 |
return true; |
367 |
return true; |
Lines 427-453
Link Here
|
427 |
return false; |
408 |
return false; |
428 |
} |
409 |
} |
429 |
|
410 |
|
430 |
private boolean isSelectedServer () { |
411 |
private boolean checkSelectedServer (boolean checkDebug, boolean checkProfile, boolean noMessages) { |
431 |
// XXX determine what to do with the ejb jar project properties |
412 |
// XXX determine what to do with the ejb jar project properties |
432 |
String instance = updateHelper.getAntProjectHelper().getStandardPropertyEvaluator ().getProperty (EarProjectProperties.J2EE_SERVER_INSTANCE); |
413 |
return J2EEProjectProperties.checkSelectedServer(project, updateHelper.getAntProjectHelper(), |
433 |
if (instance != null) { |
414 |
project.getJ2eeProfile(), J2eeModule.Type.EAR, new J2EEProjectProperties.SetServerInstanceCallback() { |
434 |
String id = Deployment.getDefault().getServerID(instance); |
415 |
|
435 |
if (id != null) { |
416 |
@Override |
436 |
return true; |
417 |
public void setServerInstance(String serverInstanceId) { |
|
|
418 |
EarProjectProperties.setServerInstance(project, updateHelper, serverInstanceId); |
437 |
} |
419 |
} |
438 |
} |
420 |
}, checkDebug, checkProfile, noMessages); |
439 |
|
|
|
440 |
// if there is some server instance of the type which was used |
441 |
// previously do not ask and use it |
442 |
String serverType = updateHelper.getAntProjectHelper().getStandardPropertyEvaluator ().getProperty (EarProjectProperties.J2EE_SERVER_TYPE); |
443 |
if (serverType != null) { |
444 |
String instanceID = J2EEProjectProperties.getMatchingInstance(serverType, J2eeModule.Type.EAR, project.getJ2eeProfile()); |
445 |
if (instanceID != null) { |
446 |
EarProjectProperties.setServerInstance(project, updateHelper, instanceID); |
447 |
return true; |
448 |
} |
449 |
} |
450 |
return false; |
451 |
} |
421 |
} |
452 |
|
422 |
|
453 |
private boolean isTargetServerRemote() { |
423 |
private boolean isTargetServerRemote() { |