Author: akazakov
Date: 2011-11-03 19:11:02 -0400 (Thu, 03 Nov 2011)
New Revision: 36167
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-9581 Create vanilla CDI getting started project
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2011-11-03 22:43:01 UTC
(rev 36166)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2011-11-03 23:11:02 UTC
(rev 36167)
@@ -37,7 +37,9 @@
org.eclipse.draw2d;bundle-version="3.7.0",
org.eclipse.jdt.core.manipulation;bundle-version="1.4.0",
org.eclipse.jst.servlet.ui;bundle-version="1.1.500",
- org.eclipse.wst.web.ui;bundle-version="1.1.400"
+ org.eclipse.wst.web.ui;bundle-version="1.1.400",
+ org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
+ org.eclipse.wst.common.frameworks.ui;bundle-version="1.2.100"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor.0
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-11-03
22:43:01 UTC (rev 36166)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-11-03
23:11:02 UTC (rev 36167)
@@ -156,4 +156,5 @@
public static String CDI_PROJECT_WIZARD_NEW_PROJECT;
public static String CDI_PROJECT_WIZARD_NEW_PROJECT_TITLE;
public static String CDI_PROJECT_WIZARD_NEW_PROJECT_DESCRIPTION;
+ public static String CDI_PROJECT_WIZARD_PAGE1_CDI_FACET_MUST_BE_SPECIFIED;
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-11-03
22:43:01 UTC (rev 36166)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-11-03
23:11:02 UTC (rev 36167)
@@ -143,4 +143,5 @@
CDI_PROJECT_WIZARD_NEW_PROJECT=New CDI Web Project
CDI_PROJECT_WIZARD_NEW_PROJECT_TITLE=CDI Web Project
-CDI_PROJECT_WIZARD_NEW_PROJECT_DESCRIPTION=Create a standalone CDI Web project or add it
to a new or existing Enterprise Application.
\ No newline at end of file
+CDI_PROJECT_WIZARD_NEW_PROJECT_DESCRIPTION=Create a standalone CDI Web project or add it
to a new or existing Enterprise Application.
+CDI_PROJECT_WIZARD_PAGE1_CDI_FACET_MUST_BE_SPECIFIED=CDI facet must be enabled.
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java 2011-11-03
22:43:01 UTC (rev 36166)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java 2011-11-03
23:11:02 UTC (rev 36167)
@@ -17,7 +17,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.servlet.ui.project.facet.WebProjectFirstPage;
import org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
@@ -27,6 +29,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.project.facet.ICDIFacetDataModelProperties;
import org.jboss.tools.cdi.ui.CDIUIMessages;
/**
@@ -96,12 +99,7 @@
*/
@Override
protected IWizardPage createFirstPage() {
- IWizardPage page = super.createFirstPage();
-
- page.setTitle(CDIUIMessages.CDI_PROJECT_WIZARD_NEW_PROJECT_TITLE);
- page.setDescription(CDIUIMessages.CDI_PROJECT_WIZARD_NEW_PROJECT_DESCRIPTION);
- page.setImageDescriptor(getDefaultPageImageDescriptor());
-
+ IWizardPage page = new FirstPage(model, "first.page"); //$NON-NLS-1$
return page;
}
@@ -113,4 +111,43 @@
protected ImageDescriptor getDefaultPageImageDescriptor() {
return CDIImages.getImageDescriptor(CDIImages.WELD_WIZARD_IMAGE_PATH);
}
+
+ class FirstPage extends WebProjectFirstPage {
+
+ public FirstPage(IDataModel model, String pageName) {
+ super(model, pageName);
+
+ setTitle(CDIUIMessages.CDI_PROJECT_WIZARD_NEW_PROJECT_TITLE);
+ setDescription(CDIUIMessages.CDI_PROJECT_WIZARD_NEW_PROJECT_DESCRIPTION);
+ setImageDescriptor(CDIProjectWizard.this.getDefaultPageImageDescriptor());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ boolean pageComplete = super.isPageComplete();
+
+ IProjectFacet pFacet =
ProjectFacetsManager.getProjectFacet(ICDIFacetDataModelProperties.CDI_FACET_ID);
+ IFacetedProjectWorkingCopy fProject = getFacetedProjectWorkingCopy();
+ if(fProject!=null) {
+ IProjectFacetVersion cdiFacet = fProject.getProjectFacetVersion(pFacet);
+ if(cdiFacet==null) {
+ if(pageComplete) {
+
this.setErrorMessage(CDIUIMessages.CDI_PROJECT_WIZARD_PAGE1_CDI_FACET_MUST_BE_SPECIFIED);
+ return false;
+ }
+ } else {
+ if(pageComplete) {
+ this.setErrorMessage(null);
+ } else
if(CDIUIMessages.CDI_PROJECT_WIZARD_PAGE1_CDI_FACET_MUST_BE_SPECIFIED.equals(getErrorMessage()))
{
+ this.setErrorMessage(null);
+ }
+ }
+ }
+ return pageComplete;
+ }
+ }
}
\ No newline at end of file