[jbosstools-commits] JBoss Tools SVN: r17517 - in trunk/portlet/plugins: org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 10 18:42:39 EDT 2009


Author: snjeza
Date: 2009-09-10 18:42:39 -0400 (Thu, 10 Sep 2009)
New Revision: 17517

Added:
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/AbstractLibraryProviderInstallOperationConfig.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/AbstractPortletProviderInstallPanel.java
Modified:
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletPostInstallListener.java
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperation.java
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperationConfig.java
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperation.java
   trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletServerRuntimeProviderInstallPanel.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/PortletServerRuntimeProviderInstallPanel.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/JSFPortletFacetInstallPage.java
   trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/PortletFacetInstallPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4689 Integrate Portlet facet with WTP 3.1 Library Framework

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletPostInstallListener.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletPostInstallListener.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletPostInstallListener.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -48,10 +48,12 @@
 import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.core.Messages;
 import org.jboss.tools.portlet.core.PortletCoreActivator;
+import org.jboss.tools.portlet.core.libprov.AbstractLibraryProviderInstallOperationConfig;
 import org.jboss.tools.portlet.core.libprov.JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig;
 
 public class PortletPostInstallListener implements IFacetedProjectListener {
 
+	private static final String JSFPORTLET_LIBRARY_PROVIDER = "jsfportlet-library-provider";
 	private static final String JSFPORTLETBRIDGE_LIBRARY_PROVIDER = "jsfportletbridge-library-provider"; //$NON-NLS-1$
 	private static final IProjectFacet seamFacet = ProjectFacetsManager.getProjectFacet("jst.seam"); //$NON-NLS-1$
 	private static final IOverwriteQuery OVERWRITE_NONE_QUERY = new IOverwriteQuery()
@@ -62,9 +64,9 @@
       }
     };
 	private String portletbridgeRuntime;
-	//private boolean richfacesCapabilities;
+	private boolean richfacesCapabilities = false;
 	//private boolean richfacesSelected;
-	//private String richfacesType;
+	private String richfacesType;
 	private String richfacesRuntime;
 	
 	
@@ -98,44 +100,50 @@
 			IDataModel dataModel = (IDataModel) actionEvent.getActionConfig();
 			try {
 				LibraryInstallDelegate libraryDelegate = ( (LibraryInstallDelegate) dataModel.getProperty( IPortletConstants.JSFPORTLET_LIBRARY_PROVIDER_DELEGATE ) );
-				ILibraryProvider libraryProvider = libraryDelegate.getLibraryProvider();
-				String providerId = libraryProvider.getId();
-				if (JSFPORTLETBRIDGE_LIBRARY_PROVIDER.equals(providerId)) {
-					JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig libraryConfig = (JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig) libraryDelegate.getLibraryProviderOperationConfig(libraryProvider);
-					portletbridgeRuntime = libraryConfig.getPortletbridgeHome();
-				} else {
-					portletbridgeRuntime = null;
+				if (libraryDelegate != null) {
+					ILibraryProvider libraryProvider = libraryDelegate
+							.getLibraryProvider();
+					String providerId = libraryProvider.getId();
+					if (JSFPORTLETBRIDGE_LIBRARY_PROVIDER.equals(providerId)) {
+						JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig libraryConfig = (JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig) libraryDelegate
+								.getLibraryProviderOperationConfig(libraryProvider);
+						portletbridgeRuntime = libraryConfig.getPortletbridgeHome();
+					} else {
+						portletbridgeRuntime = null;
+					}
+					richfacesFromServerRuntime = JSFPORTLET_LIBRARY_PROVIDER.equals(providerId); //$NON-NLS-1$
+
+					if (JSFPORTLETBRIDGE_LIBRARY_PROVIDER.equals(providerId)
+							|| JSFPORTLET_LIBRARY_PROVIDER.equals(providerId)) {
+						AbstractLibraryProviderInstallOperationConfig libraryConfig = (AbstractLibraryProviderInstallOperationConfig) libraryDelegate.getLibraryProviderOperationConfig(libraryProvider);
+						richfacesCapabilities = libraryConfig.isAddRichfacesCapabilities();
+						richfacesRuntime = libraryConfig.getRichfacesRuntime();
+						richfacesType = libraryConfig.getRichfacesType();
+					}
+					
 				}
-				richfacesFromServerRuntime = "jsfportlet-library-provider".equals(providerId); //$NON-NLS-1$
-					
-				//richfacesCapabilities = dataModel.getBooleanProperty(IPortletConstants.RICHFACES_CAPABILITIES);
-				//richfacesSelected = dataModel.getBooleanProperty(IPortletConstants.RICHFACES_LIBRARIES_SELECTED);
-				//richfacesType = dataModel.getStringProperty(IPortletConstants.RICHFACES_LIBRARIES_TYPE);
-				//richfacesRuntime = dataModel.getStringProperty(IPortletConstants.RICHFACES_RUNTIME);
 			} catch (Exception e) {
 				//PortletCoreActivator.log(e);
 			}
 		}
 		
-		//if (!richfacesCapabilities || !richfacesSelected) {
-		//	return;
-		//}
 		if (isJSFPortlet) {
 			if (portletbridgeRuntime != null) {
-				addRichfacesFromPortletBridgeRuntime(facetedProject,portletbridgeRuntime);
+				addLibrariesFromPortletBridgeRuntime(facetedProject,portletbridgeRuntime);
 			} 
 			else if (richfacesFromServerRuntime) {
-				addRichFacesFromServerRuntime(facetedProject);
+				addLibrariesFromServerRuntime(facetedProject);
 			}
-			//else {
-			//	addRichfacesFromRichfacesRuntime(facetedProject,isSeamProject);
-			//}
 		}
 	}
 
