EGF Engine
Release 0.1.0

org.eclipse.egf.pde.reader
Class CreateDescriptorOperation

java.lang.Object
  extended by org.eclipse.egf.pde.internal.ui.util.ModelModification
      extended by org.eclipse.egf.pde.reader.CreateDescriptorOperation
Direct Known Subclasses:
CreateContextDescriptorOperation, CreateContractDescriptorOperation, CreateContractElementReferenceOperation, CreateFactoryComponentDescriptorOperation, CreateFactoryComponentInvocationDescriptorOperation, CreateMappingDescriptorOperation, CreateProductionPlanDescriptorOperation, CreateTaskFactoryDescriptorOperation, PdeEmfReader.CreateEmfExtensionDescriptorOperation, WorkspacePatternExtensionReader.CreatePatternExtensionDescriptorOperation, WorkspacePatternTemplateExtensionReader.CreatePatternTemplateExtensionDescriptorOperation

public abstract class CreateDescriptorOperation
extends ModelModification

Base class to implement operations that read elements from a plug-in within the workspace.


Constructor Summary
CreateDescriptorOperation(IFile modelFile_p)
          Constructor.
CreateDescriptorOperation(IFile modelFile_p, String readExtensionId_p)
          Constructor.
 
Method Summary
protected abstract  IDescriptor createDescriptor(IPluginModelBase model_p)
          Create descriptor for given model.
protected  IPluginElement[] getChildren(IPluginElement parent_p)
          Get all children of given plug-in element.
protected  IPluginElement[] getChildren(IPluginElement parent_p, String childNodeName_p)
          Get all children for a parent with a given name.
 IDescriptor getDescriptor()
          Get the created descriptor.
protected  IPluginElement getExtensionWithId(IPluginModelBase model_p, String extensionPointId_p, String idValue_p)
          Get the extension element for given parameters.
protected  IPluginElement[] getExtensionWithNodeName(IPluginModelBase model_p, String extensionPointId_p, String extensionChildNodeName_p)
          Get all extension elements for given parameters.
protected  IFile getModelFile()
          Get model file.
protected  String getPluginAttributeValue(IPluginElement element_p, String attributeName_p)
          Get the attribute value for given element and attribute name.
protected  IPluginModelBase getPluginModelBase()
           
protected  String getReadExtensionId()
          Get the id of the read element.
protected  void modifyModel(IBaseModel model_p, IProgressMonitor monitor_p)
          Invoke this using PDEModelUtility.modifyModel(ModelModification modification) Clients / subclasses should not invoke this method.
protected  String readDescription(IPluginElement element_p)
          Read the description of given plug-in element.
 void setPluginModelBase(IPluginModelBase pluginModelBase_p)
           
 
Methods inherited from class org.eclipse.egf.pde.internal.ui.util.ModelModification
getFile, getManifestFile, getPropertiesFile, getXMLFile, isFullBundleModification, saveOpenEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateDescriptorOperation

public CreateDescriptorOperation(IFile modelFile_p)
Constructor.

Parameters:
modelFile_p -

CreateDescriptorOperation

public CreateDescriptorOperation(IFile modelFile_p,
                                 String readExtensionId_p)
Constructor.

Parameters:
modelFile_p -
readExtensionId_p - id of read element.
Method Detail

getReadExtensionId

protected String getReadExtensionId()
Get the id of the read element.

Returns:

getDescriptor

public IDescriptor getDescriptor()
Get the created descriptor.

Returns:
an IDescriptor instance or null if an error occurs.

modifyModel

protected void modifyModel(IBaseModel model_p,
                           IProgressMonitor monitor_p)
                    throws CoreException
Description copied from class: ModelModification
Invoke this using PDEModelUtility.modifyModel(ModelModification modification) Clients / subclasses should not invoke this method.

Specified by:
modifyModel in class ModelModification
Throws:
CoreException
See Also:
org.eclipse.egf.pde.internal.ui.util.ModelModification#modifyModel(org.eclipse.pde.core.IBaseModel, org.eclipse.core.runtime.IProgressMonitor)

createDescriptor

protected abstract IDescriptor createDescriptor(IPluginModelBase model_p)
Create descriptor for given model.

Parameters:
model_p -
Returns:
a IDescriptor instance according to model read operations.

getExtensionWithId

protected IPluginElement getExtensionWithId(IPluginModelBase model_p,
                                            String extensionPointId_p,
                                            String idValue_p)
Get the extension element for given parameters.

Parameters:
model_p -
extensionPointId_p - the fully qualified extension-point id.
idValue_p - the value of the id attribute.
Returns:
a plug-in element according to searched extension or null if not found.

getExtensionWithNodeName

protected IPluginElement[] getExtensionWithNodeName(IPluginModelBase model_p,
                                                    String extensionPointId_p,
                                                    String extensionChildNodeName_p)
Get all extension elements for given parameters.

Parameters:
model_p -
extensionPointId_p - fully qualified extension point id.
extensionChildNodeName_p - the value of the extension child node name.
Returns:
a not null array of IPluginElement.

getChildren

protected IPluginElement[] getChildren(IPluginElement parent_p,
                                       String childNodeName_p)
Get all children for a parent with a given name.

Parameters:
parent_p -
childNodeName_p -
Returns:
a not null array.

getChildren

protected IPluginElement[] getChildren(IPluginElement parent_p)
Get all children of given plug-in element.

Parameters:
parent_p -
Returns:
A not null array of IPluginElement (but may be empty).

getPluginAttributeValue

protected String getPluginAttributeValue(IPluginElement element_p,
                                         String attributeName_p)
Get the attribute value for given element and attribute name.

Parameters:
element_p -
attributeName_p -
Returns:
null if attribute is not found.

getModelFile

protected IFile getModelFile()
Get model file.

Returns:

readDescription

protected String readDescription(IPluginElement element_p)
Read the description of given plug-in element.

Parameters:
element_p -
Returns:
null if no description is read.

getPluginModelBase

protected IPluginModelBase getPluginModelBase()
Returns:
the pluginModelBase

setPluginModelBase

public void setPluginModelBase(IPluginModelBase pluginModelBase_p)
Parameters:
pluginModelBase_p - the pluginModelBase to set

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.