+ Provides additional methods to query for support for debugging and profiling. +
+true
when debugging is supported by the server.
+ *
+ * @return true
when debugging is supported by the server
+ * @throws InstanceRemovedException if the instance is not available anymore
+ * @since 1.103
+ */
+ public boolean isDebuggingSupported() throws InstanceRemovedException {
+ return getInstanceFromRegistry(ServerRegistry.getInstance()).isDebugSupported();
+ }
+
+ /**
+ * Returns true
when profiling is supported by the server.
+ *
+ * @return true
when profiling is supported by the server
+ * @throws InstanceRemovedException if the instance is not available anymore
+ * @since 1.103
+ */
+ public boolean isProfilingSupported() throws InstanceRemovedException {
+ return getInstanceFromRegistry(ServerRegistry.getInstance()).isProfileSupported();
+ }
+
+ /**
* Returns descriptor providing extra information about the instance. May
* return null
if the server does not support this.
*
diff -r 468cd4361449 javaee.project/manifest.mf
--- a/javaee.project/manifest.mf Thu Aug 15 10:13:49 2013 +0200
+++ b/javaee.project/manifest.mf Thu Aug 15 14:36:04 2013 +0200
@@ -2,6 +2,6 @@
OpenIDE-Module: org.netbeans.modules.javaee.project
OpenIDE-Module-Layer: org/netbeans/modules/javaee/project/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javaee/project/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.7
+OpenIDE-Module-Specification-Version: 1.8
AutoUpdate-Show-In-Client: false
diff -r 468cd4361449 javaee.project/nbproject/project.xml
--- a/javaee.project/nbproject/project.xml Thu Aug 15 10:13:49 2013 +0200
+++ b/javaee.project/nbproject/project.xml Thu Aug 15 14:36:04 2013 +0200
@@ -97,7 +97,7 @@
+ * The check may try to use and set another server of the same type if
+ * the current server instance does not exist and the {@code callback}
+ * is not null.
+ *
+ * @param project the project we are checking
+ * @param helper the ant helper associated with the project
+ * @param profile the Java EE profile project is using
+ * @param moduleType the module type of the project
+ * @param callback the callback to use to set another server of the same type
+ * when the current instance is not available
+ * @param checkDebug {@code true} if the ability to run in debugging mode should be checked
+ * @param checkProfile {@code true} if the ability to run in profiling mode should be checked
+ * @param noMessages {@code true} to suppress UI dialogs
+ * @return {@code true} if the server instance is usable {@code false} otherwise
+ * @since 1.8
+ */
+ public static boolean checkSelectedServer(@NonNull Project project, @NonNull AntProjectHelper helper,
+ @NonNull Profile profile, @NonNull J2eeModule.Type moduleType,
+ @NullAllowed SetServerInstanceCallback callback,
+ boolean checkDebug, boolean checkProfile, boolean noMessages) {
+
+ final PropertyEvaluator eval = helper.getStandardPropertyEvaluator();
+ String instanceId = null;
+ String instance = eval.getProperty(J2EE_SERVER_INSTANCE);
+ if (instance != null) {
+ J2eeModuleProvider jmp = (J2eeModuleProvider) project.getLookup().lookup(J2eeModuleProvider.class);
+ String sdi = jmp.getServerInstanceID();
+ if (sdi != null) {
+ String id = Deployment.getDefault().getServerID(sdi);
+ if (id != null) {
+ instanceId = sdi;
+ }
+ }
+ }
+
+// if there is some server instance of the type which was used
+// previously do not ask and use it
+ if (instanceId == null) {
+ String serverType = eval.getProperty(J2EE_SERVER_TYPE);
+ if (serverType != null) {
+ String instanceID = getMatchingInstance(serverType, moduleType, profile);
+ if (instanceID != null && callback != null) {
+ callback.setServerInstance(instanceID);
+ instanceId = instanceID;
+ }
+ }
+ }
+
+ if (instanceId != null) {
+ try {
+ ServerInstance instanceObject = Deployment.getDefault().getServerInstance(instanceId);
+ if (checkDebug && !instanceObject.isDebuggingSupported()) {
+ if (!noMessages) {
+ String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_Server_No_Debugging"); // NOI18N
+ DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
+ }
+ return false;
+ }
+ if (checkProfile && !instanceObject.isProfilingSupported()) {
+ if (!noMessages) {
+ String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_Server_No_Profiling"); // NOI18N
+ DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
+ }
+ return false;
+ }
+ } catch (InstanceRemovedException ex) {
+ instanceId = null;
+ }
+ }
+ if (instanceId == null) {
+ // no selected server => warning
+ if (!noMessages) {
+ String msg = NbBundle.getMessage(J2EEProjectProperties.class, "MSG_No_Server_Selected"); // NOI18N
+ DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
+ }
+
+ return false;
+ }
+ return true;
+ }
+
/**
* Sets all server related properties.
*/
@@ -447,5 +542,17 @@
return toClasspathString(files.toArray(new File[files.size()]), roots);
}
+ /**
+ * Callback to set the desired server instance.
+ * since 1.8
+ */
+ public static interface SetServerInstanceCallback {
+ /**
+ * Sets the server instance.
+ *
+ * @param serverInstanceId the id of the server instance
+ */
+ void setServerInstance(String serverInstanceId);
+ }
}
diff -r 468cd4361449 nbbuild/javadoctools/links.xml
--- a/nbbuild/javadoctools/links.xml Thu Aug 15 10:13:49 2013 +0200
+++ b/nbbuild/javadoctools/links.xml Thu Aug 15 14:36:04 2013 +0200
@@ -218,3 +218,4 @@
+
diff -r 468cd4361449 nbbuild/javadoctools/properties.xml
--- a/nbbuild/javadoctools/properties.xml Thu Aug 15 10:13:49 2013 +0200
+++ b/nbbuild/javadoctools/properties.xml Thu Aug 15 14:36:04 2013 +0200
@@ -216,3 +216,4 @@