Class ContributionContextTypeRegistry
- java.lang.Object
-
- org.eclipse.text.templates.ContextTypeRegistry
-
- org.eclipse.jface.text.templates.ContextTypeRegistry
-
- org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry
-
public class ContributionContextTypeRegistry extends ContextTypeRegistry
A registry for context types. Editor implementors will usually instantiate a registry and configure the context types available in their editor.ContextType
s can be added either directly usingContextTypeRegistry.addContextType(TemplateContextType)
or by instantiating and adding a contributed context type usingaddContextType(String)
.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ContributionContextTypeRegistry()
Creates a new context type registry.ContributionContextTypeRegistry(String registryId)
Creates a new context type registry and registers all context types contributed for the given registry ID.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContextType(String id)
Tries to create a context type given an id.static TemplateContextType
createContextType(String id)
Tries to create a context type given an id.-
Methods inherited from class org.eclipse.jface.text.templates.ContextTypeRegistry
addContextType, contextTypes, getContextType
-
-
-
-
Constructor Detail
-
ContributionContextTypeRegistry
public ContributionContextTypeRegistry(String registryId)
Creates a new context type registry and registers all context types contributed for the given registry ID.- Parameters:
registryId
- the registry ID- Since:
- 3.5
-
ContributionContextTypeRegistry
public ContributionContextTypeRegistry()
Creates a new context type registry.Clients need to enable the desired context types by calling
addContextType(String)
.
-
-
Method Detail
-
addContextType
public void addContextType(String id)
Tries to create a context type given an id. If there is already a context type registered under the given id, nothing happens. Otherwise, contributions to theorg.eclipse.ui.editors.templates
extension point are searched for the given identifier and the specified context type instantiated if it is found.- Parameters:
id
- the id for the context type as specified in XML
-
createContextType
public static TemplateContextType createContextType(String id)
Tries to create a context type given an id. Contributions to theorg.eclipse.ui.editors.templates
extension point are searched for the given identifier and the specified context type instantiated if it is found. Any contributedTemplateVariableResolver
s are also instantiated and added to the context type.- Parameters:
id
- the id for the context type as specified in XML- Returns:
- the instantiated and configured context type, or
null
if it is not found or cannot be instantiated
-
-