All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fife.rsta.ac.jsp.JspLanguageSupport Maven / Gradle / Ivy

Go to download

A library adding code completion and other advanced features for Java, JavaScript, Perl, and other languages to RSyntaxTextArea.

There is a newer version: 3.3.0
Show newest version
/*
 * 07/05/2011
 *
 * Copyright (C) 2011 Robert Futrell
 * robert_futrell at users.sourceforge.net
 * http://fifesoft.com/rsyntaxtextarea
 *
 * This library is distributed under a modified BSD license.  See the included
 * RSTALanguageSupport.License.txt file for details.
 */
package org.fife.rsta.ac.jsp;

import java.util.HashSet;
import java.util.Set;
import javax.swing.ListCellRenderer;

import org.fife.rsta.ac.AbstractMarkupLanguageSupport;
import org.fife.rsta.ac.html.HtmlCellRenderer;
import org.fife.rsta.ac.html.HtmlCompletionProvider;
import org.fife.rsta.ac.html.HtmlLanguageSupport;
import org.fife.ui.autocomplete.AutoCompletion;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;


/**
 * Language support for JSP.  Features currently include:
 *
 * 
    *
  • Code completion for HTML5 tags and attributes.
  • *
  • Code completion for JSTL.
  • *
  • Automatic creation of closing tags for non-self-closing tags.
  • *
* * @author Robert Futrell * @version 1.0 */ public class JspLanguageSupport extends AbstractMarkupLanguageSupport { /** * The completion provider. This is shared amongst all JSP text areas. */ private JspCompletionProvider provider; /** * A cached set of tags that require closing tags. */ private static Set tagsToClose = new HashSet(); /** * Constructor. */ public JspLanguageSupport() { setAutoActivationEnabled(true); setParameterAssistanceEnabled(false); setShowDescWindow(true); tagsToClose = HtmlLanguageSupport.getTagsToClose(); } /** * {@inheritDoc} */ protected ListCellRenderer createDefaultCompletionCellRenderer() { return new HtmlCellRenderer(); } private JspCompletionProvider getProvider() { if (provider==null) { provider = new JspCompletionProvider(); } return provider; } /** * {@inheritDoc} */ public void install(RSyntaxTextArea textArea) { HtmlCompletionProvider provider = getProvider(); AutoCompletion ac = createAutoCompletion(provider); ac.install(textArea); installImpl(textArea, ac); installKeyboardShortcuts(textArea); textArea.setToolTipSupplier(null); } /** * {@inheritDoc} */ protected boolean shouldAutoCloseTag(String tag) { return tagsToClose.contains(tag.toLowerCase()); } /** * {@inheritDoc} */ public void uninstall(RSyntaxTextArea textArea) { uninstallImpl(textArea); uninstallKeyboardShortcuts(textArea); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy