org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry Java Examples

The following examples show how to use org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaPlugin.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns the template context type registry for the java plug-in.
 *
 * @return the template context type registry for the java plug-in
 * @since 3.0
 */
public synchronized ContextTypeRegistry getTemplateContextRegistry() {
	if (fContextTypeRegistry == null) {
		ContributionContextTypeRegistry registry= new ContributionContextTypeRegistry(JavaUI.ID_CU_EDITOR);

		TemplateContextType all_contextType= registry.getContextType(JavaContextType.ID_ALL);
		((AbstractJavaContextType) all_contextType).initializeContextTypeResolvers();

		registerJavaContext(registry, JavaContextType.ID_MEMBERS, all_contextType);
		registerJavaContext(registry, JavaContextType.ID_STATEMENTS, all_contextType);

		registerJavaContext(registry, SWTContextType.ID_ALL, all_contextType);
		all_contextType= registry.getContextType(SWTContextType.ID_ALL);

		registerJavaContext(registry, SWTContextType.ID_MEMBERS, all_contextType);
		registerJavaContext(registry, SWTContextType.ID_STATEMENTS, all_contextType);

		fContextTypeRegistry= registry;
	}

	return fContextTypeRegistry;
}
 
Example #2
Source File: JSDTTypeScriptUIPlugin.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Returns the template context type registry for the java plug-in.
 * 
 * @return the template context type registry for the java plug-in
 * 
 */
public ContextTypeRegistry getTemplateContextRegistry() {
	if (fContextTypeRegistry == null) {
		ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry(CONTEXT_TYPE_REGISTRY_ID);
		fContextTypeRegistry = registry;
	}

	return fContextTypeRegistry;
}
 
Example #3
Source File: TemplateRegistry.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected ContextTypeRegistry createContributionContextTypeRegistry() {
	final ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
	for(String id : getRegisteredContextTypeIds()) {
		registry.addContextType(id);
	}
	return registry;
}
 
Example #4
Source File: JavaPlugin.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Registers the given Java template context.
 *
 * @param registry the template context type registry
 * @param id the context type id
 * @param parent the parent context type
 * @since 3.4
 */
private static void registerJavaContext(ContributionContextTypeRegistry registry, String id, TemplateContextType parent) {
	TemplateContextType contextType= registry.getContextType(id);
	Iterator<TemplateVariableResolver> iter= parent.resolvers();
	while (iter.hasNext())
		contextType.addResolver(iter.next());
}