summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Munoz2013-04-17 17:10:58 (EDT)
committer Roberto Sanchez2013-04-17 17:10:58 (EDT)
commit284e391e4c70b9b075a68e45408dc19ad0613a23 (patch)
treee5e8d009d2b8847e53fbfc669a73abb96dd9e786
parentbf11650f409a4e21e763e31f32aecda1fe43b1bd (diff)
downloadwebtools.javaee-284e391e4c70b9b075a68e45408dc19ad0613a23.zip
webtools.javaee-284e391e4c70b9b075a68e45408dc19ad0613a23.tar.gz
webtools.javaee-284e391e4c70b9b075a68e45408dc19ad0613a23.tar.bz2
[404834] Disable Java EE module creation if not supported by target server runtimev201304172200
Update plugin version for WTP 3.5
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java112
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java33
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java18
4 files changed, 141 insertions, 24 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
index 1557408..d490715 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.jst.j2ee.ui; singleton:=true
-Bundle-Version: 1.1.600.qualifier
+Bundle-Version: 1.1.700.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
index accebf1..5c1f8fd 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
@@ -25,8 +25,8 @@ import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.GridData;
@@ -45,6 +45,8 @@ import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCr
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
import org.eclipse.wst.common.frameworks.internal.ui.GenericWizardNode;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implements IDefaultJ2EEComponentCreationDataModelProperties {
@@ -91,7 +93,11 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
*/
@Override
protected String[] getValidationPropertyNames() {
- return new String[] { CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME, CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME, CREATE_EJB, EJB_COMPONENT_NAME, CREATE_WEB, WEB_COMPONENT_NAME, MODULE_NAME_COLLISIONS_VALIDATION, ENABLED };
+ return new String[] { CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME, APPCLIENT_SUPPORT,
+ CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME, CONNECTOR_SUPPORT,
+ CREATE_EJB, EJB_COMPONENT_NAME, EJB_SUPPORT,
+ CREATE_WEB, WEB_COMPONENT_NAME, WEB_SUPPORT,
+ MODULE_NAME_COLLISIONS_VALIDATION, ENABLED };
}
/*
@@ -138,11 +144,25 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
defaultModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Default Module Controls creation
createAppClientDefaultModuleControl();
- if (J2EEPlugin.isEJBSupportAvailable())
- createEJBDefaultModuleControl();
+ if(!isAppClientSupported()){
+ getDataModel().setBooleanProperty(APPCLIENT_SUPPORT, false);
+ getDataModel().setBooleanProperty(CREATE_APPCLIENT, false);
+ }
+ createEJBDefaultModuleControl();
+ if(!isEJBSupported()){
+ getDataModel().setBooleanProperty(EJB_SUPPORT, false);
+ getDataModel().setBooleanProperty(CREATE_EJB, false);
+ }
createWebDefaultModuleControl();
- if (J2EEPlugin.isEJBSupportAvailable())
- createConnectorDefaultModuleControl();
+ if(!isWebSupported()){
+ getDataModel().setBooleanProperty(WEB_SUPPORT, false);
+ getDataModel().setBooleanProperty(CREATE_WEB, false);
+ }
+ createConnectorDefaultModuleControl();
+ if(!isJCASupported()){
+ getDataModel().setBooleanProperty(CONNECTOR_SUPPORT, false);
+ getDataModel().setBooleanProperty(CREATE_CONNECTOR, false);
+ }
}
/**
@@ -154,23 +174,28 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
layout.numColumns = 1;
newModulesComposite.setLayout(layout);
newModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
appClientRadioButton = new Button(newModulesComposite, SWT.RADIO);
-
appClientRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.appClient")); //$NON-NLS-1$
+ appClientRadioButton.setEnabled(isAppClientSupported());
appClientRadioButton.addListener(SWT.Selection, this);
+
if (EarModuleManager.getEJBModuleExtension() != null) {
ejbRadioButton = new Button(newModulesComposite, SWT.RADIO);
ejbRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.ejb")); //$NON-NLS-1$
+ ejbRadioButton.setEnabled(isEJBSupported());
ejbRadioButton.addListener(SWT.Selection, this);
}
if (EarModuleManager.getWebModuleExtension() != null) {
webRadioButton = new Button(newModulesComposite, SWT.RADIO);
webRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.web")); //$NON-NLS-1$
+ webRadioButton.setEnabled(isWebSupported());
webRadioButton.addListener(SWT.Selection, this);
}
if (EarModuleManager.getJCAModuleExtension() != null) {
connectorRadioButton = new Button(newModulesComposite, SWT.RADIO);
connectorRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.jca")); //$NON-NLS-1$
+ connectorRadioButton.setEnabled(isJCASupported());
connectorRadioButton.addListener(SWT.Selection, this);
}
}
@@ -285,10 +310,22 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
}
private void setDefaultModulesSelection(boolean selection) {
- getDataModel().setBooleanProperty(CREATE_APPCLIENT, selection);
- getDataModel().setBooleanProperty(CREATE_CONNECTOR, selection);
- getDataModel().setBooleanProperty(CREATE_EJB, selection);
- getDataModel().setBooleanProperty(CREATE_WEB, selection);
+ if(isAppClientSupported())
+ getDataModel().setBooleanProperty(CREATE_APPCLIENT, selection);
+ else
+ getDataModel().setBooleanProperty(CREATE_APPCLIENT, false);
+ if(isJCASupported())
+ getDataModel().setBooleanProperty(CREATE_CONNECTOR, selection);
+ else
+ getDataModel().setBooleanProperty(CREATE_CONNECTOR, false);
+ if(isEJBSupported())
+ getDataModel().setBooleanProperty(CREATE_EJB, selection);
+ else
+ getDataModel().setBooleanProperty(CREATE_EJB, false);
+ if(isWebSupported())
+ getDataModel().setBooleanProperty(CREATE_WEB, selection);
+ else
+ getDataModel().setBooleanProperty(CREATE_WEB, false);
}
private void showDefaultModulesComposite() {
@@ -304,7 +341,7 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
private void setButtonEnablement() {
if (!defaultModulesButton.getSelection() && connectorRadioButton != null) {
int version = getDataModel().getIntProperty(J2EE_VERSION);
- connectorRadioButton.setEnabled(version > J2EEVersionConstants.J2EE_1_2_ID);
+ connectorRadioButton.setEnabled(version > J2EEVersionConstants.J2EE_1_2_ID && isJCASupported());
}
}
@@ -315,16 +352,30 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
defaultModulesComposite.setVisible(false);
newModulesComposite.setVisible(true);
if (!isAnyModuleRadioSelected())
- appClientRadioButton.setSelection(true);
+ if(getFisrtAvailableRadioButton() != null)
+ getFisrtAvailableRadioButton().setSelection(true);
setSelectedNode(getWizardNodeFromSelection());
stackLayout.topControl = newModulesComposite;
}
+
+ private Button getFisrtAvailableRadioButton(){
+ if(appClientRadioButton != null && appClientRadioButton.isEnabled())
+ return appClientRadioButton;
+ else if(ejbRadioButton != null && ejbRadioButton.isEnabled())
+ return ejbRadioButton;
+ else if(connectorRadioButton != null && connectorRadioButton.isEnabled())
+ return connectorRadioButton;
+ else if(webRadioButton != null && webRadioButton.isEnabled())
+ return webRadioButton;
+
+ return null;
+ }
/**
* @return
*/
private GenericWizardNode getWizardNodeFromSelection() {
- if (appClientRadioButton.getSelection())
+ if (appClientRadioButton != null && appClientRadioButton.getSelection())
return getAppClientNode();
if (connectorRadioButton != null && connectorRadioButton.getSelection())
return getConnectorNode();
@@ -339,7 +390,7 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
* @return
*/
private boolean isAnyModuleRadioSelected() {
- return appClientRadioButton.getSelection() || (connectorRadioButton != null && connectorRadioButton.getSelection()) || (ejbRadioButton != null && ejbRadioButton.getSelection()) || (webRadioButton != null && webRadioButton.getSelection());
+ return (appClientRadioButton != null && appClientRadioButton.getSelection()) || (connectorRadioButton != null && connectorRadioButton.getSelection()) || (ejbRadioButton != null && ejbRadioButton.getSelection()) || (webRadioButton != null && webRadioButton.getSelection());
}
/**
@@ -526,5 +577,32 @@ public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implement
} else
super.validatePage();
}
-
-}
+
+ private boolean isWebSupported(){
+ return isFacetSupported(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ }
+
+ private boolean isAppClientSupported(){
+ return isFacetSupported(IJ2EEFacetConstants.APPLICATION_CLIENT_FACET);
+ }
+
+ private boolean isEJBSupported(){
+ return isFacetSupported(IJ2EEFacetConstants.EJB_FACET);
+ }
+
+ private boolean isJCASupported(){
+ return isFacetSupported(IJ2EEFacetConstants.JCA_FACET);
+ }
+
+ private boolean isFacetSupported(IProjectFacet facet){
+ boolean supports = true;
+
+ IRuntime rt = (IRuntime) getDataModel().getProperty(FACET_RUNTIME);
+
+ if(rt != null)
+ if( ! rt.supports( facet ) )
+ supports = false;
+
+ return supports;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
index 8b23418..d75ca36 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
@@ -85,6 +85,10 @@ public class DefaultJ2EEComponentCreationDataModelProvider extends AbstractDataM
propertyNames.add(CREATE_WEB);
propertyNames.add(CREATE_APPCLIENT);
propertyNames.add(CREATE_CONNECTOR);
+ propertyNames.add(EJB_SUPPORT);
+ propertyNames.add(WEB_SUPPORT);
+ propertyNames.add(APPCLIENT_SUPPORT);
+ propertyNames.add(CONNECTOR_SUPPORT);
propertyNames.add(MODULE_NAME_COLLISIONS_VALIDATION);
propertyNames.add(ENABLED);
propertyNames.add(NESTED_MODEL_CLIENT);
@@ -156,6 +160,11 @@ public class DefaultJ2EEComponentCreationDataModelProvider extends AbstractDataM
return getDefaultCreateValue(propertyName);
if (propertyName.equals(ENABLED))
return Boolean.TRUE;
+ if(propertyName.equals(EJB_SUPPORT) ||
+ propertyName.equals(WEB_SUPPORT) ||
+ propertyName.equals(APPCLIENT_SUPPORT) ||
+ propertyName.equals(CONNECTOR_SUPPORT))
+ return Boolean.TRUE;
return super.getDefaultProperty(propertyName);
}
@@ -453,19 +462,33 @@ public class DefaultJ2EEComponentCreationDataModelProvider extends AbstractDataM
@Override
public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(CREATE_CONNECTOR)) {
+ if (propertyName.equals(CONNECTOR_COMPONENT_NAME)) {
int version = getIntProperty(J2EE_VERSION);
- return version > J2EEVersionConstants.J2EE_1_2_ID;
- }
- if( propertyName.equals(CONNECTOR_COMPONENT_NAME)){
- return getBooleanProperty(CREATE_CONNECTOR);
+ return ((version > J2EEVersionConstants.J2EE_1_2_ID) &&
+ getBooleanProperty(CREATE_CONNECTOR)) ;
}
+
+ if(propertyName.equals(CREATE_CONNECTOR))
+ return getBooleanProperty(CONNECTOR_SUPPORT);
+
+ if(propertyName.equals(CREATE_APPCLIENT))
+ return getBooleanProperty(APPCLIENT_SUPPORT);
+
if (propertyName.equals(APPCLIENT_COMPONENT_NAME))
return getBooleanProperty(CREATE_APPCLIENT);
+
+ if(propertyName.equals(CREATE_EJB))
+ return getBooleanProperty(EJB_SUPPORT);
+
if (propertyName.equals(EJB_COMPONENT_NAME))
return getBooleanProperty(CREATE_EJB);
+
+ if(propertyName.equals(CREATE_WEB))
+ return getBooleanProperty(WEB_SUPPORT);
+
if (propertyName.equals(WEB_COMPONENT_NAME))
return getBooleanProperty(CREATE_WEB);
+
return super.isPropertyEnabled(propertyName);
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
index 44ad358..1af732c 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
@@ -53,7 +53,23 @@ public interface IDefaultJ2EEComponentCreationDataModelProperties {
* Default is true. type Boolean
*/
public static final String CREATE_CONNECTOR = "DefaultJ2EEComponentCreationDataModel.CREATE_CONNECTOR"; //$NON-NLS-1$
-
+ /**
+ * Default is true. type Boolean
+ */
+ public static final String EJB_SUPPORT = "DefaultJ2EEComponentCreationDataModel.EJB_SUPPORT"; //$NON-NLS-1$
+ /**
+ * Default is true. type Boolean
+ */
+ public static final String WEB_SUPPORT = "DefaultJ2EEComponentCreationDataModel.WEB_SUPPORT"; //$NON-NLS-1$
+ /**
+ * Default is true. type Boolean
+ */
+ public static final String APPCLIENT_SUPPORT = "DefaultJ2EEComponentCreationDataModel.CLIENT_SUPPORT"; //$NON-NLS-1$
+ /**
+ * Default is true. type Boolean
+ */
+ public static final String CONNECTOR_SUPPORT = "DefaultJ2EEComponentCreationDataModel.CONNECTOR_SUPPORT"; //$NON-NLS-1$
+
/**
* Used for validation only; validates no collsions between various module names. Do not set
* this value.