This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 202587
Collapse All | Expand All

(-)a/j2ee.clientproject/nbproject/project.xml (-1 / +1 lines)
Lines 155-161 Link Here
155
                    <build-prerequisite/>
155
                    <build-prerequisite/>
156
                    <compile-dependency/>
156
                    <compile-dependency/>
157
                    <run-dependency>
157
                    <run-dependency>
158
                        <specification-version>1.5</specification-version>
158
                        <specification-version>1.8</specification-version>
159
                    </run-dependency>
159
                    </run-dependency>
160
                </dependency>
160
                </dependency>
161
                <dependency>
161
                <dependency>
(-)a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientActionProvider.java (-31 / +11 lines)
Lines 54-76 Link Here
54
import org.netbeans.api.debugger.DebuggerManager;
54
import org.netbeans.api.debugger.DebuggerManager;
55
import org.netbeans.api.debugger.Session;
55
import org.netbeans.api.debugger.Session;
56
import org.netbeans.api.debugger.jpda.AttachingDICookie;
56
import org.netbeans.api.debugger.jpda.AttachingDICookie;
57
import org.netbeans.api.j2ee.core.Profile;
58
import org.netbeans.api.java.project.JavaProjectConstants;
57
import org.netbeans.api.java.project.JavaProjectConstants;
59
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
58
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
60
import org.netbeans.modules.j2ee.clientproject.ui.customizer.AppClientProjectProperties;
59
import org.netbeans.modules.j2ee.clientproject.ui.customizer.AppClientProjectProperties;
61
import org.netbeans.modules.javaee.project.api.ant.ui.J2EEProjectProperties;
60
import org.netbeans.modules.javaee.project.api.ant.ui.J2EEProjectProperties;
62
import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
61
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
63
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule.Type;
64
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
62
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
65
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
63
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
66
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
64
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
67
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
65
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
68
import org.netbeans.modules.java.api.common.project.BaseActionProvider;
66
import org.netbeans.modules.java.api.common.project.BaseActionProvider;
69
import org.netbeans.spi.project.SingleMethod;
67
import org.netbeans.spi.project.SingleMethod;
70
import org.openide.DialogDisplayer;
71
import org.openide.NotifyDescriptor;
72
import org.openide.util.Lookup;
68
import org.openide.util.Lookup;
73
import org.openide.util.NbBundle;
74
69
75
/**
70
/**
76
 * Action provider of the Application Client project.
71
 * Action provider of the Application Client project.
Lines 213-223 Link Here
213
    public String[] getTargetNames(String command, Lookup context, Properties p, boolean doJavaChecks) throws IllegalArgumentException {
208
    public String[] getTargetNames(String command, Lookup context, Properties p, boolean doJavaChecks) throws IllegalArgumentException {
214
        if (command.equals(COMMAND_RUN) || command.equals(EjbProjectConstants.COMMAND_REDEPLOY) || 
209
        if (command.equals(COMMAND_RUN) || command.equals(EjbProjectConstants.COMMAND_REDEPLOY) || 
215
                command.equals(COMMAND_DEBUG) || command.equals(COMMAND_DEBUG_SINGLE) || command.equals(COMMAND_RUN_SINGLE)) {
210
                command.equals(COMMAND_DEBUG) || command.equals(COMMAND_DEBUG_SINGLE) || command.equals(COMMAND_RUN_SINGLE)) {
216
            if (!isSelectedServer()) {
211
            if (!checkSelectedServer(command.equals(COMMAND_DEBUG) || command.equals(COMMAND_DEBUG_SINGLE), false, false)) {
217
                String msg = NbBundle.getMessage(
218
                        AppClientActionProvider.class, "MSG_No_Server_Selected"); //  NOI18N
219
                DialogDisplayer.getDefault().notify(
220
                        new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
221
                return null;
212
                return null;
222
            }
213
            }
223
            if (isDebugged()) {
214
            if (isDebugged()) {
Lines 241-271 Link Here
241
        if (command.equals(COMMAND_RUN) || command.equals(COMMAND_DEBUG)) {
232
        if (command.equals(COMMAND_RUN) || command.equals(COMMAND_DEBUG)) {
242
            //see issue #92895
233
            //see issue #92895
243
            //XXX - replace this method with a call to API as soon as issue 109895 will be fixed
234
            //XXX - replace this method with a call to API as soon as issue 109895 will be fixed
244
            return res && isSelectedServer() && !isTargetServerRemote();
235
            return res && checkSelectedServer(command.equals(COMMAND_DEBUG), false, true) && !isTargetServerRemote();
245
        }
236
        }
246
        return res;
237
        return res;
247
    }
238
    }
248
    
239
    
249
    private boolean isSelectedServer() {
240
    private boolean checkSelectedServer(boolean checkDebug, boolean checkProfile, boolean noMessages) {
250
        String instance = getAntProjectHelper().getStandardPropertyEvaluator ().getProperty (AppClientProjectProperties.J2EE_SERVER_INSTANCE);
241
        return J2EEProjectProperties.checkSelectedServer(getProject(), getAntProjectHelper(),
251
        if (instance != null) {
242
                ((AppClientProject) getProject()).getAPICar().getJ2eeProfile(), J2eeModule.Type.CAR, new J2EEProjectProperties.SetServerInstanceCallback() {
252
            String id = Deployment.getDefault().getServerID(instance);
243
253
            if (id != null) {
244
            @Override
254
                return true;
245
            public void setServerInstance(String serverInstanceId) {
246
                AppClientActionProvider.this.setServerInstance(serverInstanceId);
255
            }
247
            }
256
        }
248
        }, checkDebug, checkProfile, false);
257
        
258
        // if there is some server instance of the type which was used
259
        // previously do not ask and use it
260
        String serverType = getAntProjectHelper().getStandardPropertyEvaluator ().getProperty (AppClientProjectProperties.J2EE_SERVER_TYPE);
261
        if (serverType != null) {
262
            String instanceID = J2EEProjectProperties.getMatchingInstance(serverType, Type.CAR, ((AppClientProject) getProject()).getAPICar().getJ2eeProfile());
263
            if (instanceID != null) {
264
                setServerInstance(instanceID);
265
                return true;
266
            }
267
        }
268
        return false;
269
    }
249
    }
270
    
250
    
271
    private void setServerInstance(final String serverInstanceId) {
251
    private void setServerInstance(final String serverInstanceId) {
(-)a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/Bundle.properties (-1 lines)
Lines 49-55 Link Here
49
LBL_No_Main_Classs_Found=Class "{0}" does not have a main method.
49
LBL_No_Main_Classs_Found=Class "{0}" does not have a main method.
50
LBL_No_Build_XML_Found=The project has no build script.
50
LBL_No_Build_XML_Found=The project has no build script.
51
MSG_FinishSession=Application Client debugging is not available right now because there is another remote debugging session active. The IDE will now close the active session and start a new session.
51
MSG_FinishSession=Application Client debugging is not available right now because there is another remote debugging session active. The IDE will now close the active session and start a new session.
52
MSG_No_Server_Selected=<html>The target server has not been set or has been removed.<br>Right-click the project in the Projects window and choose<br> <b>Resolve Missing Server to set the target server.</html>
53
MSG_SessionRunning={0} cannot be executed when a debugging session is running. Do you want to close the debugging session and execute the {0}?
52
MSG_SessionRunning={0} cannot be executed when a debugging session is running. Do you want to close the debugging session and execute the {0}?
54
53
55
NAME_src.dir=Source Packages
54
NAME_src.dir=Source Packages
(-)a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/ui/customizer/AppClientProjectProperties.java (-2 / +2 lines)
Lines 136-143 Link Here
136
    public static final String DIST_EAR_JAR = "dist.ear.jar"; //NOI18N
136
    public static final String DIST_EAR_JAR = "dist.ear.jar"; //NOI18N
137
    public static final String JAR_NAME = "jar.name"; // NOI18N
137
    public static final String JAR_NAME = "jar.name"; // NOI18N
138
    public static final String BUILD_EAR_CLASSES_DIR = "build.ear.classes.dir"; // NOI18N
138
    public static final String BUILD_EAR_CLASSES_DIR = "build.ear.classes.dir"; // NOI18N
139
    public static final String J2EE_SERVER_INSTANCE = "j2ee.server.instance"; // NOI18N
139
    public static final String J2EE_SERVER_INSTANCE = J2EEProjectProperties.J2EE_SERVER_INSTANCE;
140
    public static final String J2EE_SERVER_TYPE = "j2ee.server.type"; // NOI18N
140
    public static final String J2EE_SERVER_TYPE = J2EEProjectProperties.J2EE_SERVER_TYPE;
141
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
141
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
142
    
142
    
143
    // Properties stored in the PROJECT.PROPERTIES    
143
    // Properties stored in the PROJECT.PROPERTIES    
(-)a/j2ee.earproject/nbproject/project.xml (-1 / +1 lines)
Lines 216-222 Link Here
216
                    <build-prerequisite/>
216
                    <build-prerequisite/>
217
                    <compile-dependency/>
217
                    <compile-dependency/>
218
                    <run-dependency>
218
                    <run-dependency>
219
                        <specification-version>1.6</specification-version>
219
                        <specification-version>1.8</specification-version>
220
                    </run-dependency>
220
                    </run-dependency>
221
                </dependency>
221
                </dependency>
222
                <dependency>
222
                <dependency>
(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/Bundle.properties (-2 lines)
Lines 66-73 Link Here
66
CTL_UpdateOption=Upgrade Project
66
CTL_UpdateOption=Upgrade Project
67
67
68
# EarActionProvider
68
# EarActionProvider
69
MSG_No_Server_Selected=<html>The target server has not been set or has been removed.<br>Right-click the project in the Projects window and choose<br> <b>Resolve Missing Server Problem</b> \
70
    to set the target server.</html>
71
MSG_Server_State_Question=Is server running in debug mode?
69
MSG_Server_State_Question=Is server running in debug mode?
72
MSG_Server_State=Either stop the server or re-start it in debug mode.
70
MSG_Server_State=Either stop the server or re-start it in debug mode.
73
71
(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarActionProvider.java (-42 / +12 lines)
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() {
(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ui/customizer/EarProjectProperties.java (-2 / +2 lines)
Lines 154-161 Link Here
154
    public static final String J2EE_DEPLOY_ON_SAVE = "j2ee.deploy.on.save"; //NOI18N
154
    public static final String J2EE_DEPLOY_ON_SAVE = "j2ee.deploy.on.save"; //NOI18N
155
    public static final String J2EE_COMPILE_ON_SAVE = "j2ee.compile.on.save"; //NOI18N
155
    public static final String J2EE_COMPILE_ON_SAVE = "j2ee.compile.on.save"; //NOI18N
156
    public static final String CLIENT_MODULE_URI = "client.module.uri"; //NOI18N
156
    public static final String CLIENT_MODULE_URI = "client.module.uri"; //NOI18N
157
    public static final String J2EE_SERVER_INSTANCE = "j2ee.server.instance"; //NOI18N
157
    public static final String J2EE_SERVER_INSTANCE = J2EEProjectProperties.J2EE_SERVER_INSTANCE;
158
    public static final String J2EE_SERVER_TYPE = "j2ee.server.type"; //NOI18N
158
    public static final String J2EE_SERVER_TYPE = J2EEProjectProperties.J2EE_SERVER_TYPE;
159
    public static final String JAVAC_SOURCE = "javac.source"; //NOI18N
159
    public static final String JAVAC_SOURCE = "javac.source"; //NOI18N
160
    public static final String JAVAC_DEBUG = "javac.debug"; //NOI18N
160
    public static final String JAVAC_DEBUG = "javac.debug"; //NOI18N
161
    public static final String JAVAC_DEPRECATION = "javac.deprecation"; //NOI18N
161
    public static final String JAVAC_DEPRECATION = "javac.deprecation"; //NOI18N
(-)a/j2ee.ejbjarproject/nbproject/project.xml (-1 / +1 lines)
Lines 175-181 Link Here
175
                    <build-prerequisite/>
175
                    <build-prerequisite/>
176
                    <compile-dependency/>
176
                    <compile-dependency/>
177
                    <run-dependency>
177
                    <run-dependency>
178
                        <specification-version>1.5</specification-version>
178
                        <specification-version>1.8</specification-version>
179
                    </run-dependency>
179
                    </run-dependency>
180
                </dependency>
180
                </dependency>
181
                <dependency>
181
                <dependency>
(-)a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarActionProvider.java (-28 / +23 lines)
Lines 69-80 Link Here
69
import org.netbeans.spi.project.LookupProvider;
69
import org.netbeans.spi.project.LookupProvider;
70
import org.netbeans.spi.project.ProjectServiceProvider;
70
import org.netbeans.spi.project.ProjectServiceProvider;
71
import org.netbeans.spi.project.SingleMethod;
71
import org.netbeans.spi.project.SingleMethod;
72
import org.openide.DialogDisplayer;
73
import org.openide.NotifyDescriptor;
74
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileUtil;
73
import org.openide.filesystems.FileUtil;
76
import org.openide.util.Lookup;
74
import org.openide.util.Lookup;
77
import org.openide.util.NbBundle;
78
import org.openide.util.Parameters;
75
import org.openide.util.Parameters;
79
76
80
77
Lines 260-267 Link Here
260
            command.equals(COMMAND_PROFILE_TEST_SINGLE)) {
257
            command.equals(COMMAND_PROFILE_TEST_SINGLE)) {
261
            setDirectoryDeploymentProperty(p);
258
            setDirectoryDeploymentProperty(p);
262
        }
259
        }
260
        if (command.equals(COMMAND_RUN_SINGLE) || command.equals(COMMAND_DEBUG_SINGLE) || command.equals(COMMAND_PROFILE_SINGLE)) {
261
            if (!checkSelectedServer(
262
                    command.equals(COMMAND_DEBUG_SINGLE), command.equals(COMMAND_PROFILE_SINGLE))) {
263
                return null;
264
            }
265
        } else if (command.equals(COMMAND_PROFILE)) {
266
            if (!checkSelectedServer(false, true)) {
267
                return null;
268
            }
269
        } else if (command.equals(COMMAND_DEBUG)) {
270
            if (!checkSelectedServer(true, false)) {
271
                return null;
272
            }
273
        }
263
        if (command.equals(COMMAND_RUN) || command.equals(EjbProjectConstants.COMMAND_REDEPLOY)) {
274
        if (command.equals(COMMAND_RUN) || command.equals(EjbProjectConstants.COMMAND_REDEPLOY)) {
264
            if (!isSelectedServer()) {
275
            if (!checkSelectedServer(false, false)) {
265
                return null;
276
                return null;
266
            }
277
            }
267
            if (isDebugged()) {
278
            if (isDebugged()) {
Lines 332-362 Link Here
332
        return false;
343
        return false;
333
    }
344
    }
334
    
345
    
335
    private boolean isSelectedServer() {
346
    private boolean checkSelectedServer(boolean checkDebug, boolean checkProfile) {
336
        String instance = getAntProjectHelper().getStandardPropertyEvaluator().getProperty(EjbJarProjectProperties.J2EE_SERVER_INSTANCE);
347
        return J2EEProjectProperties.checkSelectedServer(getProject(), getAntProjectHelper(),
337
        if (instance != null) {
348
                project.getAPIEjbJar().getJ2eeProfile(), J2eeModule.Type.EJB, new J2EEProjectProperties.SetServerInstanceCallback() {
338
            String id = Deployment.getDefault().getServerID(instance);
349
339
            if (id != null) {
350
            @Override
340
                return true;
351
            public void setServerInstance(String serverInstanceId) {
352
                EjbJarActionProvider.this.setServerInstance(serverInstanceId);
341
            }
353
            }
342
        }
354
        }, checkDebug, checkProfile, false);
343
        
344
        // if there is some server instance of the type which was used
345
        // previously do not ask and use it
346
        String serverType = getAntProjectHelper().getStandardPropertyEvaluator().getProperty(EjbJarProjectProperties.J2EE_SERVER_TYPE);
347
        if (serverType != null) {
348
            String instanceID = J2EEProjectProperties.getMatchingInstance(
349
                    serverType, J2eeModule.Type.EJB, project.getAPIEjbJar().getJ2eeProfile());
350
            if (instanceID != null) {
351
                setServerInstance(instanceID);
352
                return true;
353
            }
354
        }
355
        
356
        // no selected server => warning
357
        String msg = NbBundle.getMessage(EjbJarActionProvider.class, "MSG_No_Server_Selected"); //  NOI18N
358
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
359
        return false;
360
    }
355
    }
361
    
356
    
362
    private void setServerInstance(final String serverInstanceId) {
357
    private void setServerInstance(final String serverInstanceId) {
(-)a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/EjbJarProjectProperties.java (-2 / +2 lines)
Lines 147-154 Link Here
147
    public static final String JAR_COMPRESS = "jar.compress"; // NOI18N
147
    public static final String JAR_COMPRESS = "jar.compress"; // NOI18N
148
    public static final String INCLUDE_JARS = "jars.in.ejbjar"; // NOI18N
148
    public static final String INCLUDE_JARS = "jars.in.ejbjar"; // NOI18N
149
149
150
    public static final String J2EE_SERVER_INSTANCE = "j2ee.server.instance"; // NOI18N
150
    public static final String J2EE_SERVER_INSTANCE = J2EEProjectProperties.J2EE_SERVER_INSTANCE;
151
    public static final String J2EE_SERVER_TYPE = "j2ee.server.type"; // NOI18N
151
    public static final String J2EE_SERVER_TYPE = J2EEProjectProperties.J2EE_SERVER_TYPE;
152
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
152
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
153
    public static final String J2EE_PLATFORM_EMBEDDABLE_EJB_CLASSPATH = "j2ee.platform.embeddableejb.classpath"; //NOI18N
153
    public static final String J2EE_PLATFORM_EMBEDDABLE_EJB_CLASSPATH = "j2ee.platform.embeddableejb.classpath"; //NOI18N
154
    public static final String JAVAC_SOURCE = "javac.source"; // NOI18N
154
    public static final String JAVAC_SOURCE = "javac.source"; // NOI18N
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java (-1 / +1 lines)
Lines 148-154 Link Here
148
    }
148
    }
149
    
149
    
150
    public boolean supportsStartProfiling(Target target) {
150
    public boolean supportsStartProfiling(Target target) {
151
        return true;
151
        return !dm.isAs7();
152
    }
152
    }
153
    
153
    
154
    public boolean isAlsoTargetServer(Target target) {
154
    public boolean isAlsoTargetServer(Target target) {
(-)a/j2eeserver/apichanges.xml (+17 lines)
Lines 117-122 Link Here
117
117
118
    <changes>
118
    <changes>
119
119
120
        <change id="profileAndDebuggingInfo">
121
    	    <api name="devmodules"/>
122
            <summary>
123
                Public API to ask the server about profile and debug support.
124
            </summary>
125
            <version major="1" minor="103"/>
126
            <date day="21" month="8" year="2013"/>
127
            <author login="phejl"/>
128
            <compatibility binary="compatible" source="compatible" semantic="compatible" addition="yes"/>
129
            <description>
130
               <p>
131
                   Provides additional methods to query for support for debugging and profiling.
132
               </p>
133
            </description>
134
            <class package="org.netbeans.modules.j2ee.deployment.devmodules.api" name="ServerInstance"/>
135
            <issue number="202587"/>
136
        </change>
120
        <change id="beforeDeploymentHook">
137
        <change id="beforeDeploymentHook">
121
    	    <api name="devmodules"/>
138
    	    <api name="devmodules"/>
122
            <summary>
139
            <summary>
(-)a/j2eeserver/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
is.autoload=true
43
is.autoload=true
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=1.102.0
45
spec.version.base=1.103.0
46
46
47
javadoc.arch=${basedir}/arch.xml
47
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/ServerInstance.java (+22 lines)
Lines 188-193 Link Here
188
    }
188
    }
189
189
190
    /**
190
    /**
191
     * Returns <code>true</code> when debugging is supported by the server.
192
     *
193
     * @return <code>true</code> when debugging is supported by the server
194
     * @throws InstanceRemovedException if the instance is not available anymore
195
     * @since 1.103
196
     */
