01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.navigator;
11:
12: import org.eclipse.jface.viewers.StructuredViewer;
13: import org.eclipse.ui.ISaveablesLifecycleListener;
14: import org.eclipse.ui.ISaveablesSource;
15: import org.eclipse.ui.Saveable;
16:
17: /**
18: *
19: * This interface is not intended to be implemented by clients.
20: *
21: * @since 3.2
22: *
23: */
24: public interface INavigatorSaveablesService {
25:
26: /**
27: * Initializes this service. Must be called on the UI thread, and may only
28: * be called once. The given viewer's control must not be disposed.
29: * <p>
30: * The given listener will be notified of changes to the result of
31: * {@link #getSaveables()} and to the dirty state of those saveables. The
32: * given source will be used as the event source for these event
33: * notifications.
34: * </p>
35: * <p>
36: * The given viewer's selection will be used by
37: * {@link #getActiveSaveables()} to determine the active saveables. The
38: * active saveables are determined by iterating over the current selection,
39: * and for each element, walking up its parent chain until an element
40: * representing a saveable is found, or a root element is reached.
41: * </p>
42: *
43: * @param source
44: * @param viewer
45: * @param listener
46: *
47: */
48: public void init(ISaveablesSource source, StructuredViewer viewer,
49: ISaveablesLifecycleListener listener);
50:
51: /**
52: * Returns the Saveable objects for which elements are contained in the
53: * tree.
54: *
55: * @return the saveables
56: */
57: public Saveable[] getSaveables();
58:
59: /**
60: * Returns the active saveables based on the current selection. This method
61: * must be called on the UI thread.
62: *
63: * @return the active saveables based on the current selection
64: */
65: public Saveable[] getActiveSaveables();
66:
67: }
|