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 net.sourceforge.phpdt.core.ICompilationUnit;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.jface.text.IDocument;
18 import org.eclipse.jface.text.ILineTracker;
19 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;
27 public interface ICompilationUnitDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3 {
30 * Shuts down this provider.
35 * Returns the working copy for the given element.
37 * @param element the element
38 * @return the working copy for the given element
40 ICompilationUnit getWorkingCopy(Object element);
43 * Saves the content of the given document to the given element. This method has
44 * only an effect if it is called when directly or indirectly inside <code>saveDocument</code>.
46 * @param monitor the progress monitor
47 * @param element the element to which to save
48 * @param document the document to save
49 * @param overwrite <code>true</code> if the save should be enforced
51 void saveDocumentContent(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException;
54 * Creates a line tracker for the given element. It is of the same kind as the one that would be
55 * used for a newly created document for the given element.
57 * @param element the element
58 * @return a line tracker for the given element
60 ILineTracker createLineTracker(Object element);
63 * Sets the document provider's save policy.
65 * @param savePolicy the save policy
67 void setSavePolicy(ISavePolicy savePolicy);
70 * Adds a listener that reports changes from all compilation unit annotation models.
72 * @param listener the listener
74 void addGlobalAnnotationModelListener(IAnnotationModelListener listener);
77 * Removes the listener.
79 * @param listener the listener
81 void removeGlobalAnnotationModelListener(IAnnotationModelListener listener);