当前位置: 首页>>代码示例>>Java>>正文


Java GrammarUtil.getName方法代码示例

本文整理汇总了Java中org.eclipse.xtext.GrammarUtil.getName方法的典型用法代码示例。如果您正苦于以下问题:Java GrammarUtil.getName方法的具体用法?Java GrammarUtil.getName怎么用?Java GrammarUtil.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.GrammarUtil的用法示例。


在下文中一共展示了GrammarUtil.getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGuiceBindingsRt

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bindFactory = new BindFactory();
  final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getName(grammar); //$NON-NLS-1$
  final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getName(grammar); //$NON-NLS-1$

  ExportModel m = getModel(grammar);
  if (m != null) {
    bindFactory.addTypeToType(IQualifiedNameProvider.class.getName(), namingPrefix + "ExportedNamesProvider"); //$NON-NLS-1$
    if (!m.getInterfaces().isEmpty()) {
      bindFactory.addTypeToType(IFingerprintComputer.class.getName(), resourcePrefix + "FingerprintComputer"); //$NON-NLS-1$
    }
    if (!m.getExports().isEmpty()) {
      bindFactory.addTypeToType(IDefaultResourceDescriptionStrategy.class.getName(), resourcePrefix + "ResourceDescriptionStrategy"); //$NON-NLS-1$
    }
    if (Iterables.any(m.getExports(), new Predicate<Export>() {
      @Override
      public boolean apply(final Export input) {
        return input.isFingerprint() && input.getFragmentAttribute() != null;
      }
    })) {
      bindFactory.addTypeToType(IFragmentProvider.class.getName(), resourcePrefix + "FragmentProvider");
    }
  }
  bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager"); //$NON-NLS-1$
  return bindFactory.getBindings();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:29,代码来源:ExportFragment.java

示例2: getGuiceBindingsRt

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bindFactory = new BindFactory();
  final String prefix = GrammarUtil.getNamespace(grammar) + ".scoping." + GrammarUtil.getName(grammar);

  bindFactory.addTypeToType(IScopeProvider.class.getName(), prefix + "ScopeProvider");
  bindFactory.addTypeToType(IScopeNameProvider.class.getName(), prefix + "ScopeNameProvider");
  bindFactory.addTypeToType(ILinkingService.class.getName(), "com.avaloq.tools.ddk.xtext.linking.LinkingService");

  return bindFactory.getBindings();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ScopingFragment.java

示例3: getValidModel

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Gets the valid model.
 *
 * @param grammar
 *          the grammar
 * @return the valid model
 */
private ValidModel getValidModel(final Grammar grammar) {
  if (model != null) {
    return model;
  }

  Resource resource = null;
  final String name = GrammarUtil.getName(grammar) + '.' + XTEXT_EXTENSION;
  URI uri;
  for (final Resource res : grammar.eResource().getResourceSet().getResources()) {
    if (res.getURI() != null && name.equals(EmfResourceUtil.getFileName(res.getURI()))) {
      resource = res;
      break;
    }
  }
  if (getValidURI() == null) {
    Assert.isNotNull(resource, NLS.bind(Messages.RESOURCE_NOT_FOUND, name));
    uri = resource.getURI().trimFileExtension().appendFileExtension(VALID_EXTENSION);
  } else {
    uri = URI.createURI(getValidURI());
  }

  resource = resource.getResourceSet().getResource(uri, true);

  final List<Issue> issues = VALIDATOR.validate(resource, LOGGER);
  for (final Issue issue : issues) {
    if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
      throw new WorkflowInterruptedException(NLS.bind(Messages.ERROR_FOUND, uri.toString()));
    }
  }
  model = (ValidModel) resource.getContents().get(0);
  return model;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:40,代码来源:ValidValidatorFragment.java

示例4: caseGrammar

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
public String caseGrammar(final org.eclipse.xtext.Grammar object) {
  return GrammarUtil.getName(object);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:5,代码来源:FormatScopeNameProvider.java

示例5: getFormatterName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Get the qualified class name of the formatter. The class name is prefixed with classNamePrefix.
 *
 * @param grammar
 *          the format grammar
 * @param classNamePrefix
 *          the class prefix - may be null
 * @return String fully qualified name of the formatter class
 */
public static String getFormatterName(final Grammar grammar, final String classNamePrefix) {
  return GrammarUtil.getNamespace(grammar) + ".formatting." + (classNamePrefix == null ? "" : classNamePrefix) + GrammarUtil.getName(grammar) + "Formatter";
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:FormatGeneratorUtil.java

示例6: getJavaValidatorName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Gets the java validator name.
 *
 * @param grammar
 *          the grammar
 * @param prefix
 *          the prefix (common usage is "Abstract")
 * @return the java validator name
 */
public static String getJavaValidatorName(final Grammar grammar, final String prefix) {
  return GrammarUtil.getNamespace(grammar) + ".validation." + prefix + GrammarUtil.getName(grammar) + "JavaValidator"; //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ValidValidatorFragment.java

示例7: getPreferencePageName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Gets the java validator name.
 *
 * @param grammar
 *          the grammar
 * @param naming
 *          generator naming variables and properties
 * @return the java validator name
 */
public static String getPreferencePageName(final Grammar grammar, final Naming naming) {
  return getPreferencePackage(grammar, naming) + "." + GrammarUtil.getName(grammar) + "ValidPreferencePage"; //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ValidValidatorFragment.java

示例8: getQuickfixProviderName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Gets the quickfix provider name.
 *
 * @param grammar
 *          the grammar
 * @param naming
 *          generator naming variables and properties
 * @return the quickfix provider name
 */
public static String getQuickfixProviderName(final Grammar grammar, final Naming naming) {
  return getQuickfixPackage(grammar, naming) + "." + GrammarUtil.getName(grammar) + "QuickfixProvider"; //$NON-NLS-1$//$NON-NLS-2$
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ValidValidatorFragment.java

示例9: getCheckValidatorName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Gets the check validator name.
 *
 * @param grammar
 *          the grammar
 * @param naming
 *          generator naming variables and properties
 * @return the check validator name
 */
public static String getCheckValidatorName(final Grammar grammar, final Naming naming) {
  return naming.basePackageRuntime(grammar) + ".validation." + GrammarUtil.getName(grammar) + "CheckValidator"; //$NON-NLS-1$//$NON-NLS-2$
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ValidValidatorFragment.java

示例10: getQualifiedName

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Returns the qualified name of the Constants class.
 *
 * @param grammar
 *          the grammar
 * @param prefix
 *          the prefix (e.g. "Abstract", "Default", ...
 * @param naming
 *          the naming
 * @return the qualified name
 */
public static String getQualifiedName(final Grammar grammar, final String prefix, final Naming naming) {
  return naming.basePackageRuntime(grammar) + "." + prefix + GrammarUtil.getName(grammar) + "Constants"; //$NON-NLS-1$
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:15,代码来源:LanguageConstantsFragment.java


注:本文中的org.eclipse.xtext.GrammarUtil.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。