197
    public boolean isDebuggingSupported() throws InstanceRemovedException {
198
        return getInstanceFromRegistry(ServerRegistry.getInstance()).isDebugSupported();
199
    }
200
201
    /**
202
     * Returns <code>true</code> when profiling is supported by the server.
203
     *
204
     * @return <code>true</code> when profiling is supported by the server
205
     * @throws InstanceRemovedException if the instance is not available anymore
206
     * @since 1.103
207
     */
208
    public boolean isProfilingSupported() throws InstanceRemovedException {
209
        return getInstanceFromRegistry(ServerRegistry.getInstance()).isProfileSupported();
210
    }
211
212
    /**
191
     * Returns descriptor providing extra information about the instance. May
213
     * Returns descriptor providing extra information about the instance. May
192
     * return <code>null</code> if the server does not support this.
214
     * return <code>null</code> if the server does not support this.
193
     *
215
     *
(-)a/javaee.project/manifest.mf (-1 / +1 lines)
Lines 2-7 Link Here
2
OpenIDE-Module: org.netbeans.modules.javaee.project
2
OpenIDE-Module: org.netbeans.modules.javaee.project
3
OpenIDE-Module-Layer: org/netbeans/modules/javaee/project/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/javaee/project/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javaee/project/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javaee/project/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.7
5
OpenIDE-Module-Specification-Version: 1.8
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
7
(-)a/javaee.project/nbproject/project.xml (-1 / +1 lines)
Lines 97-103 Link Here
97
                    <compile-dependency/>
97
                    <compile-dependency/>
98
                    <run-dependency>
98
                    <run-dependency>
99
                        <release-version>4</release-version>
99
                        <release-version>4</release-version>
100
                        <specification-version>1.100</specification-version>
100
                        <specification-version>1.103</specification-version>
101
                    </run-dependency>
101
                    </run-dependency>
102
                </dependency>
102
                </dependency>
103
                <dependency>
103
                <dependency>
(-)468cd4361449 (+46 lines)
Added Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
8
# The contents of this file are subject to the terms of either the GNU
9
# General Public License Version 2 only ("GPL") or the Common
10
# Development and Distribution License("CDDL") (collectively, the
11
# "License"). You may not use this file except in compliance with the
12
# License. You can obtain a copy of the License at
13
# http://www.netbeans.org/cddl-gplv2.html
14
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
# specific language governing permissions and limitations under the
16
# License.  When distributing the software, include this License Header
17
# Notice in each file and include the License file at
18
# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle in the GPL Version 2 section of the License file that
21
# accompanied this code. If applicable, add the following below the
22
# License Header, with the fields enclosed by brackets [] replaced by
23
# your own identifying information:
24
# "Portions Copyrighted [year] [name of copyright owner]"
25
#
26
# Contributor(s):
27
#
28
# The Original Software is NetBeans. The Initial Developer of the Original
29
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30
# Microsystems, Inc. All Rights Reserved.
31
#
32
# If you wish your version of this file to be governed by only the CDDL
33
# or only the GPL Version 2, indicate your decision by adding
34
# "[Contributor] elects to include this software in this distribution
35
# under the [CDDL or GPL Version 2] license." If you do not indicate a
36
# single choice of license, a recipient has the option to distribute
37
# your version of this file under either the CDDL, the GPL Version 2 or
38
# to extend the choice of license to its licensees as provided above.
39
# However, if you add GPL Version 2 code and therefore, elected the GPL
40
# Version 2 license, then the option applies only if the new code is
41
# made subject to such option by the copyright holder.
42
43
MSG_No_Server_Selected=<html>The target server has not been set or has been removed.<br>Right-click the project in the Projects window and choose<br> <b>Resolve Missing Server Problem</b> \
44
    to set the target server.</html>
45
MSG_Server_No_Debugging=<html>The target server does not support debugging.<br><b>Choose a different server</b> in project properties.</html>
46
MSG_Server_No_Profiling=<html>The target server does not support profiling.<br><b>Choose a different server</b> in project properties.</html>
(-)a/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/J2EEProjectProperties.java (-1 / +108 lines)
Lines 52-57 Link Here
52
import java.util.logging.Level;
52
import java.util.logging.Level;
53
import java.util.logging.Logger;
53
import java.util.logging.Logger;
54
import org.netbeans.api.annotations.common.CheckForNull;
54
import org.netbeans.api.annotations.common.CheckForNull;
55
import org.netbeans.api.annotations.common.NonNull;
56
import org.netbeans.api.annotations.common.NullAllowed;
55
import org.netbeans.api.j2ee.core.Profile;
57
import org.netbeans.api.j2ee.core.Profile;
56
import org.netbeans.api.project.Project;
58
import org.netbeans.api.project.Project;
57
import org.netbeans.modules.j2ee.common.ClasspathUtil;
59
import org.netbeans.modules.j2ee.common.ClasspathUtil;
Lines 60-72 Link Here
60
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
62
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
61
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
63
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
62
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
64
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
65
import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerInstance;
66
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
63
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport;
67
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport;
64
import org.netbeans.modules.javaee.specs.support.api.JaxWs;
68
import org.netbeans.modules.javaee.specs.support.api.JaxWs;
65
import org.netbeans.modules.websvc.wsstack.api.WSStack;
69
import org.netbeans.modules.websvc.wsstack.api.WSStack;
66
import org.netbeans.modules.websvc.wsstack.api.WSTool;
70
import org.netbeans.modules.websvc.wsstack.api.WSTool;
71
import org.netbeans.spi.project.support.ant.AntProjectHelper;
67
import org.netbeans.spi.project.support.ant.EditableProperties;
72
import org.netbeans.spi.project.support.ant.EditableProperties;
73
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
74
import org.openide.DialogDisplayer;
75
import org.openide.NotifyDescriptor;
68
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileUtil;
77
import org.openide.filesystems.FileUtil;
78
import org.openide.util.NbBundle;
70
79
71
80
72
/** Helper class. Defines constants for properties. Knows the proper
81
/** Helper class. Defines constants for properties. Knows the proper
Lines 143-149 Link Here
143
        }
152
        }
144
        return null;
153
        return null;
145
    }
154
    }
146
    
155
156
    /**
157
     * Performs necessary check of server instance. Those include server presence
158
     * and optionally support for debugging and/or profiling. Unless suppressed
159
     * it will display warning dialog on a check failure.
160
     * <p>
161
     * The check may try to use and set another server of the same type if
162
     * the current server instance does not exist and the {@code callback}
163
     * is not null.
164
     *
165
     * @param project the project we are checking
166
     * @param helper the ant helper associated with the project
167
     * @param profile the Java EE profile project is using
168
     * @param moduleType the module type of the project
169
     * @param callback the callback to use to set another server of the same type
170
     *             when the current instance is not available
171
     * @param checkDebug {@code true} if the ability to run in debugging mode should be checked
172
     * @param checkProfile {@code true} if the ability to run in profiling mode should be checked
173
     * @param noMessages {@code true} to suppress UI dialogs
174
     * @return {@code true} if the server instance is usable {@code false} otherwise
175
     * @since 1.8
176
     */
177
    public static boolean checkSelectedServer(@NonNull Project project, @NonNull AntProjectHelper helper,
178
            @NonNull Profile profile, @NonNull J2eeModule.Type moduleType,
179
            @NullAllowed SetServerInstanceCallback callback,
180
            boolean checkDebug, boolean checkProfile, boolean noMessages) {
181
182
        final PropertyEvaluator eval = helper.getStandardPropertyEvaluator();
183
        String instanceId = null;
184
        String instance = eval.getProperty(J2EE_SERVER_INSTANCE);
185
        if (instance != null) {
186
            J2eeModuleProvider jmp = (J2eeModuleProvider) project.getLookup().lookup(J2eeModuleProvider.class);
187
            String sdi = jmp.getServerInstanceID();
188
            if (sdi != null) {
189
                String id = Deployment.getDefault().getServerID(sdi);
190
                if (id != null) {
191
                    instanceId = sdi;
192
                }
193
            }
194
        }
195
196
// if there is some server instance of the type which was used
197
// previously do not ask and use it
198
        if (instanceId == null) {
199
            String serverType = eval.getProperty(J2EE_SERVER_TYPE);
200
            if (serverType != null) {
201
                String instanceID = getMatchingInstance(serverType, moduleType, profile);
202
                if (instanceID != null && callback != null) {
203
                    callback.setServerInstance(instanceID);
204
                    instanceId = instanceID;
205
                }
206
            }
207
        }
208
209
        if (instanceId != null) {
210
            try {
211
                ServerInstance instanceObject = Deployment.getDefault().getServerInstance(instanceId);
212
                if (checkDebug && !instanceObject.isDebuggingSupported()) {
213
                    if (!noMessages) {
214
                        String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_Server_No_Debugging"); //  NOI18N
215
                        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
216
                    }
217
                    return false;
218
                }
219
                if (checkProfile && !instanceObject.isProfilingSupported()) {
220
                    if (!noMessages) {
221
                        String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_Server_No_Profiling"); //  NOI18N
222
                        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
223
                    }
224
                    return false;
225
                }
226
            } catch (InstanceRemovedException ex) {
227
                instanceId = null;
228
            }
229
        }
230
        if (instanceId == null) {
231
            // no selected server => warning
232
            if (!noMessages) {
233
                String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_No_Server_Selected"); //  NOI18N
234
                DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
235
            }
236
237
            return false;
238
        }
239
        return true;
240
    }
241
147
    /**
242
    /**
148
     * Sets all server related properties.
243
     * Sets all server related properties.
149
     */
244
     */
Lines 447-451 Link Here
447
        return toClasspathString(files.toArray(new File[files.size()]), roots);
542
        return toClasspathString(files.toArray(new File[files.size()]), roots);
448
    }
543
    }
449
544
545
    /**
546
     * Callback to set the desired server instance.
547
     * since 1.8
548
     */
549
    public static interface SetServerInstanceCallback {
450
550
551
        /**
552
         * Sets the server instance.
553
         * 
554
         * @param serverInstanceId the id of the server instance
555
         */
556
        void setServerInstance(String serverInstanceId);
557
    }
451
}
558
}
(-)a/nbbuild/javadoctools/links.xml (+1 lines)
Lines 218-220 Link Here
218
<link href="${javadoc.docs.org-netbeans-modules-glassfish-cloud}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-glassfish-cloud"/>
218
<link href="${javadoc.docs.org-netbeans-modules-glassfish-cloud}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-glassfish-cloud"/>
219
<link href="${javadoc.docs.org-netbeans-spi-editor-hints-projects}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-spi-editor-hints-projects"/>
219
<link href="${javadoc.docs.org-netbeans-spi-editor-hints-projects}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-spi-editor-hints-projects"/>
220
<link href="${javadoc.docs.org-netbeans-modules-glassfish-common}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-glassfish-common"/>
220
<link href="${javadoc.docs.org-netbeans-modules-glassfish-common}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-glassfish-common"/>
221
<link href="${javadoc.docs.org-netbeans-modules-javaee-project}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-javaee-project"/>
(-)a/nbbuild/javadoctools/properties.xml (+1 lines)
Lines 216-218 Link Here
216
<property name="javadoc.docs.org-netbeans-modules-glassfish-cloud" value="${javadoc.web.root}/org-netbeans-modules-glassfish-cloud"/>
216
<property name="javadoc.docs.org-netbeans-modules-glassfish-cloud" value="${javadoc.web.root}/org-netbeans-modules-glassfish-cloud"/>
217
<property name="javadoc.docs.org-netbeans-spi-editor-hints-projects" value="${javadoc.web.root}/org-netbeans-spi-editor-hints-projects"/>
217
<property name="javadoc.docs.org-netbeans-spi-editor-hints-projects" value="${javadoc.web.root}/org-netbeans-spi-editor-hints-projects"/>
218
<property name="javadoc.docs.org-netbeans-modules-glassfish-common" value="${javadoc.web.root}/org-netbeans-modules-glassfish-common"/>
218
<property name="javadoc.docs.org-netbeans-modules-glassfish-common" value="${javadoc.web.root}/org-netbeans-modules-glassfish-common"/>
219
<property name="javadoc.docs.org-netbeans-modules-javaee-project" value="${javadoc.web.root}/org-netbeans-modules-javaee-project"/>
(-)a/nbbuild/javadoctools/replaces.xml (+1 lines)
Lines 216-218 Link Here
216
<replacefilter token="@org-netbeans-modules-glassfish-cloud@" value="${javadoc.docs.org-netbeans-modules-glassfish-cloud}"/>
216
<replacefilter token="@org-netbeans-modules-glassfish-cloud@" value="${javadoc.docs.org-netbeans-modules-glassfish-cloud}"/>
217
<replacefilter token="@org-netbeans-spi-editor-hints-projects@" value="${javadoc.docs.org-netbeans-spi-editor-hints-projects}"/>
217
<replacefilter token="@org-netbeans-spi-editor-hints-projects@" value="${javadoc.docs.org-netbeans-spi-editor-hints-projects}"/>
218
<replacefilter token="@org-netbeans-modules-glassfish-common@" value="${javadoc.docs.org-netbeans-modules-glassfish-common}"/>
218
<replacefilter token="@org-netbeans-modules-glassfish-common@" value="${javadoc.docs.org-netbeans-modules-glassfish-common}"/>
219
<replacefilter token="@org-netbeans-modules-javaee-project@" value="${javadoc.docs.org-netbeans-modules-javaee-project}"/>
(-)a/web.project/nbproject/project.xml (-2 / +2 lines)
Lines 240-246 Link Here
240
                    <compile-dependency/>
