Author: scabanovich
Date: 2011-06-30 19:03:29 -0400 (Thu, 30 Jun 2011)
New Revision: 32512
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/JSFFacetedProjectListener.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
Log:
JBIDE-9280
https://issues.jboss.org/browse/JBIDE-9280
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-06-30 21:59:37 UTC (rev 32511)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-06-30 23:03:29 UTC (rev 32512)
@@ -386,15 +386,11 @@
class="org.jboss.tools.jsf.jsf2.model.FileCompositeComponentRecognizer"/>
</extension>
<extension
- point="org.eclipse.wst.common.project.facet.core.facets">
- <event-handler
- facet="jst.jsf"
- type="PRE_INSTALL"
- version="[1.1">
- <delegate
-
class="org.jboss.tools.jsf.project.facet.PostInstallJsfFacetDelegate">
- </delegate>
- </event-handler>
+ point="org.eclipse.wst.common.project.facet.core.listeners">
+ <listener
+
class="org.jboss.tools.jsf.project.facet.JSFFacetedProjectListener"
+ eventTypes="PRE_INSTALL">
+ </listener>
</extension>
<extension id="xhtml" name="%XHTML_Validator.name"
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/JSFFacetedProjectListener.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/JSFFacetedProjectListener.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/JSFFacetedProjectListener.java 2011-06-30
23:03:29 UTC (rev 32512)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.project.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent.Type;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jst.web.WebModelPlugin;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.KbBuilder;
+
+/**
+ *
+ * @author eskimo & Viacheslav Kabanovich
+ *
+ */
+public class JSFFacetedProjectListener implements IFacetedProjectListener {
+
+ @Override
+ public void handleEvent(IFacetedProjectEvent event) {
+ if(event.getType() == Type.PRE_INSTALL && event instanceof
IProjectFacetActionEvent) {
+ IProject project = event.getProject().getProject();
+ String facetID = ((IProjectFacetActionEvent)event).getProjectFacet().getId();
+ if("jst.webfragment".equals(facetID) || "jst.jsf".equals(facetID))
{
+ try {
+ WebModelPlugin.addNatureToProjectWithValidationSupport(project,
KbBuilder.BUILDER_ID, IKbProject.NATURE_ID);
+ } catch (CoreException e) {
+ JSFModelPlugin.getDefault().logError(e);
+ }
+ }
+ if("jst.jsf".equals(facetID)) {
+ try {
+ EclipseResourceUtil.addNatureToProject(project, JSFNature.NATURE_ID);
+ } catch (CoreException e) {
+ JSFModelPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/JSFFacetedProjectListener.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java 2011-06-30
21:59:37 UTC (rev 32511)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java 2011-06-30
23:03:29 UTC (rev 32512)
@@ -1,30 +0,0 @@
-package org.jboss.tools.jsf.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jst.web.WebModelPlugin;
-import org.jboss.tools.jst.web.kb.IKbProject;
-import org.jboss.tools.jst.web.kb.internal.KbBuilder;
-
-/**
- *
- * @author eskimo
- *
- */
-public class PostInstallJsfFacetDelegate implements IDelegate {
-
- /* (non-Javadoc)
- * @see
org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object,
org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- WebModelPlugin.addNatureToProjectWithValidationSupport(project, KbBuilder.BUILDER_ID,
IKbProject.NATURE_ID);
- EclipseResourceUtil.addNatureToProject(project, JSFNature.NATURE_ID);
- }
-
-}