EGF Engine
Release 0.1.0

org.eclipse.egf.pde.plugin.command
Class AbstractExtensionChangesCommand

java.lang.Object
  extended by org.eclipse.egf.pde.plugin.command.AbstractChangesCommand
      extended by org.eclipse.egf.pde.plugin.command.AbstractExtensionChangesCommand
All Implemented Interfaces:
IPluginChangesCommand
Direct Known Subclasses:
AbstractContextCommand, AbstractContractCommand, AbstractContractElementRefCmd, AbstractFactoryComponentExtensionCommand, AbstractFactoryComponentInvocationCommand, AbstractGeneratedPackageCommand, AbstractMappingCommand, AbstractPatternConditionCommand, AbstractPatternElementCommand, AbstractPatternTemplateCommand, AbstractProductionPlanCommand, AbstractTaskFactoryCommand

public abstract class AbstractExtensionChangesCommand
extends AbstractChangesCommand

Base class to implement a command that performs plug-in changes in extension part.
Changes can be an extension adding operation.


Constructor Summary
AbstractExtensionChangesCommand()
           
 
Method Summary
protected  IPluginExtension createExtension()
          Create extension for extension-point id returned by getExtensionPointId().
protected  IPluginElement createExtensionElementChild(IPluginElement extension_p, String elementChildNodeName_p, String elementChildIdAttribute_p, String elementChildIdAttributeValue_p)
          Create an extension element child for given parameters.
protected  IPluginElement getElement(IPluginParent parent_p, String elementChildNodeName_p, String elementChildIdAttribute_p, String elementChildIdAttributeValue_p, boolean createIfMissing_p)
          Get an element for given parameters.
protected  String getExtensionChildIdAttribute()
          Get the id attribute of the children for the extension.
protected abstract  String getExtensionChildName()
          Get the node name of the children for the extension.
protected  IPluginElement getExtensionElementFromUniqueExtension(String childElementId_p)
          Get an extension element child for specified element id value.
protected  IPluginElement getExtensionElementFromUniqueExtension(String childElementId_p, boolean createIfMissing_p)
          Get an extension element child for specified element id value.
protected  IPluginElement getExtensionElementWithId(String elementIdValue_p)
          Get a child for given id in extension matching getExtensionPointId(), getExtensionChildName() and getExtensionChildIdAttribute().
protected  IPluginElement[] getExtensionElementWithNodeName(String elementName_p, boolean createIfMissing_p)
          Get the extension element for given parameters.
protected abstract  String getExtensionPointId()
          Get the extension point id.
protected  IExtensions getExtensions()
          Get IExtensions instance from plug-in object.
protected  IPluginExtension[] getExtensions(String extensionPointId_p)
          Returns the extensions matching the given extension point id.
protected  IPluginElement getFirstExtensionElement()
          Get first extension element for given parameters.
protected  void removeExtension(String extensionChildIdValue_p)
          Remove extension point according to the result of getExtensionPointId().
protected  boolean removeExtensionElementChild(IPluginElement extension_p, String elementChildIdAttribute_p, String elementChildAttributeValue_p)
          Remove a child from its parent extension for given parameters.
protected  void setDescription(IPluginElement parentElement_p, String idAttributeValue_p, String description_p)
          Set the description node.
protected  IPluginElement setSingleChild(IPluginParent parentElement_p, String childNodeName_p, String childIdAttribute_p, String childIdAttributeValue_p)
          Set a single child in a parent element.
 
Methods inherited from class org.eclipse.egf.pde.plugin.command.AbstractChangesCommand
execute, getPluginModelBase, setPluginModelBase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractExtensionChangesCommand

public AbstractExtensionChangesCommand()
Method Detail

createExtension

protected IPluginExtension createExtension()
Create extension for extension-point id returned by getExtensionPointId().

Returns:

removeExtension

protected void removeExtension(String extensionChildIdValue_p)
Remove extension point according to the result of getExtensionPointId().


getExtensionElementWithNodeName

protected IPluginElement[] getExtensionElementWithNodeName(String elementName_p,
                                                           boolean createIfMissing_p)
Get the extension element for given parameters. Extension is created if not existing, depending on createIfMissing parameter.

