Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text.templates
Class TemplateContext


java.lang.Object
  extended by 
org.eclipse.jface.text.templates.TemplateContext
Direct Known Subclasses:
DocumentTemplateContext

public abstract class TemplateContext
extends Object

Provides the context for a Template being resolved. Keeps track of resolved variables.

Clients may extend this class.

Since:
3.0

Constructor Summary
protected TemplateContext ( TemplateContextType contextType)
          Creates a template context of a particular context type.
 
Method Summary
abstract  boolean canEvaluate ( Template template)
          Tests if the specified template can be evaluated in this context.
abstract   TemplateBuffer evaluate ( Template template)
          Evaluates the template in this context and returns a template buffer.
  TemplateContextType getContextType ()
          Returns the context type of this context.
  String getVariable ( String name)
          Returns the value of a defined variable.
 boolean isReadOnly ()
          Returns true if the receiver is read-only, false otherwise.
 void setReadOnly (boolean readOnly)
          Sets or clears the read-only flag.
 void setVariable ( String name, String value)
          Defines the value of a variable.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateContext

protected TemplateContext(
TemplateContextType contextType)
Creates a template context of a particular context type.

Parameters:
contextType - the context type of this context
Method Detail

getContextType

public 
TemplateContextType getContextType()
Returns the context type of this context.

Returns:
the context type of this context

setReadOnly

public void setReadOnly(boolean readOnly)
Sets or clears the read-only flag.

Parameters:
readOnly - the new read-only state

isReadOnly

public boolean isReadOnly()
Returns true if the receiver is read-only, false otherwise.

Returns:
true if the receiver is read-only, false otherwise

setVariable

public void setVariable(
String name,
                        
String value)
Defines the value of a variable.

Parameters:
name - the name of the variable
value - the value of the variable, null to un-define a variable

getVariable

public 
String getVariable(
String name)
Returns the value of a defined variable.

Parameters:
name - the name of the variable
Returns:
returns the value of the variable, null if the variable was not defined

evaluate

public abstract 
TemplateBuffer evaluate(
Template template)
                                 throws 
BadLocationException,
                                        
TemplateException
Evaluates the template in this context and returns a template buffer.

Evaluation means translating the template into a TemplateBuffer, resolving the defined variables in this context and possibly formatting the resolved buffer.

Parameters:
template - the template to evaluate
Returns:
returns the buffer with the evaluated template or null if the buffer could not be created
Throws:
BadLocationException - if evaluation fails due to concurrently changed documents etc.
TemplateException - if the template specification is not valid

canEvaluate

public abstract boolean canEvaluate(
Template template)
Tests if the specified template can be evaluated in this context.

Examples are templates defined for a different context (e.g. a javadoc template cannot be evaluated in Java context).

Parameters:
template - the Template to check
Returns:
true if template can be evaluated in this context, false otherwise

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire