use of org.eclipse.jdt.internal.corext.template.java.ImportsResolver 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);
}
Aggregations