|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.text.templates.persistence.TemplateStore
A collection of templates. Clients may instantiate this class. In order to
load templates contributed using the org.eclipse.ui.editors.templates
extension point, use a ContributionTemplateStore
.
Constructor Summary | |
---|---|
TemplateStore(ContextTypeRegistry registry,
IPreferenceStore store,
String key)
Creates a new template store with a context type registry. |
|
TemplateStore(IPreferenceStore store,
String key)
Creates a new template store. |
Method Summary | |
---|---|
void |
add(TemplatePersistenceData data)
Adds a template encapsulated in its persistent form. |
void |
delete(TemplatePersistenceData data)
Removes a template from the store. |
Template |
findTemplate(String name)
Returns the first enabled template that matches the name. |
Template |
findTemplate(String name,
String contextTypeId)
Returns the first enabled template that matches both name and context type id. |
Template |
findTemplateById(String id)
Returns the first enabled template that matches the given template id. |
protected ContextTypeRegistry |
getRegistry()
Returns the registry. |
TemplatePersistenceData[] |
getTemplateData(boolean includeDeleted)
Returns all template data. |
TemplatePersistenceData |
getTemplateData(String id)
Returns the template data of the template with id id or
null if no such template can be found. |
Template[] |
getTemplates()
Returns all enabled templates. |
Template[] |
getTemplates(String contextTypeId)
Returns all enabled templates for the given context type. |
protected void |
internalAdd(TemplatePersistenceData data)
Adds a template to the internal store. |
void |
load()
Loads the templates from contributions and preferences. |
protected void |
loadContributedTemplates()
Hook method to load contributed templates. |
void |
restoreDefaults()
Deletes all user-added templates and reverts all contributed templates. |
void |
restoreDeleted()
Restores all contributed templates that have been deleted. |
void |
save()
Saves the templates to the preferences. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TemplateStore(IPreferenceStore store, String key)
store
- the preference store in which to store custom templates
under key
key
- the key into store
where to store custom
templatespublic TemplateStore(ContextTypeRegistry registry, IPreferenceStore store, String key)
null
.
registry
- a context type registry, or null
if all
templates should be loadedstore
- the preference store in which to store custom templates
under key
key
- the key into store
where to store custom
templatesMethod Detail |
public void load() throws IOException
IOException
- if loading fails.protected void loadContributedTemplates() throws IOException
The default implementation does nothing.
IOException
- if loading failsprotected void internalAdd(TemplatePersistenceData data)
data
- the template data to addpublic void save() throws IOException
IOException
- if the templates cannot be writtenpublic void add(TemplatePersistenceData data)
data
- the template to addpublic void delete(TemplatePersistenceData data)
data
- the template to removepublic void restoreDeleted()
public void restoreDefaults()
public Template[] getTemplates()
public Template[] getTemplates(String contextTypeId)
contextTypeId
- the id of the context type of the requested templates, or null
if all templates should be returned
public Template findTemplate(String name)
name
- the name of the template searched for
null
if none is foundpublic Template findTemplate(String name, String contextTypeId)
name
- the name of the template searched forcontextTypeId
- the context type id to clip unwanted templates, or null
if any context type is OK
null
if none is foundpublic Template findTemplateById(String id)
id
- the id of the template searched for
null
if none is foundpublic TemplatePersistenceData[] getTemplateData(boolean includeDeleted)
includeDeleted
- whether to include deleted data
public TemplatePersistenceData getTemplateData(String id)
id
or
null
if no such template can be found.
id
- the id of the template data
id
or null
protected final ContextTypeRegistry getRegistry()
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.