Xtext项目JDT Independence

时间:2016-06-27 15:13:58

标签: xtext eclipse-jdt xtend

我用Xtext 2.9.1创建了编辑器,现在我想让它独立于JDT。我按照本指南https://eclipse.org/Xtext/documentation/307_special_languages.html

但它似乎不起作用。这是我的ErrmsgUiModule.xtend

@FinalFieldsConstructor
class ErrmsgUiModule extends AbstractErrmsgUiModule {

    override configure(Binder binder) {
        super.configure(binder);
        binder.bind(DefaultHighlightingConfiguration).to(ErrMsgHighlightingConfiguration);
        binder.bind(DefaultSemanticHighlightingCalculator).to(ErrorSemanticHighlightingCalculator);
    }

    override bindIResourceForEditorInputFactory() {
        return ResourceForIEditorInputFactory
    }

    override bindIResourceSetProvider() {
        return SimpleResourceSetProvider
    }

    override provideIAllContainersState() {
        return Access.getWorkspaceProjectsState()
    }
}

我用调试器检查了每个覆盖的方法,并调用了所有3种方法。我没有创建自己的项目向导,所以这应该足够了。 但是在插件安装后,Java项目向导仍然可用......

/编辑: 要提供更多信息,这是项目的 mwe2 文件

module com.xxx.lang.errmsg.GenerateErrmsg

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*
import org.eclipse.xtext.ui.generator.*


var rootPath = ".."

Workflow {

    component = XtextGenerator {
        configuration = {
            project = StandardProjectConfig {
                baseName = "com.xxx.lang.errmsg"
                rootPath = rootPath
                runtimeTest = {
                    enabled = true
                }
                eclipsePlugin = {
                    enabled = true
                }
                eclipsePluginTest = {
                    enabled = true
                }
                createEclipseMetaData = true
            }
            code = {
                encoding = "windows-1250"
                fileHeader = "/*\n * generated by Xtext \${version}\n */"
            }
        }
        language = StandardLanguage {
            name = "com.xxx.lang.errmsg.Errmsg"
            fileExtensions = "msg"
            fragment = formatting.Formatter2Fragment2 auto-inject {}
            serializer = {
                generateStub = false
            }
            validator = {
            // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
            }
        }

    }
}

这是plugin.xml中各种项目的依赖关系列表:

项目 com.xxx.lang.errmsg

org.eclipse.xtext,
org.eclipse.xtext.xbase,
org.eclipse.equinox.common;bundle-version="3.5.0",
org.eclipse.emf.ecore,
org.eclipse.xtext.xbase.lib,
org.antlr.runtime,
org.eclipse.xtext.util,
org.eclipse.xtend.lib,
org.eclipse.emf.common,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional,
org.eclipse.xtext.ui

项目 com.xxx.lang.errmsg.ui

com.xxx.lang.errmsg,
com.xxx.lang.errmsg.ide,
org.eclipse.xtext.ui,
org.eclipse.xtext.ui.shared,
org.eclipse.xtext.ui.codetemplates.ui,
org.eclipse.ui.editors;bundle-version="3.5.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
org.eclipse.ui,
org.eclipse.compare,
org.eclipse.xtext.builder,
org.eclipse.xtend.lib;resolution:=optional,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtext.xbase.ui

/ Edit2:根据此主题https://bugs.eclipse.org/bugs/show_bug.cgi?id=336217,我还尝试在运行配置中禁用所有org.eclipse.jdt *插件。这就是我得到的http://pastebin.com/Wi0gzceM

1 个答案:

答案 0 :(得分:0)

您必须从运行时和UI项目中删除org.eclipse.xtext.xbaseorg.eclipse.xtext.xbase.ui的依赖项。

确保在Package Explorer中打开了未在列表中看到org.eclipse.jdt.core的插件依赖项。如果是这样,则存在具有(传递)依赖性的另一个插件。找出哪个并删除。