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

      <tfoot id='jlYzF'></tfoot><legend id='jlYzF'><style id='jlYzF'><dir id='jlYzF'><q id='jlYzF'></q></dir></style></legend>

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

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

        如何在 Eclipse 中向 Java 文件添加自定义警告?

        How can I add a custom warning to Java files in Eclipse?(如何在 Eclipse 中向 Java 文件添加自定义警告?)
          <tbody id='V7qMI'></tbody>
        <i id='V7qMI'><tr id='V7qMI'><dt id='V7qMI'><q id='V7qMI'><span id='V7qMI'><b id='V7qMI'><form id='V7qMI'><ins id='V7qMI'></ins><ul id='V7qMI'></ul><sub id='V7qMI'></sub></form><legend id='V7qMI'></legend><bdo id='V7qMI'><pre id='V7qMI'><center id='V7qMI'></center></pre></bdo></b><th id='V7qMI'></th></span></q></dt></tr></i><div id='V7qMI'><tfoot id='V7qMI'></tfoot><dl id='V7qMI'><fieldset id='V7qMI'></fieldset></dl></div>
            • <bdo id='V7qMI'></bdo><ul id='V7qMI'></ul>
            • <tfoot id='V7qMI'></tfoot>

                  <legend id='V7qMI'><style id='V7qMI'><dir id='V7qMI'><q id='V7qMI'></q></dir></style></legend>

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

                  本文介绍了如何在 Eclipse 中向 Java 文件添加自定义警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想为 Eclipse 中的 .java 文件添加一条自定义警告消息(即,在问题"选项卡的警告"部分添加一个条目).

                  I'd like to add a custom warning message (i.e. add an entry to the Warnings section of the Problems tab) for .java files in Eclipse.

                  虽然我找到了有关创建插件和使用标记的信息(此处和其他地方),但我还没有找到任何关于扩展问题发现"过程的信息.我发现的大多数文章都没有讨论何时创建标记,只讨论如何,并且那些确实假设我有兴趣将它们附加到自定义构建步骤或自定义编辑器,这两者似乎都不适合我正在尝试做的事情.

                  While I've found information (here and elsewhere) on creating plugins and using markers, I haven't yet found anything which talks about extending the "problem-finding" process. Most of the articles I've found don't discuss when to create markers, only how, and those that do assume that I'm interested in attaching them to a custom build step or custom editor, neither of which seems appropriate for what I'm trying to do.

                  如何创建类似于通过 Window > Preferences > Java > Compiler > Errors/Warnings 提供的功能的警告?

                  How can I create a warning which functions like those available via Window > Preferences > Java > Compiler > Errors/Warnings?

                  推荐答案

                  我认为构建器可能适合您想做的事情.新插件向导中有一个模板,可以创建构建器所需的一切(例如业务逻辑).由于每次修改文件时都会运行构建器,因此您可以清除旧警告(为您生成的代码)并添加新警告(为您生成的代码)(如果适用).这也适用于首次创建文件时.

                  I think that a builder might be appropriate for what you want to do. There's a template in the new plugin wizard that creates everything you need for a builder (ex. business logic). Since the builder runs every time the file is modified, you can clear the old warning (code generated for you) and add a new warning (code generated for you) if applicable. This also applies when the file is first created.

                  如果需要,您甚至可以查看代码并找到硬编码字符串并用警告标记它们.

                  You could even look through the code and find hard-coded strings and flag them with warnings if you want.

                  至于今天代码中标记翻译键的注释,那些是用来指导 NLS 工具的(你可能已经知道了).这个想法是先写代码,然后再回去翻译.如果稍后对代码进行更改,工具可以再次运行,并且只对增量添加的新字符串起作用.

                  As for the comments marking translation keys in the code today, those are there to guide NLS tools (you probably already knew that). The idea was to write the code first and then go back later and translate. If a change is made to the code later, the tools can run again and only act on new strings added by the delta.

                  这篇关于如何在 Eclipse 中向 Java 文件添加自定义警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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?(为什么是锯齿形图形?)
                    • <legend id='PDymC'><style id='PDymC'><dir id='PDymC'><q id='PDymC'></q></dir></style></legend>
                    • <tfoot id='PDymC'></tfoot>
                    • <small id='PDymC'></small><noframes id='PDymC'>

                            <tbody id='PDymC'></tbody>

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