Search in sources :

Example 1 with PluginXmlAccess

use of org.eclipse.xtext.xtext.generator.model.PluginXmlAccess 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();
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) IBundleProjectConfig(org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 2 with PluginXmlAccess

use of org.eclipse.xtext.xtext.generator.model.PluginXmlAccess 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();
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) IBundleProjectConfig(org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 3 with PluginXmlAccess

use of org.eclipse.xtext.xtext.generator.model.PluginXmlAccess in project xtext-core by eclipse.

the class RefactorElementNameFragment2 method generate.

@Override
public void generate() {
    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();
        _requiredBundles.add("org.eclipse.xtext.ui");
    }
    final GuiceModuleAccess.BindingFactory uiBindings = new GuiceModuleAccess.BindingFactory();
    String _join = IterableExtensions.join(TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer").getSimpleNames(), ".");
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("binder.bind(");
            TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer");
            _builder.append(_typeRef);
            _builder.append(".class)");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(".annotatedWith(");
            _builder.append(Names.class, "\t");
            _builder.append(".named(\"RefactoringPreferences\"))");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(".to(");
            TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "RefactoringPreferences.Initializer");
            _builder.append(_typeReference, "\t");
            _builder.append(".class);");
            _builder.newLineIfNotEmpty();
        }
    };
    uiBindings.addConfiguredBinding(_join, _client);
    boolean _isUseChangeSerializer = this.isUseChangeSerializer(this.getGrammar());
    if (_isUseChangeSerializer) {
        TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.refactoring.IRenameStrategy2");
        TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ide.refactoring", "IRenameStrategy2.DefaultImpl");
        uiBindings.addTypeToType(_typeRef, _typeReference).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.AbstractRenameProcessor"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring2.rename.RenameElementProcessor2")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ILinkedPositionGroupCalculator"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring2.rename.DefaultLinkedPositionGroupCalculator2"));
    } else {
        uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategy")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater"));
    }
    boolean _isUseJdtRefactoring = this.isUseJdtRefactoring(this.getGrammar());
    if (_isUseJdtRefactoring) {
        GuiceModuleAccess.BindingFactory _addTypeToType = uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"), TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JdtRefactoringContextFactory")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JvmRenameRefactoringProvider"));
        TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory");
        TypeReference _typeReference_2 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring", "JdtRenameSupport.Factory");
        GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeReference_1, _typeReference_2);
        TypeReference _typeReference_3 = new TypeReference("org.eclipse.xtext.ui.refactoring", "IRenameStrategy.Provider");
        TypeReference _typeReference_4 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JvmMemberRenameStrategy.Provider");
        GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeReference_3, _typeReference_4);
        StringConcatenationClient _client_1 = new StringConcatenationClient() {

            @Override
            protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                _builder.append("binder.bind(");
                TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.refactoring", "IRenameStrategy.Provider");
                _builder.append(_typeReference);
                _builder.append(".class).annotatedWith(");
                TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JvmMemberRenameStrategy.Provider.Delegate");
                _builder.append(_typeReference_1);
                _builder.append(".class).to(");
                TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategyProvider");
                _builder.append(_typeRef);
                _builder.append(".class);");
                _builder.newLineIfNotEmpty();
            }
        };
        _addTypeToType_2.addConfiguredBinding("JvmMemberRenameStrategy.Provider.Delegate", _client_1);
    } else {
        GuiceModuleAccess.BindingFactory _addTypeToType_3 = uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameRefactoringProvider"));
        TypeReference _typeReference_5 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory");
        TypeReference _typeReference_6 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "DefaultRenameSupport.Factory");
        _addTypeToType_3.addTypeToType(_typeReference_5, _typeReference_6);
    }
    uiBindings.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("<!-- Rename Refactoring -->");
        _builder.newLine();
        _builder.append("<extension point=\"org.eclipse.ui.handlers\">");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("<handler ");
        _builder.newLine();
        _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.refactoring.ui.DefaultRenameElementHandler\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("commandId=\"org.eclipse.xtext.ui.refactoring.RenameElement\">");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("<activeWhen>");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("<reference");
        _builder.newLine();
        _builder.append("\t\t\t\t");
        _builder.append("definitionId=\"");
        String _name = this.getGrammar().getName();
        _builder.append(_name, "\t\t\t\t");
        _builder.append(".Editor.opened\">");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t\t");
        _builder.append("</reference>");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("</activeWhen>");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("</handler>");
        _builder.newLine();
        _builder.append("</extension>");
        _builder.newLine();
        _builder.append("<extension point=\"org.eclipse.ui.menus\">");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("<menuContribution");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("locationURI=\"popup:#TextEditorContext?after=group.edit\">");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("<command commandId=\"org.eclipse.xtext.ui.refactoring.RenameElement\"");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("style=\"push\">");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("<visibleWhen checkEnabled=\"false\">");
        _builder.newLine();
        _builder.append("\t\t\t\t");
        _builder.append("<reference");
        _builder.newLine();
        _builder.append("\t\t\t\t\t");
        _builder.append("definitionId=\"");
        String _name_1 = this.getGrammar().getName();
        _builder.append(_name_1, "\t\t\t\t\t");
        _builder.append(".Editor.opened\">");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t\t\t");
        _builder.append("</reference>");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("</visibleWhen>");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("</command>");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("</menuContribution>");
        _builder.newLine();
        _builder.append("</extension>");
        _builder.newLine();
        _builder.append("<extension point=\"org.eclipse.ui.preferencePages\">");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("<page");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("category=\"");
        String _name_2 = this.getGrammar().getName();
        _builder.append(_name_2, "\t\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("class=\"");
        TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
        _builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t");
        _builder.append(":org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("id=\"");
        String _name_3 = this.getGrammar().getName();
        _builder.append(_name_3, "\t\t");
        _builder.append(".refactoring\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("name=\"Refactoring\">");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("<keywordReference id=\"");
        String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
        String _plus = (_runtimeBasePackage + ".ui.keyword_");
        String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
        String _plus_1 = (_plus + _simpleName);
        _builder.append(_plus_1, "\t\t");
        _builder.append("\"/>");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("</page>");
        _builder.newLine();
        _builder.append("</extension>");
        _builder.newLine();
        _entries.add(_builder.toString());
    }
    boolean _isEnabled = this.getProjectConfig().getGenericIde().isEnabled();
    if (_isEnabled) {
        final GuiceModuleAccess.BindingFactory ideBindings = new GuiceModuleAccess.BindingFactory();
        ideBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.server.rename.IRenameService"), TypeReference.typeRef("org.eclipse.xtext.ide.server.rename.RenameService"));
        TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ide.refactoring.IRenameStrategy2");
        TypeReference _typeReference_7 = new TypeReference("org.eclipse.xtext.ide.refactoring", "IRenameStrategy2.DefaultImpl");
        ideBindings.addTypeToType(_typeRef_1, _typeReference_7);
        ideBindings.contributeTo(this.getLanguage().getIdeGenModule());
    }
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) IBundleProjectConfig(org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 4 with PluginXmlAccess

use of org.eclipse.xtext.xtext.generator.model.PluginXmlAccess in project xtext-core by eclipse.

the class XbaseGeneratorFragment2 method generate.

@Override
public void generate() {
    boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar());
    boolean _not = (!_inheritsXbase);
    if (_not) {
        return;
    }
    boolean _equals = this._xtextGeneratorNaming.getEclipsePluginEditor(this.getGrammar()).equals(this._xtextGeneratorNaming.getEclipsePluginXbaseEditor(this.getGrammar()));
    boolean _not_1 = (!_equals);
    if (_not_1) {
        this.contributeEditorStub();
    }
    this.contributeRuntimeGuiceBindings();
    this.contributeEclipsePluginGuiceBindings();
    PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
    boolean _tripleNotEquals = (_pluginXml != null);
    if (_tripleNotEquals) {
        this.contributeEclipsePluginExtensions();
    }
    if (this.generateXtendInferrer) {
        this.doGenerateXtendInferrer();
    }
    ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
    boolean _tripleNotEquals_1 = (_manifest != null);
    if (_tripleNotEquals_1) {
        String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
        String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
        String _plus_1 = (_plus + "\"");
        this.getProjectConfig().getRuntime().getManifest().getRequiredBundles().addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext.xbase", _plus_1)));
        if (((this.generateXtendInferrer || this.useInferredJvmModel) && (!this.skipExportedPackage))) {
            Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
            String _packageName = this.getJvmModelInferrer().getPackageName();
            _exportedPackages.add(_packageName);
        }
    }
    ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_2 = (_manifest_1 != null);
    if (_tripleNotEquals_2) {
        this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext.xbase.ui", "org.eclipse.jdt.debug.ui")));
    }
    GuiceModuleAccess _ideGenModule = this.getLanguage().getIdeGenModule();
    _ideGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.ide.DefaultXbaseIdeModule"));
    GuiceModuleAccess _webGenModule = this.getLanguage().getWebGenModule();
    _webGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.web.DefaultXbaseWebModule"));
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess)

