[jbosstools-commits] JBoss Tools SVN: r41794 - in branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui: internal/wizard and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Jun 7 17:34:19 EDT 2012


Author: snjeza
Date: 2012-06-07 17:34:19 -0400 (Thu, 07 Jun 2012)
New Revision: 41794

Modified:
   branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
   branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java
   branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/xpl/NewJavaClassWizardPageEx.java
Log:
JBIDE-12125 - Cannot invoke New Portlet wizard if no Dynamic Web Project is present

Modified: branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java	2012-06-07 21:27:20 UTC (rev 41793)
+++ branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java	2012-06-07 21:34:19 UTC (rev 41794)
@@ -16,6 +16,7 @@
 import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -82,12 +83,20 @@
 	}
 	
 	public static IFile getPortletXmlFile(IProject project) {
+		try {
+			if (project == null || !project.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
+				return null;
+			}
+		} catch (CoreException e) {
+			log(e);
+			return null;
+		}
 		IVirtualComponent component = ComponentCore.createComponent(project);
 		IVirtualFile portletVirtualFile = component.getRootFolder().getFile(
 				IPortletConstants.CONFIG_PATH);
 
 		if (!portletVirtualFile.getUnderlyingFile().exists()) {
-			log(new RuntimeException(Messages.PortletUIActivator_The_portlet_xml_file_doesnt_exist));
+			//log(new RuntimeException(Messages.PortletUIActivator_The_portlet_xml_file_doesnt_exist));
 			return null;
 		}
 

Modified: branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java	2012-06-07 21:27:20 UTC (rev 41793)
+++ branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java	2012-06-07 21:34:19 UTC (rev 41794)
@@ -25,6 +25,7 @@
 import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
 import org.eclipse.jst.j2ee.internal.war.ui.util.WebServletGroupItemProvider;
 import org.eclipse.jst.j2ee.internal.wizard.AnnotationsStandaloneGroup;
 import org.eclipse.jst.j2ee.internal.wizard.NewJavaClassWizardPage;
@@ -42,9 +43,11 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 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.internal.FacetedProject;
 import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.ui.Messages;
 import org.jboss.tools.portlet.ui.MultiSelectFilteredFileSelectionDialog;
@@ -83,8 +86,7 @@
 	protected boolean isProjectValid(IProject project) {
 		boolean result;
 		try {
-			result = project.isAccessible() && 
-				project.hasNature(JavaCore.NATURE_ID);
+			return FacetedProjectFramework.hasProjectFacet(project, IPortletConstants.PORTLET_FACET_ID);
 		} catch (CoreException ce) {
 			result = false;
 		}

Modified: branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/xpl/NewJavaClassWizardPageEx.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/xpl/NewJavaClassWizardPageEx.java	2012-06-07 21:27:20 UTC (rev 41793)
+++ branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/xpl/NewJavaClassWizardPageEx.java	2012-06-07 21:34:19 UTC (rev 41794)
@@ -80,6 +80,8 @@
 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.plugin.WTPCommonPlugin;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.ui.PortletUIActivator;
 
 /**
@@ -239,9 +241,7 @@
 	protected boolean isProjectValid(IProject project) {
 		boolean result;
 		try {
-			result = project.isAccessible() && 
-				project.hasNature(IModuleConstants.MODULE_NATURE_ID) && 
-			 	J2EEProjectUtilities.getJ2EEProjectType(project).equals(projectType);
+			return FacetedProjectFramework.hasProjectFacet(project, IPortletConstants.JSFPORTLET_FACET_ID);
 		} catch (CoreException ce) {
 			result = false;
 		}



More information about the jbosstools-commits mailing list