diff --git a/.gitignore b/.gitignore index ed647d4c..4956fd47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -ant-classes -bin -dist -javadoc -*.java~ -build -.gradle +ant-classes +bin +dist +javadoc +*.java~ +build +.gradle +/target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..d9ad41d8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + org.tros + languagesupport + 2.6.0 + jar + + + + eu.somatik.serviceloader-maven-plugin + serviceloader-maven-plugin + 1.0.7 + + + org.fife.rsta.ac.LanguageSupportRegistration + + + + + + generate + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/lib + false + false + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.0 + + true + + + + + + src/main/resources + true + + + + + + org.tros + rsyntaxtextarea + ${project.version} + + + org.tros + autocomplete + ${project.version} + + + org.mozilla + rhino + 1.7.7.1 + + + junit + junit + 4.12 + test + + + + UTF-8 + 1.5 + 1.5 + + \ No newline at end of file diff --git a/src/main/java/org/fife/rsta/ac/LanguageSupport.java b/src/main/java/org/fife/rsta/ac/LanguageSupport.java index 473236f6..3690e1c1 100644 --- a/src/main/java/org/fife/rsta/ac/LanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/LanguageSupport.java @@ -38,7 +38,6 @@ public interface LanguageSupport { public static final String PROPERTY_LANGUAGE_PARSER = "org.fife.rsta.ac.LanguageSupport.LanguageParser"; - /** * Returns the delay between when the user types a character and when the * code completion popup should automatically appear (if applicable). diff --git a/src/main/java/org/fife/rsta/ac/LanguageSupportFactory.java b/src/main/java/org/fife/rsta/ac/LanguageSupportFactory.java index c110eb24..d3a321d0 100644 --- a/src/main/java/org/fife/rsta/ac/LanguageSupportFactory.java +++ b/src/main/java/org/fife/rsta/ac/LanguageSupportFactory.java @@ -14,227 +14,178 @@ import java.beans.PropertyChangeListener; import java.util.HashMap; import java.util.Map; +import java.util.ServiceLoader; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; - /** - * Provides language support (code completion, etc.) for programming - * languages in RSyntaxTextArea. Different languages may have varying - * levels of "support." + * Provides language support (code completion, etc.) for programming languages + * in RSyntaxTextArea. Different languages may have varying levels of "support." * * @author Robert Futrell * @version 1.0 */ -public class LanguageSupportFactory implements PropertyChangeListener { - - private static final LanguageSupportFactory INSTANCE = - new LanguageSupportFactory(); - - /** - * Maps styles to class-names-for-language-supports; this way we can lazily - * create the LanguageSupports when necessary. - */ - private Map styleToSupportClass; - - /** - * Maps syntax styles to language supports for them. - */ - private Map styleToSupport; - - - /** - * Client property set on RSyntaxTextAreas that points to the current - * language support for that text area. - */ - private static final String LANGUAGE_SUPPORT_PROPERTY = - "org.fife.rsta.ac.LanguageSupport"; - - - /** - * Constructor. - */ - private LanguageSupportFactory() { - createSupportMap(); - } - - - /** - * Adds language support for a language. This is a hook for applications - * using this library to add language support for custom languages. - * - * @param style The language to add support for. This should be one of - * the values defined in {@link SyntaxConstants}. Any previous - * language support for this language is removed. - * @param lsClassName The class name of the LanguageSupport. - */ - public void addLanguageSupport(String style, String lsClassName) { - styleToSupportClass.put(style, lsClassName); - } - - - /** - * Creates the mapping of syntax styles to language supports. - */ - private void createSupportMap() { - - styleToSupport = new HashMap(); - styleToSupportClass = new HashMap(); - - String prefix = "org.fife.rsta.ac."; - - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_C, - prefix + "c.CLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_CSS, - prefix + "css.CssLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_GROOVY, - prefix + "groovy.GroovyLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_HTML, - prefix + "html.HtmlLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_JAVA, - prefix + "java.JavaLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, - prefix + "js.JavaScriptLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_JSP, - prefix + "jsp.JspLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_LESS, - prefix + "less.LessLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_PERL, - prefix + "perl.PerlLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_PHP, - prefix + "php.PhpLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_TYPESCRIPT, - prefix + "ts.TypeScriptLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_UNIX_SHELL, - prefix + "sh.ShellLanguageSupport"); - addLanguageSupport(SyntaxConstants.SYNTAX_STYLE_XML, - prefix + "xml.XmlLanguageSupport"); - - } - - - /** - * Returns the singleton instance of this class. - * - * @return The singleton instance. - */ - public static LanguageSupportFactory get() { - return INSTANCE; - } - - - /** - * Returns the language support for a programming language. - * - * @param style The language. This should be one of the constants defined - * in {@link SyntaxConstants}. - * @return The language support, or null if none is registered - * for the language specified. - */ - public LanguageSupport getSupportFor(String style) { - - LanguageSupport support = styleToSupport.get(style); - - if (support==null) { - String supportClazz = styleToSupportClass.get(style); - if (supportClazz!=null) { - try { - Class clazz = Class.forName(supportClazz); - support = (LanguageSupport)clazz.newInstance(); - } catch (RuntimeException re) { // FindBugs - throw re; - } catch (Exception e) { - e.printStackTrace(); - } - styleToSupport.put(style, support); - // Always remove from classes to load, so we don't try again - styleToSupportClass.remove(style); - } - } - - return support; - - } - - - /** - * Installs language support on an RSTA depending on its syntax style. - * - * @param textArea The text area to install language support on. - * @see #uninstallSupport(RSyntaxTextArea) - */ - private void installSupport(RSyntaxTextArea textArea) { - String style = textArea.getSyntaxEditingStyle(); - LanguageSupport support = getSupportFor(style); - if (support!=null) { - support.install(textArea); - } - textArea.putClientProperty(LANGUAGE_SUPPORT_PROPERTY, support); - } - - - /** - * Listens for RSyntaxTextAreas to change what language they're - * highlighting, so language support can be updated appropriately. - * - * @param e The event. - */ - @Override - public void propertyChange(PropertyChangeEvent e) { - - RSyntaxTextArea source = (RSyntaxTextArea)e.getSource(); - String name = e.getPropertyName(); - if (RSyntaxTextArea.SYNTAX_STYLE_PROPERTY.equals(name)) { - uninstallSupport(source); - installSupport(source); - } - - } - - - /** - * Registers an RSyntaxTextArea to receive language support. The text area - * will get support for the currently highlighted language, and if it - * changes what language it is highlighting, the support will change as - * appropriate. - * - * @param textArea The text area to register. - */ - public void register(RSyntaxTextArea textArea) { - installSupport(textArea); - textArea.addPropertyChangeListener( - RSyntaxTextArea.SYNTAX_STYLE_PROPERTY, this); - } - - - /** - * Uninstalls the language support on an RSyntaxTextArea, if any. - * - * @param textArea The text area. - * @see #installSupport(RSyntaxTextArea) - */ - private void uninstallSupport(RSyntaxTextArea textArea) { - LanguageSupport support = (LanguageSupport)textArea.getClientProperty( - LANGUAGE_SUPPORT_PROPERTY); - if (support!=null) { - support.uninstall(textArea); - } - } - - - /** - * Un-registers an RSyntaxTextArea. This removes any language support - * on it. - * - * @param textArea The text area. - * @see #register(RSyntaxTextArea) - */ - public void unregister(RSyntaxTextArea textArea) { - uninstallSupport(textArea); - textArea.removePropertyChangeListener( - RSyntaxTextArea.SYNTAX_STYLE_PROPERTY, this); - } - - -} \ No newline at end of file +public final class LanguageSupportFactory implements PropertyChangeListener { + + private static final LanguageSupportFactory INSTANCE + = new LanguageSupportFactory(); + + /** + * Maps styles to class-names-for-language-supports; this way we can lazily + * create the LanguageSupports when necessary. + */ + private final Map styleToSupportClass; + + /** + * Maps syntax styles to language supports for them. + */ + private final Map styleToSupport; + + /** + * Client property set on RSyntaxTextAreas that points to the current + * language support for that text area. + */ + private static final String LANGUAGE_SUPPORT_PROPERTY + = "org.fife.rsta.ac.LanguageSupport"; + + /** + * Constructor. + */ + private LanguageSupportFactory() { + styleToSupport = new HashMap(); + styleToSupportClass = new HashMap(); + ServiceLoader s = ServiceLoader.load(LanguageSupportRegistration.class); + for(LanguageSupportRegistration l : s) { + addLanguageSupport(l.getLanguage(), l.getLanguageSupportType()); + } + } + + /** + * Adds language support for a language. This is a hook for applications + * using this library to add language support for custom languages. + * + * @param style The language to add support for. This should be one of the + * values defined in {@link SyntaxConstants}. Any previous language support + * for this language is removed. + * @param lsClassName The class name of the LanguageSupport. + */ + public void addLanguageSupport(String style, String lsClassName) { + styleToSupportClass.put(style, lsClassName); + } + + /** + * Returns the singleton instance of this class. + * + * @return The singleton instance. + */ + public static LanguageSupportFactory get() { + return INSTANCE; + } + + /** + * Returns the language support for a programming language. + * + * @param style The language. This should be one of the constants defined in + * {@link SyntaxConstants}. + * @return The language support, or null if none is registered + * for the language specified. + */ + public LanguageSupport getSupportFor(String style) { + + LanguageSupport support = styleToSupport.get(style); + + if (support == null) { + String supportClazz = styleToSupportClass.get(style); + if (supportClazz != null) { + try { + Class clazz = Class.forName(supportClazz); + support = (LanguageSupport) clazz.newInstance(); + } catch (RuntimeException re) { // FindBugs + throw re; + } catch (Exception e) { + e.printStackTrace(); + } + styleToSupport.put(style, support); + // Always remove from classes to load, so we don't try again + styleToSupportClass.remove(style); + } + } + + return support; + + } + + /** + * Installs language support on an RSTA depending on its syntax style. + * + * @param textArea The text area to install language support on. + * @see #uninstallSupport(RSyntaxTextArea) + */ + private void installSupport(RSyntaxTextArea textArea) { + String style = textArea.getSyntaxEditingStyle(); + LanguageSupport support = getSupportFor(style); + if (support != null) { + support.install(textArea); + } + textArea.putClientProperty(LANGUAGE_SUPPORT_PROPERTY, support); + } + + /** + * Listens for RSyntaxTextAreas to change what language they're + * highlighting, so language support can be updated appropriately. + * + * @param e The event. + */ + public void propertyChange(PropertyChangeEvent e) { + + RSyntaxTextArea source = (RSyntaxTextArea) e.getSource(); + String name = e.getPropertyName(); + if (RSyntaxTextArea.SYNTAX_STYLE_PROPERTY.equals(name)) { + uninstallSupport(source); + installSupport(source); + } + + } + + /** + * Registers an RSyntaxTextArea to receive language support. The text area + * will get support for the currently highlighted language, and if it + * changes what language it is highlighting, the support will change as + * appropriate. + * + * @param textArea The text area to register. + */ + public void register(RSyntaxTextArea textArea) { + installSupport(textArea); + textArea.addPropertyChangeListener( + RSyntaxTextArea.SYNTAX_STYLE_PROPERTY, this); + } + + /** + * Uninstalls the language support on an RSyntaxTextArea, if any. + * + * @param textArea The text area. + * @see #installSupport(RSyntaxTextArea) + */ + private void uninstallSupport(RSyntaxTextArea textArea) { + LanguageSupport support = (LanguageSupport) textArea.getClientProperty( + LANGUAGE_SUPPORT_PROPERTY); + if (support != null) { + support.uninstall(textArea); + } + } + + /** + * Un-registers an RSyntaxTextArea. This removes any language support on it. + * + * @param textArea The text area. + * @see #register(RSyntaxTextArea) + */ + public void unregister(RSyntaxTextArea textArea) { + uninstallSupport(textArea); + textArea.removePropertyChangeListener( + RSyntaxTextArea.SYNTAX_STYLE_PROPERTY, this); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/LanguageSupportRegistration.java b/src/main/java/org/fife/rsta/ac/LanguageSupportRegistration.java new file mode 100644 index 00000000..8867bd02 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/LanguageSupportRegistration.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac; + +/** + * + * @author matta + */ +public interface LanguageSupportRegistration { + + String getLanguage(); + + String getLanguageSupportType(); +} diff --git a/src/main/java/org/fife/rsta/ac/c/CLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/c/CLanguageRegistration.java new file mode 100644 index 00000000..97d7581e --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/c/CLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.c; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.CTokenRegistration; + +/** + * + * @author matta + */ +public class CLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return CTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return CLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/c/CLanguageSupport.java b/src/main/java/org/fife/rsta/ac/c/CLanguageSupport.java index 9df0cf25..a403c495 100644 --- a/src/main/java/org/fife/rsta/ac/c/CLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/c/CLanguageSupport.java @@ -38,8 +38,7 @@ public CLanguageSupport() { setParameterAssistanceEnabled(true); setShowDescWindow(true); } - - + /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/css/CssLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/css/CssLanguageRegistration.java new file mode 100644 index 00000000..fc6ac6e4 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/css/CssLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.css; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.CSSTokenRegistration; + +/** + * + * @author matta + */ +public class CssLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return CSSTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return CssLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/css/CssLanguageSupport.java b/src/main/java/org/fife/rsta/ac/css/CssLanguageSupport.java index 0c8426b1..bb376172 100644 --- a/src/main/java/org/fife/rsta/ac/css/CssLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/css/CssLanguageSupport.java @@ -41,7 +41,6 @@ public CssLanguageSupport() { //setShowDescWindow(true); } - @Override protected ListCellRenderer createDefaultCompletionCellRenderer() { return new CssCellRenderer(); diff --git a/src/main/java/org/fife/rsta/ac/demo/DemoRootPane.java b/src/main/java/org/fife/rsta/ac/demo/DemoRootPane.java index 3863dae5..26ecb2e4 100644 --- a/src/main/java/org/fife/rsta/ac/demo/DemoRootPane.java +++ b/src/main/java/org/fife/rsta/ac/demo/DemoRootPane.java @@ -33,6 +33,18 @@ import org.fife.ui.rsyntaxtextarea.ErrorStrip; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +import org.fife.ui.rsyntaxtextarea.modes.CSSTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.CTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.GroovyTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.HTMLTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JSPTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JavaScriptTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JavaTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.LessTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.PHPTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.PerlTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.UnixShellTokenRegistration; +import org.fife.ui.rsyntaxtextarea.modes.XMLTokenRegistration; import org.fife.ui.rtextarea.RTextScrollPane; @@ -55,7 +67,7 @@ class DemoRootPane extends JRootPane implements HyperlinkListener, public DemoRootPane() { LanguageSupportFactory lsf = LanguageSupportFactory.get(); - LanguageSupport support = lsf.getSupportFor(SYNTAX_STYLE_JAVA); + LanguageSupport support = lsf.getSupportFor(JavaTokenRegistration.SYNTAX_STYLE); JavaLanguageSupport jls = (JavaLanguageSupport)support; // TODO: This API will change! It will be easier to do per-editor // changes to the build path. @@ -71,7 +83,7 @@ public DemoRootPane() { treeSP = new JScrollPane(dummy); textArea = createTextArea(); - setText("CExample.txt", SYNTAX_STYLE_C); + setText("CExample.txt", CTokenRegistration.SYNTAX_STYLE); scrollPane = new RTextScrollPane(textArea, true); scrollPane.setIconRowHeaderEnabled(true); scrollPane.getGutter().setBookmarkingEnabled(true); @@ -117,19 +129,18 @@ private JMenuBar createMenuBar() { menu = new JMenu("Language"); ButtonGroup bg = new ButtonGroup(); - addItem(new StyleAction(this, "C", "CExample.txt", SYNTAX_STYLE_C), bg, menu); - addItem(new StyleAction(this, "CSS", "CssExample.txt", SYNTAX_STYLE_CSS), bg, menu); - addItem(new StyleAction(this, "Groovy", "GroovyExample.txt", SYNTAX_STYLE_GROOVY), bg, menu); - addItem(new StyleAction(this, "Java", "JavaExample.txt", SYNTAX_STYLE_JAVA), bg, menu); - addItem(new StyleAction(this, "JavaScript", "JSExample.txt", SYNTAX_STYLE_JAVASCRIPT), bg, menu); - addItem(new StyleAction(this, "JSP", "JspExample.txt", SYNTAX_STYLE_JSP), bg, menu); - addItem(new StyleAction(this, "Less", "LessExample.txt", SYNTAX_STYLE_LESS), bg, menu); - addItem(new StyleAction(this, "Perl", "PerlExample.txt", SYNTAX_STYLE_PERL), bg, menu); - addItem(new StyleAction(this, "HTML", "HtmlExample.txt", SYNTAX_STYLE_HTML), bg, menu); - addItem(new StyleAction(this, "PHP", "PhpExample.txt", SYNTAX_STYLE_PHP), bg, menu); - addItem(new StyleAction(this, "sh", "ShellExample.txt", SYNTAX_STYLE_UNIX_SHELL), bg, menu); - addItem(new StyleAction(this, "TypeScript", "TypeScriptExample.txt", SYNTAX_STYLE_TYPESCRIPT), bg, menu); - addItem(new StyleAction(this, "XML", "XMLExample.txt", SYNTAX_STYLE_XML), bg, menu); + addItem(new StyleAction(this, "C", "CExample.txt", CTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "CSS", "CssExample.txt", CSSTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "Groovy", "GroovyExample.txt", GroovyTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "Java", "JavaExample.txt", JavaTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "JavaScript", "JSExample.txt", JavaScriptTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "JSP", "JspExample.txt", JSPTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "Less", "LessExample.txt", LessTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "Perl", "PerlExample.txt", PerlTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "HTML", "HtmlExample.txt", HTMLTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "PHP", "PhpExample.txt", PHPTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "sh", "ShellExample.txt", UnixShellTokenRegistration.SYNTAX_STYLE), bg, menu); + addItem(new StyleAction(this, "XML", "XMLExample.txt", XMLTokenRegistration.SYNTAX_STYLE), bg, menu); menu.getItem(0).setSelected(true); mb.add(menu); @@ -241,13 +252,13 @@ private void refreshSourceTree() { } String language = textArea.getSyntaxEditingStyle(); - if (SyntaxConstants.SYNTAX_STYLE_JAVA.equals(language)) { + if (JavaTokenRegistration.SYNTAX_STYLE.equals(language)) { tree = new JavaOutlineTree(); } - else if (SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT.equals(language)) { + else if (JavaScriptTokenRegistration.SYNTAX_STYLE.equals(language)) { tree = new JavaScriptOutlineTree(); } - else if (SyntaxConstants.SYNTAX_STYLE_XML.equals(language)) { + else if (XMLTokenRegistration.SYNTAX_STYLE.equals(language)) { tree = new XmlOutlineTree(); } else { diff --git a/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageRegistration.java new file mode 100644 index 00000000..dccbf8a5 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.groovy; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.GroovyTokenRegistration; + +/** + * + * @author matta + */ +public class GroovyLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return GroovyTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return GroovyLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageSupport.java b/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageSupport.java index 1d79e070..10dc59d4 100644 --- a/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/groovy/GroovyLanguageSupport.java @@ -39,7 +39,6 @@ public GroovyLanguageSupport() { setShowDescWindow(true); } - // /** // * {@inheritDoc} // */ diff --git a/src/main/java/org/fife/rsta/ac/html/HtmlLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/html/HtmlLanguageRegistration.java new file mode 100644 index 00000000..a20bb5d8 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/html/HtmlLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.html; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.HTMLTokenRegistration; + +/** + * + * @author matta + */ +public class HtmlLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return HTMLTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return HtmlLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/html/HtmlLanguageSupport.java b/src/main/java/org/fife/rsta/ac/html/HtmlLanguageSupport.java index c5c0e8d5..1ffa3faa 100644 --- a/src/main/java/org/fife/rsta/ac/html/HtmlLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/html/HtmlLanguageSupport.java @@ -56,7 +56,6 @@ public HtmlLanguageSupport() { setShowDescWindow(true); } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/java/JavaLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/java/JavaLanguageRegistration.java new file mode 100644 index 00000000..2254203d --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/java/JavaLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.java; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JavaTokenRegistration; + +/** + * + * @author matta + */ +public class JavaLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return JavaTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return JavaLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/java/JavadocUrlHandler.java b/src/main/java/org/fife/rsta/ac/java/JavadocUrlHandler.java index 1505c5ea..ebafc88f 100644 --- a/src/main/java/org/fife/rsta/ac/java/JavadocUrlHandler.java +++ b/src/main/java/org/fife/rsta/ac/java/JavadocUrlHandler.java @@ -25,7 +25,7 @@ import org.fife.ui.autocomplete.DescWindowCallback; import org.fife.ui.autocomplete.ExternalURLHandler; import org.fife.ui.autocomplete.Util; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rsyntaxtextarea.modes.JavaTokenRegistration; /** @@ -65,7 +65,7 @@ private String doBackups(String pkg, int backupCount) { */ private JavaLanguageSupport getJavaLanguageSupport() { return (JavaLanguageSupport)LanguageSupportFactory.get(). - getSupportFor(SyntaxConstants.SYNTAX_STYLE_JAVA); + getSupportFor(JavaTokenRegistration.SYNTAX_STYLE); } diff --git a/src/main/java/org/fife/rsta/ac/java/SourceParamChoicesProvider.java b/src/main/java/org/fife/rsta/ac/java/SourceParamChoicesProvider.java index f4933400..38905805 100644 --- a/src/main/java/org/fife/rsta/ac/java/SourceParamChoicesProvider.java +++ b/src/main/java/org/fife/rsta/ac/java/SourceParamChoicesProvider.java @@ -39,7 +39,7 @@ import org.fife.ui.autocomplete.ParameterChoicesProvider; import org.fife.ui.autocomplete.ParameterizedCompletion; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rsyntaxtextarea.modes.JavaTokenRegistration; /** @@ -166,8 +166,7 @@ public List getParameterChoices(JTextComponent tc, // Get the language support for Java LanguageSupportFactory lsf = LanguageSupportFactory.get(); - LanguageSupport support = lsf.getSupportFor(SyntaxConstants. - SYNTAX_STYLE_JAVA); + LanguageSupport support = lsf.getSupportFor(JavaTokenRegistration.SYNTAX_STYLE); JavaLanguageSupport jls = (JavaLanguageSupport)support; JarManager jm = jls.getJarManager(); diff --git a/src/main/java/org/fife/rsta/ac/java/tree/JavaOutlineTree.java b/src/main/java/org/fife/rsta/ac/java/tree/JavaOutlineTree.java index 03f53527..a854bf50 100644 --- a/src/main/java/org/fife/rsta/ac/java/tree/JavaOutlineTree.java +++ b/src/main/java/org/fife/rsta/ac/java/tree/JavaOutlineTree.java @@ -42,6 +42,7 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rsyntaxtextarea.modes.JavaTokenRegistration; /** @@ -163,8 +164,7 @@ private void checkForJavaParsing() { // Get the Java language support (shared by all RSTA instances editing // Java that were registered with the LanguageSupportFactory). LanguageSupportFactory lsf = LanguageSupportFactory.get(); - LanguageSupport support = lsf.getSupportFor(SyntaxConstants. - SYNTAX_STYLE_JAVA); + LanguageSupport support = lsf.getSupportFor(JavaTokenRegistration.SYNTAX_STYLE); JavaLanguageSupport jls = (JavaLanguageSupport)support; // Listen for re-parsing of the editor, and update the tree accordingly diff --git a/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageRegistration.java new file mode 100644 index 00000000..852629ad --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.js; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JavaScriptTokenRegistration; + +/** + * + * @author matta + */ +public class JavaScriptLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return JavaScriptTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return JavaScriptLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageSupport.java b/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageSupport.java index 2a2866a3..a2aef419 100644 --- a/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/js/JavaScriptLanguageSupport.java @@ -100,7 +100,6 @@ public JavaScriptLanguageSupport() { setLanguageVersion(Integer.MIN_VALUE); // Take Rhino's default } - /** * Creates a jar manager instance for used in JS language support. * diff --git a/src/main/java/org/fife/rsta/ac/js/tree/JavaScriptOutlineTree.java b/src/main/java/org/fife/rsta/ac/js/tree/JavaScriptOutlineTree.java index 610b81b7..170cff09 100644 --- a/src/main/java/org/fife/rsta/ac/js/tree/JavaScriptOutlineTree.java +++ b/src/main/java/org/fife/rsta/ac/js/tree/JavaScriptOutlineTree.java @@ -28,7 +28,7 @@ import org.fife.ui.rsyntaxtextarea.DocumentRange; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rsyntaxtextarea.modes.JavaScriptTokenRegistration; import org.mozilla.javascript.ast.AstRoot; @@ -102,8 +102,7 @@ private void checkForJavaScriptParsing() { // Get the Java language support (shared by all RSTA instances editing // Java that were registered with the LanguageSupportFactory). LanguageSupportFactory lsf = LanguageSupportFactory.get(); - LanguageSupport support = lsf.getSupportFor(SyntaxConstants. - SYNTAX_STYLE_JAVASCRIPT); + LanguageSupport support = lsf.getSupportFor(JavaScriptTokenRegistration.SYNTAX_STYLE); JavaScriptLanguageSupport jls = (JavaScriptLanguageSupport)support; // Listen for re-parsing of the editor, and update the tree accordingly diff --git a/src/main/java/org/fife/rsta/ac/jsp/JspLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/jsp/JspLanguageRegistration.java new file mode 100644 index 00000000..609b0132 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/jsp/JspLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.jsp; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.JSPTokenRegistration; + +/** + * + * @author matta + */ +public class JspLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return JSPTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return JspLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/jsp/JspLanguageSupport.java b/src/main/java/org/fife/rsta/ac/jsp/JspLanguageSupport.java index 107e216a..6f24ec70 100644 --- a/src/main/java/org/fife/rsta/ac/jsp/JspLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/jsp/JspLanguageSupport.java @@ -5,7 +5,7 @@ * robert_futrell at users.sourceforge.net * http://fifesoft.com/rsyntaxtextarea * - * This library is distributed under a modified BSD license. See the included + * This library is distributed under a modified BSD license. See the included * RSTALanguageSupport.License.txt file for details. */ package org.fife.rsta.ac.jsp; @@ -57,7 +57,6 @@ public JspLanguageSupport() { tagsToClose = HtmlLanguageSupport.getTagsToClose(); } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/less/LessLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/less/LessLanguageRegistration.java new file mode 100644 index 00000000..8ec43155 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/less/LessLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.less; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.LessTokenRegistration; + +/** + * + * @author matta + */ +public class LessLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return LessTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return LessLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/less/LessLanguageSupport.java b/src/main/java/org/fife/rsta/ac/less/LessLanguageSupport.java index d07e3cac..47866a3a 100644 --- a/src/main/java/org/fife/rsta/ac/less/LessLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/less/LessLanguageSupport.java @@ -13,7 +13,6 @@ import org.fife.rsta.ac.css.CssCompletionProvider; import org.fife.rsta.ac.css.CssLanguageSupport; - /** * Language support for Less. * @@ -22,24 +21,21 @@ */ public class LessLanguageSupport extends CssLanguageSupport { - - /** - * Constructor. - */ - public LessLanguageSupport() { - setShowDescWindow(true); - } - - - /** - * Overridden to return a completion provider that understands Less. - * - * @return A completion provider to use for this language. - */ - @Override - protected CssCompletionProvider createProvider() { - return new LessCompletionProvider(); - } - - -} \ No newline at end of file + /** + * Constructor. + */ + public LessLanguageSupport() { + setShowDescWindow(true); + } + + /** + * Overridden to return a completion provider that understands Less. + * + * @return A completion provider to use for this language. + */ + @Override + protected CssCompletionProvider createProvider() { + return new LessCompletionProvider(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/perl/PerlLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/perl/PerlLanguageRegistration.java new file mode 100644 index 00000000..0237b6c2 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/perl/PerlLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.perl; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.PerlTokenRegistration; + +/** + * + * @author matta + */ +public class PerlLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return PerlTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return PerlLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/perl/PerlLanguageSupport.java b/src/main/java/org/fife/rsta/ac/perl/PerlLanguageSupport.java index 0420f2fa..e54d625b 100644 --- a/src/main/java/org/fife/rsta/ac/perl/PerlLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/perl/PerlLanguageSupport.java @@ -15,7 +15,6 @@ import org.fife.rsta.ac.AbstractLanguageSupport; import org.fife.rsta.ac.IOUtil; -import org.fife.rsta.ac.perl.PerlCompletionProvider; import org.fife.ui.autocomplete.AutoCompletion; import org.fife.ui.autocomplete.CompletionCellRenderer; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; @@ -101,7 +100,6 @@ public PerlLanguageSupport() { setShowDescWindow(true); } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/php/PhpLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/php/PhpLanguageRegistration.java new file mode 100644 index 00000000..599444a2 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/php/PhpLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.php; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.PHPTokenRegistration; + +/** + * + * @author matta + */ +public class PhpLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return PHPTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return PhpLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/php/PhpLanguageSupport.java b/src/main/java/org/fife/rsta/ac/php/PhpLanguageSupport.java index 758108a3..89fe53bd 100644 --- a/src/main/java/org/fife/rsta/ac/php/PhpLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/php/PhpLanguageSupport.java @@ -20,99 +20,90 @@ import org.fife.ui.autocomplete.AutoCompletion; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; - /** - * Language support for PHP. Features currently include: + * Language support for PHP. Features currently include: * *
    - *
  • Code completion for PHP functions.
  • - *
  • Code completion for HTML5 tags and attributes.
  • - *
  • Automatic creation of closing tags for non-self-closing tags.
  • + *
  • Code completion for PHP functions.
  • + *
  • Code completion for HTML5 tags and attributes.
  • + *
  • Automatic creation of closing tags for non-self-closing tags.
  • *
- * + * * @author Robert Futrell * @version 1.0 */ public class PhpLanguageSupport extends AbstractMarkupLanguageSupport { - /** - * The completion provider. This is shared amongst all PHP text areas. - */ - private PhpCompletionProvider provider; - - /** - * A cached set of tags that require closing tags. - */ - private static Set tagsToClose = new HashSet(); - - - /** - * Constructor. - */ - public PhpLanguageSupport() { - setAutoActivationEnabled(true); - setParameterAssistanceEnabled(true); - setShowDescWindow(true); - tagsToClose = HtmlLanguageSupport.getTagsToClose(); - } - - - /** - * {@inheritDoc} - */ - @Override - protected ListCellRenderer createDefaultCompletionCellRenderer() { - return new HtmlCellRenderer(); - } - - - /** - * Lazily creates the shared completion provider instance for PHP. - * - * @return The completion provider. - */ - private PhpCompletionProvider getProvider() { - if (provider==null) { - provider = new PhpCompletionProvider(); - } - return provider; - } - - - /** - * {@inheritDoc} - */ - @Override - public void install(RSyntaxTextArea textArea) { - - PhpCompletionProvider provider = getProvider(); - AutoCompletion ac = createAutoCompletion(provider); - ac.install(textArea); - installImpl(textArea, ac); - installKeyboardShortcuts(textArea); - - textArea.setToolTipSupplier(null); - - } - - - /** - * {@inheritDoc} - */ - @Override - protected boolean shouldAutoCloseTag(String tag) { - return tagsToClose.contains(tag.toLowerCase()); - } - - - /** - * {@inheritDoc} - */ - @Override - public void uninstall(RSyntaxTextArea textArea) { - uninstallImpl(textArea); - uninstallKeyboardShortcuts(textArea); - } - + /** + * The completion provider. This is shared amongst all PHP text areas. + */ + private PhpCompletionProvider provider; + + /** + * A cached set of tags that require closing tags. + */ + private static Set tagsToClose = new HashSet(); + + /** + * Constructor. + */ + public PhpLanguageSupport() { + setAutoActivationEnabled(true); + setParameterAssistanceEnabled(true); + setShowDescWindow(true); + tagsToClose = HtmlLanguageSupport.getTagsToClose(); + } + + + /** + * {@inheritDoc} + */ + @Override + protected ListCellRenderer createDefaultCompletionCellRenderer() { + return new HtmlCellRenderer(); + } + + /** + * Lazily creates the shared completion provider instance for PHP. + * + * @return The completion provider. + */ + private PhpCompletionProvider getProvider() { + if (provider == null) { + provider = new PhpCompletionProvider(); + } + return provider; + } + + /** + * {@inheritDoc} + */ + public void install(RSyntaxTextArea textArea) { + + PhpCompletionProvider provider = getProvider(); + AutoCompletion ac = createAutoCompletion(provider); + ac.install(textArea); + installImpl(textArea, ac); + installKeyboardShortcuts(textArea); + + textArea.setToolTipSupplier(null); + + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean shouldAutoCloseTag(String tag) { + return tagsToClose.contains(tag.toLowerCase()); + } + + /** + * {@inheritDoc} + */ + public void uninstall(RSyntaxTextArea textArea) { + uninstallImpl(textArea); + uninstallKeyboardShortcuts(textArea); + } } \ No newline at end of file diff --git a/src/main/java/org/fife/rsta/ac/sh/ShellLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/sh/ShellLanguageRegistration.java new file mode 100644 index 00000000..dadc77e6 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/sh/ShellLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.sh; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.UnixShellTokenRegistration; + +/** + * + * @author matta + */ +public class ShellLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return UnixShellTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return ShellLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/sh/ShellLanguageSupport.java b/src/main/java/org/fife/rsta/ac/sh/ShellLanguageSupport.java index 36fdeadb..8381bf86 100644 --- a/src/main/java/org/fife/rsta/ac/sh/ShellLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/sh/ShellLanguageSupport.java @@ -48,6 +48,7 @@ public ShellLanguageSupport() { } + /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/xml/XmlLanguageRegistration.java b/src/main/java/org/fife/rsta/ac/xml/XmlLanguageRegistration.java new file mode 100644 index 00000000..c9a5a3a3 --- /dev/null +++ b/src/main/java/org/fife/rsta/ac/xml/XmlLanguageRegistration.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.fife.rsta.ac.xml; + +import org.fife.rsta.ac.LanguageSupportRegistration; +import org.fife.ui.rsyntaxtextarea.modes.XMLTokenRegistration; + +/** + * + * @author matta + */ +public class XmlLanguageRegistration implements LanguageSupportRegistration { + + @Override + public String getLanguage() { + return XMLTokenRegistration.SYNTAX_STYLE; + } + + @Override + public String getLanguageSupportType() { + return XmlLanguageSupport.class.getName(); + } + +} diff --git a/src/main/java/org/fife/rsta/ac/xml/XmlLanguageSupport.java b/src/main/java/org/fife/rsta/ac/xml/XmlLanguageSupport.java index 76c023e1..6e5ebd7f 100644 --- a/src/main/java/org/fife/rsta/ac/xml/XmlLanguageSupport.java +++ b/src/main/java/org/fife/rsta/ac/xml/XmlLanguageSupport.java @@ -72,7 +72,6 @@ public XmlLanguageSupport() { setShowSyntaxErrors(true); } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/fife/rsta/ac/xml/tree/XmlOutlineTree.java b/src/main/java/org/fife/rsta/ac/xml/tree/XmlOutlineTree.java index c3830453..dac80573 100644 --- a/src/main/java/org/fife/rsta/ac/xml/tree/XmlOutlineTree.java +++ b/src/main/java/org/fife/rsta/ac/xml/tree/XmlOutlineTree.java @@ -26,7 +26,7 @@ import org.fife.ui.rsyntaxtextarea.DocumentRange; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rsyntaxtextarea.modes.XMLTokenRegistration; /** @@ -99,8 +99,7 @@ private void checkForXmlParsing() { // Get the Java language support (shared by all RSTA instances editing // Java that were registered with the LanguageSupportFactory). LanguageSupportFactory lsf = LanguageSupportFactory.get(); - LanguageSupport support = lsf.getSupportFor(SyntaxConstants. - SYNTAX_STYLE_XML); + LanguageSupport support = lsf.getSupportFor(XMLTokenRegistration.SYNTAX_STYLE); XmlLanguageSupport xls = (XmlLanguageSupport)support; // Listen for re-parsing of the editor, and update the tree accordingly diff --git a/src/main/resources/META-INF/services/org.fife.rsta.ac.LanguageSupportRegistration b/src/main/resources/META-INF/services/org.fife.rsta.ac.LanguageSupportRegistration new file mode 100644 index 00000000..1ed18b59 --- /dev/null +++ b/src/main/resources/META-INF/services/org.fife.rsta.ac.LanguageSupportRegistration @@ -0,0 +1,12 @@ +org.fife.rsta.ac.css.CssLanguageRegistration +org.fife.rsta.ac.xml.XmlLanguageRegistration +org.fife.rsta.ac.groovy.GroovyLanguageRegistration +org.fife.rsta.ac.jsp.JspLanguageRegistration +org.fife.rsta.ac.less.LessLanguageRegistration +org.fife.rsta.ac.js.JavaScriptLanguageRegistration +org.fife.rsta.ac.c.CLanguageRegistration +org.fife.rsta.ac.html.HtmlLanguageRegistration +org.fife.rsta.ac.php.PhpLanguageRegistration +org.fife.rsta.ac.perl.PerlLanguageRegistration +org.fife.rsta.ac.sh.ShellLanguageRegistration +org.fife.rsta.ac.java.JavaLanguageRegistration \ No newline at end of file diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/abstract_co.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/abstract_co.gif new file mode 100644 index 00000000..533acc43 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/abstract_co.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/class_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/class_default_obj.gif new file mode 100644 index 00000000..4244a7f3 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/class_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/class_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/class_obj.gif new file mode 100644 index 00000000..e4c2a836 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/class_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/constr_ovr.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/constr_ovr.gif new file mode 100644 index 00000000..3977bc0f Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/constr_ovr.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/deprecated.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/deprecated.gif new file mode 100644 index 00000000..d03b6a99 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/deprecated.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/enum_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_default_obj.gif new file mode 100644 index 00000000..e6f557b1 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/enum_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_obj.gif new file mode 100644 index 00000000..15535f52 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/enum_private_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_private_obj.gif new file mode 100644 index 00000000..4d839591 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_private_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/enum_protected_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_protected_obj.gif new file mode 100644 index 00000000..834aa853 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/enum_protected_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/error_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/error_obj.gif new file mode 100644 index 00000000..0bc60689 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/error_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/field_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/field_default_obj.gif new file mode 100644 index 00000000..6929d3d1 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/field_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/field_private_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/field_private_obj.gif new file mode 100644 index 00000000..1fe064e6 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/field_private_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/field_protected_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/field_protected_obj.gif new file mode 100644 index 00000000..3377b1eb Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/field_protected_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/field_public_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/field_public_obj.gif new file mode 100644 index 00000000..d4cb4254 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/field_public_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/final_co.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/final_co.gif new file mode 100644 index 00000000..01c580d4 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/final_co.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/html_tag_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/html_tag_obj.gif new file mode 100644 index 00000000..21fad228 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/html_tag_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/imp_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/imp_obj.gif new file mode 100644 index 00000000..9e44ce52 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/imp_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/impc_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/impc_obj.gif new file mode 100644 index 00000000..ea94702c Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/impc_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/info_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/info_obj.gif new file mode 100644 index 00000000..2da001e3 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/info_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_default_obj.gif new file mode 100644 index 00000000..4244a7f3 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_private_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_private_obj.gif new file mode 100644 index 00000000..7392f191 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_private_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_protected_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_protected_obj.gif new file mode 100644 index 00000000..5105577d Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_protected_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_public_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_public_obj.gif new file mode 100644 index 00000000..e4c2a836 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerclass_public_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_default_obj.gif new file mode 100644 index 00000000..ab1b576a Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_private_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_private_obj.gif new file mode 100644 index 00000000..a1cbff36 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_private_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_protected_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_protected_obj.gif new file mode 100644 index 00000000..f58eef07 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_protected_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_public_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_public_obj.gif new file mode 100644 index 00000000..2ebc46e1 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/innerinterface_public_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/int_default_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/int_default_obj.gif new file mode 100644 index 00000000..ab1b576a Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/int_default_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/int_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/int_obj.gif new file mode 100644 index 00000000..2ebc46e1 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/int_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/jcu_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/jcu_obj.gif new file mode 100644 index 00000000..200e5ed8 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/jcu_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/jdoc_tag_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/jdoc_tag_obj.gif new file mode 100644 index 00000000..c43c5d51 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/jdoc_tag_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/localvariable_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/localvariable_obj.gif new file mode 100644 index 00000000..8adce954 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/localvariable_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/methdef_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/methdef_obj.gif new file mode 100644 index 00000000..f4a1ea15 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/methdef_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/methpri_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/methpri_obj.gif new file mode 100644 index 00000000..29887165 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/methpri_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/methpro_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/methpro_obj.gif new file mode 100644 index 00000000..563743d3 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/methpro_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/methpub_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/methpub_obj.gif new file mode 100644 index 00000000..7d24707e Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/methpub_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/package_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/package_obj.gif new file mode 100644 index 00000000..131c28da Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/package_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/static_co.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/static_co.gif new file mode 100644 index 00000000..499664d5 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/static_co.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/synch_co.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/synch_co.gif new file mode 100644 index 00000000..5893bda5 Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/synch_co.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/template_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/template_obj.gif new file mode 100644 index 00000000..fdde5fbb Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/template_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/img/warning_obj.gif b/src/main/resources/org/fife/rsta/ac/bsh/img/warning_obj.gif new file mode 100644 index 00000000..2b2e50fe Binary files /dev/null and b/src/main/resources/org/fife/rsta/ac/bsh/img/warning_obj.gif differ diff --git a/src/main/resources/org/fife/rsta/ac/bsh/resources.properties b/src/main/resources/org/fife/rsta/ac/bsh/resources.properties new file mode 100644 index 00000000..4fbf68c7 --- /dev/null +++ b/src/main/resources/org/fife/rsta/ac/bsh/resources.properties @@ -0,0 +1,26 @@ +sysout.shortDesc=print to standard out +sysout.summary=System.out.println(); +syserr.shortDesc=print to standard error +syserr.summary=System.err.println(); +for.array.shortDesc=iterate over array +for.array.summary=for (int i = 0; i < array.length; i++) {

}
+for.loop.shortDesc=iterate +for.loop.summary=for (int i = 0; i < 10; i++) {

}
+do.shortDesc=do-while statement +do.summary=do {

} while(condition);
+runnable.shortDesc=runnable +runnable.summary=new Runnable() {
public void run() {
}
}
+if.cond.shortDesc=if statement +if.cond.summary=if (condition) {

}
+if.else.shortDesc=if-else statement +if.else.summary=if (condition) {

}
else {

}
+while.shortDesc=while condition +while.summary=while (condition) {

}
+todo=A to-do reminder +fixme=A bug that needs to be fixed +switch.case.shortDesc=switch case statement +switch.case.summary=switch (key) {
 case value:

      break;

  default:
      break;
} +try.catch.shortDesc=try catch statement +try.catch.summary=try {

}
catch (err) {

} +catch.block.shortDesc=catch block +catch.block.summary=catch (err) {

}