public class TemplateStore
extends org.eclipse.text.templates.TemplateStoreCore
org.eclipse.ui.editors.templates
extension point, use a ContributionTemplateStore.| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(TemplatePersistenceData data) |
void |
delete(TemplatePersistenceData data) |
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. |
protected void |
internalAdd(TemplatePersistenceData data) |
void |
load()
Loads the templates from contributions and preferences.
|
void |
restoreDefaults(boolean doSave)
Deletes all user-added templates and reverts all contributed templates.
|
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(). |
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
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 keykey - the key into store where to store custom
templatespublic void load()
throws IOException
load in class org.eclipse.text.templates.TemplateStoreCoreIOException - if loading fails.public final void startListeningForPreferenceChanges()
reloaded. Call
stopListeningForPreferenceChanges() to remove any listener and stop the
auto-updating behavior.startListeningForPreferenceChanges in class org.eclipse.text.templates.TemplateStoreCorepublic final void stopListeningForPreferenceChanges()
startListeningForPreferenceChanges().stopListeningForPreferenceChanges in class org.eclipse.text.templates.TemplateStoreCorepublic void save()
throws IOException
save in class org.eclipse.text.templates.TemplateStoreCoreIOException - if the templates cannot be writtenpublic void restoreDefaults(boolean doSave)
restoreDefaults in class org.eclipse.text.templates.TemplateStoreCoredoSave - true if the store should be saved after restoringprotected final ContextTypeRegistry getRegistry()
org.eclipse.text.templates.TemplateStoreCoregetRegistry in class org.eclipse.text.templates.TemplateStoreCorepublic void add(TemplatePersistenceData data)
public void delete(TemplatePersistenceData data)
public TemplatePersistenceData[] getTemplateData(boolean includeDeleted)
org.eclipse.text.templates.TemplateStoreCoregetTemplateData in class org.eclipse.text.templates.TemplateStoreCoreincludeDeleted - whether to include deleted datapublic TemplatePersistenceData getTemplateData(String id)
org.eclipse.text.templates.TemplateStoreCoreid or
null if no such template can be found.getTemplateData in class org.eclipse.text.templates.TemplateStoreCoreid - the id of the template dataid or nullprotected void internalAdd(TemplatePersistenceData data)
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.