KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > navigator > filters > CommonFilterContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 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.internal.navigator.filters;
13
14 import org.eclipse.jface.viewers.IStructuredContentProvider;
15 import org.eclipse.jface.viewers.Viewer;
16 import org.eclipse.ui.navigator.INavigatorContentService;
17 import org.eclipse.ui.navigator.INavigatorFilterService;
18
19 /**
20  *
21  * <p>
22  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part of a work in
23  * progress. There is a guarantee neither that this API will work nor that it will remain the same.
24  * Please do not use this API without consulting with the Platform/UI team.
25  * </p>
26  *
27  * @since 3.2
28  *
29  */

30 public class CommonFilterContentProvider implements IStructuredContentProvider {
31
32     private INavigatorContentService contentService;
33     private Object JavaDoc[] NO_ELEMENTS = new Object JavaDoc[0];
34  
35  
36     public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
37         if (newInput instanceof INavigatorContentService) {
38             contentService = (INavigatorContentService) newInput;
39         }
40     }
41
42     /*
43      * (non-Javadoc)
44      *
45      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
46      */

47     public Object JavaDoc[] getElements(Object JavaDoc inputElement) {
48         if(contentService != null) {
49             INavigatorFilterService filterService = contentService.getFilterService();
50             return filterService.getVisibleFilterDescriptors();
51         }
52         return NO_ELEMENTS ;
53         
54     }
55
56     /*
57      * (non-Javadoc)
58      *
59      * @see org.eclipse.jface.viewers.IContentProvider#dispose()
60      */

61     public void dispose() {
62
63     }
64
65 }
66
Popular Tags