|
Lines 11-84
Link Here
|
| 11 |
|
11 |
|
| 12 |
package org.eclipse.jst.jsf.core.internal.project.facet; |
12 |
package org.eclipse.jst.jsf.core.internal.project.facet; |
| 13 |
|
13 |
|
| 14 |
import java.util.HashSet; |
|
|
| 15 |
import java.util.Map; |
| 16 |
import java.util.Set; |
| 17 |
|
| 18 |
import org.eclipse.core.runtime.CoreException; |
| 19 |
import org.eclipse.jst.common.project.facet.core.JavaFacet; |
| 20 |
import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils; |
14 |
import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils; |
| 21 |
import org.eclipse.jst.jsf.core.IJSFCoreConstants; |
15 |
import org.eclipse.jst.jsf.core.IJSFCoreConstants; |
| 22 |
import org.eclipse.jst.jsf.core.internal.Messages; |
|
|
| 23 |
import org.eclipse.wst.common.project.facet.core.IDynamicPreset; |
| 24 |
import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase; |
| 25 |
import org.eclipse.wst.common.project.facet.core.IPresetFactory; |
| 26 |
import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
| 27 |
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
| 28 |
import org.eclipse.wst.common.project.facet.core.PresetDefinition; |
| 29 |
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
16 |
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
| 30 |
|
17 |
|
| 31 |
/** |
18 |
/** |
|
|
19 |
* Preset factory for JSF 1.1. |
| 20 |
* |
| 32 |
* @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> |
21 |
* @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> |
| 33 |
*/ |
22 |
*/ |
| 34 |
|
23 |
|
| 35 |
public final class JSFConfigurationPresetFactory11 |
24 |
public final class JSFConfigurationPresetFactory11 |
| 36 |
|
25 |
extends AbstractJSFConfigurationPresetFactory |
| 37 |
implements IPresetFactory |
|
|
| 38 |
|
26 |
|
| 39 |
{ |
27 |
{ |
| 40 |
public PresetDefinition createPreset( final String presetId, |
28 |
/** |
| 41 |
final Map<String,Object> context ) |
29 |
*/ |
| 42 |
|
30 |
public JSFConfigurationPresetFactory11() |
| 43 |
throws CoreException |
|
|
| 44 |
|
| 45 |
{ |
31 |
{ |
| 46 |
final IFacetedProjectBase fproj |
32 |
super(WebFacetUtils.WEB_23, ProjectFacetsManager |
| 47 |
= (IFacetedProjectBase) context.get( IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT ); |
33 |
.getProjectFacet(IJSFCoreConstants.JSF_CORE_FACET_ID) |
| 48 |
|
34 |
.getVersion(IJSFCoreConstants.JSF_VERSION_1_1)); |
| 49 |
final IProjectFacetVersion webFacetVersion |
|
|
| 50 |
= fproj.getProjectFacetVersion( WebFacetUtils.WEB_FACET ); |
| 51 |
|
| 52 |
if( webFacetVersion != null && webFacetVersion.compareTo( WebFacetUtils.WEB_23 ) >= 0 ) |
| 53 |
{ |
| 54 |
final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>(); |
| 55 |
|
| 56 |
final IProjectFacet jsfFacet |
| 57 |
= ProjectFacetsManager.getProjectFacet( IJSFCoreConstants.JSF_CORE_FACET_ID ); |
| 58 |
|
| 59 |
final IProjectFacetVersion jsfFacetVersion11 |
| 60 |
= jsfFacet.getVersion( IJSFCoreConstants.JSF_VERSION_1_1 ); |
| 61 |
|
| 62 |
facets.add( jsfFacetVersion11 ); |
| 63 |
facets.add( webFacetVersion ); |
| 64 |
|
| 65 |
if( webFacetVersion == WebFacetUtils.WEB_23 ) |
| 66 |
{ |
| 67 |
facets.add( JavaFacet.VERSION_1_3 ); |
| 68 |
} |
| 69 |
else if( webFacetVersion == WebFacetUtils.WEB_24 ) |
| 70 |
{ |
| 71 |
facets.add( JavaFacet.VERSION_1_4 ); |
| 72 |
} |
| 73 |
else |
| 74 |
{ |
| 75 |
facets.add( JavaFacet.VERSION_1_5 ); |
| 76 |
} |
| 77 |
|
| 78 |
return new PresetDefinition( Messages.JSFFacet11_presetLabel, Messages.JSFFacet11_presetDescription, facets ); |
| 79 |
} |
| 80 |
|
| 81 |
return null; |
| 82 |
} |
35 |
} |
| 83 |
|
|
|
| 84 |
} |
36 |
} |