本文整理汇总了Java中org.eclipse.xpand2.XpandFacade类的典型用法代码示例。如果您正苦于以下问题:Java XpandFacade类的具体用法?Java XpandFacade怎么用?Java XpandFacade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XpandFacade类属于org.eclipse.xpand2包,在下文中一共展示了XpandFacade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generatePluginXmlRt
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generatePluginXmlRt(List<LanguageConfig> configs, XpandExecutionContext ctx) {
String filePath = fileExists(ctx, "plugin.xml", PLUGIN_RT) ? "plugin.xml_gen" : "plugin.xml";
deleteFile(ctx, filePath, PLUGIN_RT);
ctx.getOutput().openFile(filePath, PLUGIN_RT);
ctx.getOutput().getOutlet(PLUGIN_RT).addVetoStrategy(new EmptyPluginXmlVeto());
try {
XpandFacade facade = XpandFacade.create(ctx);
List<Grammar> grammars = getGrammars(configs);
facade.evaluate("org::eclipse::xtext::generator::Plugin::pre", grammars);
for (LanguageConfig conf : languageConfigs) {
conf.addToPluginXmlRt(conf, ctx);
if (isUiMergedIntoRt()) {
conf.addToPluginXmlUi(conf, ctx);
}
}
facade.evaluate("org::eclipse::xtext::generator::Plugin::post", grammars);
} finally {
ctx.getOutput().closeFile();
}
}
示例2: generatePluginXmlUi
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generatePluginXmlUi(List<LanguageConfig> configs, XpandExecutionContext ctx) {
if (isUi() && !isUiMergedIntoRt()) {
String filePath = fileExists(ctx, "plugin.xml", PLUGIN_UI) ? "plugin.xml_gen" : "plugin.xml";
deleteFile(ctx, filePath, PLUGIN_UI);
ctx.getOutput().openFile(filePath, PLUGIN_UI);
try {
XpandFacade facade = XpandFacade.create(ctx);
List<Grammar> grammars = getGrammars(configs);
facade.evaluate("org::eclipse::xtext::generator::Plugin::pre", grammars);
for (LanguageConfig conf : languageConfigs) {
conf.addToPluginXmlUi(conf, ctx);
}
facade.evaluate("org::eclipse::xtext::generator::Plugin::post", grammars);
} finally {
ctx.getOutput().closeFile();
}
}
}
示例3: addToPluginXmlUi
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
@Override
public void addToPluginXmlUi(LanguageConfig config, XpandExecutionContext ctx) {
Grammar grammar = config.getGrammar();
List<Object> parameters = newArrayList();
parameters.addAll(getParameters(grammar));
parameters.add(config.getFileExtensions(grammar));
XpandFacade.create(ctx).evaluate2(getTemplate() + "::addToPluginXmlUi", grammar, parameters);
}
示例4: generate
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
@Override
public void generate(Grammar grammar, XpandExecutionContext ctx) {
if (log.isInfoEnabled()) {
log.info("generating Java-based EValidator API");
}
XpandFacade.create(ctx).evaluate2(getTemplate() + "::generate", grammar, getParameters(grammar));
}
示例5: addToStandaloneSetup
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void addToStandaloneSetup(LanguageConfig config, XpandExecutionContext ctx) {
ctx.getOutput().openFile(naming.asPath(naming.setupImpl(config.getGrammar())) + ".java", SRC_GEN);
try {
XpandFacade facade = XpandFacade.create(ctx);
facade.evaluate("org::eclipse::xtext::generator::StandaloneSetup::pre", config.getGrammar(), config.getFileExtensions(config.getGrammar()));
config.addToStandaloneSetup(config, ctx);
facade.evaluate("org::eclipse::xtext::generator::StandaloneSetup::post", config.getGrammar());
} finally {
ctx.getOutput().closeFile();
}
}
示例6: generateGuiceModuleRt
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateGuiceModuleRt(LanguageConfig config, XpandExecutionContext ctx) {
XpandFacade facade = XpandFacade.create(ctx);
Set<Binding> bindings = config.getGuiceBindingsRt(config.getGrammar());
String superClassName = config.getDefaultRuntimeModuleClassName(config.getGrammar());
if (superClassName == null) {
superClassName = "org.eclipse.xtext.service.DefaultRuntimeModule";
}
facade.evaluate("org::eclipse::xtext::generator::GuiceModuleRt::generate", config.getGrammar(), superClassName, bindings,
config.getFileExtensions(config.getGrammar()));
}
示例7: generateGuiceModuleUi
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateGuiceModuleUi(LanguageConfig config, XpandExecutionContext ctx) {
if (isUi()) {
XpandFacade facade = XpandFacade.create(ctx);
Set<Binding> bindings = config.getGuiceBindingsUi(config.getGrammar());
String superClassName = config.getDefaultUiModuleClassName(config.getGrammar());
if (superClassName == null) {
superClassName = "org.eclipse.xtext.ui.DefaultUiModule";
}
facade.evaluate("org::eclipse::xtext::generator::GuiceModuleUi::generate", config.getGrammar(), superClassName, bindings);
}
}
示例8: generateManifestRt
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateManifestRt(List<LanguageConfig> configs, XpandExecutionContext ctx) {
String manifestPath = "META-INF/MANIFEST.MF";
Set<String> exported = new LinkedHashSet<String>();
Set<String> requiredBundles = new LinkedHashSet<String>();
Set<String> imported = new LinkedHashSet<String>();
String activator = null;
if (isUiMergedIntoRt())
activator = getActivator();
for (LanguageConfig config : configs) {
exported.addAll(Arrays.asList(config.getExportedPackagesRt(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesRt(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesRt(config.getGrammar())));
if (isUiMergedIntoRt()) {
exported.addAll(Arrays.asList(config.getExportedPackagesUi(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesUi(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesUi(config.getGrammar())));
}
if (isIdeMergedIntoRt()) {
exported.addAll(Arrays.asList(config.getExportedPackagesIde(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesIde(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesIde(config.getGrammar())));
}
}
if (isMergeManifest()) {
String path = ctx.getOutput().getOutlet(PLUGIN_RT).getPath() + "/" + manifestPath;
mergeManifest(getProjectNameRt(), path, exported, requiredBundles, imported, activator);
} else {
manifestPath = manifestPath + "_gen";
deleteFile(ctx, manifestPath, PLUGIN_RT);
ctx.getOutput().openFile(manifestPath, PLUGIN_RT);
try {
XpandFacade facade = XpandFacade.create(ctx);
generateManifest(facade, getProjectNameRt(), getProjectNameRt(), getBundleVersion(), exported,
requiredBundles, imported, activator);
} finally {
ctx.getOutput().closeFile();
}
}
}
示例9: generateManifestUi
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateManifestUi(List<LanguageConfig> configs, XpandExecutionContext ctx) {
if (isUi() && !isUiMergedIntoRt()) {
String manifestPath = "META-INF/MANIFEST.MF";
Set<String> exported = new LinkedHashSet<String>();
Set<String> imported = new LinkedHashSet<String>();
Set<String> requiredBundles = new LinkedHashSet<String>();
for (LanguageConfig config : languageConfigs) {
exported.addAll(Arrays.asList(config.getExportedPackagesUi(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesUi(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesUi(config.getGrammar())));
if (!isIde()) {
exported.addAll(Arrays.asList(config.getExportedPackagesIde(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesIde(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesIde(config.getGrammar())));
}
}
if (isMergeManifest()) {
String path = ctx.getOutput().getOutlet(PLUGIN_UI).getPath() + "/" + manifestPath;
mergeManifest(getProjectNameUi(), path, exported, requiredBundles, imported, getActivator());
} else {
manifestPath = manifestPath + "_gen";
deleteFile(ctx, manifestPath, PLUGIN_UI);
ctx.getOutput().openFile(manifestPath, PLUGIN_UI);
try {
XpandFacade facade = XpandFacade.create(ctx);
generateManifest(facade, getProjectNameUi(), getProjectNameUi(), getBundleVersion(), exported,
requiredBundles, imported, getActivator());
} finally {
ctx.getOutput().closeFile();
}
}
}
}
示例10: generateManifestIde
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateManifestIde(List<LanguageConfig> configs, XpandExecutionContext ctx) {
if (isIde() && !isIdeMergedIntoRt() ) {
String manifestPath = "META-INF/MANIFEST.MF";
Set<String> exported = new LinkedHashSet<String>();
Set<String> imported = new LinkedHashSet<String>();
Set<String> requiredBundles = new LinkedHashSet<String>();
for (LanguageConfig config : languageConfigs) {
exported.addAll(Arrays.asList(config.getExportedPackagesIde(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesIde(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesIde(config.getGrammar())));
}
if (isMergeManifest()) {
String path = ctx.getOutput().getOutlet(PLUGIN_IDE).getPath() + "/" + manifestPath;
mergeManifest(getProjectNameIde(), path, exported, requiredBundles, imported, null);
} else {
manifestPath = manifestPath + "_gen";
deleteFile(ctx, manifestPath, PLUGIN_IDE);
ctx.getOutput().openFile(manifestPath, PLUGIN_IDE);
try {
XpandFacade facade = XpandFacade.create(ctx);
generateManifest(facade, getProjectNameIde(), getProjectNameIde(), getBundleVersion(), exported,
requiredBundles, imported, null);
} finally {
ctx.getOutput().closeFile();
}
}
}
}
示例11: generateManifestTests
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
private void generateManifestTests(List<LanguageConfig> configs, XpandExecutionContext ctx) {
if (isTest()) {
String manifestPath = "META-INF/MANIFEST.MF";
Set<String> exported = new LinkedHashSet<String>();
Set<String> imported = new LinkedHashSet<String>();
Set<String> requiredBundles = new LinkedHashSet<String>();
for (LanguageConfig config : languageConfigs) {
exported.addAll(Arrays.asList(config.getExportedPackagesTests(config.getGrammar())));
imported.addAll(Arrays.asList(config.getImportedPackagesTests(config.getGrammar())));
requiredBundles.addAll(Arrays.asList(config.getRequiredBundlesTests(config.getGrammar())));
}
if (isMergeManifest()) {
String path = ctx.getOutput().getOutlet(PLUGIN_TEST).getPath() + "/" + manifestPath;
mergeManifest(getProjectNameTests(), path, exported, requiredBundles, imported, null);
} else {
manifestPath = manifestPath + "_gen";
deleteFile(ctx, manifestPath, PLUGIN_TEST);
ctx.getOutput().openFile(manifestPath, PLUGIN_TEST);
try {
XpandFacade facade = XpandFacade.create(ctx);
generateManifest(facade, getProjectNameTests(), getProjectNameTests(), getBundleVersion(),
exported, requiredBundles, imported, getActivator());
} finally {
ctx.getOutput().closeFile();
}
}
}
}
示例12: generate
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
@Override
public void generate(final Grammar grammar, XpandExecutionContext ctx) {
final String templateName = getNewProjectTemplateName(grammar, getNaming());
final Outlet outlet = ctx.getOutput().getOutlet(Generator.SRC_UI);
final File templateFile = new File(new File(outlet.getPath()), templateName.replaceAll("::", "/") + '.' + XpandUtil.TEMPLATE_EXTENSION);
final boolean templateExisted = templateFile.exists();
List<Object> parameters = getParameters(grammar);
parameters.add(outlet.getFileEncoding());
XpandFacade.create(ctx).evaluate2(getTemplate()+"::generate", grammar, parameters);
if (!templateExisted && templateFile.exists()) {
LOG.info("A new template " + templateName + " has been generated into " + outlet.getPath() + ".");
LOG.info(" Make sure to enable the Xtend/Xpand nature and JavaBeans metamodel to edit this template.");
}
}
示例13: generate
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void generate(final Grammar grammar, final XpandExecutionContext ctx) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info(NLS.bind(Messages.EXECUTING_GENERATE, getClass().getName()));
}
ValidStandaloneSetup.doSetup();
final ValidModel validModel = getValidModel(grammar);
grammar.eResource().getResourceSet().getResources().add(validModel.eResource());
grammar.eResource().getResourceSet().getResources().add(validModel.getImports().get(0).eResource());
// profile for generator is:
// <<DEFINE generate(List[String] packageQNames, List[String] composedChecks, ValidModel validModel) FOR Grammar>>
XpandFacade.create(ctx).evaluate(getTemplate() + "::generate", // template //$NON-NLS-1$
grammar, // this (the grammar)
getParameters(grammar).get(0), // package Qualified Names (first parameter of the argument list is the 'list of
// packages')
this.composedChecks, // composed checks
validModel); // validModel
if (generateTests) {
XpandFacade.create(ctx).evaluate("com::avaloq::tools::ddk::xtext::valid::generator::ValidatorTests::generate", // template //$NON-NLS-1$
grammar, // this (the grammar)
validModel); // validModel
XpandFacade.create(ctx).evaluate("com::avaloq::tools::ddk::xtext::valid::generator::QuickfixTests::generate", // template //$NON-NLS-1$
grammar, // this (the grammar)
validModel); // validModel
}
}
示例14: enhanceProject
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
OutputImpl output = new OutputImpl();
output.addOutlet(new Outlet(false, getEncoding(), null, true, project.getLocation().makeAbsolute().toOSString()));
XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(output, null);
execCtx.getResourceManager().setFileEncoding("UTF-8");
execCtx.registerMetaModel(new JavaBeansMetaModel());
XpandFacade facade = XpandFacade.create(execCtx);
facade.evaluate("edu::byu::ee::phdl::ui::wizard::PhdlNewProject::main", getProjectInfo());
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
示例15: enhanceProject
import org.eclipse.xpand2.XpandFacade; //导入依赖的package包/类
protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
OutputImpl output = new OutputImpl();
output.addOutlet(new Outlet(false, getEncoding(), null, true, project.getLocation().makeAbsolute().toOSString()));
XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(output, null);
execCtx.getResourceManager().setFileEncoding("UTF-8");
execCtx.registerMetaModel(new JavaBeansMetaModel());
XpandFacade facade = XpandFacade.create(execCtx);
facade.evaluate("org::xtext::example::hellobuck::ui::wizard::HelloBuckNewProject::main", getProjectInfo());
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}