Author: snjeza
Date: 2012-06-27 19:50:34 -0400 (Wed, 27 Jun 2012)
New Revision: 42271
Modified:
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewJSFPortletClassWizardPage.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/action/xpl/AddJavaEEArtifactOperationEx.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-12174 - Portlet wizards should not be restricted to portlet enabled projects
(regression)
Modified:
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewJSFPortletClassWizardPage.java
===================================================================
---
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewJSFPortletClassWizardPage.java 2012-06-27
23:35:35 UTC (rev 42270)
+++
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewJSFPortletClassWizardPage.java 2012-06-27
23:50:34 UTC (rev 42271)
@@ -299,7 +299,7 @@
if (!result)
return result;
try {
- result = FacetedProjectFramework.hasProjectFacet(project,
IPortletConstants.JSFPORTLET_FACET_ID);
+ result = project.isAccessible() &&
FacetedProjectFramework.hasProjectFacet(project, IPortletConstants.JSFPORTLET_FACET_ID);
if (!result) {
return result;
}
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-27
23:35:35 UTC (rev 42270)
+++
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassWizardPage.java 2012-06-27
23:50:34 UTC (rev 42271)
@@ -16,6 +16,7 @@
import static
org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
import static
org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.BROWSE_BUTTON_LABEL;
import static
org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.CLASS_NAME_LABEL;
+import static
org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties.PROJECT_NAME;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
@@ -24,8 +25,8 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
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;
@@ -43,14 +44,13 @@
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;
+import org.jboss.tools.portlet.ui.PortletUIActivator;
import org.jboss.tools.portlet.ui.internal.wizard.xpl.NewJavaClassWizardPageEx;
public class NewPortletClassWizardPage extends NewJavaClassWizardPageEx {
@@ -86,7 +86,12 @@
protected boolean isProjectValid(IProject project) {
boolean result;
try {
- return FacetedProjectFramework.hasProjectFacet(project,
IPortletConstants.PORTLET_FACET_ID);
+ result = project.isAccessible() &&
+ project.hasNature(JavaCore.NATURE_ID);
+ if ("External Plug-in Libraries".equals(project.getName()) || //$NON-NLS-1$
+ ".JETEmitters".equals(project.getName()) ) { //$NON-NLS-1$
+ result = false;
+ }
} 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/action/xpl/AddJavaEEArtifactOperationEx.java
===================================================================
---
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/action/xpl/AddJavaEEArtifactOperationEx.java 2012-06-27
23:35:35 UTC (rev 42270)
+++
branches/jbosstools-3.3.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/action/xpl/AddJavaEEArtifactOperationEx.java 2012-06-27
23:50:34 UTC (rev 42271)
@@ -6,6 +6,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -17,6 +18,7 @@
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.jboss.tools.portlet.ui.PortletUIActivator;
public abstract class AddJavaEEArtifactOperationEx extends AbstractDataModelOperation {
@@ -53,6 +55,14 @@
}
private IModelProvider getModelProvider() {
+ IProject project = getTargetProject();
+ try {
+ if (!FacetedProjectFramework.isFacetedProject(project)) {
+ return null;
+ }
+ } catch (CoreException e1) {
+ return null;
+ }
IModelProvider modelProvider = null;
try {
modelProvider = ModelProviderManager.getModelProvider(getTargetProject());
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-27
23:35:35 UTC (rev 42270)
+++
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-27
23:50:34 UTC (rev 42271)
@@ -80,8 +80,6 @@
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;
/**
@@ -241,7 +239,9 @@
protected boolean isProjectValid(IProject project) {
boolean result;
try {
- return FacetedProjectFramework.hasProjectFacet(project,
IPortletConstants.JSFPORTLET_FACET_ID);
+ result = project.isAccessible() &&
+ project.hasNature(IModuleConstants.MODULE_NATURE_ID) &&
+ J2EEProjectUtilities.getJ2EEProjectType(project).equals(projectType);
} catch (CoreException ce) {
result = false;
}
Show replies by date