240
                    <compile-dependency/>
241
                    <run-dependency>
241
                    <run-dependency>
242
                        <release-version>4</release-version>
242
                        <release-version>4</release-version>
243
                        <specification-version>1.97</specification-version>
243
                        <specification-version>1.103</specification-version>
244
                    </run-dependency>
244
                    </run-dependency>
245
                </dependency>
245
                </dependency>
246
                <dependency>
246
                <dependency>
Lines 290-296 Link Here
290
                    <build-prerequisite/>
290
                    <build-prerequisite/>
291
                    <compile-dependency/>
291
                    <compile-dependency/>
292
                    <run-dependency>
292
                    <run-dependency>
293
                        <specification-version>1.4</specification-version>
293
                        <specification-version>1.8</specification-version>
294
                    </run-dependency>
294
                    </run-dependency>
295
                </dependency>
295
                </dependency>
296
                <dependency>
296
                <dependency>
(-)a/web.project/src/org/netbeans/modules/web/project/Bundle.properties (-3 lines)
Lines 96-104 Link Here
96
CTL_UpdateOption=Upgrade Project
96
CTL_UpdateOption=Upgrade Project
97
AD_UpdateOption=N/A
97
AD_UpdateOption=N/A
98
98
99
MSG_No_Server_Selected=<html>The target server has not been set or has been removed.<br>Right-click the project in the Projects window and choose<br> <b>Resolve Missing Server Problem</b> \
100
    to set the target server.</html>
