fix #774 infinite loop in net.sourceforge.phpeclipse.builder.IdentifierIndexManager...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / ICompilationUnitDocumentProvider.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.phpeditor;
12
13 import net.sourceforge.phpdt.core.ICompilationUnit;
14
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;
23
24 /**
25  * @since 3.0
26  */
27 public interface ICompilationUnitDocumentProvider extends IDocumentProvider,
28                 IDocumentProviderExtension2, IDocumentProviderExtension3 {
29
30         /**
31          * Shuts down this provider.
32          */
33         void shutdown();
34
35         /**
36          * Returns the working copy for the given element.
37          * 
38          * @param element
39          *            the element
40          * @return the working copy for the given element
41          */
42         ICompilationUnit getWorkingCopy(Object element);
43
44         /**
45          * Saves the content of the given document to the given element. This method
46          * has only an effect if it is called when directly or indirectly inside
47          * <code>saveDocument</code>.
48          * 
49          * @param monitor
50          *            the progress monitor
51          * @param element
52          *            the element to which to save
53          * @param document
54          *            the document to save
55          * @param overwrite
56          *            <code>true</code> if the save should be enforced
57          */
58         void saveDocumentContent(IProgressMonitor monitor, Object element,
59                         IDocument document, boolean overwrite) throws CoreException;
60
61         /**
62          * Creates a line tracker for the given element. It is of the same kind as
63          * the one that would be used for a newly created document for the given
64          * element.
65          * 
66          * @param element
67          *            the element
68          * @return a line tracker for the given element
69          */
70         ILineTracker createLineTracker(Object element);
71
72         /**
73          * Sets the document provider's save policy.
74          * 
75          * @param savePolicy
76          *            the save policy
77          */
78         void setSavePolicy(ISavePolicy savePolicy);
79
80         /**
81          * Adds a listener that reports changes from all compilation unit annotation
82          * models.
83          * 
84          * @param listener
85          *            the listener
86          */
87         void addGlobalAnnotationModelListener(IAnnotationModelListener listener);
88
89         /**
90          * Removes the listener.
91          * 
92          * @param listener
93          *            the listener
94          */
95         void removeGlobalAnnotationModelListener(IAnnotationModelListener listener);
96 }