Example 5 with PluginXmlAccess

use of org.eclipse.xtext.xtext.generator.model.PluginXmlAccess in project xtext-core by eclipse.

the class ImplicitFragment method generate.

@Override
public void generate() {
    ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
    boolean _tripleNotEquals = (_manifest != null);
    if (_tripleNotEquals) {
        this.getProjectConfig().getRuntime().getManifest().getRequiredBundles().addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext", "org.eclipse.xtext.util")));
        boolean _isGenerateXtendStub = this.isGenerateXtendStub();
        if (_isGenerateXtendStub) {
            Set<String> _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles();
            String _xtendLibVersionLowerBound = this.getProjectConfig().getRuntime().getXtendLibVersionLowerBound();
            String _plus = ("org.eclipse.xtend.lib;bundle-version=\"" + _xtendLibVersionLowerBound);
            String _plus_1 = (_plus + "\"");
            _requiredBundles.add(_plus_1);
        }
        this.getProjectConfig().getRuntime().getManifest().getImportedPackages().add("org.apache.log4j");
    }
    ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_1 = (_manifest_1 != null);
    if (_tripleNotEquals_1) {
        this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext.ui", "org.eclipse.xtext.ui.shared", "org.eclipse.ui.editors", "org.eclipse.ui")));
        boolean _isGenerateXtendStub_1 = this.isGenerateXtendStub();
        if (_isGenerateXtendStub_1) {
            Set<String> _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
            String _xtendLibVersionLowerBound_1 = this.getProjectConfig().getRuntime().getXtendLibVersionLowerBound();
            String _plus_2 = ("org.eclipse.xtend.lib;bundle-version=\"" + _xtendLibVersionLowerBound_1);
            String _plus_3 = (_plus_2 + "\"");
            _requiredBundles_1.add(_plus_3);
        }
        this.getProjectConfig().getEclipsePlugin().getManifest().getImportedPackages().add("org.apache.log4j");
    }
    PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
    boolean _tripleNotEquals_2 = (_pluginXml != null);
    if (_tripleNotEquals_2) {
        List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
        CharSequence _implicitPluginXmlEnties = this.getImplicitPluginXmlEnties(this.getGrammar());
        _entries.add(_implicitPluginXmlEnties);
    }
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.shared.Access");
            _builder.append(_typeRef);
            _builder.append(".getJavaProjectsState()");
        }
    };
    final StringConcatenationClient expression = _client;
    final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory().addTypeToProviderInstance(TypeReference.typeRef(IAllContainersState.class), expression);
    boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar());
    if (_inheritsXbase) {
        bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.ui.editor.XbaseDocumentProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler"), TypeReference.typeRef("org.eclipse.xtext.xbase.ui.generator.trace.XbaseOpenGeneratedFileHandler"));
    }
    bindingFactory.contributeTo(this.getLanguage().getEclipsePluginGenModule());
}
Also used : IAllContainersState(org.eclipse.xtext.resource.containers.IAllContainersState) GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Aggregations

PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)14 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)12 TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)11 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)9 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)9 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)7 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)7 List (java.util.List)2 Names (com.google.inject.name.Names)1 GenPackage (org.eclipse.emf.codegen.ecore.genmodel.GenPackage)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1 IAllContainersState (org.eclipse.xtext.resource.containers.IAllContainersState)1 IXtextGeneratorFileSystemAccess (org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)1