Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.text.templates.persistence
Class TemplatePersistenceData

    java.lang.Object
      org.eclipse.jface.text.templates.persistence.TemplatePersistenceData

public class TemplatePersistenceData
extends Object

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.0

Constructor Summary
`TemplatePersistenceData(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
`String` | `getId()` Returns the id of this template store, or `null` if there is none.
`Template` | `getTemplate()` Returns the template encapsulated by the receiver.
`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.
`boolean` | `isDeleted()` Returns the deletion state of the stored template.
`boolean` | `isEnabled()` Returns the enablement state of the contained template.
`boolean` | `isModified()` Returns whether the receiver represents a modified template, i.e. a contributed template that has been changed.
`boolean` | `isUserAdded()` Returns `true` if the contained template was added by a user, i.e. does not reference a contributed template.
`void` | `revert()` Reverts the template to its original setting.
`void` | `setDeleted(boolean isDeleted)` Sets the deletion state of the stored template.
`void` | `setEnabled(boolean isEnabled)` Sets the enablement state of the contained template.
`void` | `setTemplate(Template template)` Sets the template encapsulated by the receiver.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TemplatePersistenceData

    public TemplatePersistenceData(Template template,
                                   boolean enabled)

  Creates a new, user-added instance that is not linked to a contributed template.

Parameters:
  `template` - the template which is stored by the new instance
  `enabled` - whether the template is enabled

### TemplatePersistenceData

    public TemplatePersistenceData(Template template,
                                   boolean enabled,
                                   String id)

  Creates a new instance. If `id` is not `null`, 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 instance
  `enabled` - whether the template is enabled
  `id` - the id of the template, or `null` if a user-added instance should be created

Method Detail

### getId

    public String getId()

  Returns the id of this template store, or `null` if 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

    public Template getTemplate()

  Returns the template encapsulated by the receiver.

  Returns:
    the template encapsulated by the receiver

### setTemplate

    public void setTemplate(Template template)

  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:
    `true` if 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:
    `true` if the contained template is contributed but has been modified, `false` otherwise

### isUserAdded

    public boolean isUserAdded()

  Returns `true` if the contained template was added by a user, i.e. does not reference a contributed template.

  Returns:
    `true` if the contained template was added by a user, `false` otherwise

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
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, 2004. All rights reserved.