101
102
TXT_noExecutableClass=Class "{0}" neither has a main method nor is it a servlet specified in web.xml.
99
TXT_noExecutableClass=Class "{0}" neither has a main method nor is it a servlet specified in web.xml.
103
100
104
#WebActionProvider
101
#WebActionProvider
(-)a/web.project/src/org/netbeans/modules/web/project/WebActionProvider.java (-32 / +13 lines)
Lines 333-339 Link Here
333
            if (res != null) {
333
            if (res != null) {
334
                return res;
334
                return res;
335
            }
335
            }
336
            if (!isSelectedServer()) {
336
            if (!checkSelectedServer(
337
                    command.equals(COMMAND_DEBUG_SINGLE), command.equals(COMMAND_PROFILE_SINGLE))) {
337
                return null;
338
                return null;
338
            }
339
            }
339
            String targetNames[];
340
            String targetNames[];
Lines 383-389 Link Here
383
            }
384
            }
384
            return null;
385
            return null;
385
        } else if (command.equals(COMMAND_RUN) || command.equals(WebProjectConstants.COMMAND_REDEPLOY)) {
386
        } else if (command.equals(COMMAND_RUN) || command.equals(WebProjectConstants.COMMAND_REDEPLOY)) {
386
            if (!isSelectedServer()) {
387
            if (!checkSelectedServer(false, false)) {
387
                return null;
388
                return null;
388
            }
389
            }
389
            if (WhiteListUpdater.isWhitelistViolated(getProject())) {
390
            if (WhiteListUpdater.isWhitelistViolated(getProject())) {
Lines 391-402 Link Here
391
            }
392
            }
392
            return commands.get(command);
393
            return commands.get(command);
393
        } else if (command.equals(COMMAND_PROFILE)) {
394
        } else if (command.equals(COMMAND_PROFILE)) {
394
            if (!isSelectedServer()) {
395
            if (!checkSelectedServer(false, true)) {
395
                return null;
396
                return null;
396
            }
397
            }
397
            initWebServiceProperties(p);
398
            initWebServiceProperties(p);
398
        } else if (command.equals(COMMAND_DEBUG)) {
399
        } else if (command.equals(COMMAND_DEBUG)) {
399
            if (!isSelectedServer()) {
400
            if (!checkSelectedServer(true, false)) {
400
                return null;
401
                return null;
401
            }
402
            }
402
            initWebServiceProperties(p);
403
            initWebServiceProperties(p);
Lines 899-937 Link Here
899
        return false;
900
        return false;
900
    }
