org.eclipse.xtend2.lib.StringConcatenationClient Java Examples

The following examples show how to use org.eclipse.xtend2.lib.StringConcatenationClient. 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: ToAnnoProcessor.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
  super.doTransform(annotatedClass, context);
  Type _findTypeGlobally = context.findTypeGlobally(this.generatedAnnotationName(annotatedClass));
  final MutableAnnotationTypeDeclaration annotationType = ((MutableAnnotationTypeDeclaration) _findTypeGlobally);
  final Procedure1<MutableAnnotationTypeElementDeclaration> _function = (MutableAnnotationTypeElementDeclaration it) -> {
    it.setDocComment("Best building strategy game ever");
    it.setType(context.newTypeReference(Integer.TYPE));
    boolean _booleanValue = annotatedClass.findAnnotation(context.findTypeGlobally(ToAnno.class)).getBooleanValue("defaultValue");
    if (_booleanValue) {
      StringConcatenationClient _client = new StringConcatenationClient() {
        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
          _builder.append("1602");
        }
      };
      it.setDefaultValueExpression(_client);
    }
  };
  annotationType.addAnnotationTypeElement("anno", _function);
}
 
Example #2
Source File: SimpleProjectWizardFragment2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public void generateProjectInfo() {
  final TypeReference projectInfoClass = TypeReference.typeRef(this.getProjectInfoClassName());
  final JavaFileAccess file = this.fileAccessFactory.createJavaFile(projectInfoClass);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = projectInfoClass.getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.wizard.DefaultProjectInfo");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  file.setContent(_client);
  file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
 
Example #3
Source File: GeneratorNodeTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private StringConcatenationClient someCodeGen(final int n) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      {
        ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, n, true);
        for(final Integer i : _doubleDotLessThan) {
          _builder.append("before ");
          CompositeGeneratorNode _append = GeneratorNodeTest.this.exts.append(GeneratorNodeTest.this.exts.trace(GeneratorNodeTest.this.loc((10 + (i).intValue()))), "Hello");
          _builder.append(_append);
          _builder.append(" after");
          _builder.newLineIfNotEmpty();
          _builder.append("  ");
          StringConcatenationClient _someCodeGen = GeneratorNodeTest.this.someCodeGen((n - 1));
          _builder.append(_someCodeGen, "  ");
          _builder.newLineIfNotEmpty();
        }
      }
    }
  };
  return _client;
}
 
Example #4
Source File: TemplateNodeTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testSeparatorLoopWithWhitespace2() {
  final List<String> strings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      {
        boolean _hasElements = false;
        for(final String s : strings) {
          if (!_hasElements) {
            _hasElements = true;
          } else {
            _builder.appendImmediate(",", "");
          }
          _builder.append(s);
          _builder.append(" ");
          _builder.append(s);
          _builder.newLineIfNotEmpty();
        }
      }
    }
  };
  this.assertEquals(_client);
}
 
Example #5
Source File: GrammarAccessFragment2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected StringConcatenationClient _initializer(final TerminalRule it) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("this.");
      String _gaRuleAccessorLocalVarName = GrammarAccessFragment2.this.gaRuleAccessorLocalVarName(it);
      _builder.append(_gaRuleAccessorLocalVarName);
      _builder.append(" = (");
      _builder.append(TerminalRule.class);
      _builder.append(") ");
      _builder.append(GrammarUtil.class);
      _builder.append(".findRuleForName(getGrammar(), \"");
      String _qualifiedName = GrammarAccessFragment2.this.getQualifiedName(it);
      _builder.append(_qualifiedName);
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
    }
  };
  return _client;
}
 
Example #6
Source File: StatemachineTemplateProposalProvider.java    From xtext-web with Eclipse Public License 2.0 6 votes vote down vote up
public void createStateProposal(ContentAssistContext context, IIdeContentProposalAcceptor acceptor) {
	StringConcatenationClient template = new StringConcatenationClient() {
		@Override
		protected void appendTo(StringConcatenationClient.TargetStringConcatenation target) {
			target.append("state ");
			target.append(variable("name"));
			target.newLineIfNotEmpty();
			target.append("\t");
			target.append(cursor(), "\t");
			target.newLineIfNotEmpty();
			target.append("end");
			target.newLine();
		}
	};
	acceptProposal("state", "Create a new state", template, context, acceptor);
}
 
Example #7
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public StringConcatenationClient __generatePropertyWithDebugging(final Property it) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("Property ");
      IGeneratorNode __name = TracingSugarTest.this._myExtensions._name(it, true);
      _builder.append(__name);
      _builder.append(" : ");
      final Function1<Type, String> _function = (Type it_1) -> {
        return it_1.getName();
      };
      IGeneratorNode __type = TracingSugarTest.this._myExtensions._type(it, _function);
      _builder.append(__type);
      _builder.newLineIfNotEmpty();
    }
  };
  return _client;
}
 
