Package org.eclipse.text.templates
Class TemplatePersistenceData
java.lang.Object
org.eclipse.text.templates.TemplatePersistenceData
- Direct Known Subclasses:
TemplatePersistenceData
TemplatePersistenceData stores information about a template. It uniquely
references contributed templates via their id. Contributed templates may be
deleted or modified. All template may be enabled or not.
Clients may use this class, although this is not usually needed except when implementing a custom template preference page or template store. This class is not intended to be subclassed.
- Since:
- 3.7
- Restriction:
- This class is not intended to be subclassed by clients.
-
Constructor Summary
ConstructorsConstructorDescriptionTemplatePersistenceData(Template template, boolean enabled) Creates a new, user-added instance that is not linked to a contributed template.TemplatePersistenceData(Template template, boolean enabled, String id) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetId()Returns the id of this template store, ornullif there is none.Returns the template encapsulated by the receiver.protected UUIDRequired to support equals() with deprecated type org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.protected static final UUIDRequired to support equals() with deprecated type org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.inthashCode()booleanisCustom()Returns whether the receiver represents a custom template, i.e. is either a user-added template or a contributed template that has been modified.booleanReturns the deletion state of the stored template.booleanReturns the enablement state of the contained template.booleanReturns whether the receiver represents a modified template, i.e. a contributed template that has been changed.booleanReturnstrueif the contained template was added by a user, i.e. does not reference a contributed template.voidrevert()Reverts the template to its original setting.voidsetDeleted(boolean isDeleted) Sets the deletion state of the stored template.voidsetEnabled(boolean isEnabled) Sets the enablement state of the contained template.voidsetTemplate(Template template) Sets the template encapsulated by the receiver.
-
Constructor Details
-
TemplatePersistenceData
Creates a new, user-added instance that is not linked to a contributed template.- Parameters:
template- the template which is stored by the new instanceenabled- whether the template is enabled
-
TemplatePersistenceData
Creates a new instance. Ifidis notnull, the instance is represents a template that is contributed and can be identified via its id.- Parameters:
template- the template which is stored by the new instanceenabled- whether the template is enabledid- the id of the template, ornullif a user-added instance should be created
-
-
Method Details
-
getId
Returns the id of this template store, ornullif there is none.- Returns:
- the id of this template store
-
isDeleted
public boolean isDeleted()Returns the deletion state of the stored template. This is only relevant of contributed templates.- Returns:
- the deletion state of the stored template
-
setDeleted
public void setDeleted(boolean isDeleted) Sets the deletion state of the stored template.- Parameters:
isDeleted- the deletion state of the stored template
-
getTemplate
Returns the template encapsulated by the receiver.- Returns:
- the template encapsulated by the receiver
-
setTemplate
Sets the template encapsulated by the receiver.- Parameters:
template- the new template
-
isCustom
public boolean isCustom()Returns whether the receiver represents a custom template, i.e. is either a user-added template or a contributed template that has been modified.- Returns:
trueif the contained template is a custom template and cannot be reconstructed from the contributed templates
-
isModified
public boolean isModified()Returns whether the receiver represents a modified template, i.e. a contributed template that has been changed.- Returns:
trueif the contained template is contributed but has been modified,falseotherwise
-
isUserAdded
public boolean isUserAdded()Returnstrueif the contained template was added by a user, i.e. does not reference a contributed template.- Returns:
trueif the contained template was added by a user,falseotherwise
-
revert
public void revert()Reverts the template to its original setting. -
isEnabled
public boolean isEnabled()Returns the enablement state of the contained template.- Returns:
- the enablement state of the contained template
-
setEnabled
public void setEnabled(boolean isEnabled) Sets the enablement state of the contained template.- Parameters:
isEnabled- the new enablement state of the contained template
-
hashCode
public int hashCode() -
equals
-
getUniqueIdForEquals
Required to support equals() with deprecated type org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.- Returns:
- unique id to support
equals(Object) - Since:
- 3.8
-
getUniqueIdForEquals
Required to support equals() with deprecated type org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.- Parameters:
data- non null- Returns:
- unique id to support
equals(Object) - Since:
- 3.8
-