-	private void addRichFacesFromServerRuntime(IFacetedProject facetedProject) {
+	private void addLibrariesFromServerRuntime(IFacetedProject facetedProject) {
 		final boolean isSeamProject = facetedProject.hasProjectFacet(seamFacet);
-		if (isSeamProject) {
+		final boolean addRichfacesFromRichfacesRuntime = richfacesCapabilities && IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richfacesType);
+		if (addRichfacesFromRichfacesRuntime) {
+			addRichfacesFromRichfacesRuntime(facetedProject);
+		}
+		if (isSeamProject) {	
 			return;
 		}
 		org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime = facetedProject.getPrimaryRuntime();
@@ -168,19 +176,22 @@
 			try {
 				IProject project = facetedProject.getProject();
 				final IProject earProject = getEarProject(project, isSeamProject);
+				
 				String[] fileList = richfacesLib.list(new FilenameFilter() {
 
 					public boolean accept(File dir, String name) {
-						if (name.startsWith("richfaces-ui") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
-							return true;
-						}
-						if (name.startsWith("richfaces-impl") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
-							return true;
-						}
-						if (earProject == null) {
-							if (name.startsWith("richfaces-api") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
+						if (!addRichfacesFromRichfacesRuntime) {
+							if (name.startsWith("richfaces-ui") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
 								return true;
 							}
+							if (name.startsWith("richfaces-impl") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
+								return true;
+							}
+							if (earProject == null) {
+								if (name.startsWith("richfaces-api") && name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
+									return true;
+								}
+							}
 						}
 						if (!isSeamProject) {
 							if (name.startsWith("portal")) { //$NON-NLS-1$
@@ -246,7 +257,8 @@
 	}
 
 	private void addRichfacesFromRichfacesRuntime(
-			IFacetedProject facetedProject, boolean isSeamProject) {
+			IFacetedProject facetedProject) {
+		final boolean isSeamProject = facetedProject.hasProjectFacet(seamFacet);
 		File richfacesRuntimeHome = new File(richfacesRuntime);
 		File richfacesLib = new File(richfacesRuntimeHome, "lib"); //$NON-NLS-1$
 		if (!richfacesLib.exists()) {
@@ -360,7 +372,7 @@
 		}
 	}
 
-	private void addRichfacesFromPortletBridgeRuntime(IFacetedProject facetedProject, String portletbridgeRuntime) {
+	private void addLibrariesFromPortletBridgeRuntime(IFacetedProject facetedProject, String portletbridgeRuntime) {
 		File portletbridgeHome = new File(portletbridgeRuntime);
 		if (!portletbridgeHome.exists()) {
 			PortletCoreActivator.log(null, Messages.PortletPostInstallListener_Cannot_find_Portletbridge_Runtime);
@@ -385,7 +397,11 @@
 			ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(
 					zipFile );
 			boolean isSeamProject = facetedProject.hasProjectFacet(seamFacet);
-			List<ZipEntry> list = prepareList(zipFile, facetedProject, isSeamProject);
+			final boolean addRichfacesFromRichfacesRuntime = richfacesCapabilities && IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richfacesType);
+			if (addRichfacesFromRichfacesRuntime) {
+				addRichfacesFromRichfacesRuntime(facetedProject);
+			}
+			List<ZipEntry> list = prepareList(zipFile, facetedProject, isSeamProject, addRichfacesFromRichfacesRuntime);
 			
 			IProject project = facetedProject.getProject();
 			IProject earProject = getEarProject(project, isSeamProject);
@@ -502,7 +518,7 @@
 		return projectScope.getNode("org.jboss.tools.seam.core"); //$NON-NLS-1$
 	}
 	
-	private List<ZipEntry> prepareList(ZipFile rootEntry, IFacetedProject facetedProject, boolean isSeamProject) {
+	private List<ZipEntry> prepareList(ZipFile rootEntry, IFacetedProject facetedProject, boolean isSeamProject, boolean addRichfacesFromRichfacesRuntime) {
 		if (rootEntry == null) {
 			return null;
 		}
@@ -513,18 +529,21 @@
 		while (entries.hasMoreElements()) {
 			ZipEntry entry = entries.nextElement();
 			if (entry.getName().endsWith(".jar")) { //$NON-NLS-1$
-				if (entry.getName().startsWith("WEB-INF/lib/richfaces-ui")) { //$NON-NLS-1$
-					list.add(entry);
-				}
-				if (entry.getName().startsWith("WEB-INF/lib/richfaces-impl")) { //$NON-NLS-1$
-					list.add(entry);
-				}
-				if (earProject == null) {
-					if (entry.getName().startsWith("WEB-INF/lib/richfaces-api")) { //$NON-NLS-1$
+				if (!addRichfacesFromRichfacesRuntime) {
+					if (entry.getName().startsWith("WEB-INF/lib/richfaces-ui")) { //$NON-NLS-1$
 						list.add(entry);
-					}	
+					}
+					if (entry.getName()
+							.startsWith("WEB-INF/lib/richfaces-impl")) { //$NON-NLS-1$
+						list.add(entry);
+					}
+					if (earProject == null) {
+						if (entry.getName().startsWith(
+								"WEB-INF/lib/richfaces-api")) { //$NON-NLS-1$
+							list.add(entry);
+						}
+					}
 				}
-				
 				if (!isSeamProject) {
 					if (entry.getName().startsWith(
 							"WEB-INF/lib/commons-beanutils") //$NON-NLS-1$

Added: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/AbstractLibraryProviderInstallOperationConfig.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/AbstractLibraryProviderInstallOperationConfig.java	                        (rev 0)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/AbstractLibraryProviderInstallOperationConfig.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -0,0 +1,141 @@
+package org.jboss.tools.portlet.core.libprov;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.portlet.core.IPortletConstants;
+import org.jboss.tools.portlet.core.Messages;
+import org.jboss.tools.portlet.core.PortletCoreActivator;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public abstract class AbstractLibraryProviderInstallOperationConfig extends
+		LibraryProviderInstallOperationConfig {
+
+	private boolean addRichfacesCapabilities;
+	private String richfacesType;
+	private String richfacesRuntime;
+	
+	@Override
+	public synchronized IStatus validate() {
+		IStatus status = super.validate();
+		if (!status.isOK()) {
+			return status;
+		}
+		if (!addRichfacesCapabilities) {
+			return status;
+		}
+		if (!IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richfacesType)) {
+			return status;
+		}
+		if (richfacesRuntime == null) {
+			return getInvalidRichfacesRuntime();
+		}
+		richfacesRuntime = richfacesRuntime.trim();
+		if (richfacesRuntime.length() <= 0) {
+			return getInvalidRichfacesRuntime();
+		}
+		File folder = new File(richfacesRuntime);
+		if (!folder.exists() || !folder.isDirectory()) {
+			return getInvalidRichfacesRuntime();
+		}
+		folder = new File(folder,"lib"); //$NON-NLS-1$
+		if (!folder.exists() || !folder.isDirectory()) {
+			return getInvalidRichfacesRuntime();
+		}
+		String[] fileList = folder.list(new FilenameFilter() {
+
+			public boolean accept(File dir, String name) {
+				if (name.startsWith("richfaces") || name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
+					return true;
+				}
+				return false;
+			}
+
+		});
+		if (fileList.length < 3) {
+			return getInvalidRichfacesRuntime();
+		}
+		
+		return Status.OK_STATUS;
+	}
+
+	private IStatus getInvalidRichfacesRuntime() {
+		IStatus status = new Status( IStatus.ERROR, PortletCoreActivator.PLUGIN_ID, Messages.PortletPostInstallListener_Invalid_Richfaces_Runtime );
+		return status;
+	}
+	
+	private void updatePreferences() {
+		IProjectFacet f = getProjectFacet();
+        try {
+			Preferences prefs = FacetedProjectFramework.getPreferences( f );
+			prefs = prefs.node(IPortletConstants.PORTLET_BRIDGE_HOME);
+			prefs.putBoolean(IPortletConstants.RICHFACES_CAPABILITIES, addRichfacesCapabilities);
+			prefs.put(IPortletConstants.RICHFACES_LIBRARIES_TYPE, richfacesType);
+			prefs.put(IPortletConstants.RICHFACES_RUNTIME, richfacesRuntime);
+		} catch (BackingStoreException e) {
+			PortletCoreActivator.log(e);
+		}
+	}
+	
+	public boolean isAddRichfacesCapabilities() {
+		return addRichfacesCapabilities;
+	}
+	
+	@Override
+	public void init(IFacetedProjectBase fpj, IProjectFacetVersion fv,
+			ILibraryProvider provider) {
+		super.init(fpj, fv, provider);
+		reset();
+	}
+
+	@Override
+	public void reset() {
+		super.reset();
+		IProjectFacet f = getProjectFacet();
+        try {
+			Preferences prefs = FacetedProjectFramework.getPreferences( f );
+			prefs = prefs.node(IPortletConstants.PORTLET_BRIDGE_HOME);
+			if( prefs.nodeExists( IPortletConstants.PREFS_PORTLETBRIDGE_HOME ) ) {
+				addRichfacesCapabilities = prefs.getBoolean(IPortletConstants.RICHFACES_CAPABILITIES, false);
+				richfacesType = prefs.get(IPortletConstants.RICHFACES_LIBRARIES_TYPE, null);
+				richfacesRuntime = prefs.get(IPortletConstants.RICHFACES_RUNTIME, null);
+			}
+		} catch (BackingStoreException e) {
+			PortletCoreActivator.log(e);
+		}
+	}
+	
+	public void setAddRichfacesCapabilities(boolean addRichfacesCapabilities) {
+		boolean oldValue = this.addRichfacesCapabilities;
+		this.addRichfacesCapabilities = addRichfacesCapabilities;
+		notifyListeners(IPortletConstants.PORTLETBRIDGE_HOME, oldValue, addRichfacesCapabilities);
+		updatePreferences();
+	}
+	public String getRichfacesType() {
+		return richfacesType;
+	}
+	public void setRichfacesType(String richfacesType) {
+		String oldValue = this.richfacesType;
+		this.richfacesType = richfacesType;
+		notifyListeners(IPortletConstants.PORTLETBRIDGE_HOME, oldValue, richfacesType);
+		updatePreferences();
+	}
+	public String getRichfacesRuntime() {
+		return richfacesRuntime;
+	}
+	public void setRichfacesRuntime(String richfacesRuntime) {
+		String oldValue = this.richfacesRuntime;
+		this.richfacesRuntime = richfacesRuntime;
+		notifyListeners(IPortletConstants.PORTLETBRIDGE_HOME, oldValue, richfacesRuntime);
+		updatePreferences();
+	}
+}

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperation.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperation.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperation.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -18,6 +18,7 @@
 import org.eclipse.wst.common.componentcore.ComponentCore;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
 import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
 import org.eclipse.wst.common.project.facet.core.IProjectFacet;
 import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -27,6 +28,8 @@
 import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.core.Messages;
 import org.jboss.tools.portlet.core.PortletCoreActivator;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
 
 public class JSFPortletServerRuntimeLibraryProviderInstallOperation extends
 		LibraryProviderOperation {
@@ -82,6 +85,20 @@
 				}
 			}
 		}
+		JSFPortletServerRuntimeLibraryProviderInstallOperationConfig serverConfig = (JSFPortletServerRuntimeLibraryProviderInstallOperationConfig) config;
+		boolean addRichfacesCapabilities = serverConfig.isAddRichfacesCapabilities();
+		String richfacesType = serverConfig.getRichfacesType();
+		String richfacesRuntime = serverConfig.getRichfacesRuntime();
+		try {
+			Preferences prefs = FacetedProjectFramework.getPreferences( config.getProjectFacet() );
+			prefs = prefs.node(IPortletConstants.PORTLET_BRIDGE_HOME);
+			prefs.putBoolean(IPortletConstants.RICHFACES_CAPABILITIES, addRichfacesCapabilities);
+			prefs.put(IPortletConstants.RICHFACES_LIBRARIES_TYPE, richfacesType);
+			prefs.put(IPortletConstants.RICHFACES_RUNTIME, richfacesRuntime);
+			prefs.flush();
+		} catch (BackingStoreException e) {
+			PortletCoreActivator.log(e);
+		}
 	}
 	
 	private String[] getPortletbridgeLibraries(File file, final boolean hasSeamFacet) {

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperationConfig.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperationConfig.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletServerRuntimeLibraryProviderInstallOperationConfig.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -1,8 +1,7 @@
 package org.jboss.tools.portlet.core.libprov;
 
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig;
 
 public class JSFPortletServerRuntimeLibraryProviderInstallOperationConfig extends
-		LibraryProviderInstallOperationConfig {
+		AbstractLibraryProviderInstallOperationConfig {
 
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperation.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperation.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperation.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -35,11 +35,16 @@
 		JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig portletbridgeConfig = (JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig) config;
 		String pbRuntime = portletbridgeConfig.getPortletbridgeHome();
 		getPortletbridgeLibraries(monitor, project, pbRuntime);
-		
+		boolean addRichfacesCapabilities = portletbridgeConfig.isAddRichfacesCapabilities();
+		String richfacesType = portletbridgeConfig.getRichfacesType();
+		String richfacesRuntime = portletbridgeConfig.getRichfacesRuntime();
 		try {
 			Preferences prefs = FacetedProjectFramework.getPreferences( config.getProjectFacet() );
 			prefs = prefs.node(IPortletConstants.PORTLET_BRIDGE_HOME);
 			prefs.put(IPortletConstants.PREFS_PORTLETBRIDGE_HOME, pbRuntime);
+			prefs.putBoolean(IPortletConstants.RICHFACES_CAPABILITIES, addRichfacesCapabilities);
+			prefs.put(IPortletConstants.RICHFACES_LIBRARIES_TYPE, richfacesType);
+			prefs.put(IPortletConstants.RICHFACES_RUNTIME, richfacesRuntime);
 			prefs.flush();
 		} catch (BackingStoreException e) {
 			PortletCoreActivator.log(e);

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/libprov/JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -6,7 +6,6 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig;
 import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
 import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
 import org.eclipse.wst.common.project.facet.core.IProjectFacet;
@@ -18,7 +17,7 @@
 import org.osgi.service.prefs.Preferences;
 
 public class JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig extends
-		LibraryProviderInstallOperationConfig {
+		AbstractLibraryProviderInstallOperationConfig {
 
 	private String portletbridgeHome;
 
@@ -81,6 +80,7 @@
 
 	@Override
 	public void reset() {
+		super.reset();
 		IProjectFacet f = getProjectFacet();
         try {
 			Preferences prefs = FacetedProjectFramework.getPreferences( f );

Copied: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/AbstractPortletProviderInstallPanel.java (from rev 17509, trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java)
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/AbstractPortletProviderInstallPanel.java	                        (rev 0)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/AbstractPortletProviderInstallPanel.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -0,0 +1,164 @@
+package org.jboss.tools.portlet.ui.internal.libprov;
+
+import java.util.List;
+
+import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderOperationPanel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.portlet.core.IPortletConstants;
+import org.jboss.tools.portlet.core.libprov.AbstractLibraryProviderInstallOperationConfig;
+import org.jboss.tools.portlet.ui.Messages;
+
+public abstract class AbstractPortletProviderInstallPanel extends LibraryProviderOperationPanel {
+
+	private Button addRichFacesLibraries;
+	private Combo richFacesLibraryCombo;
+	private Text richfacesText;
+	private AbstractLibraryProviderInstallOperationConfig config;
+	private Button richfacesButton;
+
+	@Override
+    public Control createControl( final Composite parent )
+    {
+        final Composite composite = new Composite( parent, SWT.NONE );
+        final GridLayout layout = new GridLayout( 1, false );
+        config = (AbstractLibraryProviderInstallOperationConfig) getOperationConfig();
+		
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        composite.setLayout( layout );
+        addMessage(composite);
+        addPortletBridgeGroup(composite);
+        addRichfacesGroup(composite);
+        return composite;
+    }
+	
+	protected abstract void addMessage(Composite composite);
+	
+	protected abstract void addPortletBridgeGroup(Composite composite);
+	
+	protected abstract List<String> getRichfacesTypes();
+
+	private void addRichfacesGroup(Composite composite) {
+		Group richfacesGroup = new Group(composite, SWT.NONE);
+		richfacesGroup.setLayout(new GridLayout(2, false));
+		richfacesGroup.setText(Messages.JSFPortletFacetInstallPage_Richfaces_Capabilities);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		richfacesGroup.setLayoutData(gd);
+		addRichFacesLibraries = new Button(richfacesGroup,SWT.CHECK);
+		addRichFacesLibraries.setText(Messages.JSFPortletFacetInstallPage_Add_Change_Richfaces_Libraries);
+		addRichFacesLibraries.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				enableRichfacesLibraries();
+				config.setAddRichfacesCapabilities(addRichFacesLibraries.getSelection());
+			}
+			
+		});
+		richFacesLibraryCombo = new Combo(richfacesGroup, SWT.READ_ONLY);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan=2;
+		richFacesLibraryCombo.setLayoutData(gd);
+		configureRichfacesCombo();
+		richFacesLibraryCombo.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				boolean enabled =IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText());
+				richfacesText.setEnabled(enabled);
+				richfacesButton.setEnabled(enabled);
+				config.setRichfacesType(richFacesLibraryCombo.getText());
+			}
+			
+		});
+		addRichFaces(richfacesGroup);
+		
+		boolean richFacesLibrariesSelected = config.isAddRichfacesCapabilities();
+		addRichFacesLibraries.setSelection(richFacesLibrariesSelected);
+		enableRichfacesLibraries();
+		richFacesLibraryCombo.select(0);
+	}
+
+	private void configureRichfacesCombo() {
+		List<String> types = getRichfacesTypes();
+		for (String type:types) {
+			richFacesLibraryCombo.add(type);
+		}
+	}
+	
+	private void addRichFaces(Composite parent) {
+		richfacesText = new Text(parent, SWT.SINGLE | SWT.BORDER);
+		richfacesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+		String richfacesRuntime = config.getRichfacesRuntime();
+		if (richfacesRuntime == null) {
+			richfacesRuntime = ""; //$NON-NLS-1$
+		}
+		richfacesText.setText(richfacesRuntime);
+		richfacesText.addModifyListener(new ModifyListener() {
+
+			public void modifyText(ModifyEvent e) {
+				config.setRichfacesRuntime(richfacesText.getText());
+			}
+
+		});
+
+		richfacesButton = new Button(parent, SWT.PUSH);
+		richfacesButton.setText(Messages.JSFPortletFacetInstallPage_Browse);
+		richfacesButton
+				.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+		richfacesButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleRichFacesButtonPressed();
+			}
+
+		});
+	}
+	
+	private void handleRichFacesButtonPressed() {
+		String lastPath = richfacesText.getText();
+		DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.MULTI);
+		dialog.setText(Messages.JSFPortletFacetInstallPage_Select_RichFaces_Runtime);
+		dialog.setFilterPath(lastPath);
+		String res = dialog.open();
+		if (res == null) {
+			return;
+		}
+		String newPath = dialog.getFilterPath();
+		richfacesText.setText(newPath);
+	}
+	
+	private void enableRichfacesLibraries() {
+		boolean enabled = addRichFacesLibraries.getSelection();
+		richFacesLibraryCombo.setEnabled(enabled);
+		if (enabled) {
+			enabled =IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText());
+			richfacesText.setEnabled(enabled);
+			richfacesButton.setEnabled(enabled);
+		} else {
+			richfacesText.setEnabled(false);
+			richfacesButton.setEnabled(false);
+		}
+	}
+
+	protected Shell getShell() {
+		return Display.getCurrent().getActiveShell();
+	}
+
+	
+}

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletServerRuntimeProviderInstallPanel.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletServerRuntimeProviderInstallPanel.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletServerRuntimeProviderInstallPanel.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -1,29 +1,34 @@
 package org.jboss.tools.portlet.ui.internal.libprov;
 
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gl;
+import java.util.ArrayList;
+import java.util.List;
 
-import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderOperationPanel;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Link;
+import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.ui.Messages;
 
-public class JSFPortletServerRuntimeProviderInstallPanel extends LibraryProviderOperationPanel {
+public class JSFPortletServerRuntimeProviderInstallPanel extends AbstractPortletProviderInstallPanel {
 
 	@Override
-    public Control createControl( final Composite parent )
-    {
-        final Composite composite = new Composite( parent, SWT.NONE );
-        composite.setLayout( gl( 1, 0, 0 ) );
-        
-        final Link link = new Link( composite, SWT.WRAP );
-        final GridData data = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
-        data.widthHint = 300;
-        link.setLayoutData( data );
-        link.setText( Messages.JSFPortletServerRuntimeProviderInstallPanel_The_targeted_runtime_contains_a_portlet_library );
-        
-        return composite;
-    }
+	protected void addMessage(Composite composite) {
+		Link link = new Link( composite, SWT.WRAP );
+	    GridData data = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
+	    data.widthHint = 300;
+	    link.setLayoutData( data );
+	    link.setText( Messages.JSFPortletServerRuntimeProviderInstallPanel_The_targeted_runtime_contains_a_portlet_library );
+	}
+
+	@Override
+	protected void addPortletBridgeGroup(Composite composite) {
+	}
+	
+	@Override
+	protected List<String> getRichfacesTypes() {
+		List<String> types = new ArrayList<String>();
+		types.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
+		return types;
+	}
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -1,10 +1,9 @@
 package org.jboss.tools.portlet.ui.internal.libprov;
 
-import java.io.File;
-import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderOperationPanel;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -14,40 +13,32 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.jboss.tools.portlet.core.IPortletConstants;
 import org.jboss.tools.portlet.core.libprov.JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig;
 import org.jboss.tools.portlet.ui.Messages;
 import org.jboss.tools.portlet.ui.PortletUIActivator;
 
-public class JSFPortletbridgeRuntimeProviderInstallPanel extends LibraryProviderOperationPanel {
+public class JSFPortletbridgeRuntimeProviderInstallPanel extends
+		AbstractPortletProviderInstallPanel {
 
 	@Override
-    public Control createControl( final Composite parent )
-    {
-        final Composite composite = new Composite( parent, SWT.NONE );
-        final GridLayout layout = new GridLayout( 1, false );
+	protected void addMessage(Composite composite) {
+		
+	}
 
-        layout.marginWidth = 0;
-        layout.marginHeight = 0;
-        composite.setLayout( layout );
-        addPortletBridgeGroup(composite);
-//        final Link link = new Link( composite, SWT.WRAP );
-//        final GridData data = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
-//        data.widthHint = 300;
-//        link.setLayoutData( data );
-//        link.setText( Messages.JSFPortletServerRuntimeProviderInstallPanel_The_targeted_runtime_contains_a_portlet_library );
-//        
-        return composite;
-    }
+	@Override
+	protected List<String> getRichfacesTypes() {
+		List<String> types = new ArrayList<String>();
+		types.add(IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE);
+		types.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
+		return types;
+	}
 	
-	private void addPortletBridgeGroup(Composite composite) {
+	@Override
+	protected void addPortletBridgeGroup(Composite composite) {
 		GridData gd;
 		Group portletBridgeGroup = new Group(composite, SWT.NONE);
 		portletBridgeGroup.setText(Messages.JSFPortletFacetInstallPage_Portletbridge_Runtime);
@@ -111,8 +102,4 @@
 		String newPath = dialog.getFilterPath();
 		folderText.setText(newPath);
 	}
-
-	private Shell getShell() {
-		return Display.getCurrent().getActiveShell();
-	}
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/PortletServerRuntimeProviderInstallPanel.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/PortletServerRuntimeProviderInstallPanel.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/PortletServerRuntimeProviderInstallPanel.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -18,12 +18,16 @@
         final Composite composite = new Composite( parent, SWT.NONE );
         composite.setLayout( gl( 1, 0, 0 ) );
         
-        final Link link = new Link( composite, SWT.WRAP );
+        addMessage(composite);
+        
+        return composite;
+    }
+
+	private void addMessage(final Composite composite) {
+		final Link link = new Link( composite, SWT.WRAP );
         final GridData data = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
         data.widthHint = 300;
         link.setLayoutData( data );
         link.setText( Messages.PortletServerRuntimeProviderInstallPanel_The_targeted_runtime_contains_a_portlet_library );
-        
-        return composite;
-    }
+	}
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/JSFPortletFacetInstallPage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/JSFPortletFacetInstallPage.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/JSFPortletFacetInstallPage.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -1,425 +1,45 @@
 package org.jboss.tools.portlet.ui.internal.project.facet;
 
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
 import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
 import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
 import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
 import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
 import org.eclipse.wst.common.project.facet.ui.IWizardContext;
-import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
 import org.jboss.tools.portlet.core.IPortletConstants;
-import org.jboss.tools.portlet.core.PortletCoreActivator;
 import org.jboss.tools.portlet.ui.Messages;
-import org.jboss.tools.portlet.ui.PortletUIActivator;
 
 /**
  * @author snjeza
  */
-public class JSFPortletFacetInstallPage extends DataModelWizardPage implements IFacetWizardPage  {
+public class JSFPortletFacetInstallPage extends DataModelWizardPage implements IFacetWizardPage  {	
 
-	private static final Object PORTLETBRIDGE_LIBRARY_PROVIDER = "jsfportletbridge-library-provider"; //$NON-NLS-1$
-	private IDialogSettings dialogSettings;
-	private IDialogSettings jsfSection;
-	private boolean deployJars;
-	private String portletbridgeRuntime;
-	private Text folderText;
-	private Button folderButton;
-	private Button deployButton;
-	private Combo portletBridgeLibraryCombo;
-	private Combo userLibraries;
-	private String userLibraryName;
-	private Button add;
-	private String implementationLibrary;
-	//private Button addRichFacesCapabilities;
-	private boolean hasSeamFacet;
-	private Button addRichFacesLibraries;
-	private Combo richFacesLibraryCombo;
-	private Text richfacesText;
-	private Button richfacesButton;
-	private String richfacesRuntime;
-	private boolean richFacesLibrariesSelected;
-
 	public JSFPortletFacetInstallPage() {
 		super(DataModelFactory.createDataModel(new AbstractDataModelProvider() {
 		}), "jboss.jsfportal.facet.install.page"); //$NON-NLS-1$
 		setTitle(Messages.JSFPortletFacetInstallPage_JBoss_JSF_Portlet_Capabilities);
 		setDescription(Messages.JSFPortletFacetInstallPage_Add_JBoss_JSF_Portlet_capabilities_to_this_Web_Project);
-		// ImageDescriptor imageDesc = getDefaultPageImageDescriptor( );
-		// if ( imageDesc != null )
-		// setImageDescriptor( imageDesc );
-		dialogSettings = PortletUIActivator.getDefault().getDialogSettings();
-		jsfSection = dialogSettings.getSection(IPortletConstants.JSF_SECTION);
-		if (jsfSection == null) {
-			jsfSection = dialogSettings
-					.addNewSection(IPortletConstants.JSF_SECTION);
-			deployJars = true;
-			portletbridgeRuntime = ""; //$NON-NLS-1$
-			jsfSection.put(IPortletConstants.PORTLET_BRIDGE_RUNTIME,
-					portletbridgeRuntime);
-			
-			richfacesRuntime = ""; //$NON-NLS-1$
-			jsfSection.put(IPortletConstants.RICHFACES_RUNTIME,
-					richfacesRuntime);
-			
-			implementationLibrary = IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE;
-			jsfSection.put(IPortletConstants.IMPLEMENTATION_LIBRARY, implementationLibrary);
-			
-			richFacesLibrariesSelected = false;
-			jsfSection.put(IPortletConstants.RICHFACES_LIBRARIES_SELECTED, richFacesLibrariesSelected);
-			
-			
-		} else {
-			deployJars = jsfSection.getBoolean(IPortletConstants.DEPLOY_JARS);
-			portletbridgeRuntime = jsfSection
-					.get(IPortletConstants.PORTLET_BRIDGE_RUNTIME);
-			if (portletbridgeRuntime == null) {
-				portletbridgeRuntime = ""; //$NON-NLS-1$
-				jsfSection.put(IPortletConstants.PORTLET_BRIDGE_RUNTIME,
-						portletbridgeRuntime);
-			}
-			implementationLibrary = jsfSection.get(IPortletConstants.IMPLEMENTATION_LIBRARY);
-			if (implementationLibrary == null) {
-				implementationLibrary = IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE;
-				jsfSection.put(IPortletConstants.IMPLEMENTATION_LIBRARY, implementationLibrary);
-			}
-			richfacesRuntime = jsfSection
-			.get(IPortletConstants.RICHFACES_RUNTIME);
-			if (richfacesRuntime == null) {
-				richfacesRuntime = ""; //$NON-NLS-1$
-				jsfSection.put(IPortletConstants.RICHFACES_RUNTIME,
-				richfacesRuntime);
-			}
-			richFacesLibrariesSelected = jsfSection.getBoolean(IPortletConstants.RICHFACES_LIBRARIES_SELECTED);
-		}
-
 	}
 
 	protected Composite createTopLevelComposite(Composite parent) {
 		initializeDialogUnits(parent);
 		Composite composite = new Composite(parent, SWT.NONE);
 		composite.setLayout(new GridLayout(1, false));
-		// createButton(composite);
 		LibraryInstallDelegate librariesInstallDelegate= (LibraryInstallDelegate) getDataModel().getProperty( IPortletConstants.JSFPORTLET_LIBRARY_PROVIDER_DELEGATE );
 		Control librariesComposite= LibraryProviderFrameworkUi.createInstallLibraryPanel( composite, librariesInstallDelegate,
 	                                                            Messages.JSFPortletFacetInstallPage_JSFPortletImplementationLibrariesFrame );
 		GridData gd = new GridData( GridData.FILL_HORIZONTAL );
 		librariesComposite.setLayoutData( gd );
 		
-		synchHelper = new DataModelSynchHelper(model);
-		//addFolderGroup(composite);
-		
 		return composite;
 	}
-
-	private void createButton(Composite composite) {
-		deployButton = new Button(composite, SWT.CHECK);
-		deployButton.setText(Messages.JSFPortletFacetInstallPage_Deploy_jars);
-		deployButton.setSelection(deployJars);
-		deployButton.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				model.setBooleanProperty(IPortletConstants.DEPLOY_JARS,
-						deployButton.getSelection());
-			}
-
-		});
-	}
-
-	private void addFolderGroup(Composite composite) {
-//		portletBridgeLibraryCombo = new Combo(composite, SWT.READ_ONLY);
-//		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-//		portletBridgeLibraryCombo.setLayoutData(gd);
-//		portletBridgeLibraryCombo.addSelectionListener(new SelectionAdapter() {
-//
-//			@Override
-//			public void widgetSelected(SelectionEvent e) {
-//				boolean enabled = IPortletConstants.USER_LIBRARY
-//						.equals(portletBridgeLibraryCombo.getText());
-//				userLibraries.setEnabled(enabled);
-//				add.setEnabled(enabled);
-//
-//				enabled = IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE.equals(portletBridgeLibraryCombo.getText());
-//				folderText.setEnabled(enabled);
-//				folderButton.setEnabled(enabled);
-//				model.setProperty(IPortletConstants.IMPLEMENTATION_LIBRARY,
-//						portletBridgeLibraryCombo.getText());
-//				model.setProperty(IPortletConstants.PORTLET_BRIDGE_RUNTIME,folderText.getText().trim());
-//				model.setProperty(IPortletConstants.USER_LIBRARY_NAME,userLibraries.getText());
-//				if (IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE.equals(portletBridgeLibraryCombo.getText())) {
-//					richFacesLibraryCombo.removeAll();
-//					richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE);
-//					richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
-//					richFacesLibraryCombo.select(0);
-//				} else {
-//					richFacesLibraryCombo.removeAll();
-//					richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
-//					richFacesLibraryCombo.select(0);
-//				}
-//				validatePage();
-//			}
-//
-//		});
-//		
-//		if (portletBridgeLibrariesExistOnServer()) {
-//			portletBridgeLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_SERVER_RUNTIME);
-//		}
-//		portletBridgeLibraryCombo.add(IPortletConstants.USER_LIBRARY);
-//		
-//		addUserLibraryGroup(composite);
-//		
-//		portletBridgeLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE);
-//		
-//		addPortletBridgeGroup(composite);
-//		
-//		portletBridgeLibraryCombo.setText(implementationLibrary);
-//		
-//		synchHelper.synchCombo(portletBridgeLibraryCombo, IPortletConstants.IMPLEMENTATION_LIBRARY, null);
-//		
-		
-		Group richfacesGroup = new Group(composite, SWT.NONE);
-		richfacesGroup.setLayout(new GridLayout(2, false));
-		richfacesGroup.setText(Messages.JSFPortletFacetInstallPage_Richfaces_Capabilities);
-		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-		richfacesGroup.setLayoutData(gd);
-		/*
-		addRichFacesCapabilities= new Button(richfacesGroup,SWT.CHECK);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		gd.horizontalSpan=2;
-		addRichFacesCapabilities.setLayoutData(gd);
-		synchHelper.synchCheckbox(addRichFacesCapabilities, IPortletConstants.RICHFACES_CAPABILITIES, null);
-		
-		addRichFacesCapabilities.setText("Add Richfaces Capabilities");
-		
-		if (hasSeamFacet) {
-			addRichFacesCapabilities.setSelection(true);
-			addRichFacesCapabilities.setEnabled(false);
-		}
-		*/
-		addRichFacesLibraries= new Button(richfacesGroup,SWT.CHECK);
-		addRichFacesLibraries.setText(Messages.JSFPortletFacetInstallPage_Add_Change_Richfaces_Libraries);
-		synchHelper.synchCheckbox(addRichFacesLibraries, IPortletConstants.RICHFACES_LIBRARIES_SELECTED, null);
-		
-		addRichFacesLibraries.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				enableRichfacesLibraries();
-			}
-			
-		});
-		richFacesLibraryCombo = new Combo(richfacesGroup, SWT.READ_ONLY);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		gd.horizontalSpan=2;
-		richFacesLibraryCombo.setLayoutData(gd);
-		richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE);
-		richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
-		synchHelper.synchCombo(richFacesLibraryCombo, IPortletConstants.RICHFACES_LIBRARIES_TYPE, null);
-		richFacesLibraryCombo.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				boolean enabled =IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText());
-				richfacesText.setEnabled(enabled);
-				richfacesButton.setEnabled(enabled);
-				validatePage();
-			}
-			
-		});
-		addRichFaces(richfacesGroup);
-		changeRichFaces();
-		getDataModel().addListener(new IDataModelListener() {
-			
-			public void propertyChanged(DataModelEvent event) {
-				String propertyName = event.getPropertyName();
-				if (IPortletConstants.JSFPORTLET_LIBRARY_PROVIDER_DELEGATE.equals(propertyName)) {
-					changeRichFaces();
-				}
-			}
-		});
-		
-		addRichFacesLibraries.setSelection(richFacesLibrariesSelected);
-		enableRichfacesLibraries();
-		richFacesLibraryCombo.select(0);
-		
-		//validatePage();
-	}
-
-	private void changeRichFaces() {
-		LibraryInstallDelegate librariesInstallDelegate= (LibraryInstallDelegate) getDataModel().getProperty( IPortletConstants.JSFPORTLET_LIBRARY_PROVIDER_DELEGATE );
-		String providerId = librariesInstallDelegate.getLibraryProvider().getId();
-		if (providerId != null && providerId.equals(PORTLETBRIDGE_LIBRARY_PROVIDER)) {
-			richFacesLibraryCombo.removeAll();
-			richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE);
-			richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
-			richFacesLibraryCombo.select(0);
-		} else {
-			richFacesLibraryCombo.removeAll();
-			richFacesLibraryCombo.add(IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES);
-			richFacesLibraryCombo.select(0);
-		}
-		boolean enabled =IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText());
-		richfacesText.setEnabled(enabled);
-		richfacesButton.setEnabled(enabled);
-	}
-	private void addRichFaces(Composite parent) {
-		richfacesText = new Text(parent, SWT.SINGLE | SWT.BORDER);
-		richfacesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		synchHelper.synchText(richfacesText,
-				IPortletConstants.RICHFACES_RUNTIME, null);
-
-		richfacesText.setText(richfacesRuntime);
-		richfacesText.addModifyListener(new ModifyListener() {
-
-			public void modifyText(ModifyEvent e) {
-				validateRichFaces();
-			}
-
-		});
-
-		richfacesButton = new Button(parent, SWT.PUSH);
-		richfacesButton.setText(Messages.JSFPortletFacetInstallPage_Browse);
-		richfacesButton
-				.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-		richfacesButton.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				handleRichFacesButtonPressed();
-			}
-
-		});
-	}
-
-	private void addPortletBridgeGroup(Composite composite) {
-		GridData gd;
-		Group portletBridgeGroup = new Group(composite, SWT.NONE);
-		portletBridgeGroup.setText(Messages.JSFPortletFacetInstallPage_Portletbridge_Runtime);
-		portletBridgeGroup.setLayout(new GridLayout(2, false));
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		portletBridgeGroup.setLayoutData(gd);
-		
-		folderText = new Text(portletBridgeGroup, SWT.SINGLE | SWT.BORDER);
-		folderText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		synchHelper.synchText(folderText,
-				IPortletConstants.PORTLET_BRIDGE_RUNTIME, null);
-
-		folderText.setText(portletbridgeRuntime);
-		folderText.addModifyListener(new ModifyListener() {
-
-			public void modifyText(ModifyEvent e) {
-				validatePortletBridge();
-			}
-
-		});
-
-		folderButton = new Button(portletBridgeGroup, SWT.PUSH);
-		folderButton.setText(Messages.JSFPortletFacetInstallPage_Browse);
-		folderButton
-				.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-		folderButton.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				handleFolderButtonPressed();
-			}
-
-		});
-	}
-
-	private void addUserLibraryGroup(Composite composite) {
-		GridData gd;
-		Group userLibrariesGroup = new Group(composite, SWT.NONE);
-		userLibrariesGroup.setText(Messages.PortletFacetInstallPage_User_Library);
-		userLibrariesGroup.setLayout(new GridLayout(2, false));
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		userLibrariesGroup.setLayoutData(gd);
-		userLibraries = new Combo(userLibrariesGroup, SWT.READ_ONLY);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		userLibraries.setLayoutData(gd);
-		synchHelper.synchCombo(userLibraries, IPortletConstants.USER_LIBRARY_NAME, null);
-		setLibraryCombo();
-		add = new Button(userLibrariesGroup, SWT.PUSH);
-		add.setText(Messages.PortletFacetInstallPage_Add);
-		add.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-				WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog
-				.createDialogOn(shell, "org.eclipse.jdt.ui.preferences.UserLibraryPreferencePage"); //$NON-NLS-1$
-				if (dialog != null) {
-					dialog.open();
-					setLibraryCombo();
-				}
-			}
-			
-		});
-		boolean enabled = IPortletConstants.USER_LIBRARY.equals(portletBridgeLibraryCombo
-				.getText());
-		userLibraries.setEnabled(enabled);
-		userLibraries.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				model.setProperty(IPortletConstants.USER_LIBRARY_NAME,
-										userLibraries
-												.getText());
-				userLibraryName = userLibraries.getText();
-				validatePage();
-			}
-		});
-		add.setEnabled(enabled);
-	}
-
-	private void setLibraryCombo() {
-		String[] libraryNames = JavaCore.getUserLibraryNames();
-		boolean exists = false;
-		for (int i = 0; i < libraryNames.length; i++) {
-			userLibraries.add(libraryNames[i]);
-			if (libraryNames[i].equals(userLibraryName)) {
-				exists = true;
-			}
-		}
-		if (exists) {
-			userLibraries.setText(userLibraryName);
-		} else {
-			userLibraries.select(0);
-			userLibraryName = userLibraries.getText();
-		}
-		validatePage();
-	}
 	
 	@Override
 	protected String[] getValidationPropertyNames() {
@@ -428,11 +48,8 @@
 
 	public void setConfig(Object config) {
 		model.removeListener(this);
-		synchHelper.dispose();
-
 		model = (IDataModel) config;
 		model.addListener(this);
-		synchHelper = initializeSynchHelper(model);
 	}
 
 	@Override
@@ -449,188 +66,4 @@
 
 	}
 	
