|
Eclipse Platform Release 3.2 |
|||||||||
| 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
public class 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 |
handleException(IOException x)
Handles an IOException thrown during reloading the preferences due to a preference
store update. |
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. |
void |
startListeningForPreferenceChanges()
Starts listening for property changes on the preference store. |
void |
stopListeningForPreferenceChanges()
Stops the auto-updating behavior started by calling startListeningForPreferenceChanges(). |
| 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 keykey - the key into store where to store custom
templates
public 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 keykey - the key into store where to store custom
templates| Method Detail |
|---|
public void load()
throws IOException
IOException - if loading fails.public final void startListeningForPreferenceChanges()
reloaded. Call
stopListeningForPreferenceChanges() to remove any listener and stop the
auto-updating behavior.
public final void stopListeningForPreferenceChanges()
startListeningForPreferenceChanges().
protected void handleException(IOException x)
IOException thrown during reloading the preferences due to a preference
store update. The default is to write to stderr.
x - the exception
protected void loadContributedTemplates()
throws IOException
The default implementation does nothing.
IOException - if loading failsprotected void internalAdd(TemplatePersistenceData data)
data - the template data to add
public 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 found
public 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 nullprotected final ContextTypeRegistry getRegistry()
|
Eclipse Platform Release 3.2 |
|||||||||
| 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, 2006. All rights reserved.