• <bdo id='hXI1L'></bdo><ul id='hXI1L'></ul>

      <i id='hXI1L'><tr id='hXI1L'><dt id='hXI1L'><q id='hXI1L'><span id='hXI1L'><b id='hXI1L'><form id='hXI1L'><ins id='hXI1L'></ins><ul id='hXI1L'></ul><sub id='hXI1L'></sub></form><legend id='hXI1L'></legend><bdo id='hXI1L'><pre id='hXI1L'><center id='hXI1L'></center></pre></bdo></b><th id='hXI1L'></th></span></q></dt></tr></i><div id='hXI1L'><tfoot id='hXI1L'></tfoot><dl id='hXI1L'><fieldset id='hXI1L'></fieldset></dl></div>
      <legend id='hXI1L'><style id='hXI1L'><dir id='hXI1L'><q id='hXI1L'></q></dir></style></legend>

        <small id='hXI1L'></small><noframes id='hXI1L'>

        <tfoot id='hXI1L'></tfoot>
      1. 如何在 Eclipse 编辑器插件中显示语法错误

        How to show syntax errors in an eclipse editor plugin(如何在 Eclipse 编辑器插件中显示语法错误)
        <i id='eSiuT'><tr id='eSiuT'><dt id='eSiuT'><q id='eSiuT'><span id='eSiuT'><b id='eSiuT'><form id='eSiuT'><ins id='eSiuT'></ins><ul id='eSiuT'></ul><sub id='eSiuT'></sub></form><legend id='eSiuT'></legend><bdo id='eSiuT'><pre id='eSiuT'><center id='eSiuT'></center></pre></bdo></b><th id='eSiuT'></th></span></q></dt></tr></i><div id='eSiuT'><tfoot id='eSiuT'></tfoot><dl id='eSiuT'><fieldset id='eSiuT'></fieldset></dl></div>

      2. <legend id='eSiuT'><style id='eSiuT'><dir id='eSiuT'><q id='eSiuT'></q></dir></style></legend>

      3. <small id='eSiuT'></small><noframes id='eSiuT'>

              <bdo id='eSiuT'></bdo><ul id='eSiuT'></ul>
                <tbody id='eSiuT'></tbody>
              <tfoot id='eSiuT'></tfoot>
                1. 本文介绍了如何在 Eclipse 编辑器插件中显示语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我如何在 Eclipse 编辑器插件中指示语法错误(例如,非法的标记序列),就像在 Eclipse Java 编辑器中一样,即通过红色扭曲的下划线、滚动条上可以跳转到的红色标记以及将鼠标悬停在其中一个上时会显示说明性消息?

                  How can I indicate syntax errors (e.g. an illegal sequence of tokens) in an eclipse editor plugin just like in the eclipse Java editor, i.e. by red wriggly underlines, a red marker on the scrollbar that you can jump to, and an explanatory message when you hover over either one?

                  我正在为自定义文件格式(特别是 Shark3D 游戏引擎的蛇文件格式")编写一个 Eclipse 编辑器插件.我已经实现了一个扫描器来获得语法高亮和一个大纲.

                  I'm writing an eclipse editor plugin for a custom file format (specifically, the "snake file format" of the Shark3D game engine). I have implemented a scanner to get syntax highlighting, and an outline.

                  • 对于下划线,我是否只是让扫描仪返回一个带有弯曲下划线"TextAttributeIToken 而不是正常的,或者是否有特定的机制标记语法错误?
                  • 如何实现滚动条标记?IAnnotationModel 是这里的相关接口吗?如果是这样,我在哪里注册实现以便标记出现?
                  • 我只找到了 SourceViewerConfiguration.getAnnotationHover(),它可以让我实现悬停行为,但仅限于注释",我想这意味着滚动条标记 - 我该怎么做实现文本本身的悬停行为?
                  • For the underlines, do I simply have the scanner return an IToken with a "wriggly underline" TextAttribute instead of the normal one, or is there a specific mechanism for marking syntax errors?
                  • How do I implement the scrollbar markers? Is IAnnotationModel the relevant interface here? If so, where do I register the implementation so that the markers appear?
                  • I've only found SourceViewerConfiguration.getAnnotationHover(), which would allow me to implement the hover behaviour, but only for the "annotation", which I suppose means the scrollbar markers - how do I implement the hover behaviour for the text itself?

                  我很乐意提供具体建议以及涵盖此内容的教程的 URL - eclipse 帮助文档和示例似乎没有.

                  I'd be happy specific advice as well as an URL of a tutorial that covers this - the eclipse help documents and examples don't seem to.

                  标记是最好的解决方案.如何使用它们的工作示例可以在 org.eclipse.ui.examples.readmetool.AddReadmeMarkerAction

                  Markers are the best solutions to this. A working example of how to use them can be found in the plugin example code in org.eclipse.ui.examples.readmetool.AddReadmeMarkerAction

                  推荐答案

                  你应该使用 Markers.

                  You should be using Markers.

                  一个来自The Java Developer's Guide to Eclipse"的例子如下:

                  An example derived from "The Java Developer's Guide to Eclipse" follows:

                  <extension point="org.eclipse.core.resources.markers"  
                              id="snakesyntax"  
                              name="Snake syntax error">  
                      <super type="org.eclipse.core.resources.problemmarker" />  
                      <super type="org.eclipse.core.resources.textmarker" />  
                      <persistent value="true" />
                  <extension>
                  
                  IMarker marker = res.createMarker("com.ibm.tool.resources.snakesyntax");
                  
                  marker.setAttribute(IMarker.SEVERITY, 0);
                  marker.setAttribute(IMarker.CHAR_START, startOfSyntaxError);
                  marker.setAttribute(IMarker.CHAR_END, endOfSyntaxError);
                  marker.setAttribute(IMarker.LOCATION, "Snake file");
                  marker.setAttribute(IMarker.MESSAGE, "Syntax error");
                  

                  这篇关于如何在 Eclipse 编辑器插件中显示语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                  ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                  How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                  Why a sawtooth shaped graph?(为什么是锯齿形图形?)
                  <tfoot id='oHJsJ'></tfoot>

                    <legend id='oHJsJ'><style id='oHJsJ'><dir id='oHJsJ'><q id='oHJsJ'></q></dir></style></legend>
                      <i id='oHJsJ'><tr id='oHJsJ'><dt id='oHJsJ'><q id='oHJsJ'><span id='oHJsJ'><b id='oHJsJ'><form id='oHJsJ'><ins id='oHJsJ'></ins><ul id='oHJsJ'></ul><sub id='oHJsJ'></sub></form><legend id='oHJsJ'></legend><bdo id='oHJsJ'><pre id='oHJsJ'><center id='oHJsJ'></center></pre></bdo></b><th id='oHJsJ'></th></span></q></dt></tr></i><div id='oHJsJ'><tfoot id='oHJsJ'></tfoot><dl id='oHJsJ'><fieldset id='oHJsJ'></fieldset></dl></div>

                      <small id='oHJsJ'></small><noframes id='oHJsJ'>

                        <bdo id='oHJsJ'></bdo><ul id='oHJsJ'></ul>

                            <tbody id='oHJsJ'></tbody>