1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2006, 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
|
|
12
|
package org.eclipse.ui.navigator;
|
13
|
|
14
|
import org.eclipse.jface.viewers.ViewerFilter;
|
15
|
|
16
|
/**
|
17
|
* Provides support for managing the filters defined for a Common Navigator
|
18
|
* viewer.
|
19
|
*
|
20
|
* <p>
|
21
|
* An INavigatorFilterService manages the available common filters and their
|
22
|
* current activation state for a particular INavigatorContentService. An
|
23
|
* INavigatorFilterService cannot be acquired without an
|
24
|
* INavigatorContentService (through
|
25
|
* {@link INavigatorContentService#getFilterService}). Each instance will
|
26
|
* provide information specific to the content service associated with it.
|
27
|
* </p>
|
28
|
* <p>
|
29
|
* The visibility of commonFilters is controlled through matching
|
30
|
* <b>viewerContentBinding</b>s. That is, like content extensions, the id of a
|
31
|
* commonFilter must match an includes expression for at least one
|
32
|
* <b>viewerContentBinding</b> element for the corresponding
|
33
|
* INavigatorContentService.
|
34
|
* </p>
|
35
|
* <p>
|
36
|
* The activation of each filter should be persisted from session to session.
|
37
|
* Clients of this interface have control over when the persistence occurs. In
|
38
|
* particular, clients should call {@link #persistFilterActivationState()}
|
39
|
* after each call to {@link #setActiveFilterIds(String[])}.
|
40
|
* </p>
|
41
|
*
|
42
|
* @see INavigatorContentService#getFilterService()
|
43
|
* @see ViewerFilter
|
44
|
*
|
45
|
* @noimplement This interface is not intended to be implemented by clients.
|
46
|
* @noextend This interface is not intended to be extended by clients.
|
47
|
* @since 3.2
|
48
|
*
|
49
|
*/
|
50
|
public interface INavigatorFilterService {
|
51
|
|
52
|
/**
|
53
|
*
|
54
|
* Determine the set of filters which are <i>visible</i> to the
|
55
|
* content service associated with this filter service.
|
56
|
*
|
57
|
* @param toReturnOnlyActiveFilters
|
58
|
* True indicates that only active filters should be returned.
|
59
|
* @return An array of ViewerFilters that should be applied to the viewer
|
60
|
* rendering the content from this INavigatorContentService
|
61
|
*/
|
62
|
ViewerFilter[] getVisibleFilters(boolean toReturnOnlyActiveFilters);
|
63
|
|
64
|
/**
|
65
|
*
|
66
|
* <i>Visible</i> filters are filters whose ids match a
|
67
|
* <b>viewerContentBinding</b> for the corresponding viewer.
|
68
|
*
|
69
|
* @return An array of all visible filter descriptors.
|
70
|
*/
|
71
|
ICommonFilterDescriptor[] getVisibleFilterDescriptors();
|
72
|
|
73
|
/**
|
74
|
* @param aFilterId
|
75
|
* Check the activation of aFilterId for the content service
|
76
|
* corresponding to this filter service.
|
77
|
* @return True if the filter specified by the id is active for the content
|
78
|
* service corresponding to this filter service.
|
79
|
*/
|
80
|
boolean isActive(String aFilterId);
|
81
|
|
82
|
/**
|
83
|
* Cause the specified set of filters to be activated, and any filters not
|
84
|
* specified to be deactivated. Updates the viewer filters for the
|
85
|
* associated viewer. This is a higher level operation that handles the
|
86
|
* filter activation completely, in contrast to
|
87
|
* {@link #setActiveFilterIds(String[])} which does not set the viewer
|
88
|
* filter state. This is probably the one you want if you are changing
|
89
|
* filters.
|
90
|
*
|
91
|
* @param theFilterIds
|
92
|
* An array of filter ids to activate.
|
93
|
* @since 3.5
|
94
|
*/
|
95
|
public void activateFilterIdsAndUpdateViewer(String[] theFilterIds);
|
96
|
|
97
|
/**
|
98
|
* Activate the set of given filters. An <i>active</i> filter will always be
|
99
|
* returned from {@link #getVisibleFilters(boolean)}. An <i>inactive</i> filter will
|
100
|
* only be returned from {@link #getVisibleFilters(boolean)} when it is
|
101
|
* called with <b>false</b>.
|
102
|
*
|
103
|
*
|
104
|
* @param theFilterIds
|
105
|
* An array of filter ids to activate.
|
106
|
*
|
107
|
*/
|
108
|
void setActiveFilterIds(String[] theFilterIds);
|
109
|
|
110
|
/**
|
111
|
* Persist the current activation state for visible filters.
|
112
|
*/
|
113
|
void persistFilterActivationState();
|
114
|
|
115
|
/**
|
116
|
*
|
117
|
* Return the viewer filter for the given descriptor
|
118
|
*
|
119
|
* @param theDescriptor
|
120
|
* A non-null filter descriptor.
|
121
|
* @return the viewer filter for the given descriptor
|
122
|
* @since 3.3
|
123
|
*/
|
124
|
ViewerFilter getViewerFilter(ICommonFilterDescriptor theDescriptor);
|
125
|
|
126
|
}
|