01: /*******************************************************************************
02: * Copyright (c) 2005, 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.jface.viewers;
11:
12: /**
13: * A selection containing tree paths.
14: * <p>
15: * It is recommended that clients do not implement this interface but instead
16: * use the standard implementation of this interface, {@link TreeSelection}.
17: * <code>TreeSelection</code> adds API for getting the {@link IElementComparer}
18: * of a selection (if available). This is important for clients who want to
19: * create a slightly modified tree selection based on an existing tree selection.
20: * The recommended coding pattern in this case is as follows:
21: * <pre>
22: * ITreeSelection selection = (ITreeSelection)treeViewer.getSelection();
23: * TreePath[] paths = selection.getPaths();
24: * IElementComparer comparer = null;
25: * if (selection instanceof TreeSelection) {
26: * comparer = ((TreeSelection)selection).getElementComparer();
27: * }
28: * TreePath[] modifiedPaths = ... // modify as required
29: * TreeSelection modifiedSelection = new TreeSelection(modifiedPaths, comparer);
30: * </pre>
31: * See bugs 135818 and 133375 for details.
32: * </p>
33: *
34: * @since 3.2
35: *
36: */
37: public interface ITreeSelection extends IStructuredSelection {
38:
39: /**
40: * Returns the paths in this selection
41: *
42: * @return the paths in this selection
43: */
44: public TreePath[] getPaths();
45:
46: /**
47: * Returns the paths in this selection whose last segment is equal
48: * to the given element
49: *
50: * @param element the element to get the tree paths for
51: *
52: * @return the array of tree paths
53: */
54: public TreePath[] getPathsFor(Object element);
55:
56: }
|