-	private boolean portletBridgeLibrariesExistOnServer() {
-		IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy) model.getProperty(IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY);
-		Set<IProjectFacetVersion> facets = fpwc.getProjectFacets();
-		hasSeamFacet = false;
-		for(IProjectFacetVersion facet:facets) {
-			IProjectFacet projectFacet = facet.getProjectFacet();
-			if ("jst.seam".equals(projectFacet.getId())) { //$NON-NLS-1$
-				hasSeamFacet = true;
-				break;
-			}
-		}
-		
-		org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime = fpwc.getPrimaryRuntime();
-		if (facetRuntime == null) {
-			return false;
-		}
-		IRuntime runtime = PortletCoreActivator.getRuntime(facetRuntime);
-		IJBossServerRuntime jbossRuntime = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
-		if (jbossRuntime != null) {
-			// JBoss Portal server
-			IPath jbossLocation = runtime.getLocation();
-			IPath configPath = jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
-			File configFile = configPath.toFile();
-			if (hasPortletbridgeLibraries(new File(configFile,IPortletConstants.PORTLET_SAR_LIB))) {
-				return true;
-			}
-			if (hasPortletbridgeLibraries(new File(configFile,IPortletConstants.PORTLET_SAR_HA_LIB))) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	private boolean hasPortletbridgeLibraries(File file) {
-		if (file != null && file.isDirectory()) {
-			String[] list = file.list(new FilenameFilter() {
-
-				public boolean accept(File dir, String name) {
-					if ("portletbridge-api.jar".equals(name) || //$NON-NLS-1$
-							"portletbridge-impl.jar".equals(name)) { //$NON-NLS-1$
-						return true;
-					}
-					return false;
-				}
-				
-			});
-			return list.length == 2;
-		}
-		return false;
-	}
-	
-	private boolean validatePortletBridge() {
-		if (!IPortletConstants.LIBRARIES_PROVIDED_BY_PORTLETBRIDGE.equals(portletBridgeLibraryCombo.getText())) {
-			setErrorMessage(null);
-			setPageComplete(true);
-			return true;
-		}
-		String folderString = folderText.getText();
-		folderString = folderString.trim();
-		if (folderString.length() <= 0) {
-			setErrorMessage(Messages.JSFPortletFacetInstallPage_Portletbridge_Runtime_directory_is_required);
-			setPageComplete(false);
-			return false;
-		}
-		File folder = new File(folderString);
-		if (!folder.exists() || !folder.isDirectory()) {
-			setInvalidPortletbridgeRuntime();
-			return false;
-		}
-		String[] fileList = folder.list(new FilenameFilter() {
-
-			public boolean accept(File dir, String name) {
-				if (name.startsWith("portletbridge") || name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
-					return true;
-				}
-				return false;
-			}
-
-		});
-		if (fileList.length < 2) {
-			setInvalidPortletbridgeRuntime();
-			return false;
-		}
-		portletbridgeRuntime = folderText.getText();
-		setErrorMessage(null);
-		setPageComplete(true);
-		return true;
-	}
-
-	private boolean validateRichFaces() {
-		if (richFacesLibraryCombo == null) {
-			return true;
-		}
-		if (!IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText())) {
-			setErrorMessage(null);
-			setPageComplete(true);
-			return true;
-		}
-		String folderString = richfacesText.getText();
-		folderString = folderString.trim();
-		if (folderString.length() <= 0) {
-			setErrorMessage(Messages.JSFPortletFacetInstallPage_RichFaces_Runtime_directory_is_required);
-			setPageComplete(false);
-			return false;
-		}
-		File folder = new File(folderString);
-		if (!folder.exists() || !folder.isDirectory()) {
-			setInvalidRichfacesRuntime();
-			return false;
-		}
-		folder = new File(folder,"lib"); //$NON-NLS-1$
-		if (!folder.exists() || !folder.isDirectory()) {
-			setInvalidRichfacesRuntime();
-			return false;
-		}
-		String[] fileList = folder.list(new FilenameFilter() {
-
-			public boolean accept(File dir, String name) {
-				if (name.startsWith("richfaces") || name.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
-					return true;
-				}
-				return false;
-			}
-
-		});
-		if (fileList.length < 3) {
-			setInvalidRichfacesRuntime();
-			return false;
-		}
-		richfacesRuntime = richfacesText.getText();
-		setErrorMessage(null);
-		setPageComplete(true);
-		return true;
-	}
-
-	private void setInvalidRichfacesRuntime() {
-		setErrorMessage(Messages.JSFPortletFacetInstallPage_Invalid_Richfaces_Runtime_directory);
-		setPageComplete(false);
-	}
-	
-	private void setInvalidPortletbridgeRuntime() {
-		setErrorMessage(Messages.JSFPortletFacetInstallPage_Invalid_Portletbridge_Runtime_directory);
-		setPageComplete(false);
-	}
-
-	private void handleFolderButtonPressed() {
-		String lastPath = folderText.getText();
-		DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.MULTI);
-		dialog.setText(Messages.JSFPortletFacetInstallPage_Select_Portletbridge_Runtime);
-		dialog.setFilterPath(lastPath);
-		String res = dialog.open();
-		if (res == null) {
-			return;
-		}
-		String newPath = dialog.getFilterPath();
-		folderText.setText(newPath);
-	}
-	
-	private void handleRichFacesButtonPressed() {
-		String lastPath = richfacesText.getText();
-		DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.MULTI);
-		dialog.setText(Messages.JSFPortletFacetInstallPage_Select_RichFaces_Runtime);
-		dialog.setFilterPath(lastPath);
-		String res = dialog.open();
-		if (res == null) {
-			return;
-		}
-		String newPath = dialog.getFilterPath();
-		richfacesText.setText(newPath);
-	}
-
-	private void enableRichfacesLibraries() {
-		boolean enabled = addRichFacesLibraries.getSelection();
-		richFacesLibraryCombo.setEnabled(enabled);
-		if (enabled) {
-			enabled =IPortletConstants.LIBRARIES_PROVIDED_BY_RICHFACES.equals(richFacesLibraryCombo.getText());
-			richfacesText.setEnabled(enabled);
-			richfacesButton.setEnabled(enabled);
-		} else {
-			richfacesText.setEnabled(false);
-			richfacesButton.setEnabled(false);
-		}
-	}
-
 }

Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/PortletFacetInstallPage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/PortletFacetInstallPage.java	2009-09-10 22:41:38 UTC (rev 17516)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/project/facet/PortletFacetInstallPage.java	2009-09-10 22:42:39 UTC (rev 17517)
@@ -1,23 +1,12 @@
 package org.jboss.tools.portlet.ui.internal.project.facet;
 
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
 import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
 import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -25,9 +14,7 @@
 import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
 import org.eclipse.wst.common.project.facet.ui.IWizardContext;
 import org.jboss.tools.portlet.core.IPortletConstants;