Example #8
Source File: GrammarAccessFragment2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected StringConcatenationClient _cache(final ParserRule it) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("private final ");
      String _gaRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it);
      _builder.append(_gaRuleAccessorClassName);
      _builder.append(" ");
      String _gaRuleAccessorLocalVarName = GrammarAccessFragment2.this.gaRuleAccessorLocalVarName(it);
      _builder.append(_gaRuleAccessorLocalVarName);
      _builder.append(";");
      _builder.newLineIfNotEmpty();
    }
  };
  return _client;
}
 
Example #9
Source File: TemplateNodeTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testSeparatorLoopWithWhitespace3() {
  final List<String> strings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      {
        boolean _hasElements = false;
        for(final String s : strings) {
          if (!_hasElements) {
            _hasElements = true;
          } else {
            _builder.appendImmediate(",", "");
          }
          _builder.newLine();
          _builder.append(s);
          _builder.append(" ");
          _builder.newLineIfNotEmpty();
          _builder.newLine();
        }
      }
    }
  };
  this.assertEquals(_client);
}
 
Example #10
Source File: AddInterfaceWithDefaultProcessor.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
  super.doTransform(annotatedClass, context);
  Type _findTypeGlobally = context.findTypeGlobally("de.test.Test");
  final MutableInterfaceDeclaration ifType = ((MutableInterfaceDeclaration) _findTypeGlobally);
  final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration it) -> {
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("System.out.println(\"Hello World\");");
      }
    };
    it.setBody(_client);
    it.setDefault(true);
  };
  ifType.addMethod("sayHello", _function);
}
 
Example #11
Source File: XtendReentrantTypeResolver.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
private EObject getNearestClosureOrTypeDeclaration(EObject object, IResolvedTypes resolvedTypes) {
	EObject candidate = object;
	while(candidate != null) {
		if (candidate instanceof XClosure) {
			return candidate;
		}
		if (candidate instanceof XConstructorCall) {
			// skip anonymous class constructors themselves
			if (candidate.eContainingFeature() == XtendPackage.Literals.ANONYMOUS_CLASS__CONSTRUCTOR_CALL) {
				candidate = candidate.eContainer();
			}
		} else if (candidate instanceof XtendTypeDeclaration) {
			return candidate;
		}
		if (candidate instanceof RichString) {
			LightweightTypeReference type = resolvedTypes.getActualType((RichString)candidate);
			if (type != null && type.isType(StringConcatenationClient.class)) {
				return candidate;
			}
		}
		candidate = candidate.eContainer();
	}
	return null;
}
 
Example #12
Source File: XtextGenerator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected void generateServices() {
  if (((this.projectConfig.getGenericIde().getSrcGen() == null) || this.languageConfigs.isEmpty())) {
    return;
  }
  final TextFileAccess file = new TextFileAccess();
  file.setPath("META-INF/services/org.eclipse.xtext.ISetup");
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      {
        for(final XtextGeneratorLanguage lang : XtextGenerator.this.languageConfigs) {
          TypeReference _genericIdeSetup = XtextGenerator.this.naming.getGenericIdeSetup(lang.getGrammar());
          _builder.append(_genericIdeSetup);
          _builder.newLineIfNotEmpty();
        }
      }
    }
  };
  file.setContent(_client);
  file.writeTo(this.projectConfig.getGenericIde().getSrcGen());
}
 
Example #13
Source File: SerializerFragment2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private StringConcatenationClient genParameterSelector(final EObject obj, final Set<ISerializationContext> contexts, final IGrammarConstraintProvider.IConstraint constraint) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append(" ");
      _builder.append("&& (");
      {
        boolean _hasElements = false;
        for(final ISerializationContext context : contexts) {
          if (!_hasElements) {
            _hasElements = true;
          } else {
            _builder.appendImmediate("\n\t\t\t|| ", " ");
          }
          StringConcatenationClient _genParameterCondition = SerializerFragment2.this.genParameterCondition(context, constraint);
          _builder.append(_genParameterCondition, " ");
        }
      }
      _builder.append(")");
    }
  };
  return _client;
}
 
Example #14
Source File: TemplateNodeTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testIndentedIf() {
  final boolean condition = true;
  final String string = "foo";
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("Very wise:");
      _builder.newLine();
      {
        if (condition) {
          _builder.append("\t");
          _builder.append("who ");
          _builder.append(string, "\t");
          _builder.append(" do");
          _builder.newLineIfNotEmpty();
        }
      }
    }
  };
  this.assertEquals(_client);
}
 
