]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2000, 2008 IBM Corporation and others. | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * IBM Corporation - initial API and implementation | |
10 | *******************************************************************************/ | |
11 | package org.eclipse.jdt.ui; | |
12 | ||
13 | import org.eclipse.core.runtime.CoreException; | |
14 | ||
15 | import org.eclipse.ui.IEditorInput; | |
16 | ||
17 | import org.eclipse.jdt.core.ICompilationUnit; | |
18 | ||
19 | /** | |
20 | * Interface for accessing working copies of <code>ICompilationUnit</code> | |
21 | * objects. The original compilation unit is only given indirectly by means | |
22 | * of an <code>IEditorInput</code>. The life cycle is as follows: | |
23 | * <ul> | |
24 | * <li> <code>connect</code> creates and remembers a working copy of the | |
25 | * compilation unit which is encoded in the given editor input</li> | |
26 | * <li> <code>getWorkingCopy</code> returns the working copy remembered on | |
27 | * <code>connect</code></li> | |
28 | * <li> <code>disconnect</code> destroys the working copy remembered on | |
29 | * <code>connect</code></li> | |
30 | * </ul> | |
31 | * <p> | |
32 | * In order to provide backward compatibility for clients of <code>IWorkingCopyManager</code>, extension | |
33 | * interfaces are used to provide a means of evolution. The following extension interfaces | |
34 | * exist: | |
35 | * <ul> | |
36 | * <li> {@link org.eclipse.jdt.ui.IWorkingCopyManagerExtension} since version 2.1 introducing API | |
37 | * to set and remove the working copy for a given editor input.</li> | |
38 | * </ul> | |
39 | * </p> | |
40 | * <p> | |
41 | * This interface is not intended to be implemented by clients. | |
42 | * </p> | |
43 | * | |
44 | * @see JavaUI#getWorkingCopyManager() | |
45 | * @see org.eclipse.jdt.ui.IWorkingCopyManagerExtension | |
46 | * | |
47 | * @noimplement This interface is not intended to be implemented by clients. | |
48 | * @noextend This interface is not intended to be extended by clients. | |
49 | */ | |
50 | public interface IWorkingCopyManager { | |
51 | ||
52 | /** | |
53 | * Connects the given editor input to this manager. After calling | |
54 | * this method, a working copy will be available for the compilation unit encoded | |
55 | * in the given editor input (does nothing if there is no encoded compilation unit). | |
56 | * | |
57 | * @param input the editor input | |
58 | * @exception CoreException if the working copy cannot be created for the | |
59 | * compilation unit | |
60 | */ | |
61 | void connect(IEditorInput input) throws CoreException; | |
62 | ||
63 | /** | |
64 | * Disconnects the given editor input from this manager. After calling | |
65 | * this method, a working copy for the compilation unit encoded | |
66 | * in the given editor input will no longer be available. Does nothing if there | |
67 | * is no encoded compilation unit, or if there is no remembered working copy for | |
68 | * the compilation unit. | |
69 | * | |
70 | * @param input the editor input | |
71 | */ | |
72 | void disconnect(IEditorInput input); | |
73 | ||
74 | /** | |
75 | * Returns the working copy remembered for the compilation unit encoded in the | |
76 | * given editor input. | |
77 | * | |
78 | * @param input the editor input | |
79 | * @return the working copy of the compilation unit, or <code>null</code> if the | |
80 | * input does not encode an editor input, or if there is no remembered working | |
81 | * copy for this compilation unit | |
82 | */ | |
83 | ICompilationUnit getWorkingCopy(IEditorInput input); | |
84 | ||
85 | /** | |
86 | * Shuts down this working copy manager. All working copies still remembered | |
87 | * by this manager are destroyed. | |
88 | */ | |
89 | void shutdown(); | |
90 | } |