Eclipse Platform
Release 3.0

org.eclipse.jface.text.templates
Class Template

java.lang.Object
  extended byorg.eclipse.jface.text.templates.Template

public class Template
extends Object

A template consisting of a name and a pattern.

Clients may instantiate this class. May become final in the future.

Since:
3.0

Constructor Summary
Template()
          Creates an empty template.
Template(String name, String description, String contextTypeId, String pattern)
          Creates a template.
Template(Template template)
          Creates a copy of a template.
 
Method Summary
 boolean equals(Object o)
           
 String getContextTypeId()
          Returns the id of the context type in which the template can be applied.
 String getDescription()
          Returns the description of the template.
 String getName()
          Returns the name of the template.
 String getPattern()
          Returns the template pattern.
 int hashCode()
           
 boolean matches(String prefix, String contextTypeName)
          Returns true if template is enabled and matches the context, false otherwise.
 void setContextTypeId(String contextTypeId)
          Sets the name of the context type in which the template can be applied.
 void setDescription(String description)
          Sets the description of the template.
 void setName(String name)
          Sets the name of the template.
 void setPattern(String pattern)
          Sets the pattern of the template.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template()
Creates an empty template.


Template

public Template(Template template)
Creates a copy of a template.

Parameters:
template - the template to copy

Template

public Template(String name,
                String description,
                String contextTypeId,
                String pattern)
Creates a template.

Parameters:
name - the name of the template
description - the description of the template
contextTypeId - the id of the context type in which the template can be applied
pattern - the template pattern
Method Detail

hashCode

public int hashCode()

setDescription

public void setDescription(String description)
Sets the description of the template.

Parameters:
description - the new description

getDescription

public String getDescription()
Returns the description of the template.

Returns:
the description of the template

setContextTypeId

public void setContextTypeId(String contextTypeId)
Sets the name of the context type in which the template can be applied.

Parameters:
contextTypeId - the new context type name

getContextTypeId

public String getContextTypeId()
Returns the id of the context type in which the template can be applied.

Returns:
the id of the context type in which the template can be applied

setName

public void setName(String name)
Sets the name of the template.

Parameters:
name - the name of the template

getName

public String getName()
Returns the name of the template.

Returns:
the name of the template

setPattern

public void setPattern(String pattern)
Sets the pattern of the template.

Parameters:
pattern - the new pattern of the template

getPattern

public String getPattern()
Returns the template pattern.

Returns:
the template pattern

matches

public boolean matches(String prefix,
                       String contextTypeName)
Returns true if template is enabled and matches the context, false otherwise.

Parameters:
prefix - the prefix (e.g. inside a document) to match
contextTypeName - the context type name to match
Returns:
true if template is enabled and matches the context, false otherwise

equals

public boolean equals(Object o)

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.