Example #15
Source File: QuickfixProviderFragment2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public void generateGenQuickfixProvider() {
  final TypeReference genClass = this.getQuickfixProviderClass(this.getGrammar());
  final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(genClass);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = genClass.getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(QuickfixProviderFragment2.this.getGrammar());
      _builder.append(_quickfixProviderSuperClass);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("}");
      _builder.newLine();
    }
  };
  file.setContent(_client);
  file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen());
}
 
Example #16
Source File: AbstractIdeTemplateProposalProvider.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected ContentAssistEntry createProposal(StringConcatenationClient template, ContentAssistContext context,
		boolean adaptIndentation) {
	ContentAssistEntry entry = new ContentAssistEntry();
	entry.setPrefix(context.getPrefix());
	TemplateStringConcatenation stringConcat = new TemplateStringConcatenation(context, entry, getLineDelimiter());
	String indentation = null;
	if (adaptIndentation) {
		indentation = getIndentation(context);
	}
	if (indentation == null) {
		stringConcat.append(template);
	} else {
		stringConcat.append(template, indentation);
	}
	entry.setProposal(stringConcat.toString());
	return entry;
}
 
Example #17
Source File: ImportNamespacesScopingFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void generateXtendScopeProvider() {
  TypeReference _scopeProviderClass = this.getScopeProviderClass(this.getGrammar());
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("/**");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* This class contains custom scoping description.");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* ");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* on how and when to use it.");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("*/");
      _builder.newLine();
      _builder.append("class ");
      String _simpleName = ImportNamespacesScopingFragment2.this.getScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar()).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _abstractScopeProviderClass = ImportNamespacesScopingFragment2.this.getAbstractScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar());
      _builder.append(_abstractScopeProviderClass);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  this.fileAccessFactory.createXtendFile(_scopeProviderClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc());
}
 
Example #18
Source File: SerializerFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private StringConcatenationClient genCondition(final List<ISerializationContext> contexts, final IGrammarConstraintProvider.IConstraint constraint, final Multimap<EObject, IGrammarConstraintProvider.IConstraint> ctx2ctr) {
  StringConcatenationClient _xblockexpression = null;
  {
    final List<ISerializationContext> sorted = IterableExtensions.<ISerializationContext>sort(contexts);
    final LinkedHashMultimap<EObject, ISerializationContext> index = LinkedHashMultimap.<EObject, ISerializationContext>create();
    final Consumer<ISerializationContext> _function = (ISerializationContext it) -> {
      index.put(this.getContextObject(it), it);
    };
    sorted.forEach(_function);
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        {
          Set<EObject> _keySet = index.keySet();
          boolean _hasElements = false;
          for(final EObject obj : _keySet) {
            if (!_hasElements) {
              _hasElements = true;
            } else {
              _builder.appendImmediate("\n\t\t|| ", "");
            }
            StringConcatenationClient _genObjectSelector = SerializerFragment2.this.genObjectSelector(obj);
            _builder.append(_genObjectSelector);
            {
              int _size = ctx2ctr.get(obj).size();
              boolean _greaterThan = (_size > 1);
              if (_greaterThan) {
                StringConcatenationClient _genParameterSelector = SerializerFragment2.this.genParameterSelector(obj, index.get(obj), constraint);
                _builder.append(_genParameterSelector);
              }
            }
          }
        }
      }
    };
    _xblockexpression = _client;
  }
  return _xblockexpression;
}
 
Example #19
Source File: FragmentAdapter.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
private void generateStandaloneSetup(final LanguageConfig config1, final XpandExecutionContext ctx) {
  ctx.getOutput().openFile(null, StringConcatOutputImpl.STRING_OUTLET);
  try {
    final IXtextGeneratorLanguage config2 = this.getLanguage();
    if ((this.fragment instanceof IGeneratorFragmentExtension2)) {
      ((IGeneratorFragmentExtension2)this.fragment).addToStandaloneSetup(config1, ctx);
    } else {
      this.fragment.addToStandaloneSetup(config1.getGrammar(), ctx);
    }
    Output _output = ctx.getOutput();
    final StringConcatenation result = ((StringConcatOutputImpl) _output).getStringOutlet();
    List<StringConcatenationClient> _registrations = config2.getRuntimeGenSetup().getRegistrations();
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        StringBuilder _decreaseIndentation = FragmentAdapter.this.decreaseIndentation(result.toString(), 2);
        _builder.append(_decreaseIndentation);
      }
    };
    _registrations.add(_client);
    Set<TypeReference> _imports = config2.getRuntimeGenSetup().getImports();
    TypeReference _typeReference = new TypeReference("org.eclipse.emf.ecore.EPackage");
    _imports.add(_typeReference);
    Set<TypeReference> _imports_1 = config2.getRuntimeGenSetup().getImports();
    TypeReference _typeReference_1 = new TypeReference("org.eclipse.emf.ecore.resource.Resource");
    _imports_1.add(_typeReference_1);
  } finally {
    ctx.getOutput().closeFile();
  }
}
 
