use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class OutlineTreeProviderFragment2 method generate.
@Override
public void generate() {
ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
_requiredBundles.add("org.eclipse.xtext.ui");
}
boolean _isGenerateStub = this.isGenerateStub();
boolean _not = (!_isGenerateStub);
if (_not) {
return;
}
IXtextGeneratorFileSystemAccess _src = this.getProjectConfig().getEclipsePlugin().getSrc();
boolean _tripleNotEquals_1 = (_src != null);
if (_tripleNotEquals_1) {
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
this.generateXtendOutlineTreeProvider();
} else {
this.generateJavaOutlineTreeProvider();
}
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider");
GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, this.getOutlineTreeProviderClass(this.getGrammar()));
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider");
_addTypeToType.addTypeToType(_typeReference_1, this.getOutlineTreeProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
}
use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class SimpleProjectWizardFragment2 method generateWizardNewProjectCreationPage.
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());
}
use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class SimpleProjectWizardFragment2 method generateNewProjectWizard.
public void generateNewProjectWizard() {
final TypeReference genClass = TypeReference.typeRef(this.getProjectWizardClassName());
final TypeReference projectInfoClass = TypeReference.typeRef(this.getProjectInfoClassName());
final TypeReference creationPageClassName = TypeReference.typeRef(this.getProjectWizardCreationPageClassName());
final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(genClass);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("import org.eclipse.xtext.ui.wizard.IExtendedProjectInfo;");
_builder.newLine();
_builder.append("import org.eclipse.xtext.ui.wizard.IProjectCreator;");
_builder.newLine();
_builder.append("import com.google.inject.Inject;");
_builder.newLine();
_builder.newLine();
_builder.append("public class ");
String _simpleName = genClass.getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.wizard.XtextNewProjectWizard");
_builder.append(_typeRef);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("private ");
_builder.append(creationPageClassName, "\t");
_builder.append(" mainPage;");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("@Inject");
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
String _simpleName_1 = genClass.getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append("(IProjectCreator projectCreator) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(projectCreator);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("setWindowTitle(\"New ");
String _simpleName_2 = GrammarUtil.getSimpleName(SimpleProjectWizardFragment2.this.getGrammar());
_builder.append(_simpleName_2, "\t\t");
_builder.append(" Project\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("protected ");
_builder.append(creationPageClassName, "\t");
_builder.append(" getMainPage() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("return mainPage;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("/**");
_builder.newLine();
_builder.append("\t ");
_builder.append("* Use this method to add pages to the wizard.");
_builder.newLine();
_builder.append("\t ");
_builder.append("* The one-time generated version of this class will add a default new project page to the wizard.");
_builder.newLine();
_builder.append("\t ");
_builder.append("*/");
_builder.newLine();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("public void addPages() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("mainPage = createMainPage(\"basicNewProjectPage\");");
_builder.newLine();
_builder.append("\t\t");
_builder.append("mainPage.setTitle(\"");
String _simpleName_3 = GrammarUtil.getSimpleName(SimpleProjectWizardFragment2.this.getGrammar());
_builder.append(_simpleName_3, "\t\t");
_builder.append(" Project\");");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("mainPage.setDescription(\"Create a new ");
String _simpleName_4 = GrammarUtil.getSimpleName(SimpleProjectWizardFragment2.this.getGrammar());
_builder.append(_simpleName_4, "\t\t");
_builder.append(" project.\");");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("addPage(mainPage);");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("protected ");
_builder.append(creationPageClassName, "\t");
_builder.append(" createMainPage(String pageName) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("return new ");
_builder.append(creationPageClassName, "\t\t");
_builder.append("(pageName);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("/**");
_builder.newLine();
_builder.append("\t ");
_builder.append("* Use this method to read the project settings from the wizard pages and feed them into the project info class.");
_builder.newLine();
_builder.append("\t ");
_builder.append("*/");
_builder.newLine();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("protected IExtendedProjectInfo getProjectInfo() {");
_builder.newLine();
_builder.append("\t\t");
String _simpleName_5 = projectInfoClass.getSimpleName();
_builder.append(_simpleName_5, "\t\t");
_builder.append(" projectInfo = new ");
String _simpleName_6 = projectInfoClass.getSimpleName();
_builder.append(_simpleName_6, "\t\t");
_builder.append("();");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("projectInfo.setProjectName(mainPage.getProjectName());");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (!mainPage.useDefaults()) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("projectInfo.setLocationPath(mainPage.getLocationPath());");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return projectInfo;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
file.setContent(_client);
file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen());
}
use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class SimpleProjectWizardFragment2 method generate.
@Override
public void generate() {
if ((!this.generate)) {
return;
}
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
ManifestAccess _manifest = null;
if (_eclipsePlugin != null) {
_manifest = _eclipsePlugin.getManifest();
}
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
Iterables.<String>addAll(_requiredBundles, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.ui", "org.eclipse.core.runtime", "org.eclipse.core.resources", "org.eclipse.ui.ide")));
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.wizard.IProjectCreator");
String _projectCreatorClassName = this.getProjectCreatorClassName();
TypeReference _typeReference_1 = new TypeReference(_projectCreatorClassName);
_bindingFactory.addTypeToType(_typeReference, _typeReference_1).contributeTo(this.getLanguage().getEclipsePluginGenModule());
IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
PluginXmlAccess _pluginXml = null;
if (_eclipsePlugin_1 != null) {
_pluginXml = _eclipsePlugin_1.getPluginXml();
}
boolean _tripleNotEquals_1 = (_pluginXml != null);
if (_tripleNotEquals_1) {
List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<extension");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.newWizards\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<wizard");
_builder.newLine();
_builder.append("\t\t");
_builder.append("category=\"org.eclipse.xtext.projectwiz\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t");
_builder.append(":");
String _projectWizardClassName = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("id=\"");
String _projectWizardClassName_1 = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName_1, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("name=\"");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName, "\t\t");
_builder.append(" Project\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("project=\"true\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</wizard>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
this.generateProjectInfo();
this.generateWizardNewProjectCreationPage();
this.generateNewProjectWizardInitialContents();
this.generateProjectCreator();
this.generateNewProjectWizard();
}
use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class TemplateProjectWizardFragment method generate.
@Override
public void generate() {
if ((!this.generate)) {
return;
}
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
ManifestAccess _manifest = null;
if (_eclipsePlugin != null) {
_manifest = _eclipsePlugin.getManifest();
}
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
Iterables.<String>addAll(_requiredBundles, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.core.runtime", "org.eclipse.core.resources", "org.eclipse.ui", "org.eclipse.ui.ide", "org.eclipse.ui.forms")));
if (this.pluginProject) {
Set<String> _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
Iterables.<String>addAll(_requiredBundles_1, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.jdt.core", "org.eclipse.pde.core")));
}
Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
String _eclipsePluginBasePackage = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
String _plus = (_eclipsePluginBasePackage + ".wizard");
Iterables.<String>addAll(_exportedPackages, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_plus)));
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.wizard.IProjectCreator");
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.wizard.template.DefaultTemplateProjectCreator");
_bindingFactory.addTypeToType(_typeReference, _typeReference_1).contributeTo(this.getLanguage().getEclipsePluginGenModule());
IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
PluginXmlAccess _pluginXml = null;
if (_eclipsePlugin_1 != null) {
_pluginXml = _eclipsePlugin_1.getPluginXml();
}
boolean _tripleNotEquals_1 = (_pluginXml != null);
if (_tripleNotEquals_1) {
List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<extension");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.newWizards\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<category id=\"");
String _eclipsePluginBasePackage_1 = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
_builder.append(_eclipsePluginBasePackage_1, "\t");
_builder.append(".category\" name=\"");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName, "\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</category>");
_builder.newLine();
_builder.append("\t");
_builder.append("<wizard");
_builder.newLine();
_builder.append("\t\t");
_builder.append("category=\"");
String _eclipsePluginBasePackage_2 = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
_builder.append(_eclipsePluginBasePackage_2, "\t\t");
_builder.append(".category\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t");
_builder.append(":org.eclipse.xtext.ui.wizard.template.TemplateNewProjectWizard\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("id=\"");
String _projectWizardClassName = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("name=\"");
String _simpleName_1 = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName_1, "\t\t");
_builder.append(" Project\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("icon=\"icons/new_");
String _simpleName_2 = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName_2, "\t\t");
_builder.append("_proj.gif\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("project=\"true\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</wizard>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension");
_builder.newLine();
_builder.append(" ");
_builder.append("point=\"org.eclipse.xtext.ui.projectTemplate\">");
_builder.newLine();
_builder.append(" ");
_builder.append("<projectTemplateProvider");
_builder.newLine();
_builder.append(" ");
_builder.append("class=\"");
String _projectTemplateProviderClassName = this.getProjectTemplateProviderClassName();
_builder.append(_projectTemplateProviderClassName, " ");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("grammarName=\"");
String _name = this.getGrammar().getName();
_builder.append(_name, " ");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("</projectTemplateProvider>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
this.generateProjectTemplateProvider();
this.generateDefaultIcons();
}
Aggregations