1) Reintroduced PHPPerspectiveFactory (was lost with refactoring).
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / ui / IWorkingCopyManager.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 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.phpdt.ui;
12
13 import net.sourceforge.phpdt.core.ICompilationUnit;
14
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.ui.IEditorInput;
17
18 /**
19  * Interface for accessing working copies of <code>ICompilationUnit</code>
20  * objects. The original compilation unit is only given indirectly by means of
21  * an <code>IEditorInput</code>. The life cycle is as follows:
22  * <ul>
23  * <li> <code>connect</code> creates and remembers a working copy of the
24  * compilation unit which is encoded in the given editor input</li>
25  * <li> <code>getWorkingCopy</code> returns the working copy remembered on
26  * <code>connect</code></li>
27  * <li> <code>disconnect</code> destroys the working copy remembered on
28  * <code>connect</code></li>
29  * </ul>
30  * <p>
31  * This interface is not intended to be implemented by clients.
32  * </p>
33  * 
34  * @see JavaUI#getWorkingCopyManager
35  */
36 public interface IWorkingCopyManager {
37
38         /**
39          * Connects the given editor input to this manager. After calling this
40          * method, a working copy will be available for the compilation unit encoded
41          * in the given editor input (does nothing if there is no encoded
42          * compilation unit).
43          * 
44          * @param input
45          *            the editor input
46          * @exception CoreException
47          *                if the working copy cannot be created for the compilation
48          *                unit
49          */
50         void connect(IEditorInput input) throws CoreException;
51
52         /**
53          * Disconnects the given editor input from this manager. After calling this
54          * method, a working copy for the compilation unit encoded in the given
55          * editor input will no longer be available. Does nothing if there is no
56          * encoded compilation unit, or if there is no remembered working copy for
57          * the compilation unit.
58          * 
59          * @param input
60          *            the editor input
61          */
62         void disconnect(IEditorInput input);
63
64         /**
65          * Returns the working copy remembered for the compilation unit encoded in
66          * the given editor input.
67          * 
68          * @param input
69          *            the editor input
70          * @return the working copy of the compilation unit, or <code>null</code>
71          *         if the input does not encode an editor input, or if there is no
72          *         remembered working copy for this compilation unit
73          */
74         ICompilationUnit getWorkingCopy(IEditorInput input);
75
76         /**
77          * Shuts down this working copy manager. All working copies still remembered
78          * by this manager are destroyed.
79          */
80         void shutdown();
81 }