901
    }
901
902
902
    private boolean isSelectedServer() {
903
    private boolean checkSelectedServer(boolean checkDebug, boolean checkProfile) {
903
        final PropertyEvaluator eval = getAntProjectHelper().getStandardPropertyEvaluator();
904
        final PropertyEvaluator eval = getAntProjectHelper().getStandardPropertyEvaluator();
904
        if ("false".equals(eval.getProperty(WebProjectProperties.J2EE_SERVER_CHECK))) { // NOI18N
905
        if ("false".equals(eval.getProperty(WebProjectProperties.J2EE_SERVER_CHECK))) { // NOI18N
905
            return true;
906
            return true;
906
        }
907
        }
907
        String instance = eval.getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE);
908
        return J2EEProjectProperties.checkSelectedServer(getProject(), getAntProjectHelper(),
908
        if (instance != null) {
909
                ((WebProject) getProject()).getAPIWebModule().getJ2eeProfile(), J2eeModule.Type.WAR, new J2EEProjectProperties.SetServerInstanceCallback() {
909
            J2eeModuleProvider jmp = (J2eeModuleProvider) getProject().getLookup().lookup(J2eeModuleProvider.class);
910
910
            String sdi = jmp.getServerInstanceID();
911
            @Override
911
            if (sdi != null) {
912
            public void setServerInstance(String serverInstanceId) {
912
                String id = Deployment.getDefault().getServerID(sdi);
913
                WebActionProvider.this.setServerInstance(serverInstanceId);
913
                if (id != null) {
914
                    return true;
915
                }
916
            }
914
            }
917
        }
915
        }, checkDebug, checkProfile, false);
918
919
// if there is some server instance of the type which was used
920
// previously do not ask and use it
921
        String serverType = eval.getProperty(WebProjectProperties.J2EE_SERVER_TYPE);
922
        if (serverType != null) {
923
            String instanceID = J2EEProjectProperties.getMatchingInstance(serverType, J2eeModule.Type.WAR, ((WebProject) getProject()).getAPIWebModule().getJ2eeProfile());
924
            if (instanceID != null) {
925
                setServerInstance(instanceID);
926
                return true;
927
            }
928
        }
929
930
        // no selected server => warning
931
        String msg = NbBundle.getMessage(WebActionProvider.class, "MSG_No_Server_Selected"); //  NOI18N
932
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
933
934
        return false;
935
    }