Parameters:
elementName_p - name of element to create.
createIfMissing_p - true creates extension if missing; false otherwise.
Returns:
a not array of IPluginElement.

getExtensionElementWithId

protected IPluginElement getExtensionElementWithId(String elementIdValue_p)
Get a child for given id in extension matching getExtensionPointId(), getExtensionChildName() and getExtensionChildIdAttribute().

Parameters:
elementIdValue_p -
Returns:
null if

getExtensionElementFromUniqueExtension

protected IPluginElement getExtensionElementFromUniqueExtension(String childElementId_p)
Get an extension element child for specified element id value.
Both getExtensionChildName(), getExtensionChildIdAttribute() are used to perform the lookup.
The extension that hosts the element (or the created one) is unique and is created if not existing at first call.

Parameters:
childElementId_p -
Returns:

getExtensionElementFromUniqueExtension

protected IPluginElement getExtensionElementFromUniqueExtension(String childElementId_p,
                                                                boolean createIfMissing_p)
Get an extension element child for specified element id value.
Both getExtensionChildName(), getExtensionChildIdAttribute() are used to perform the lookup.
The extension that hosts the element is unique.

Parameters:
childElementId_p -
Returns:
a IPluginElement instance or null if not found.

getExtensions

protected IPluginExtension[] getExtensions(String extensionPointId_p)
Returns the extensions matching the given extension point id.

Parameters:
extensionPointId_p -
Returns:

getElement

protected IPluginElement getElement(IPluginParent parent_p,
                                    String elementChildNodeName_p,
                                    String elementChildIdAttribute_p,
                                    String elementChildIdAttributeValue_p,
                                    boolean createIfMissing_p)
Get an element for given parameters. Element is created if not existing, depending on createIfMissing parameter.

Parameters:
parent_p -
elementChildNodeName_p -
elementChildIdAttribute_p -
elementChildIdAttributeValue_p -
createIfMissing_p -
Returns:
an IPluginElement instance or null if not created and not found.

getExtensions

protected IExtensions getExtensions()
Get IExtensions instance from plug-in object.

Returns:

getFirstExtensionElement

protected IPluginElement getFirstExtensionElement()
Get first extension element for given parameters.
Extension-point id and extension element name are retrieved using getExtensionPointId() and getExtensionChildName().

Returns:
an IPluginElement instance or null if not found.

createExtensionElementChild

protected IPluginElement createExtensionElementChild(IPluginElement extension_p,
                                                     String elementChildNodeName_p,
                                                     String elementChildIdAttribute_p,
                                                     String elementChildIdAttributeValue_p)
Create an extension element child for given parameters.

Parameters:
extension_p - the extension that hosts the created element child.
elementChildNodeName_p - node name of the child element.
elementChildIdAttribute_p -
elementChildIdAttributeValue_p -
Returns:
a child element as IPluginElement.

removeExtensionElementChild

protected boolean removeExtensionElementChild(IPluginElement extension_p,
                                              String elementChildIdAttribute_p,
                                              String elementChildAttributeValue_p)
Remove a child from its parent extension for given parameters.

Parameters:
elementChildIdAttribute_p -
elementChildAttributeValue_p -
Returns:
true if the child is successfully removed; false otherwise.

setSingleChild

protected IPluginElement setSingleChild(IPluginParent parentElement_p,
                                        String childNodeName_p,
                                        String childIdAttribute_p,
                                        String childIdAttributeValue_p)
Set a single child in a parent element.

Parameters:
parentElement_p -
childNodeName_p -
childIdAttribute_p -
childIdAttributeValue_p -

setDescription

protected void setDescription(IPluginElement parentElement_p,
                              String idAttributeValue_p,
                              String description_p)
                       throws CoreException
Set the description node.

Parameters:
parentElement_p -
Throws:
CoreException

getExtensionPointId

protected abstract String getExtensionPointId()
Get the extension point id.

Returns:

getExtensionChildName

protected abstract String getExtensionChildName()
Get the node name of the children for the extension.

Returns:

getExtensionChildIdAttribute

protected String getExtensionChildIdAttribute()
Get the id attribute of the children for the extension.

Returns:

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.