Java Code Examples for org.eclipse.jface.text.TextUtilities#equals()

The following examples show how to use org.eclipse.jface.text.TextUtilities#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModulaAutoEditStrategy.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void customizeDocumentCommand(IDocument doc, DocumentCommand cmd) {
    ProcessingResult r1 = ProcessingResult.NONE;
    ProcessingResult r2 = ProcessingResult.NONE;
    try {
        boolean isEnterPressed = (TextUtilities.equals(doc.getLegalLineDelimiters(), cmd.text) != -1); 
        r1 = insertIndentIfNeed(doc, cmd, isEnterPressed);
        r2 = checkTypingAfterLine(doc, cmd, isEnterPressed, r1);
    } catch (Exception e) {}
    
    m2f = null;
    if (r1 == ProcessingResult.NONE && r2 == ProcessingResult.NONE) {
        super.customizeDocumentCommand(doc, cmd);
    }
}
 
Example 2
Source File: CommonAutoIndentStrategy.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected static boolean isLineDelimiter(IDocument d, String text)
{
	String[] delimiters = d.getLegalLineDelimiters();
	if (delimiters == null)
	{
		return false;
	}
	return TextUtilities.equals(delimiters, text) > -1;
}
 
Example 3
Source File: TypeScriptAutoIndentStrategy.java    From typescript.java with MIT License 4 votes vote down vote up
private boolean isLineDelimiter(IDocument document, String text) {
	String[] delimiters= document.getLegalLineDelimiters();
	if (delimiters != null)
		return TextUtilities.equals(delimiters, text) > -1;
	return false;
}
 
Example 4
Source File: JavaStringAutoIndentStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isLineDelimiter(IDocument document, String text) {
	String[] delimiters= document.getLegalLineDelimiters();
	if (delimiters != null)
		return TextUtilities.equals(delimiters, text) > -1;
	return false;
}
 
Example 5
Source File: JavaAutoIndentStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isLineDelimiter(IDocument document, String text) {
	String[] delimiters= document.getLegalLineDelimiters();
	if (delimiters != null)
		return TextUtilities.equals(delimiters, text) > -1;
	return false;
}
 
Example 6
Source File: TextUtils.java    From tm4e with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns true if text of the command is an enter and false otherwise.
 *
 * @param d
 * @param c
 * @return true if text of the command is an enter and false otherwise.
 */
public static boolean isEnter(IDocument d, DocumentCommand c) {
	return (c.length == 0 && c.text != null && TextUtilities.equals(d.getLegalLineDelimiters(), c.text) != -1);
}