EGF Engine
Release 0.1.0

org.eclipse.egf.common.helper
Class ExtensionPointHelper

java.lang.Object
  extended by org.eclipse.egf.common.helper.ExtensionPointHelper

public class ExtensionPointHelper
extends Object


Field Summary
static String ATT_CLASS
          Define a constant for the attribute named class in ExtensionPoint tab of plug-in xml files.
static String ATT_ID
          Define a constant for the attribute named id in ExtensionPoint tab of plug-in xml files.
static String ATT_NAME
          Define a constant for the attribute named name in ExtensionPoint tab of plug-in xml files.
static String ELEMENT_DESCRIPTION
          Define a constant for the element named description in ExtensionPoint tab of plug-in xml files.
 
Constructor Summary
ExtensionPointHelper()
           
 
Method Summary
static Object createExecutableExtension(String pluginId_p, String extensionPointId_p, String idValue_p)
          Create an executable extension for given parameters.
static Object createExecutableExtension(String pluginId_p, String extensionPointId_p, String attributeId_p, String attributeValue_p)
          Create an executable extension for a specified plugin's id & extension point id, matching an attribute's value.
static Object createInstance(IConfigurationElement configurationElement_p, String attributeName_p)
          Create an object instance for specified parameters.
static IConfigurationElement getConfigurationElement(String pluginId_p, String extensionId_p, String idValue_p)
          Get the configuration element for specified parameters.
static IConfigurationElement getConfigurationElement(String pluginId_p, String extensionId_p, String attName_p, String attValue_p)
          Get the configuration element for specified parameters.
static IConfigurationElement[] getConfigurationElements(String pluginId_p, String extensionPointId_p)
          Get the configuration elements for a specified plugin id & extension point id.
static IConfigurationElement[] getConfigurationElements(String pluginId_p, String extensionPointId_p, String extensionDeclaringPluginId_p)
          Get the extensions for identified plug-in extension point coming from an identified plug-in.
static String getExtensionPointId(String hostingPluginId_p, String extensionPointId_p)
          Return the fully qualified extension-point id from given parameters.
static String getId(IConfigurationElement configurationElement_p)
          Return the value of the "id" attribute for given configuration element.
static boolean hasValue(IConfigurationElement configurationElement_p, String attName_p, String attValue_p)
          Is given configuration element containing an attribute named attName_p with value set to given one ?
static boolean isDeclaredBy(IConfigurationElement configurationElement_p, String pluginId_p)
          Is given configuration element declared by identified plug-in ?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATT_CLASS

public static final String ATT_CLASS
Define a constant for the attribute named class in ExtensionPoint tab of plug-in xml files.

See Also:
Constant Field Values

ATT_NAME

public static final String ATT_NAME
Define a constant for the attribute named name in ExtensionPoint tab of plug-in xml files.

See Also:
Constant Field Values

ATT_ID

public static final String ATT_ID
Define a constant for the attribute named id in ExtensionPoint tab of plug-in xml files.

See Also:
Constant Field Values

ELEMENT_DESCRIPTION

public static final String ELEMENT_DESCRIPTION
Define a constant for the element named description in ExtensionPoint tab of plug-in xml files.

See Also:
Constant Field Values
Constructor Detail

ExtensionPointHelper

public ExtensionPointHelper()
Method Detail

getConfigurationElements

public static IConfigurationElement[] getConfigurationElements(String pluginId_p,
                                                               String extensionPointId_p)
Get the configuration elements for a specified plugin id & extension point id.

Parameters:
pluginId_p - the identifier of the plugin.
extensionPointId_p - the simple identifier of the extension point.
Returns:
an array of IConfigurationElement or an empty array if the extension point does not exist,has no extensions configured, or none of the extensions contain configuration elements.

getConfigurationElements

public static IConfigurationElement[] getConfigurationElements(String pluginId_p,
                                                               String extensionPointId_p,
                                                               String extensionDeclaringPluginId_p)
Get the extensions for identified plug-in extension point coming from an identified plug-in.

