Java Code Examples for org.eclipse.xtext.GrammarUtil#getNamespace()

The following examples show how to use org.eclipse.xtext.GrammarUtil#getNamespace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EMFGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected String getBasePackage(final Grammar grammar) {
  String _elvis = null;
  if (this.basePackage != null) {
    _elvis = this.basePackage;
  } else {
    String _namespace = GrammarUtil.getNamespace(grammar);
    _elvis = _namespace;
  }
  return _elvis;
}
 
Example 2
Source File: ExportFragment.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bindFactory = new BindFactory();
  final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getSimpleName(grammar); //$NON-NLS-1$
  final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getSimpleName(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"); //$NON-NLS-1$
    }
  }
  bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager"); //$NON-NLS-1$
  return bindFactory.getBindings();
}
 
Example 3
Source File: ExportFragment.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public String[] getExportedPackagesRt(final Grammar grammar) {
  if (getModel(grammar) != null) {
    return new String[] {GrammarUtil.getNamespace(grammar) + ".naming", GrammarUtil.getNamespace(grammar) + ".resource"}; //$NON-NLS-1$ //$NON-NLS-2$
  } else {
    return new String[] {GrammarUtil.getNamespace(grammar) + ".resource"}; //$NON-NLS-1$
  }
}
 
Example 4
Source File: ScopingFragment.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bindFactory = new BindFactory();
  final String prefix = GrammarUtil.getNamespace(grammar) + ".scoping." + GrammarUtil.getSimpleName(grammar); //$NON-NLS-1$

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

  return bindFactory.getBindings();
}
 
Example 5
Source File: GrammarAccessFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	return new String[] { GrammarUtil.getNamespace(grammar), GrammarUtil.getNamespace(grammar) + ".services" };
}
 
Example 6
Source File: EMFGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public String getBasePackage(Grammar g) {
	if (basePackage == null)
		return GrammarUtil.getNamespace(g);
	return basePackage;
}
 
Example 7
Source File: XtextGeneratorNaming.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public String getRuntimeBasePackage(Grammar grammar) {
	return GrammarUtil.getNamespace(grammar);
}
 
Example 8
Source File: XtextGeneratorNaming.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public String getEclipsePluginBasePackage(Grammar grammar) {
	return GrammarUtil.getNamespace(grammar) + ".ui";
}
 
Example 9
Source File: XtextGeneratorNaming.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public String getWebBasePackage(Grammar grammar) {
	return GrammarUtil.getNamespace(grammar) + ".web";
}
 
Example 10
Source File: ScopingFragment.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public String[] getExportedPackagesRt(final Grammar grammar) {
  return new String[] {GrammarUtil.getNamespace(grammar) + ".scoping"}; //$NON-NLS-1$
}
 
Example 11
Source File: FormatGeneratorUtil.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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.getSimpleName(grammar) + "Formatter";
}
 
Example 12
Source File: ValidValidatorFragment.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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.getSimpleName(grammar) + "JavaValidator"; //$NON-NLS-1$ //$NON-NLS-2$
}