Syntax Highlighter for Java

前端 未结 6 1895
独厮守ぢ
独厮守ぢ 2020-12-05 21:49

As you know there is a Syntax highlighter for PHP called GeSHi which supports a great number of Programming Languages or Code formats.

However, I couldn\'t find such

6条回答
  •  误落风尘
    2020-12-05 22:16

    jedit is a text editor with syntax highlighting support for some 170+ languages via "modes". It also allows you to specify your own syntaxes. You can use the StandaloneTextArea component in your own application as follows:

    • Extract source (eg: jedit4.3source.tar.bz2 to d:\source\jedit)
    • Use ant to copy all the textarea files to ..\textarea eg:

      D:\Source\jedit\jEdit> ant prepare-textArea

    • However, it misses the file BufferUndoListener.java. Copy this manually by executing

      D:\Source\jedit\jEdit> copy org\gjt\sp\jedit\buffer\BufferUndoListener.java ..\textarea\src\org\gjt\sp\jedit\buffer\

    • In Eclipse create a Java Project from existing source in the directory D:\Source\jedit\textarea

    • Navigate to org.gjt.sp.jedit.textarea.StandaloneTextArea.java
    • Change the line
    mode.setProperty("file","modes/xml.xml");
    

    to

    mode.setProperty("file","src/modes/xml.xml");
    
    • Run. Copy and paste an XML into the editor and see the syntax highlighting is working.

提交回复
热议问题