本文整理匯總了Java中com.google.gwt.core.ext.GeneratorContext.getResourcesOracle方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneratorContext.getResourcesOracle方法的具體用法?Java GeneratorContext.getResourcesOracle怎麽用?Java GeneratorContext.getResourcesOracle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.core.ext.GeneratorContext
的用法示例。
在下文中一共展示了GeneratorContext.getResourcesOracle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTemplateResource
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
private Resource getTemplateResource(GeneratorContext context) {
String packageResourcePath = this.targetType.getPackage().getName().replace('.', '/') + "/";
ResourceOracle resourceOracle = context.getResourcesOracle();
Map<String, Resource> reourceMap = new HashMap<>();
for (Resource resource : resourceOracle.getResources()) {
reourceMap.put(resource.getPath(), resource);
}
String templatePath =
packageResourcePath + this.templateName + "_" + this.locale + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
Resource templateResource = reourceMap.get(templatePath);
if (templateResource == null) {
this.locale = null;
templatePath = packageResourcePath + this.templateName + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
templateResource = reourceMap.get(templatePath);
}
if (templateResource != null) {
this.templateName = templatePath.replace(packageResourcePath, "");
}
return templateResource;
}
示例2: createTemplateImpl
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
/**
* Create the template resource implementation based on the result of the template parser.
* @param context The resource context (used to retrieve resources)
* @param printWriter The source writer
* @param componentTypeName The name of our Template class
* @param templateParserResult The result of the HTML template parsed by {@link TemplateParser}
* @throws UnableToCompleteException in case it fails to compile the HTML template to a JS
* render function
*/
private void createTemplateImpl(GeneratorContext context, TreeLogger logger,
PrintWriter printWriter, ClassName componentTypeName,
TemplateParserResult templateParserResult) throws UnableToCompleteException
{
// Resources are in the "client" folder to be included during GWT compilation
Folder folder = new GwtResourceFolder(context.getResourcesOracle(),
"com/axellience/vuegwt/gwt2/client/template/compiler");
TemplateImplBuilder templateImplBuilder = new TemplateImplBuilder();
TypeSpec templateImplType =
templateImplBuilder.buildTemplateImpl(componentTypeName, templateParserResult, folder);
// Write class
JavaFile javaFile =
JavaFile.builder(componentTypeName.packageName(), templateImplType).build();
try
{
javaFile.writeTo(printWriter);
}
catch (IOException e)
{
logger.log(TreeLogger.ERROR,
"Cannot write java file for component: " + componentTypeName.reflectionName());
throw new UnableToCompleteException();
}
context.commit(logger, printWriter);
}
示例3: TypeXmlFinder
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
TypeXmlFinder(GeneratorContext context, TreeLogger logger){
super(context, logger);
this.resourceOracle = context.getResourcesOracle();
JClassType[] _collectionOrMap = new JClassType[2];
try{
_collectionOrMap[0] = typeOracle.getType(Collection.class.getName());
_collectionOrMap[1] = typeOracle.getType(Map.class.getName());
}catch(NotFoundException e){
_collectionOrMap = null;
}
collectionOrMap = _collectionOrMap;
}