Java Code Examples for org.eclipse.wst.common.project.facet.core.ProjectFacetsManager#getProjectFacet()
The following examples show how to use
org.eclipse.wst.common.project.facet.core.ProjectFacetsManager#getProjectFacet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebAppProjectCreator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void jobSetupFacets(final IProject project) { // Facet setup is done in a workspace job since this can be long running, // hence shouldn't be from the UI thread. WorkspaceJob setupFacetsJob = new WorkspaceJob("Setting up facets") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { try { // Create faceted project IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor); // Add Java facet by default IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet(FACET_JST_JAVA); facetedProject.installProjectFacet(javaFacet.getDefaultVersion(), null, monitor); return Status.OK_STATUS; } catch (CoreException e) { // Log and continue GdtPlugin.getLogger().logError(e); return new Status(IStatus.ERROR, GdtPlugin.PLUGIN_ID, e.toString(), e); } } }; setupFacetsJob.schedule(); }
Example 2
Source File: AppEngineFlexWarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testHasAppEngineFacet_withFacet() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexWarFacet.ID); when(mockFacetedProject.hasProjectFacet(projectFacet)).thenReturn(true); Assert.assertTrue(AppEngineFlexWarFacet.hasFacet(mockFacetedProject)); }
Example 3
Source File: AppEngineFlexWarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testHasAppEngineFacet_withoutFacet() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexWarFacet.ID); when(mockFacetedProject.hasProjectFacet(projectFacet)).thenReturn(false); Assert.assertFalse(AppEngineFlexWarFacet.hasFacet(mockFacetedProject)); }
Example 4
Source File: AppEngineFlexJarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testHasAppEngineFacet_withFacet() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexJarFacet.ID); when(mockFacetedProject.hasProjectFacet(projectFacet)).thenReturn(true); Assert.assertTrue(AppEngineFlexJarFacet.hasFacet(mockFacetedProject)); }
Example 5
Source File: AppEngineFlexJarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testHasAppEngineFacet_withoutFacet() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexJarFacet.ID); when(mockFacetedProject.hasProjectFacet(projectFacet)).thenReturn(false); Assert.assertFalse(AppEngineFlexJarFacet.hasFacet(mockFacetedProject)); }
Example 6
Source File: GwtFacetUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static IProjectFacet getGwtFacet() { IProjectFacet gwtProjectFacet = null; try { // Look for something odd going on here. If it does exit with out an error. Like finding some // com.google.gwt.facet. gwtProjectFacet = ProjectFacetsManager.getProjectFacet(IGwtFacetConstants.GWT_PLUGINS_FACET_ID); } catch (Exception e) { GwtWtpPlugin.logMessage( "GwtMavenFacetManager.addGwtFacet(): 1. Couldn't find facet: IGwtFacetConstants.GWT_PLUGINS_FACET_ID=" + IGwtFacetConstants.GWT_PLUGINS_FACET_ID); e.printStackTrace(); } return gwtProjectFacet; }
Example 7
Source File: BirtFacetPresetFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates a preset for the web module version >= 2.3 * * @see org.eclipse.wst.common.project.facet.core.IPresetFactory#createPreset(java.lang.String, * java.util.Map) */ public PresetDefinition createPreset( final String presetId, final Map<String, Object> context ) throws CoreException { final IFacetedProjectBase project = (IFacetedProjectBase) context .get( IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT ); final IProjectFacetVersion webFacetVersion = project .getProjectFacetVersion( WebFacetUtils.WEB_FACET ); if ( webFacetVersion != null && webFacetVersion.compareTo( WebFacetUtils.WEB_23 ) >= 0 ) { final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( ); final IProjectFacet birtFacet = ProjectFacetsManager .getProjectFacet( "birt.chart.runtime" ); //$NON-NLS-1$ final IProjectFacetVersion chartFacetVersion = birtFacet.getVersion( "4.5.0" ); //$NON-NLS-1$ facets.add( chartFacetVersion ); facets.add( webFacetVersion ); facets.add( JavaFacetUtils.JAVA_50 ); return new PresetDefinition( Resources.BIRT_FACET_TEMPLATE_LABEL, Resources.BIRT_FACET_TEMPLATE_DESCRIPTION, facets ); } return null; }
Example 8
Source File: BirtFacetPresetFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates a preset for the web module version >= 2.3 * * @see org.eclipse.wst.common.project.facet.core.IPresetFactory#createPreset(java.lang.String, * java.util.Map) */ public PresetDefinition createPreset( final String presetId, final Map<String, Object> context ) throws CoreException { final IFacetedProjectBase project = (IFacetedProjectBase) context .get( IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT ); final IProjectFacetVersion webFacetVersion = project .getProjectFacetVersion( WebFacetUtils.WEB_FACET ); if ( webFacetVersion != null && webFacetVersion.compareTo( WebFacetUtils.WEB_23 ) >= 0 ) { final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( ); final IProjectFacet birtFacet = ProjectFacetsManager .getProjectFacet( IBirtFacetConstants.BIRT_RUNTIME_FACET_ID ); final IProjectFacetVersion birtFacetVersion = birtFacet .getVersion( IBirtFacetConstants.BIRT_RUNTIME_FACET_VERSION ); facets.add( birtFacetVersion ); facets.add( webFacetVersion ); facets.add( JavaFacetUtils.JAVA_50 ); return new PresetDefinition( Resources.BIRT_FACET_TEMPLATE_LABEL, Resources.BIRT_FACET_TEMPLATE_DESCRIPTION, facets ); } return null; }
Example 9
Source File: AppEngineFlexWarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@Test public void testFacetLabel() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexWarFacet.ID); Assert.assertEquals("App Engine Java Flexible Environment (WAR)", projectFacet.getLabel()); }
Example 10
Source File: AppEngineFlexJarFacetTest.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@Test public void testFacetLabel() { IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(AppEngineFlexJarFacet.ID); Assert.assertEquals("App Engine Java Flexible Environment (JAR)", projectFacet.getLabel()); }