Java Code Examples for org.eclipse.xtend.lib.macro.declaration.ClassDeclaration#getSimpleName()

The following examples show how to use org.eclipse.xtend.lib.macro.declaration.ClassDeclaration#getSimpleName() . 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: AccessObjectProcessor.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void doRegisterGlobals(final List<? extends ClassDeclaration> annotatedSourceElements, @Extension final RegisterGlobalsContext ctx) {
  final Consumer<ClassDeclaration> _function = (ClassDeclaration it) -> {
    String _qualifiedName = it.getQualifiedName();
    int _length = it.getQualifiedName().length();
    int _length_1 = it.getSimpleName().length();
    int _minus = (_length - _length_1);
    final String pkg = _qualifiedName.substring(0, _minus);
    String _simpleName = it.getSimpleName();
    final String PVersionName = ((pkg + "P") + _simpleName);
    String _simpleName_1 = it.getSimpleName();
    final String GVersionName = ((pkg + "G") + _simpleName_1);
    ctx.registerClass(PVersionName);
    ctx.registerClass(GVersionName);
  };
  annotatedSourceElements.forEach(_function);
}
 
Example 2
Source File: TemplateProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private String generatePropertiesFile(final ClassDeclaration annotatedClass, @Extension final CodeGenerationContext context) {
  final String label = this.replaceNewlines(this.getLabel(annotatedClass, context));
  final String description = this.replaceNewlines(this.getDescription(annotatedClass, context));
  String _simpleName = annotatedClass.getSimpleName();
  final String labelLineStart = (_simpleName + "_Label=");
  final String labelLine = (labelLineStart + label);
  boolean _contains = this.actualPropertyContents.contains(labelLineStart);
  if (_contains) {
    this.actualPropertyContents = this.actualPropertyContents.replaceFirst((("(?m)^" + labelLineStart) + ".*$"), labelLine);
  } else {
    String _actualPropertyContents = this.actualPropertyContents;
    String _lineSeparator = System.lineSeparator();
    String _plus = (labelLine + _lineSeparator);
    this.actualPropertyContents = (_actualPropertyContents + _plus);
  }
  String _simpleName_1 = annotatedClass.getSimpleName();
  final String descriptionLineStart = (_simpleName_1 + "_Description=");
  final String descriptionLine = (descriptionLineStart + description);
  boolean _contains_1 = this.actualPropertyContents.contains(descriptionLineStart);
  if (_contains_1) {
    this.actualPropertyContents = this.actualPropertyContents.replaceFirst((("(?m)^" + descriptionLineStart) + ".*$"), descriptionLine);
  } else {
    String _actualPropertyContents_1 = this.actualPropertyContents;
    String _lineSeparator_1 = System.lineSeparator();
    String _plus_1 = (descriptionLine + _lineSeparator_1);
    this.actualPropertyContents = (_actualPropertyContents_1 + _plus_1);
  }
  this.propertyContentMap.put(this.getMessagesProperties(annotatedClass), this.actualPropertyContents);
  return this.actualPropertyContents;
}
 
Example 3
Source File: EmfAdaptableProcessor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public String getAdapterClassName(final ClassDeclaration declaration) {
  String _qualifiedName = declaration.getQualifiedName();
  String _plus = (_qualifiedName + ".");
  String _simpleName = declaration.getSimpleName();
  String _plus_1 = (_plus + _simpleName);
  return (_plus_1 + "Adapter");
}