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

org.fife.rsta.ui.search.SearchUtil Maven / Gradle / Ivy

Go to download

RSTAUI is an add-on library for RSyntaxTextArea that provides pre-build dialog boxes commonly needed in text editing applications.

There is a newer version: 3.3.1
Show newest version
/*
 * 09/20/2013
 *
 * SearchUtil - Utility methods for this package.
 *
 * This library is distributed under a modified BSD license.  See the included
 * RSyntaxTextArea.License.txt file for details.
 */
package org.fife.rsta.ui.search;


/**
 * Utility methods for this package.
 *
 * @author Robert Futrell
 * @version 1.0
 */
final class SearchUtil {


    /**
     * Private constructor to prevent instantiation.
     */
    private SearchUtil() {
    }

	/**
	 * Formats an error message from a find/replace button enable result for
	 * use in a tool tip.  This assumes the error (if any) came from a
	 * PatternSyntaxException.
	 *
	 * @param res The result.
	 * @return The tool tip, or null if no error message was
	 *         specified in res.
	 */
	public static String getToolTip(FindReplaceButtonsEnableResult res) {
		String tooltip = res.getError();
		if (tooltip!=null && tooltip.indexOf('\n')>-1) {
			tooltip = tooltip.replaceFirst("\\\n", "
");
			tooltip = "" + tooltip;
		}
		return tooltip;
	}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy