java eclipse中Xtext的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12528450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 09:15:11  来源:igfitidea点击:

Problems with Xtext in eclipse

javaxtexteclipse-juno

提问by artaxerxe

I'm working on a Java project in eclipse. Trying to open a file through Ctrl+Mouse click, I got a popup that asked me if I want to add "Xtext nature to my project". I said ok. And now, I tried to put on a CSSfile the following line:

我正在 eclipse 中处理一个 Java 项目。尝试通过 . 打开文件时Ctrl+Mouse click,出现一个弹出窗口,询问我是否要向我的项目添加“Xtext 性质”。我说了可以。现在,我尝试将以CSS下行放在文件中:

@import "myfile.css";

@import "myfile.css";

as first line. But I get this error, because of Xtext Check (fast):

作为第一行。但我收到此错误,因为Xtext Check (fast)

missing EOF at ';'.

';' 处缺少 EOF。

Can anybody help me on how to deal with this kind of error?

任何人都可以帮助我如何处理这种错误?

Thanks.

谢谢。

回答by Zoltán Ujhelyi

You have two ways to solve this issue:

您有两种方法可以解决此问题:

  1. First, you could uninstall the plug-in contributing the CssDsleditor. A quick Google search told me that it is contributed by the e(fx)Eclipseplugins. To uninstall a plug-in, go to the Aboutdialog, click on the Installation detailsfeature, and in the upcoming dialog you could look for the feature to uninstall.

  2. If the previous solution does not work for you (e.g. you need the e(fx)Eclipseenvironment), you have to change the default file associations to avoid opening css files with the Xtext-basededitor, and remove the Xtextnature from the projects you added.

    1. Setting file associations: open Eclipse Preferences, navigate to the General->Editors-> FileAssociations page, where you can look for the CSS extension, and select a different default editor for it.
    2. Removing the Xtext nature: you can right click on your project, and select Configure-> Remove Xtext nature. If that does not work for some reason, you have to open the hidden .project file, and remove the <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>entry and the corresponding org.eclipse.xtext.ui.shared.xtextBuilderbuildCommand manually.
  1. 首先,您可以卸载提供CssDsl编辑器的插件。一个快速的谷歌搜索告诉我它是由e(fx)Eclipse插件贡献的。要卸载插件,请转到About对话框,单击安装详细信息功能,然后在即将出现的对话框中查找要卸载的功能。

  2. 如果之前的解决方案对您不起作用(例如您需要e(fx)Eclipse环境),您必须更改默认文件关联以避免使用Xtext-based编辑器打开 css 文件,并Xtext从您添加的项目中删除自然。

    1. 设置文件关联:打开 Eclipse 首选项,导航到General-> Editors->File关联页面,您可以在其中查找 CSS 扩展,并为其选择不同的默认编辑器。
    2. 删除 Xtext 性质:您可以右键单击您的项目,然后选择Configure-> Remove Xtext nature。如果由于某种原因这不起作用,您必须打开 hidden .project file,并手动删除<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>条目和相应的org.eclipse.xtext.ui.shared.xtextBuilderbuildCommand 。

回答by Nabil A.

I had the same error, when I was creating CSS via New -> Other... -> Web -> CSS File.
Zoltan's solutions did not work, but when I create the file with New -> File and name it *.css the error did not occur.

当我通过 New -> Other... -> Web -> CSS File 创建 CSS 时,我遇到了同样的错误。
Zoltan 的解决方案不起作用,但是当我使用 New -> File 创建文件并将其命名为 *.css 时,没有发生错误。