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 java.util.Map;
13:
14: import org.eclipse.jface.viewers.ViewerSorter;
15:
16: /**
17: *
18: * Provides an interface to extensions declared in
19: * <b>org.eclipse.ui.navigator.navigatorContent/commonSorter</b>.
20: *
21: * <p>
22: * Like other extensions to the Common Navigator framework, sorters defined by
23: * the above extension point must be bound to the associated
24: * {@link INavigatorContentService} through a
25: * <b>org.eclipse.ui.navigator.viewer/viewerContentBinding</b> extension.
26: * </p>
27: *
28: * <p>
29: * This interface is not intended to be implemented by clients.
30: * </p>
31: *
32: * @see INavigatorContentService#getSorterService()
33: * @see ViewerSorter
34: * @since 3.2
35: */
36: public interface INavigatorSorterService {
37:
38: /**
39: * Return a {@link ViewerSorter} from an extension which is visible to the
40: * associated {@link INavigatorContentService} and whose <b>parentExpression</b>
41: * matches the given parent.
42: *
43: * @param aParent
44: * An element from the tree
45: * @return An applicable ViewerSorter or simple {@link ViewerSorter} if no
46: * sorter is found.
47: */
48: ViewerSorter findSorterForParent(Object aParent);
49:
50: /**
51: * Return a {@link ViewerSorter} from an extension which is visible to the
52: * associated {@link INavigatorContentService} and whose <b>parentExpression</b>
53: * matches the given parent.
54: *
55: * @param source
56: * The source of the element.
57: * @param parent
58: * An element from the tree
59: * @param lvalue
60: * An element from the tree
61: * @param rvalue
62: * An element from the tree
63: * @return An applicable ViewerSorter or simple {@link ViewerSorter} if no
64: * sorter is found.
65: */
66: ViewerSorter findSorter(INavigatorContentDescriptor source,
67: Object parent, Object lvalue, Object rvalue);
68:
69: /**
70: * Find and return all viewer sorters associated with the given descriptor.
71: *
72: * <p>
73: * The <i>commonSorter</i> element is not required to have an id, so in
74: * some cases, an auto-generated id, using the content extension id as a
75: * base, is generated to ensure the map is properly filled with all
76: * available sorters. No guarantees are given as to the order or consistency
77: * of these generated ids between invocations.
78: * </p>
79: *
80: * @param theSource
81: * A descriptor that identifies a particular content extension
82: * @return A Map[String sorterDescriptorId, ViewerSorter instance] where the
83: * key is the id defined in the extension and the value is the
84: * instantiated sorter.
85: *
86: * @see INavigatorContentService#getContentDescriptorById(String)
87: * @see INavigatorContentService#getContentExtensionById(String)
88: * @see INavigatorContentExtension#getDescriptor()
89: * @since 3.3
90: */
91: public Map findAvailableSorters(
92: INavigatorContentDescriptor theSource);
93:
94: }
|