-import org.jboss.tools.portlet.core.PortletCoreActivator;
 import org.jboss.tools.portlet.ui.Messages;
-import org.jboss.tools.portlet.ui.PortletUIActivator;
 
 /**
  * @author snjeza
@@ -35,70 +22,13 @@
 public class PortletFacetInstallPage extends DataModelWizardPage implements
 		IFacetWizardPage {
 
-	private IDialogSettings dialogSettings;
-	private Combo implementationLibraryCombo;
-	private boolean deployPortletJars;
-	private boolean enableImplementationLibraryValue;
-	private Button enableImplementationLibrary;
-	//private Button deployButton;
-	private IDialogSettings portletSection;
-	private String implementationLibrary;
-	private Combo userLibraries;
-	private String userLibraryName=null;
-	private Button add;
-
 	public PortletFacetInstallPage() {
 		super(DataModelFactory.createDataModel(new AbstractDataModelProvider() {
 		}), "jboss.portal.facet.install.page"); //$NON-NLS-1$
 		setTitle(Messages.PortletFacetInstallPage_JBoss_Portlet_Capabilities);
 		setDescription(Messages.PortletFacetInstallPage_Add_JBoss_Portlet_capabilities_to_this_Web_Project);
-		dialogSettings = PortletUIActivator.getDefault().getDialogSettings();
-		portletSection = dialogSettings
-				.getSection(IPortletConstants.PORTLET_SECTION);
-		if (portletSection == null) {
-			portletSection = dialogSettings
-					.addNewSection(IPortletConstants.PORTLET_SECTION);
-			deployPortletJars = false;
-			enableImplementationLibraryValue = true;
-			portletSection.put(IPortletConstants.DEPLOY_PORTLET_JARS,
-					deployPortletJars);
-			portletSection.put(IPortletConstants.ENABLE_IMPLEMENTATION_LIBRARY,
-					enableImplementationLibraryValue);
-			implementationLibrary = getDefaultImplementationLibrary();
-			portletSection.put(IPortletConstants.IMPLEMENTATION_LIBRARY,
-					implementationLibrary);
-			userLibraryName = null;
-		} else {
-			deployPortletJars = portletSection
-					.getBoolean(IPortletConstants.DEPLOY_PORTLET_JARS);
-			enableImplementationLibraryValue = portletSection
-					.getBoolean(IPortletConstants.ENABLE_IMPLEMENTATION_LIBRARY);
-			implementationLibrary = portletSection
-					.get(IPortletConstants.IMPLEMENTATION_LIBRARY);
-			if (implementationLibrary == null
-					|| implementationLibrary.trim().length() <= 0) {
-				implementationLibrary = getDefaultImplementationLibrary();
-				portletSection.put(IPortletConstants.IMPLEMENTATION_LIBRARY,
-						implementationLibrary);
-			}
-			userLibraryName = portletSection.get(IPortletConstants.USER_LIBRARY_NAME);
-			
-		}
 	}
 
-	private String getDefaultImplementationLibrary() {
-		boolean checkRuntimes = PortletCoreActivator.getDefault()
-				.getPluginPreferences().getBoolean(
-						PortletCoreActivator.CHECK_RUNTIMES);
-		if (checkRuntimes) {
-			implementationLibrary = IPortletConstants.LIBRARIES_PROVIDED_BY_SERVER_RUNTIME;
-		} else {
-			//implementationLibrary = IPortletConstants.LIBRARY_PROVIDED_BY_JBOSS_TOOLS;
-			implementationLibrary = IPortletConstants.USER_LIBRARY;
-		}
-		return implementationLibrary;
-	}
-
 	@Override
 	protected Composite createTopLevelComposite(Composite parent) {
 		initializeDialogUnits(parent);
@@ -112,152 +42,9 @@
 		gd = new GridData( GridData.FILL_HORIZONTAL );
 		librariesComposite.setLayoutData( gd );
 	
-		/*enableImplementationLibrary = new Button(composite, SWT.CHECK);
-		enableImplementationLibrary.setText(Messages.PortletFacetInstallPage_Enable_implementation_library);
-		enableImplementationLibrary
-				.setSelection(enableImplementationLibraryValue);
-		enableImplementationLibrary
-				.addSelectionListener(new SelectionAdapter() {
-
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						boolean enabled = enableImplementationLibrary
-						.getSelection();
-						model.setBooleanProperty(
-										IPortletConstants.ENABLE_IMPLEMENTATION_LIBRARY,
-										enabled);
-						implementationLibraryCombo.setEnabled(enabled);
-						if (enabled) {
-							boolean enableUserLibs = IPortletConstants.USER_LIBRARY.equals(implementationLibraryCombo.getText());
-							userLibraries.setEnabled(enableUserLibs);
-							add.setEnabled(enableUserLibs);
-						} else {
-							userLibraries.setEnabled(enabled);
-							add.setEnabled(enabled);
-						}
-						//deployButton.setEnabled(enabled);
-						validatePage();
-					}
-
-				});
-		implementationLibraryCombo = new Combo(composite, SWT.READ_ONLY);
-		implementationLibraryCombo.add(IPortletConstants.USER_LIBRARY);
-		//implementationLibraryCombo.add(IPortletConstants.LIBRARY_PROVIDED_BY_JBOSS_TOOLS);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		implementationLibraryCombo.setLayoutData(gd);
-		boolean checkRuntimes = PortletCoreActivator.getDefault()
-				.getPluginPreferences().getBoolean(
-						PortletCoreActivator.CHECK_RUNTIMES);
-		if (checkRuntimes) {
-			implementationLibraryCombo
-					.add(IPortletConstants.LIBRARIES_PROVIDED_BY_SERVER_RUNTIME);
-			implementationLibraryCombo.setText(implementationLibrary);
-		} else {
-			//if (IPortletConstants.LIBRARIES_PROVIDED_BY_SERVER_RUNTIME
-			//		.equals(implementationLibrary)) {
-				//implementationLibraryCombo
-				//		.setText(IPortletConstants.LIBRARY_PROVIDED_BY_JBOSS_TOOLS);
-				implementationLibraryCombo
-						.setText(IPortletConstants.USER_LIBRARY);
-			//} else {
-			//	implementationLibraryCombo.setText(implementationLibrary);
-			//}
-		}
-		model.setProperty(IPortletConstants.IMPLEMENTATION_LIBRARY,
-				implementationLibraryCombo
-						.getText());
-		Group userLibrariesGroup = new Group(composite, SWT.NONE);
-		userLibrariesGroup.setText(Messages.PortletFacetInstallPage_User_Library);
-		userLibrariesGroup.setLayout(new GridLayout(2, false));
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		userLibrariesGroup.setLayoutData(gd);
-		userLibraries = new Combo(userLibrariesGroup, SWT.READ_ONLY);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		userLibraries.setLayoutData(gd);
-		setLibraryCombo();
-		add = new Button(userLibrariesGroup, SWT.PUSH);
-		add.setText(Messages.PortletFacetInstallPage_Add);
-		add.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-				WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog
-				.createDialogOn(shell, "org.eclipse.jdt.ui.preferences.UserLibraryPreferencePage"); //$NON-NLS-1$
-				if (dialog != null) {
-					dialog.open();
-					setLibraryCombo();
-				}
-			}
-			
-		});
-		boolean enabled = IPortletConstants.USER_LIBRARY.equals(implementationLibraryCombo
-				.getText());
-		userLibraries.setEnabled(enabled);
-		userLibraries.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				model.setProperty(IPortletConstants.USER_LIBRARY_NAME,
-										userLibraries
-												.getText());
-				userLibraryName = userLibraries.getText();
-				validatePage();
-			}
-		});
-		add.setEnabled(enabled);
-		implementationLibraryCombo.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				boolean enabled = IPortletConstants.USER_LIBRARY
-						.equals(implementationLibraryCombo.getText());
-				userLibraries.setEnabled(enabled);
-				add.setEnabled(enabled);
-				model.setProperty(IPortletConstants.IMPLEMENTATION_LIBRARY,
-										implementationLibraryCombo
-												.getText());
-				validatePage();
-			}
-
-		});
-
-		model.setProperty(IPortletConstants.USER_LIBRARY_NAME,
-				userLibraries
-						.getText());
-*/		/*deployButton = new Button(composite, SWT.CHECK);
-		deployButton.setText(Messages.JSFPortletFacetInstallPage_Deploy_jars);
-		deployButton.setSelection(deployPortletJars);
-		deployButton.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				model.setBooleanProperty(IPortletConstants.DEPLOY_PORTLET_JARS,
-						deployButton.getSelection());
-			}
-
-		}); */
-		//validatePage();
 		return composite;
 	}
 
