Project

General

Profile

Download (5.17 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2010 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.ui.navigator;
12

    
13
import java.util.Set;
14

    
15
import org.eclipse.jface.viewers.IStructuredSelection;
16

    
17
/**
18
 * 
19
 * The descriptor provides a the low-level handle to a content extension. Information such as
20
 * the Id, the name, the priority, and whether the descriptor provides one or
21
 * more root elements is provided.  This descriptor is used to form the 
22
 * {@link INavigatorContentExtension}.
23
 * 
24
 * <p>
25
 * There is a one-to-many correspondence between the {@link INavigatorContentDescriptor} and
26
 * {@link INavigatorContentExtension}.  An instance of the {@link INavigatorContentExtension} is
27
 * created for each {@link INavigatorContentDescriptor} used by a 
28
 * {@link INavigatorContentService}.
29
 * </p>
30
 * 
31
 * @noimplement This interface is not intended to be implemented by clients.
32
 * @noextend This interface is not intended to be extended by clients.
33
 * @since 3.2
34
 * 
35
 */
36
public interface INavigatorContentDescriptor {
37

    
38
	/**
39
	 * Returns the navigator content extension id
40
	 * 
41
	 * @return the navigator content extension id
42
	 */
43
	String getId();
44

    
45
	/**
46
	 * Returns the name of this navigator extension
47
	 * 
48
	 * @return the name of this navigator extension
49
	 */
50
	String getName();
51

    
52
	/**
53
	 * Returns the priority of the navigator content extension.
54
	 * 
55
	 * @return the priority of the navigator content extension. Returns {@link Priority#NORMAL}
56
	 *         if no priority was specified.
57
	 */
58
	int getPriority();
59
	
60
	/**
61
	 * Returns the extension that this extension must appear before.
62
	 * 
63
	 * @return The value specified by the <i>appearsBefore</i> attribute of the
64
	 *         &lt;navigatorContent/&gt; element.
65
	 *         
66
	 * @since 3.5        
67
	 */
68
	public String getAppearsBeforeId();
69
	
70
	/**
71
	 * Returns the unique sequence number of this extension.  This is calculated based on
72
	 * the priority and the appears before and represents the order the extension will appear
73
	 * relative to the other extensions
74
	 * 
75
	 * @return The sequence number of the extension
76
	 *         
77
	 * @since 3.5        
78
	 */
79
	public int getSequenceNumber();
80
	
81
	/**
82
	 * The enabledByDefault attribute specifies whether an extension should be
83
	 * activated in the context of a viewer automatically. Users may override
84
	 * this setting through the "Types of Content" dialog. This will be true
85
	 * if either the activeByDefault attribute of the navigatorContent element 
86
	 * is true, or if an initialActivationExpression is specified which resolves
87
	 * to true.
88
	 * 
89
	 * @return true if the extension is enabled by default.
90
	 */
91
	boolean isActiveByDefault();
92

    
93
	/**
94
	 * True if this content extension is used only to specify a commonSorter 
95
	 * in order to provide only sorting.
96
	 * @return true if sort only
97
	 * 
98
	 * @since 3.5
99
	 */
100
	boolean isSortOnly();
101
	
102
	/**
103
	 * Determine if this content extension is enabled for the given element.
104
	 * 
105
	 * @param anElement
106
	 *            The element that should be used for the evaluation.
107
	 * @return True if and only if the extension is enabled for the element.
108
	 */
109
	boolean isTriggerPoint(Object anElement);
110

    
111
	/**
112
	 * Determine if this content extension could provide the given element as a
113
	 * child.
114
	 * 
115
	 * <p>
116
	 * This method is used to determine what the parent of an element could be
117
	 * for Link with Editor support.
118
	 * </p>
119
	 * 
120
	 * @param anElement
121
	 *            The element that should be used for the evaluation.
122
	 * @return True if and only if the extension might provide an object of this
123
	 *         type as a child.
124
	 */
125
	boolean isPossibleChild(Object anElement);
126

    
127
	/**
128
	 * A convenience method to check all elements in a selection.
129
	 * 
130
	 * @param aSelection
131
	 *            A non-null selection
132
	 * @return True if and only if every element in the selection is a possible
133
	 *         child.
134
	 */
135
	boolean arePossibleChildren(IStructuredSelection aSelection);
136

    
137
	/**
138
	 * @return Returns the suppressedExtensionId or null if none specified.
139
	 */
140
	String getSuppressedExtensionId();
141

    
142
	/**
143
	 * @return Returns the overridePolicy or null if this extension does not
144
	 *         override another extension.
145
	 * @since 3.4
146
	 */
147
	OverridePolicy getOverridePolicy();
148

    
149
	/**
150
	 * @return The descriptor of the <code>suppressedExtensionId</code> if
151
	 *         non-null.
152
	 */
153
	INavigatorContentDescriptor getOverriddenDescriptor();
154

    
155
	/**
156
	 * 
157
	 * Does not force the creation of the set of overriding extensions.
158
	 * 
159
	 * @return True if this extension has overriding extensions.
160
	 */
161
	boolean hasOverridingExtensions();
162

    
163
	/**
164
	 * @return The set of overriding extensions (of type
165
	 *         {@link INavigatorContentDescriptor})
166
	 */
167
	Set getOverriddingExtensions();
168

    
169
	/**
170
	 * @return true if the extension's content provider may adapt to a {@link SaveablesProvider}.
171
	 */
172
	boolean hasSaveablesProvider();
173

    
174
}
(27-27/49)