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

org.fife.ui.rsyntaxtextarea.parser.AbstractParser Maven / Gradle / Ivy

Go to download

RSyntaxTextArea is the syntax highlighting text editor for Swing applications. Features include syntax highlighting for 40+ languages, code folding, code completion, regex find and replace, macros, code templates, undo/redo, line numbering and bracket matching.

There is a newer version: 3.5.2
Show newest version
/*
 * 07/31/2009
 *
 * AbstractParser.java - A base implementation for parsers.
 *
 * This library is distributed under a modified BSD license.  See the included
 * LICENSE file for details.
 */
package org.fife.ui.rsyntaxtextarea.parser;

import java.net.URL;


/**
 * A base class for {@link Parser} implementations.  Most Parsers
 * should be able to extend this class.
 *
 * @author Robert Futrell
 * @version 1.0
 */
public abstract class AbstractParser implements Parser {

	/**
	 * Whether this parser is enabled.  If this is false, then
	 * this parser will not be run.
	 */
	private boolean enabled;

	/**
	 * Listens for events from
	 * {@link org.fife.ui.rsyntaxtextarea.focusabletip.FocusableTip}s generated
	 * from this parser's notices.
	 */
	private ExtendedHyperlinkListener linkListener;


	/**
	 * Constructor.
	 */
	protected AbstractParser() {
		setEnabled(true);
	}


	@Override
	public ExtendedHyperlinkListener getHyperlinkListener() {
		return linkListener;
	}


	/**
	 * Returns null.  Parsers that wish to show images in their
	 * tool tips should override this method to return the image base URL.
	 *
	 * @return null always.
	 */
	@Override
	public URL getImageBase() {
		return null;
	}


	@Override
	public boolean isEnabled() {
		return enabled;
	}


	/**
	 * Toggles whether this parser is enabled.
	 *
	 * @param enabled Whether this parser is enabled.
	 * @see #isEnabled()
	 */
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}


	/**
	 * Returns the listener for this parser.
	 *
	 * @param listener The new listener.
	 * @see #getHyperlinkListener()
	 */
	public void setHyperlinkListener(ExtendedHyperlinkListener listener) {
		linkListener = listener;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy