Faceted Project Framework
Version 1.3

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

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

public final class FacetedProjectFramework
extends Object

Author:
Konstantin Komissarchik

Field Summary
static String DEFAULT_CONFIGURATION_PRESET_ID
          The id of a built-in preset that provides default configuration.
static String PLUGIN_ID
           
 
Method Summary
static void addListener(IFacetedProjectFrameworkListener listener, IFacetedProjectFrameworkEvent.Type... types)
           
static void addListener(IFacetedProjectListener listener, IFacetedProjectEvent.Type... types)
          Adds a faceted project listener that will be notified when the selected events in the faceted project life cycle occur.
static IFacetedProjectWorkingCopy createNewProject()
           
static boolean hasProjectFacet(IProject project, String fid)
          Determines whether the specified project facet is installed in the provided project.
static boolean hasProjectFacet(IProject project, String fid, String vexpr)
          Determines whether the specified project facet is installed in the provided project.
static void removeListener(IFacetedProjectFrameworkListener listener)
           
static void removeListener(IFacetedProjectListener listener)
          Removes the faceted project listener that was previously registered using the addListener(IFacetedProjectListener,IFacetedProjectEvent.Type[]) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_ID

public static final String PLUGIN_ID
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_PRESET_ID

public static final String DEFAULT_CONFIGURATION_PRESET_ID
The id of a built-in preset that provides default configuration. The contents of this preset are calculated as follows:
  1. If a runtime is selected, this preset will contain default facets as specified by IRuntime.getDefaultFacets(Set).
  2. If no runtime is selected, this preset will contain default versions for all of the fixed facets as specified by IProjectFacet.getDefaultVersion().

Since:
2.0
See Also:
Constant Field Values
Method Detail

createNewProject

public static IFacetedProjectWorkingCopy createNewProject()

hasProjectFacet

public static boolean hasProjectFacet(IProject project,
                                      String fid)
                               throws CoreException

Determines whether the specified project facet is installed in the provided project. Returns false if the project is not accessible, the project is not faceted or the facet id is unrecognized.

This method is explicitly designed to avoid activation of the Faceted Project Framework if the project is not faceted. For the code that operates in the context where it can be assumed that the framework has started already, better performance can be achieved by storing IProjectFacet and IProjectFacetVersion instances using the singleton pattern and using the IFacetedProjectBase.hasProjectFacet(IProjectFacet) or IFacetedProjectBase.hasProjectFacet(IProjectFacetVersion) methods.

This method is equivalent to calling hasProjectFacet(IProject,String,String) with null version expression parameter.

Parameters:
project - the project to check for the facet presence
fid - the project facet id
Throws:
CoreException - if failed while reading faceted project metadata

hasProjectFacet

public static boolean hasProjectFacet(IProject project,
                                      String fid,
                                      String vexpr)
                               throws CoreException

Determines whether the specified project facet is installed in the provided project. Returns false if the project is not accessible, the project is not faceted or the facet id is unrecognized.

This method is explicitly designed to avoid activation of the Faceted Project Framework if the project is not faceted. For the code that operates in the context where it can be assumed that the framework has started already, better performance can be achieved by storing IProjectFacet and IProjectFacetVersion instances using the singleton pattern and using the IFacetedProjectBase.hasProjectFacet(IProjectFacet) or IFacetedProjectBase.hasProjectFacet(IProjectFacetVersion) methods.

Parameters:
project - the project to check for the facet presence
fid - the project facet id
vexpr - the version match expression, or null to match any version
Throws:
CoreException - if failed while reading faceted project metadata; if the version expression is invalid

addListener

public static void addListener(IFacetedProjectListener listener,
                               IFacetedProjectEvent.Type... types)
Adds a faceted project listener that will be notified when the selected events in the faceted project life cycle occur. The listener will apply to all faceted projects that exist in the workspace now and in the future (until the listener is removed or the workspace is closed).

Parameters:
listener - the faceted project listener
types - the types of the events to listen for
Throws:
IllegalArgumentException - if listener parameter is null or the types parameter is null or empty.
See Also:
removeListener(IFacetedProjectListener), IFacetedProjectBase.addListener(IFacetedProjectListener,IFacetedProjectEvent.Type[]), IFacetedProject.removeListener(IFacetedProjectListener)

addListener

public static void addListener(IFacetedProjectFrameworkListener listener,
                               IFacetedProjectFrameworkEvent.Type... types)

removeListener

public static void removeListener(IFacetedProjectListener listener)
Removes the faceted project listener that was previously registered using the addListener(IFacetedProjectListener,IFacetedProjectEvent.Type[]) method. If the specified listener is not present in the listener registry, this call will be ignored.

Parameters:
listener - the faceted project listener
Throws:
IllegalArgumentException - if listener parameter is null
See Also:
addListener(IFacetedProjectListener,IFacetedProjectEvent.Type[]), IFacetedProjectBase.addListener(IFacetedProjectListener,IFacetedProjectEvent.Type[]), IFacetedProject.removeListener(IFacetedProjectListener)

removeListener

public static void removeListener(IFacetedProjectFrameworkListener listener)

Faceted Project Framework
Version 1.3

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