package org.eclipse.wst.sse.ui.internal.projection;

import org.eclipse.jface.text.source.projection.ProjectionViewer;

/**
 * Implementors of this interface which will create and maintain
 * {@link org.eclipse.jface.text.source.projection.ProjectionAnnotation}
 * objects that define folded regions in the the
 * {@link org.eclipse.jface.text.source.projection.ProjectionViewer}for a
 * structured model.
 */
public interface IStructuredTextFoldingProvider {
	public static final String ID = "structuredtextfoldingprovider"; //$NON-NLS-1$

	/**
	 * A named preference that controls whether folding is enabled in the
	 * Structured Text editor.
	 */
	public final static String FOLDING_ENABLED = "foldingEnabled"; //$NON-NLS-1$ 

	// copied interface from
	// org.eclipse.jdt.ui.text.folding.IJavaFoldingStructureProvider
	/**
	 * Installs this structure provider on the given viewer. Implementations
	 * should listen to the projection events generated by <code>viewer</code>
	 * and enable / disable generation of projection structure accordingly.
	 * 
	 * @param viewer
	 *            the projection viewer that displays the annotations created
	 *            by this structure provider
	 */
	public void install(ProjectionViewer viewer);

	/**
	 * Uninstalls this structure provider. Any references to viewers should be
	 * cleared.
	 */
	public void uninstall();

	/**
	 * Initialize this provider with the correct document. Assumes projection
	 * is enabled. (otherwise, only install would have been called)
	 */
	public void initialize();
}
