Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2004, 2006 John-Mason P. Shackelford 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: John-Mason P. Shackelford - initial API and implementation IBM Corporation - bug 52076 /
package org.eclipse.ant.internal.ui.editor.formatter;
Documents to be formatted by this strategy
	private final LinkedList fDocumentsnew LinkedList();
    
access to the preferences store *
	private int indent= -1;
	    this. = new FormattingPreferences();
    }
 
	public XmlDocumentFormattingStrategy(FormattingPreferences prefsint indent) {
	    Assert.isNotNull(prefs);
	    this. = prefs;
	    this.indent;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jface.text.formatter.IFormattingStrategyExtension#format()
	 */
	public void format() {
 
        super.format();
     	final IDocument document= (IDocument).removeFirst();
		if (document != null) {
	        // TODO allow formatting of regions, not just the entire document; bug 75611
	        String documentText = document.get();
	        XmlDocumentFormatter formatter = new XmlDocumentFormatter();
	        if ( != -1) {
	        	formatter.setInitialIndent();
	        }
            formatter.setDefaultLineDelimiter(TextUtilities.getDefaultLineDelimiter(document));
	        String formattedText = formatter.format(documentTextthis.);
	        if (formattedText != null && !formattedText.equals(documentText)) {
	        	document.set(formattedText);
	        }
		}
     }
     
     /*
 	 * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStarts(org.eclipse.jface.text.formatter.IFormattingContext)
 	 */
 	public void formatterStarts(final IFormattingContext context) {
 		super.formatterStarts(context);
 		
 	}
 	/*
 	 * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStops()
 	 */
 	public void formatterStops() {
 		super.formatterStops();
 	}
New to GrepCode? Check out our FAQ X