Example #20
Source File: Formatter2Fragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void generate() {
  boolean _isGenerateStub = this.isGenerateStub();
  boolean _not = (!_isGenerateStub);
  if (_not) {
    return;
  }
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("binder.bind(");
      _builder.append(IPreferenceValuesProvider.class);
      _builder.append(".class).annotatedWith(");
      _builder.append(FormatterPreferences.class);
      _builder.append(".class).to(");
      _builder.append(FormatterPreferenceValuesProvider.class);
      _builder.append(".class);");
    }
  };
  final StringConcatenationClient statement = _client;
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IFormatter2.class), this.getFormatter2Stub(this.getLanguage().getGrammar())).addConfiguredBinding(FormatterPreferences.class.getSimpleName(), statement).contributeTo(this.getLanguage().getRuntimeGenModule());
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory"), 
    TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
    String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
    String _plus = (_runtimeBasePackage + ".formatting2");
    _exportedPackages.add(_plus);
  }
  this.doGenerateStubFile();
}
 
Example #21
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsInt(final int value) {
  this.internalGenericSetConstantValue(Integer.valueOf(value));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append(value);
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #22
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsShort(final short value) {
  this.internalGenericSetConstantValue(Short.valueOf(value));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append(value);
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #23
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsLong(final long value) {
  this.internalGenericSetConstantValue(Long.valueOf(value));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append(value);
      _builder.append("L");
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #24
Source File: SimpleProjectWizardFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void generateWizardNewProjectCreationPage() {
  final TypeReference mainPageClass = TypeReference.typeRef(this.getProjectWizardCreationPageClassName());
  final JavaFileAccess file = this.fileAccessFactory.createJavaFile(mainPageClass);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = mainPageClass.getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.ui.dialogs.WizardNewProjectCreationPage");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = mainPageClass.getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("(String pageName) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(pageName);");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  file.setContent(_client);
  file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
 
Example #25
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsDouble(final double value) {
  this.internalGenericSetConstantValue(Double.valueOf(value));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append(value);
      _builder.append("d");
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #26
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsChar(final char value) {
  this.internalGenericSetConstantValue(Character.valueOf(value));
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("\'");
      String _convertToJavaString = Strings.convertToJavaString(Character.toString(value));
      _builder.append(_convertToJavaString);
      _builder.append("\'");
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #27
Source File: MutableJvmFieldDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setConstantValueAsString(final String value) {
  this.internalGenericSetConstantValue(value);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("\"");
      String _convertToJavaString = Strings.convertToJavaString(value);
      _builder.append(_convertToJavaString);
      _builder.append("\"");
    }
  };
  this.getCompilationUnit().setCompilationTemplate(this.getDelegate(), _client);
}
 
Example #28
Source File: ContentAssistFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private StringConcatenationClient _assignmentTerminal(final CrossReference element, final StringConcatenationClient accessor) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("lookupCrossReference(((");
      _builder.append(CrossReference.class);
      _builder.append(")");
      _builder.append(accessor);
      _builder.append("), context, acceptor);");
      _builder.newLineIfNotEmpty();
    }
  };
  return _client;
}
 
Example #29
Source File: SerializerFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private StringConcatenationClient genMethodCreateSequenceCall(final Map<IGrammarConstraintProvider.IConstraint, IGrammarConstraintProvider.IConstraint> superConstraints, final EClass type, final IGrammarConstraintProvider.IConstraint key) {
  StringConcatenationClient _xblockexpression = null;
  {
    final IGrammarConstraintProvider.IConstraint superConstraint = superConstraints.get(key);
    IGrammarConstraintProvider.IConstraint _elvis = null;
    if (superConstraint != null) {
      _elvis = superConstraint;
    } else {
      _elvis = key;
    }
    final IGrammarConstraintProvider.IConstraint constraint = _elvis;
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("sequence_");
        String _simpleName = constraint.getSimpleName();
        _builder.append(_simpleName);
        _builder.append("(context, (");
        _builder.append(type);
        _builder.append(") semanticObject); ");
        _builder.newLineIfNotEmpty();
        _builder.append("return; ");
        _builder.newLine();
      }
    };
    _xblockexpression = _client;
  }
  return _xblockexpression;
}
 
Example #30
Source File: GrammarAccessFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected StringConcatenationClient _cache(final TerminalRule it) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("private final ");
      _builder.append(TerminalRule.class);
      _builder.append(" ");
      String _gaRuleAccessorLocalVarName = GrammarAccessFragment2.this.gaRuleAccessorLocalVarName(it);
      _builder.append(_gaRuleAccessorLocalVarName);
      _builder.append(";");
      _builder.newLineIfNotEmpty();
    }
  };
  return _client;
}