├── .gitignore
├── AUTHORS
├── .gitmodules
├── .editorconfig
├── description.txt
├── .travis.yml
├── LICENSE
├── actions.xml
├── EditorConfigPlugin.props
├── README.md
├── docs
└── index.html
└── src
└── org
└── editorconfig
└── jedit
└── EditorConfigPlugin.java
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /build-support
3 | /build.properties
4 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Contributors to EditorConfig jEdit Plugin:
2 |
3 | Hong Xu
4 | jarekczek
5 | Trey Hunner
6 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "editorconfig-core-java"]
2 | path = editorconfig-core-java
3 | url = https://github.com/editorconfig/editorconfig-core-java.git
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 |
2 | root = true
3 |
4 | [*]
5 | end_of_line = lf
6 | indent_style = space
7 |
8 | [*.java]
9 | indent_size = 4
10 |
11 | [*.xml]
12 | indent_size = 2
13 |
14 | [*.html]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/description.txt:
--------------------------------------------------------------------------------
1 | EditorConfig helps developers define and maintain consistent coding styles
2 | between different editors and IDEs. The EditorConfig project consists of a file
3 | format for defining coding styles and a collection of text editor plugins that
4 | enable editors to read the file format and adhere to defined styles.
5 | EditorConfig files are easily readibly and they work nicely with version
6 | control systems.
7 |
8 | This is the EditorConfig plugin of jEdit. For more information, please visit
9 | < https://editorconfig.org >.
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | jdk:
4 | - openjdk7
5 | - openjdk6
6 | - oraclejdk7
7 |
8 | before_install:
9 | - git submodule update --init --recursive
10 |
11 | install:
12 | - sudo apt-get install jedit subversion
13 |
14 | before_script:
15 | - svn co https://svn.code.sf.net/p/jedit/svn/build-support/trunk build-support
16 | - cp build.properties.in build.properties
17 |
18 | # Run the Build script
19 | script:
20 | - ant
21 |
22 | # Notify the mailing list
23 | notifications:
24 | email:
25 | on_success: change
26 | on_failure: always
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Unless otherwise stated, all files are distributed under the Simplified BSD
2 | license included below.
3 |
4 | Copyright (c) 2012 EditorConfig Team
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright notice,
11 | this list of conditions and the following disclaimer.
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 | POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/actions.xml:
--------------------------------------------------------------------------------
1 |
26 |
27 |
30 | try
31 | {
32 | org.editorconfig.jedit.EditorConfigPlugin.getPlugin().loadEditorConfig(buffer);
33 | } catch(java.lang.NumberFormatException e) {
34 | javax.swing.JOptionPane.showMessageDialog(null,
35 | "Failed to reload EditorConfig: \n" + e.toString());
36 | return;
37 | } catch (org.editorconfig.core.EditorConfigException e) {
38 | javax.swing.JOptionPane.showMessageDialog(null,
39 | "Failed to reload EditorConfig: \n" + e.toString());
40 | return;
41 | }
42 |
43 | javax.swing.JOptionPane.showMessageDialog(null, "EditorConfig successfully reloaded.");
44 |
45 |
This is an EditorConfig plugin for jEdit.
11 | 12 |Launch the jEdit plugin manager. It’s in Plugins - Plugin Manager….
Click on the Install tab, find EditorConfig in the plugin list. 19 | Check it and click on the Install button.
If you have problem using the Plugin Manager, you can also download the binaries 24 | from here.
25 | 26 |Make sure that submodules are checked out and up-to-date:
30 | 31 |git submodule update --recursive --init
32 | Download ant and install it.
In the EditorConfig jEdit Plugin project root directory, get the jEdit 35 | build-support files:
36 | 37 |svn co https://jedit.svn.sourceforge.net/svnroot/jedit/build-support/trunk build-support
38 | Copy build.properties.in to build.properties. Edit the
40 | build.properties file and modify jedit.install.dir to the jEdit
41 | installation directory in your system.
Switch to EditorConfig jEdit Plugin project root directory and run ant.
If succeeded, Plugin should be built in build/jars/. Copy
44 | build/jars/EditorConfigPlugin.jar and build/jars/editorconfig.jar to your
45 | jEdit plugin directory (this should be ~/.jedit/jars on UNIX and
46 | ${JEDIT_INATALLATION_DIRECTORY}/jars on Windows).
If jEdit is running, restart jEdit.
For example, on Debian, the commands are like this:
52 | 53 |54 | $ sudo apt-get install ant git 55 | $ git clone git://github.com/editorconfig/editorconfig-jedit.git 56 | $ git submodule update --init --recursive 57 | $ cd editorconfig-jedit 58 | $ svn co https://jedit.svn.sourceforge.net/svnroot/jedit/build-support/trunk build-support 59 | $ cp build.properties.in build.properties # Copy build properties and modify jedit.install.dir as needed 60 | $ ant 61 | $ cp ./build/jars/*.jar ~/.jedit/jars 62 |63 | 64 |
The EditorConfig jEdit plugin supports the following EditorConfig properties:
67 | 68 |In addition, this plugin also supports a specific property which is only valid for jEdit:
79 | 80 |The usage of this property is similar to charset, but the value is the
86 | encoding string defined by jEdit, and is case sensitive. If both charset and
87 | jedit_charset are present, only charset will be used.
Feel free to submit bugs, feature requests, and other issues to the main 92 | EditorConfig issue tracker.
93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/org/editorconfig/jedit/EditorConfigPlugin.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 EditorConfig Team 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, 10 | // this list of conditions and the following disclaimer in the documentation 11 | // and/or other materials provided with the distribution. 12 | // 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 17 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | // POSSIBILITY OF SUCH DAMAGE. 24 | // 25 | 26 | package org.editorconfig.jedit; 27 | 28 | import java.io.File; 29 | import java.util.Arrays; 30 | import java.util.LinkedList; 31 | import java.util.List; 32 | import java.util.Properties; 33 | import org.editorconfig.core.*; 34 | import org.gjt.sp.jedit.Buffer; 35 | import org.gjt.sp.jedit.EBComponent; 36 | import org.gjt.sp.jedit.EBMessage; 37 | import org.gjt.sp.jedit.EditBus; 38 | import org.gjt.sp.jedit.EditPlugin; 39 | import org.gjt.sp.jedit.buffer.JEditBuffer; 40 | import org.gjt.sp.jedit.io.EncodingServer; 41 | import org.gjt.sp.jedit.msg.BufferUpdate; 42 | import org.gjt.sp.util.Log; 43 | 44 | public class EditorConfigPlugin extends EditPlugin implements EBComponent 45 | { 46 | static private EditorConfigPlugin plugin; 47 | static private EditorConfig ec; 48 | 49 | // get the plugin instance 50 | static public EditorConfigPlugin getPlugin() 51 | { 52 | return plugin; 53 | } 54 | 55 | public EditorConfigPlugin() 56 | { 57 | plugin = this; 58 | } 59 | 60 | @Override 61 | public void start() 62 | { 63 | EditBus.addToBus(this); 64 | } 65 | 66 | @Override 67 | public void stop() 68 | { 69 | EditBus.removeFromBus(this); 70 | ec = null; 71 | } 72 | 73 | // an inner class that stores EditorConfig configuration info 74 | private class EditorConfigConf 75 | { 76 | String indentStyle = null; 77 | int indentSize = 0; 78 | int tabWidth = 0; 79 | String endOfLine = null; 80 | String charset = null; 81 | String jeditCharset = null; 82 | 83 | // indentStyle will be set to this value if indent_size = tab 84 | static final int INDENT_SIZE_TAB = -1000; 85 | } 86 | 87 | public void loadEditorConfig(Buffer buf) 88 | throws NumberFormatException, EditorConfigException 89 | { 90 | // Get the possible paths of editorconfig.jar. In jedit, 91 | // editorconfig.jar cannot locate itself, thus if we don't point them 92 | // out explicitly, python modules may not be found. 93 | if (ec == null) 94 | ec = new EditorConfig(); 95 | 96 | // EditorConfig confs 97 | EditorConfigConf ecConf = new EditorConfigConf(); 98 | 99 | List