Author: rob.stryker(a)jboss.com
Date: 2011-05-09 23:44:55 -0400 (Mon, 09 May 2011)
New Revision: 31171
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java
Log:
JBIDE-8884 - NPE when deploy-only server somehow decides to deploy to server-type
deployment instead of custom
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java
===================================================================
---
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java 2011-05-10
03:43:11 UTC (rev 31170)
+++
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java 2011-05-10
03:44:55 UTC (rev 31171)
@@ -18,7 +18,6 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -31,6 +30,7 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.UIUtil;
import org.jboss.ide.eclipse.as.ui.editor.IDeploymentTypeUI.IServerModeUICallback;
@@ -142,20 +142,25 @@
callback.getServer(), IDeployableServer.SERVER_MODE,
ui.getPublishType().getId(), "Change server mode"));
String deployType = null;
- if( ui.getPublishType().getId().equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD)) {
- deployType = IDeployableServer.DEPLOY_METADATA;
- } else {
- deployType = IDeployableServer.DEPLOY_SERVER;
+ if( shouldChangeDefaultDeployType(callback.getServer())) {
+ if( ui.getPublishType().getId().equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD)) {
+ deployType = IDeployableServer.DEPLOY_METADATA;
+ } else {
+ deployType = IDeployableServer.DEPLOY_SERVER;
+ }
+ callback.execute(new ChangeServerPropertyCommand(
+ callback.getServer(), IDeployableServer.DEPLOY_DIRECTORY_TYPE,
+ deployType, "Change server's deploy location"));
}
- callback.execute(new ChangeServerPropertyCommand(
- callback.getServer(), IDeployableServer.DEPLOY_DIRECTORY_TYPE,
- deployType, "Change server's deploy location"));
}
} else {
// null selection
}
}
+ private boolean shouldChangeDefaultDeployType(IServerWorkingCopy server) {
+ return
!server.getServerType().getId().equals(IJBossToolingConstants.DEPLOY_ONLY_SERVER);
+ }
public static class ChangeServerPropertyCommand extends ServerCommand {
private IServerWorkingCopy server;