|
Eclipse PDE Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.pde.ui.templates.AbstractTemplateSection
Common function for template sections. It is recommended to subclass this class rather than implementing ITemplateSection directly when providing extension templates.
| Field Summary | |
static String |
KEY_PACKAGE_NAME
The key for the package name that will be created by this teamplate (value="packageName"). |
static String |
KEY_PLUGIN_CLASS
The key for the main plug-in class of the plug-in that the template is used for (value="pluginClass"); |
static String |
KEY_PLUGIN_ID
The key for the plug-in id of the plug-in that the template is used for (value="pluginId"). |
static String |
KEY_PLUGIN_NAME
The key for the plug-in name of the plug-in that the template is used for (value="pluginName"). |
protected IPluginModelBase |
model
The plug-in model. |
protected IProject |
project
The project handle. |
| Constructor Summary | |
AbstractTemplateSection()
|
|
| Method Summary | |
void |
addPages(Wizard wizard)
Adds template-related pages to the wizard. |
protected IPluginExtension |
createExtension(String pointId,
boolean reuse)
A utility method to create an extension object for the plug-in model from the provided extension point id. |
void |
execute(IProject project,
IPluginModelBase model,
IProgressMonitor monitor)
The default implementation of the interface method. |
protected void |
generateFiles(IProgressMonitor monitor)
Generates files as part of the template execution. |
IPluginReference[] |
getDependencies(String schemaVersion)
Provides the list of template dependencies. |
String |
getDescription()
Returns a description of the section. |
int |
getNumberOfWorkUnits()
The default implementation of the interface method. |
boolean |
getPagesAdded()
Tests if wizard pages for this template section have been added. |
protected abstract ResourceBundle |
getPluginResourceBundle()
An abstract method that returns the resource bundle that corresponds to the best match of plugin.properties file for the current locale (in case of fragments, the file is fragment.properties ). |
String |
getPluginResourceString(String key)
Returns the translated version of the resource string represented by the provided key. |
String |
getReplacementString(String fileName,
String key)
The default implementation of this method provides values of the following keys: pluginClass , pluginId and pluginName . |
protected IFolder |
getSourceFolder(IProgressMonitor monitor)
Returns the folder with Java files in the target project. |
URL |
getTemplateLocation()
Returns the URL of the zip file containing template files and directories that will be created in the plug-in project. |
Object |
getValue(String key)
Returns the value of the variable with a given name. |
protected boolean |
isOkToCreateFile(File sourceFile)
Tests if the file found in the template location should be created in the target project. |
protected boolean |
isOkToCreateFolder(File sourceFolder)
Tests if the folder found in the template location should be created in the target project. |
protected void |
markPagesAdded()
Marks that pages have been added to the wizard by this template. |
protected abstract void |
updateModel(IProgressMonitor monitor)
Subclass must implement this method to add the required entries in the plug-in model. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.pde.ui.templates.ITemplateSection |
getLabel, getNewFiles, getPage, getPageCount, getUsedExtensionPoint |
| Field Detail |
protected IProject project
protected IPluginModelBase model
public static final String KEY_PLUGIN_CLASS
public static final String KEY_PLUGIN_ID
public static final String KEY_PLUGIN_NAME
public static final String KEY_PACKAGE_NAME
| Constructor Detail |
public AbstractTemplateSection()
| Method Detail |
public String getReplacementString(String fileName,
String key)
getReplacementString in interface ITemplateSectionfileName - the name of the file in which the key was found. You can use
it to return different values for different files.key - the replacement key found in the template file
ITemplateSection#getReplacementString(String)public Object getValue(String key)
IVariableProvider
getValue in interface IVariableProviderkey - the name of the variable
IVariableProvider.getValue(String)public URL getTemplateLocation()
ITemplateSection
getTemplateLocation in interface ITemplateSectionITemplateSection.getTemplateLocation()public String getDescription()
ITemplateSection
getDescription in interface ITemplateSectionITemplateSection.getDescription()public String getPluginResourceString(String key)
key - the key of the required resource string
getPluginResourceBundle()protected abstract ResourceBundle getPluginResourceBundle()
public void addPages(Wizard wizard)
ITemplateSection
addPages in interface ITemplateSectionwizard - the host wizard to add pages intoITemplateSection#addPages(IBasePluginWizard)public boolean getPagesAdded()
getPagesAdded in interface ITemplateSectiontrue if wizard pages for this section have been
added, false otherwise.protected void markPagesAdded()
addPages(Wizard)public int getNumberOfWorkUnits()
getNumberOfWorkUnits in interface ITemplateSectionITemplateSection.getNumberOfWorkUnits()public IPluginReference[] getDependencies(String schemaVersion)
ITemplateSection
getDependencies in interface ITemplateSectionschemaVersion - version of the target manifest, or null if older
manifest (prior to 3.0) will be created. Depending on the
manifest version, the list of dependencies may vary.
ITemplateSection#getDependencies()
protected IFolder getSourceFolder(IProgressMonitor monitor)
throws CoreException
monitor - progress monitor to use
CoreException
protected void generateFiles(IProgressMonitor monitor)
throws CoreException
monitor - progress monitor to use to indicate generation progress
CoreExceptionprotected boolean isOkToCreateFolder(File sourceFolder)
sourceFolder - the folder found in the template location that needs to be
created.
protected boolean isOkToCreateFile(File sourceFile)
sourceFile - the file found in the template location that needs to be
created.
protected abstract void updateModel(IProgressMonitor monitor)
throws CoreException
monitor - the progress monitor to be used
CoreException
public void execute(IProject project,
IPluginModelBase model,
IProgressMonitor monitor)
throws CoreException
execute in interface ITemplateSectionproject - the workspace project that contains the plug-inmodel - structured representation of the plug-in manifestmonitor - progress monitor to indicate execution progress
CoreExceptionITemplateSection.execute(IProject, IPluginModelBase,
IProgressMonitor)
protected IPluginExtension createExtension(String pointId,
boolean reuse)
throws CoreException
pointId - the identifier of the target extension pointreuse - if true, new extension object will be created only if an
extension with the same Id does not exist.
CoreException
|
Eclipse PDE Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||