Search in sources :

Example 1 with JavaContextType

use of org.eclipse.jdt.internal.corext.template.java.JavaContextType in project che by eclipse.

the class ContributionContextTypeRegistry method readRegistry.

/**
	 * Registers all context types contributed for the given registry ID.
	 *
	 * @param registryId the registry ID
	 * @since 3.5
	 */
private void readRegistry(String registryId) {
    Assert.isNotNull(registryId);
    //		IConfigurationElement[] extensions= getTemplateExtensions();
    //
    //		for (int i= 0; i < extensions.length; i++) {
    //			if (extensions[i].getName().equals(REGISTRY)) {
    //				String id= extensions[i].getAttribute(ID);
    //				if (registryId.equals(id)) {
    //					for (int j= 0; j < extensions.length; j++) {
    //						if (extensions[j].getName().equals(CONTEXT_TYPE)) {
    //							if (registryId.equals(extensions[j].getAttribute(REGISTRY_ID)))
    //								addContextType(extensions[j].getAttribute(ID));
    //						}
    //					}
    //					return;
    //				}
    //
    //			}
    //		}
    //
    //		Assert.isTrue(false, "invalid registry id"); //$NON-NLS-1$
    JavaContextType javaType = new JavaContextType();
    javaType.setId("java");
    FieldResolver fieldResolver = new FieldResolver();
    fieldResolver.setType("field");
    javaType.addResolver(fieldResolver);
    LocalVarResolver localVarResolver = new LocalVarResolver();
    localVarResolver.setType("localVar");
    javaType.addResolver(localVarResolver);
    VarResolver varResolver = new VarResolver();
    varResolver.setType("var");
    javaType.addResolver(varResolver);
    NameResolver nameResolver = new NameResolver();
    nameResolver.setType("newName");
    javaType.addResolver(nameResolver);
    TypeResolver typeResolver = new TypeResolver();
    typeResolver.setType("newType");
    javaType.addResolver(typeResolver);
    ElementTypeResolver elementTypeResolver = new ElementTypeResolver();
    elementTypeResolver.setType("elemType");
    javaType.addResolver(elementTypeResolver);
    TypeVariableResolver typeVariableResolver = new TypeVariableResolver();
    typeVariableResolver.setType("argType");
    javaType.addResolver(typeVariableResolver);
    LinkResolver linkResolver = new LinkResolver();
    linkResolver.setType("link");
    javaType.addResolver(linkResolver);
    ImportsResolver importsResolver = new ImportsResolver();
    importsResolver.setType("import");
    javaType.addResolver(importsResolver);
    StaticImportResolver staticImportResolver = new StaticImportResolver();
    staticImportResolver.setType("importStatic");
    javaType.addResolver(staticImportResolver);
    ExceptionVariableNameResolver exceptionVariableNameResolver = new ExceptionVariableNameResolver();
    exceptionVariableNameResolver.setType("exception_variable_name");
    javaType.addResolver(exceptionVariableNameResolver);
    addContextType(javaType);
    JavaContextType statements = new JavaContextType();
    statements.setId("java-statements");
    //		statements.addResolver(new FieldResolver());
    //		statements.addResolver(new LocalVarResolver());
    //		statements.addResolver(new VarResolver());
    //		statements.addResolver(new NameResolver());
    //		statements.addResolver(new TypeResolver());
    //		statements.addResolver(new ElementTypeResolver());
    //		statements.addResolver(new TypeVariableResolver());
    //		statements.addResolver(new LinkResolver());
    //		statements.addResolver(new ImportsResolver());
    //		statements.addResolver(new StaticImportResolver());
    //		statements.addResolver(new ExceptionVariableNameResolver());
    addContextType(statements);
    JavaContextType members = new JavaContextType();
    members.setId("java-members");
    //		members.addResolver(new FieldResolver());
    //		members.addResolver(new LocalVarResolver());
    //		members.addResolver(new VarResolver());
    //		members.addResolver(new NameResolver());
    //		members.addResolver(new TypeResolver());
    //		members.addResolver(new ElementTypeResolver());
    //		members.addResolver(new TypeVariableResolver());
    //		members.addResolver(new LinkResolver());
    //		members.addResolver(new ImportsResolver());
    //		members.addResolver(new StaticImportResolver());
    //		members.addResolver(new ExceptionVariableNameResolver());
    addContextType(members);
    JavaContextType javadoc = new JavaContextType();
    javadoc.setId("javadoc");
    addContextType(javadoc);
}
Also used : LocalVarResolver(org.eclipse.jdt.internal.corext.template.java.LocalVarResolver) JavaContextType(org.eclipse.jdt.internal.corext.template.java.JavaContextType) FieldResolver(org.eclipse.jdt.internal.corext.template.java.FieldResolver) StaticImportResolver(org.eclipse.jdt.internal.corext.template.java.StaticImportResolver) TypeVariableResolver(org.eclipse.jdt.internal.corext.template.java.TypeVariableResolver) LinkResolver(org.eclipse.jdt.internal.corext.template.java.LinkResolver) TypeResolver(org.eclipse.jdt.internal.corext.template.java.TypeResolver) ElementTypeResolver(org.eclipse.jdt.internal.corext.template.java.ElementTypeResolver) ElementTypeResolver(org.eclipse.jdt.internal.corext.template.java.ElementTypeResolver) ExceptionVariableNameResolver(org.eclipse.jdt.internal.corext.template.java.ExceptionVariableNameResolver) ImportsResolver(org.eclipse.jdt.internal.corext.template.java.ImportsResolver) VarResolver(org.eclipse.jdt.internal.corext.template.java.VarResolver) LocalVarResolver(org.eclipse.jdt.internal.corext.template.java.LocalVarResolver) ExceptionVariableNameResolver(org.eclipse.jdt.internal.corext.template.java.ExceptionVariableNameResolver) NameResolver(org.eclipse.jdt.internal.corext.template.java.NameResolver)

Aggregations

ElementTypeResolver (org.eclipse.jdt.internal.corext.template.java.ElementTypeResolver)1 ExceptionVariableNameResolver (org.eclipse.jdt.internal.corext.template.java.ExceptionVariableNameResolver)1 FieldResolver (org.eclipse.jdt.internal.corext.template.java.FieldResolver)1 ImportsResolver (org.eclipse.jdt.internal.corext.template.java.ImportsResolver)1 JavaContextType (org.eclipse.jdt.internal.corext.template.java.JavaContextType)1 LinkResolver (org.eclipse.jdt.internal.corext.template.java.LinkResolver)1 LocalVarResolver (org.eclipse.jdt.internal.corext.template.java.LocalVarResolver)1 NameResolver (org.eclipse.jdt.internal.corext.template.java.NameResolver)1 StaticImportResolver (org.eclipse.jdt.internal.corext.template.java.StaticImportResolver)1 TypeResolver (org.eclipse.jdt.internal.corext.template.java.TypeResolver)1 TypeVariableResolver (org.eclipse.jdt.internal.corext.template.java.TypeVariableResolver)1 VarResolver (org.eclipse.jdt.internal.corext.template.java.VarResolver)1