KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.swt.widgets.Composite;
15 import org.eclipse.ui.internal.navigator.CommonNavigatorMessages;
16 import org.eclipse.ui.navigator.INavigatorContentDescriptor;
17 import org.eclipse.ui.navigator.INavigatorContentService;
18
19 /**
20  * @since 3.2
21  *
22  */

23 public class ContentExtensionsTab extends CustomizationTab {
24
25     protected ContentExtensionsTab(Composite parent,
26             INavigatorContentService aContentService) {
27         super(parent, aContentService);
28         createControl();
29
30     }
31
32     private void createControl() {
33                 
34         createInstructionsLabel(CommonNavigatorMessages.CommonFilterSelectionDialog_Select_the_available_extensions);
35         
36         createTable();
37
38         getTableViewer().setContentProvider(new ContentDescriptorContentProvider());
39         getTableViewer().setLabelProvider(new CommonFilterLabelProvider());
40         getTableViewer().setInput(getContentService());
41
42         updateCheckedState();
43
44     }
45
46
47     private void updateCheckedState() {
48         INavigatorContentDescriptor[] visibleExtensions = getContentService()
49                 .getVisibleExtensions();
50         for (int i = 0; i < visibleExtensions.length; i++) {
51             if (getContentService().isActive(visibleExtensions[i].getId())) {
52                 getTableViewer().setChecked(visibleExtensions[i], true);
53             }
54         }
55
56     }
57
58 }
59
Popular Tags