916
    }
936
917
937
    private void setServerInstance(String serverInstanceId) {
918
    private void setServerInstance(String serverInstanceId) {
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java (-2 / +2 lines)
Lines 158-166 Link Here
158
    public static final String J2EE_COMPILE_ON_SAVE = "j2ee.compile.on.save"; //NOI18N
158
    public static final String J2EE_COMPILE_ON_SAVE = "j2ee.compile.on.save"; //NOI18N
159
    public static final String J2EE_COPY_STATIC_FILES_ON_SAVE = "j2ee.copy.static.files.on.save"; //NOI18N
159
    public static final String J2EE_COPY_STATIC_FILES_ON_SAVE = "j2ee.copy.static.files.on.save"; //NOI18N
160
    public static final String CONTEXT_PATH = "context.path"; //NOI18N
160
    public static final String CONTEXT_PATH = "context.path"; //NOI18N
161
    public static final String J2EE_SERVER_INSTANCE = "j2ee.server.instance"; //NOI18N
161
    public static final String J2EE_SERVER_INSTANCE = J2EEProjectProperties.J2EE_SERVER_INSTANCE;
162
    public static final String J2EE_SERVER_CHECK = "j2ee.server.check"; //NOI18N
162
    public static final String J2EE_SERVER_CHECK = "j2ee.server.check"; //NOI18N
163
    public static final String J2EE_SERVER_TYPE = "j2ee.server.type"; //NOI18N
163
    public static final String J2EE_SERVER_TYPE = J2EEProjectProperties.J2EE_SERVER_TYPE;
164
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
164
    public static final String J2EE_PLATFORM_CLASSPATH = "j2ee.platform.classpath"; //NOI18N
165
    public static final String J2EE_PLATFORM_EMBEDDABLE_EJB_CLASSPATH = "j2ee.platform.embeddableejb.classpath"; //NOI18N
165
    public static final String J2EE_PLATFORM_EMBEDDABLE_EJB_CLASSPATH = "j2ee.platform.embeddableejb.classpath"; //NOI18N
166
    public static final String JAVAC_SOURCE = "javac.source"; //NOI18N
166
    public static final String JAVAC_SOURCE = "javac.source"; //NOI18N

Return to bug 202587