To programmatically define a preset, use the ProjectFacetsManager.definePreset()
methods.
<!ELEMENT extension (static-preset* , dynamic-preset*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT static-preset (label? , description? , facet*)>
<!ATTLIST static-preset
id CDATA #REQUIRED
extends CDATA #IMPLIED>
Defines a static preset. A static preset is fully specified in the extension point.
<!ELEMENT label (#PCDATA)>
The localizable name that is presented to the user. If not specified, the id will be used for a label.
<!ELEMENT description (#PCDATA)>
The description text.
<!ELEMENT facet EMPTY>
<!ATTLIST facet
id CDATA #REQUIRED
version CDATA #REQUIRED>
Specifies the facet that is part of this preset.
<!ELEMENT dynamic-preset (factory)>
<!ATTLIST dynamic-preset
id CDATA #IMPLIED>
Defines a dynamic preset. A dynamic preset uses a factory to synthesize the preset definition on the fly based on the context in which it will be used.
<!ELEMENT factory EMPTY>
<!ATTLIST factory
class CDATA #REQUIRED>
Specifies the factory.
<extension point=
"org.eclipse.wst.common.project.facet.core.presets"
>
<!-- Defines a dynamic preset which will be synthesized by the provided factory. This particular preset is actually supplied by the Faceted Project Framework. What it resolves to depends on the context. If project does not target a runtime, it will contain only the fixed facets with their default versions. If project targets one or more runtime, this preset will contain facets that are specified to be the default for the primary runtime. -->
<preset id=
"default.configuration"
>
<factory class=
"org.eclipse.wst.common.project.facet.core.internal.DefaultConfigurationPresetFactory"
/>
</preset>
<!-- Creates a preset which extends the
"default.configuration"
preset and adds two facets. -->
<preset id=
"my.favorite.preset"
extends=
"default.configuration"
>
<label>
My Favorite Configuration</label>
<description>
Here is the description of my favorite configuration.</description>
<facet id=
"facet_a"
version=
"1.2"
/>
<facet id=
"facet_b"
version=
"2.0"
/>
</preset>
</extension>
Copyright (c) 2005-2007 BEA Systems, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html.