-	private void setLibraryCombo() {
-		String[] libraryNames = JavaCore.getUserLibraryNames();
-		boolean exists = false;
-		for (int i = 0; i < libraryNames.length; i++) {
-			userLibraries.add(libraryNames[i]);
-			if (libraryNames[i].equals(userLibraryName)) {
-				exists = true;
-			}
-		}
-		if (exists) {
-			userLibraries.setText(userLibraryName);
-		} else {
-			userLibraries.select(0);
-			userLibraryName = userLibraries.getText();
-		}
-		validatePage();
-	}
-
 	@Override
 	protected String[] getValidationPropertyNames() {
 		return new String[] { IPortletConstants.PORTLET_LIBRARY_PROVIDER_DELEGATE };
@@ -265,11 +52,9 @@
 
 	public void setConfig(Object config) {
 		model.removeListener(this);
-		synchHelper.dispose();
-
+		
 		model = (IDataModel) config;
 		model.addListener(this);
-		synchHelper = initializeSynchHelper(model);
 	}
 
 	@Override
@@ -286,32 +71,4 @@
 
 	}
 
-	@Override
-	public void storeDefaultSettings() {
-		Display.getDefault().syncExec(new Runnable() {
-
-			public void run() {
-				/*if (deployButton != null) {
-					portletSection.put(IPortletConstants.DEPLOY_PORTLET_JARS,
-							deployButton.getSelection());
-				}*/
-				if (enableImplementationLibrary != null) {
-					portletSection.put(IPortletConstants.ENABLE_IMPLEMENTATION_LIBRARY,
-							enableImplementationLibrary.getSelection());
-				}
-				if (implementationLibraryCombo != null) {
-					portletSection.put(IPortletConstants.IMPLEMENTATION_LIBRARY,
-							implementationLibraryCombo.getText());
-				}
-				if (userLibraries != null) {
-					portletSection.put(IPortletConstants.USER_LIBRARY_NAME,
-							userLibraries.getText());
-				}
-				
-			}
-			
-		});
-		super.storeDefaultSettings();
-	}
-
 }



More information about the jbosstools-commits mailing list