use of org.eclipse.jface.text.templates.TemplateContextType in project webtools.sourceediting by eclipse.
the class XPathTemplateCompletionProcessor method getContextType.
protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
TemplateContextType type = null;
ContextTypeRegistry registry = getTemplateContextRegistry();
if (registry != null) {
type = registry.getContextType(fContextTypeId);
}
return type;
}
use of org.eclipse.jface.text.templates.TemplateContextType in project webtools.sourceediting by eclipse.
the class XMLTemplateCompletionProcessor method getContextType.
protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
TemplateContextType type = null;
ContextTypeRegistry registry = getTemplateContextRegistry();
if (registry != null) {
type = registry.getContextType(fContextTypeId);
}
return type;
}
use of org.eclipse.jface.text.templates.TemplateContextType in project flux by eclipse.
the class ContributionContextTypeRegistry method createContextType.
private static TemplateContextType createContextType(IConfigurationElement element) throws CoreException {
String id = element.getAttribute(ID);
try {
TemplateContextType contextType = (TemplateContextType) element.createExecutableExtension(CLASS);
String name = element.getAttribute(NAME);
if (name == null)
name = id;
if (contextType.getId() == null)
contextType.setId(id);
if (contextType.getName() == null)
contextType.setName(name);
return contextType;
} catch (ClassCastException e) {
// $NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, "extension does not implement " + TemplateContextType.class.getName(), e));
}
}
use of org.eclipse.jface.text.templates.TemplateContextType in project che by eclipse.
the class ContributionContextTypeRegistry method createContextType.
private static TemplateContextType createContextType(IConfigurationElement element) throws CoreException {
String id = element.getAttribute(ID);
try {
TemplateContextType contextType = (TemplateContextType) element.createExecutableExtension(CLASS);
String name = element.getAttribute(NAME);
if (name == null)
name = id;
if (contextType.getId() == null)
contextType.setId(id);
if (contextType.getName() == null)
contextType.setName(name);
return contextType;
} catch (ClassCastException e) {
//$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.ui.editors", IStatus.OK, "extension does not implement " + TemplateContextType.class.getName(), e));
}
}
use of org.eclipse.jface.text.templates.TemplateContextType in project che by eclipse.
the class ContributionContextTypeRegistry method addContextType.
/**
* 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 the <code>org.eclipse.ui.editors.templates</code>
* extension point are searched for the given identifier and the specified
* context type instantiated if it is found.
*
* @param id the id for the context type as specified in XML
*/
public void addContextType(String id) {
Assert.isNotNull(id);
if (getContextType(id) != null)
return;
TemplateContextType type = createContextType(id);
if (type != null)
addContextType(type);
}
Aggregations