KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > ISavedState


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.core.resources;
12
13 import org.eclipse.core.runtime.IPath;
14
15 /**
16  * A data structure returned by {@link IWorkspace#addSaveParticipant(org.eclipse.core.runtime.Plugin, ISaveParticipant)}
17  * containing a save number and an optional resource delta.
18  * <p>
19  * This interface is not intended to be implemented by clients.
20  * </p>
21  *
22  * @see IWorkspace#addSaveParticipant(org.eclipse.core.runtime.Plugin, ISaveParticipant)
23  */

24 public interface ISavedState {
25     /**
26      * Returns the files mapped with the {@link ISaveContext#map(IPath, IPath)}
27      * facility. Returns an empty array if there are no mapped files.
28      *
29      * @return the files currently mapped by the participant
30      *
31      * @see #lookup(IPath)
32      * @see ISaveContext#map(IPath, IPath)
33      */

34     public IPath[] getFiles();
35
36     /**
37      * Returns the save number for the save participant.
38      * This is the save number of the last successful save in which the plug-in
39      * <b>actively</b> participated, or <code>0</code> if the plug-in has
40      * never actively participated in a successful save.
41      *
42      * @return the save number
43      */

44     public int getSaveNumber();
45
46     /**
47      * Returns the mapped location associated with the given path
48      * or <code>null</code> if none.
49      *
50      * @return the mapped location of a given path
51      * @see #getFiles()
52      * @see ISaveContext#map(IPath, IPath)
53      */

54     public IPath lookup(IPath file);
55
56     /**
57      * Used to receive notification of changes that might have happened
58      * while this plug-in was not active. The listener receives notifications of changes to
59      * the workspace resource tree since the time this state was saved. After this
60      * method is run, the delta is forgotten. Subsequent calls to this method
61      * will have no effect.
62      * <p>
63      * No notification is received in the following cases:
64      * <ul>
65      * <li>if a saved state was never recorded ({@link ISaveContext#needDelta()}</code>
66      * was not called) </li>
67      * <li>a saved state has since been forgotten (using {@link IWorkspace#forgetSavedTree(String)}) </li>
68      * <li>a saved state has been deemed too old or has become invalid</li>
69      * </ul>
70      * <p>
71      * All clients should have a contingency plan in place in case
72      * a changes are not available (the case should be very similar
73      * to the first time a plug-in is activated, and only has the
74      * current state of the workspace to work from).
75      * </p>
76      * <p>
77      * The supplied event is of type {@link IResourceChangeEvent#POST_BUILD}
78      * and contains the delta detailing changes since this plug-in last participated
79      * in a save. This event object (and the resource delta within it) is valid only
80      * for the duration of the invocation of this method.
81      * </p>
82      *
83      * @param listener the listener
84      * @see ISaveContext#needDelta()
85      * @see IResourceChangeListener
86      */

87     public void processResourceChangeEvents(IResourceChangeListener listener);
88 }
89
Popular Tags