[jbosstools-commits] JBoss Tools SVN: r41974 - in trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui: internal/wizard and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Jun 14 09:27:16 EDT 2012


Author: snjeza
Date: 2012-06-14 09:27:16 -0400 (Thu, 14 Jun 2012)
New Revision: 41974

Modified:
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/Messages.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/messages.properties
Log:
JBIDE-12126 - Inform user that the selected project does not contain portlet.xml file

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/Messages.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/Messages.java	2012-06-14 13:25:39 UTC (rev 41973)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/Messages.java	2012-06-14 13:27:16 UTC (rev 41974)
@@ -19,6 +19,8 @@
 	public static String NewPortletClassDataModelProvider_The_portlet_already_exists;
 	public static String NewPortletClassWizardPage_Choose_a_portlet_class;
 	public static String NewPortletClassWizardPage_New_Portlet;
+	public static String NewPortletClassWizardPage_The_portlet_xml_file_doesn_t_exist;
+	public static String NewPortletClassWizardPage_Updating_web_xml_portlet_xml_is_not_possible_on_non_portlet_web_projects;
 	public static String NewPortletClassWizardPage_Use_an_existing_Portlet_class;
 	public static String NewPortletWizard_Specify_modifiers_interfaces_to_implement_and_method_stubs_to_generate;
 	public static String No_portlets_exist_to_add;

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java	2012-06-14 13:25:39 UTC (rev 41973)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java	2012-06-14 13:27:16 UTC (rev 41974)
@@ -201,4 +201,28 @@
 		superLabel.setEnabled(!enable);
 	}
 
+	@Override
+	protected void validatePage(boolean showMessage) {
+		super.validatePage(showMessage);
+		if (showMessage && getMessage() == null && getErrorMessage() == null) {
+			IProject project = getTargetProject();
+			boolean isFacetedProject = false;
+			try {
+				isFacetedProject = FacetedProjectFramework.isFacetedProject(project);
+			} catch (CoreException e) {
+				// ignore
+			}
+			if (!isFacetedProject) {
+				setMessage(Messages.NewPortletClassWizardPage_Updating_web_xml_portlet_xml_is_not_possible_on_non_portlet_web_projects, IMessageProvider.WARNING);
+			} else if (PortletUIActivator.getPortletXmlFile(project) == null) {
+				setMessage(Messages.NewPortletClassWizardPage_The_portlet_xml_file_doesn_t_exist, IMessageProvider.WARNING);
+			}
+		}
+	}
+	
+	public IProject getTargetProject() {
+		String projectName = model.getStringProperty(PROJECT_NAME);
+		return ProjectUtilities.getProject(projectName);
+	}
+
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/messages.properties
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/messages.properties	2012-06-14 13:25:39 UTC (rev 41973)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/messages.properties	2012-06-14 13:27:16 UTC (rev 41974)
@@ -43,6 +43,8 @@
 NewPortletClassDataModelProvider_The_portlet_already_exists=The ''{0}'' portlet already exists.
 NewPortletClassWizardPage_Choose_a_portlet_class=Choose a portlet class:
 NewPortletClassWizardPage_New_Portlet=New Portlet
+NewPortletClassWizardPage_The_portlet_xml_file_doesn_t_exist=The portlet.xml file doesn't exist
+NewPortletClassWizardPage_Updating_web_xml_portlet_xml_is_not_possible_on_non_portlet_web_projects=Updating web.xml/portlet.xml is not possible on non-portlet/web projects
 NewPortletClassWizardPage_Use_an_existing_Portlet_class=Use an existing Portlet class
 NewPortletWizard_Specify_modifiers_interfaces_to_implement_and_method_stubs_to_generate=Specify modifiers, interfaces to implement and method stubs to generate.
 No_portlets_exist_to_add=No portlets exist to add



More information about the jbosstools-commits mailing list