Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.ant.internal.ui.editor.templates;
import  org.eclipse.swt.graphics.Image;
public class AntTemplateProposal extends TemplateProposal {
	public AntTemplateProposal(Template templateTemplateContext contextIRegion region, Image imageint relevance) {
		super(templatecontextregionimagerelevance);
	}
    /* (non-Javadoc)
     * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#validate(org.eclipse.jface.text.IDocument, int, org.eclipse.jface.text.DocumentEvent)
     */
    public boolean validate(IDocument documentint offsetDocumentEvent event) {
        try {
			int replaceOffsetgetReplaceOffset();
			if (offset >= replaceOffset) {
				String contentdocument.get(replaceOffsetoffset - replaceOffset);
                if (content.length() == 0) {
                    return true;
                }
				if (content.charAt(0) == '<') {
				    contentcontent.substring(1);
				}
			}
catch (BadLocationException e) {
			// concurrent modification - ignore
		}
		return false;
    }
New to GrepCode? Check out our FAQ X