Parameters:
pluginId_p - The identifier of the plug-in declaring the extension point.
extensionPointId_p - The extension point id.
extensionDeclaringPluginId_p - The identifier of the plug-in potentially declaring extensions for this extension point.
Returns:
an array of IConfigurationElement. Empty if no extension could be found with given criteria.

isDeclaredBy

public static boolean isDeclaredBy(IConfigurationElement configurationElement_p,
                                   String pluginId_p)
Is given configuration element declared by identified plug-in ?
That is, is it read from the plugin.xml coming with identified plug-in ?

Parameters:
configurationElement_p -
pluginId_p -
Returns:

getConfigurationElement

public static IConfigurationElement getConfigurationElement(String pluginId_p,
                                                            String extensionId_p,
                                                            String idValue_p)
Get the configuration element for specified parameters.

Parameters:
pluginId_p - the identifier of the plugin.
extensionId_p - the short identifier of the extension point.
idValue_p - the value of the 'id' attribute declared into the extension point.
Returns:
a IConfigurationElement instance or null if the specified extension is not found.

getConfigurationElement

public static IConfigurationElement getConfigurationElement(String pluginId_p,
                                                            String extensionId_p,
                                                            String attName_p,
                                                            String attValue_p)
Get the configuration element for specified parameters.

Parameters:
pluginId_p - the identifier of the plugin.
extensionId_p - the short identifier of the extension point.
attName_p - the attribute name.
attValue_p - the attribute value.
Returns:
a IConfigurationElement instance or null if the specified extension is not found.

hasValue

public static boolean hasValue(IConfigurationElement configurationElement_p,
                               String attName_p,
                               String attValue_p)
Is given configuration element containing an attribute named attName_p with value set to given one ?

Parameters:
configurationElement_p -
attName_p -
attValue_p -
Returns:

getId

public static String getId(IConfigurationElement configurationElement_p)
Return the value of the "id" attribute for given configuration element.

Parameters:
configurationElement_p -
Returns:
null if given element is null, or has no attribute named "id".

createExecutableExtension

public static Object createExecutableExtension(String pluginId_p,
                                               String extensionPointId_p,
                                               String attributeId_p,
                                               String attributeValue_p)
Create an executable extension for a specified plugin's id & extension point id, matching an attribute's value.
The extension point must define an attribute 'class'.

Parameters:
pluginId_p - the identifier of the plugin.
extensionPointId_p - the simple identifier of the extension point.
attributeId_p - the identifier of the attribute used into the comparison. If null, matching is not performed.
attributeValue_p - the value of the attribute used for comparison matching. If null, matching is not performed.
Returns:
an instance of the interface regarding the attribute 'class'
See Also:
ATT_CLASS

createExecutableExtension

public static Object createExecutableExtension(String pluginId_p,
                                               String extensionPointId_p,
                                               String idValue_p)
Create an executable extension for given parameters.
The extension point must define an attribute 'class'.

Parameters:
pluginId_p - the plug-in that exposes the extension point.
extensionPointId_p - the extension point containing an attribute 'class' to instantiate.
idValue_p - the extension id value (attribute 'id') that matches the extension point estensionPointId_p.
If null, comparison is not performed.
Returns:
an Object instance if instantiation is successful; null otherwise.

createInstance

public static Object createInstance(IConfigurationElement configurationElement_p,
                                    String attributeName_p)
Create an object instance for specified parameters.

Parameters:
configurationElement_p - a configuration element loaded from an extension point.
attributeName_p - the attribute that hosts the java type.
Returns:
an Object instance if instantiation is successful; null otherwise.

getExtensionPointId

public static String getExtensionPointId(String hostingPluginId_p,
                                         String extensionPointId_p)
Return the fully qualified extension-point id from given parameters.

Parameters:
hostingPluginId_p - the id of the plug-in that defines the extension-point.
extensionPointId_p - the short id of the extension-point.
Returns:
the fully qualified extension-point id : 'plug-in id.'extension-point id'.

EGF Engine
Release 0.1.0

Copyright (c) Thales Corporate Services S.A.S, 2009.

This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.