1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.phpeditor;
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.jface.text.IDocument;
17 import org.eclipse.jface.text.ILineTracker;
18 import org.eclipse.jface.text.source.IAnnotationModelListener;
20 import org.eclipse.ui.texteditor.IDocumentProvider;
21 import org.eclipse.ui.texteditor.IDocumentProviderExtension2;
22 import org.eclipse.ui.texteditor.IDocumentProviderExtension3;
24 import net.sourceforge.phpdt.core.ICompilationUnit;
29 public interface ICompilationUnitDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3 {
32 * Shuts down this provider.
37 * Returns the working copy for the given element.
39 * @param element the element
40 * @return the working copy for the given element
42 ICompilationUnit getWorkingCopy(Object element);
45 * Saves the content of the given document to the given element. This method has
46 * only an effect if it is called when directly or indirectly inside <code>saveDocument</code>.
48 * @param monitor the progress monitor
49 * @param element the element to which to save
50 * @param document the document to save
51 * @param overwrite <code>true</code> if the save should be enforced
53 void saveDocumentContent(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException;
56 * Creates a line tracker for the given element. It is of the same kind as the one that would be
57 * used for a newly created document for the given element.
59 * @param element the element
60 * @return a line tracker for the given element
62 ILineTracker createLineTracker(Object element);
65 * Sets the document provider's save policy.
67 * @param savePolicy the save policy
69 void setSavePolicy(ISavePolicy savePolicy);
72 * Adds a listener that reports changes from all compilation unit annotation models.
74 * @param listener the listener
76 void addGlobalAnnotationModelListener(IAnnotationModelListener listener);
79 * Removes the listener.
81 * @param listener the listener
83 void removeGlobalAnnotationModelListener(IAnnotationModelListener listener);