Faceted Project Framework
Version 1.3

org.eclipse.wst.common.project.facet.core
Class ProjectFacetsManager

java.lang.Object
  extended by org.eclipse.wst.common.project.facet.core.ProjectFacetsManager

public final class ProjectFacetsManager
extends Object

This is the entry point to the project facet framework API. From here, you can (among other things) list available project facets and create instances of IFacetedProject.

Author:
Konstantin Komissarchik

Method Summary
static IStatus check(Set<IProjectFacetVersion> base, Set<IFacetedProject.Action> actions)
          Checks the validity of applying the specified set of actions to the specified set of base project facets.
static IFacetedProject create(IProject project)
          Creates a wrapper around an IProject that exposes API for manipulating the set of project facets installed on a project.
static IFacetedProject create(IProject project, boolean convertIfNecessary, IProgressMonitor monitor)
          Creates a wrapper around an IProject that exposes API for manipulating the set of project facets installed on a project.
static IFacetedProject create(String name, IPath location, IProgressMonitor monitor)
          Creates a new faceted project.
static IPreset definePreset(String name, Set<IProjectFacetVersion> facets)
          Defines a new preset.
static IPreset definePreset(String name, String description, Set<IProjectFacetVersion> facets)
          Defines a new preset.
static boolean deletePreset(IPreset preset)
          Deletes a preset.
static IActionDefinition getActionDefinition(String id)
          Returns the project facet action definition corresponding to the specified action id.
static Set<IActionDefinition> getActionDefinitions()
          Returns all of the available project facet action definitions.
static Set<ICategory> getCategories()
          Returns all of the categories.
static ICategory getCategory(String id)
          Returns the category corresponding to the specified id.
static Set<IFacetedProject> getFacetedProjects()
           
static Set<IFacetedProject> getFacetedProjects(IProjectFacet f)
           
static Set<IFacetedProject> getFacetedProjects(IProjectFacetVersion fv)
           
static IGroup getGroup(String id)
          Returns the group corresponding to the specified id.
static Set<IGroup> getGroups()
          Returns all of the groups.
static IPreset getPreset(String id)
          Returns the preset corresponding to the specified id.
static Set<IPreset> getPresets()
          Returns all of the presets.
static IProjectFacet getProjectFacet(String id)
          Returns the project facet descriptor corresponding to the specified id.
static Set<IProjectFacet> getProjectFacets()
          Returns all of the available project facets.
static IFacetedProjectTemplate getTemplate(String id)
          Returns the faceted project template corresponding to the specified id.
static Set<IFacetedProjectTemplate> getTemplates()
          Returns all of the faceted project templates.
static boolean isActionDefined(String id)
          Determines whether a given project facet action id is recognized.
static boolean isCategoryDefined(String id)
          Determines whether a given category id is recognized.
static boolean isGroupDefined(String id)
          Determines whether a given group id is recognized.
static boolean isPresetDefined(String id)
          Determines whether a given preset id is recognized.
static boolean isProjectFacetDefined(String id)
          Determines whether a given project facet id is recognized.
static boolean isTemplateDefined(String id)
          Determines whether a given template id is recognized.
static void sort(Set<IProjectFacetVersion> base, List<IFacetedProject.Action> actions)
          Sorts actions in the order that they should be applied to a project such that project facet constraints are not violated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProjectFacets

public static Set<IProjectFacet> getProjectFacets()
Returns all of the available project facets.

Returns:
a set containing all of the available project facets

isProjectFacetDefined

public static boolean isProjectFacetDefined(String id)
Determines whether a given project facet id is recognized.

Parameters:
id - the id of the project facet
Returns:
true if the project facet id is recognized, false otherwise

getProjectFacet

public static IProjectFacet getProjectFacet(String id)
Returns the project facet descriptor corresponding to the specified id.

Parameters:
id - the id of the project facet
Returns:
the project facet descriptor
Throws:
IllegalArgumentException - if id is not found

getActionDefinitions

public static Set<IActionDefinition> getActionDefinitions()
Returns all of the available project facet action definitions.

Returns:
a set containing all of the available project facets action definitions

isActionDefined

public static boolean isActionDefined(String id)
Determines whether a given project facet action id is recognized.

Parameters:
id - the id of the project facet action
Returns:
true if the project facet action id is recognized, false otherwise

getActionDefinition

public static IActionDefinition getActionDefinition(String id)
Returns the project facet action definition corresponding to the specified action id.

Parameters:
id - the id of the project facet action
Returns:
the project facet action definition
Throws:
IllegalArgumentException - if id is not found

getCategories

public static Set<ICategory> getCategories()
Returns all of the categories.

Returns:
a set containing all of the categories

isCategoryDefined

public static boolean isCategoryDefined(String id)
Determines whether a given category id is recognized.

Parameters:
id - the id of the category
Returns:
true if the category id is recognized, false otherwise

getCategory

public static ICategory getCategory(String id)
Returns the category corresponding to the specified id.

Parameters:
id - the id of the category
Returns:
the category
Throws:
IllegalArgumentException - if id is not found

getPresets

public static Set<IPreset> getPresets()
Returns all of the presets.

Returns:
a set conaining all of the presets

isPresetDefined

public static boolean isPresetDefined(String id)
Determines whether a given preset id is recognized.

Parameters:
id - the preset id
Returns:
true if the preset id is recognized, false otherwise

getPreset

public static IPreset getPreset(String id)
Returns the preset corresponding to the specified id.

Parameters:
id - the preset id
Returns:
the preset
Throws:
IllegalArgumentException - if the preset is not found

definePreset

public static IPreset definePreset(String name,
                                   Set<IProjectFacetVersion> facets)
Defines a new preset. User-defined presets are stored in the workspace.

Parameters:
name - the name of the preset
facets - the set of project facets that the preset should contain
Returns:
the preset

definePreset

public static IPreset definePreset(String name,
                                   String description,
                                   Set<IProjectFacetVersion> facets)
Defines a new preset. User-defined presets are stored in the workspace.

Parameters:
name - the name of the preset
description - the description of the preset
facets - the set of project facets that the preset should contain
Returns:
the preset

deletePreset

public static boolean deletePreset(IPreset preset)
Deletes a preset. Note that only user-defined presets can be deleted.

Parameters:
preset - the preset
Returns:
true if the preset was deleted, or false if the preset was not found or was not user-defined

getTemplates

public static Set<IFacetedProjectTemplate> getTemplates()
Returns all of the faceted project templates.

Returns:
a set conaining all of the faceted project templates

isTemplateDefined

public static boolean isTemplateDefined(String id)
Determines whether a given template id is recognized.

Parameters:
id - the template id
Returns:
true if the template id is recognized, false otherwise

getTemplate

public static IFacetedProjectTemplate getTemplate(String id)
Returns the faceted project template corresponding to the specified id.

Parameters:
id - the template id
Returns:
the faceted project templte
Throws:
IllegalArgumentException - if the template is not found

getGroups

public static Set<IGroup> getGroups()
Returns all of the groups.

Returns:
a set containing all of the groups

isGroupDefined

public static boolean isGroupDefined(String id)
Determines whether a given group id is recognized.

Parameters:
id - the group id
Returns:
true if the group id is recognized, false otherwise

getGroup

public static IGroup getGroup(String id)
Returns the group corresponding to the specified id.

Parameters:
id - the group id
Returns:
the group descriptor
Throws:
IllegalArgumentException - if the group id is not found

getFacetedProjects

public static Set<IFacetedProject> getFacetedProjects()
                                               throws CoreException
Throws:
CoreException

getFacetedProjects

public static Set<IFacetedProject> getFacetedProjects(IProjectFacet f)
                                               throws CoreException
Throws:
CoreException

getFacetedProjects

public static Set<IFacetedProject> getFacetedProjects(IProjectFacetVersion fv)
                                               throws CoreException
Throws:
CoreException

create

public static IFacetedProject create(IProject project)
                              throws CoreException
Creates a wrapper around an IProject that exposes API for manipulating the set of project facets installed on a project.

Parameters:
project - an Eclipse project
Returns:
an instance of IFacetedProject, or null
Throws:
CoreException

create

public static IFacetedProject create(IProject project,
                                     boolean convertIfNecessary,
                                     IProgressMonitor monitor)
                              throws CoreException

Creates a wrapper around an IProject that exposes API for manipulating the set of project facets installed on a project. The project will be made into a faceted project if necessary.

This method should not be called from the UI thread as it is long- running and may trigger resource change events. Although this framework is safe, there is no guarantee that other bundles are UI-safe and the risk of UI deadlock is high.

Parameters:
project - an Eclipse project
convertIfNecessary - whether the project should be converted into a faceted project
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
an instance of IFacetedProject, or null
Throws:
CoreException

create

public static IFacetedProject create(String name,
                                     IPath location,
                                     IProgressMonitor monitor)
                              throws CoreException

Creates a new faceted project.

This method should not be called from the UI thread as it is long- running and may trigger resource change events. Although this framework is safe, there is no guarantee that other bundles are UI-safe and the risk of UI deadlock is high.

Parameters:
name - project name
location -
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
an instance of IFacetedProject
Throws:
CoreException

check

public static IStatus check(Set<IProjectFacetVersion> base,
                            Set<IFacetedProject.Action> actions)
Checks the validity of applying the specified set of actions to the specified set of base project facets. Returns the union of all validation problems that are found.

Parameters:
base - the set of project facets that the actions will be applied to
actions - the set of actions to evaluate
Returns:
a status object with severity of IStatus.OK if all of the constraints were satisfied or otherwise a MultiStatus composed of individual status objects for each of the problems

sort

public static void sort(Set<IProjectFacetVersion> base,
                        List<IFacetedProject.Action> actions)
Sorts actions in the order that they should be applied to a project such that project facet constraints are not violated.

Parameters:
base - the set of project facets that the actions will be applied to
actions - the list of actions to sort; this list will be modified

Faceted Project Framework
Version 1.3

Copyright (c) 2008 BEA Systems, Inc. and others. All rights reserved.