KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > views > properties > tabbed > view > TabListContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2001, 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 package org.eclipse.ui.internal.views.properties.tabbed.view;
12
13 import org.eclipse.jface.util.Assert;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.jface.viewers.IStructuredContentProvider;
16 import org.eclipse.jface.viewers.Viewer;
17 import org.eclipse.ui.IWorkbenchPart;
18
19
20 /**
21  * The default implementation of the content provider for the
22  * tabbed property sheet page's list of tabs.
23  *
24  * @author Anthony Hunter
25  */

26 public class TabListContentProvider
27     implements IStructuredContentProvider {
28     
29     private TabbedPropertyRegistry registry;
30
31     private IWorkbenchPart currentPart;
32     
33     /**
34      * Constructor for TabListContentProvider.
35      */

36     public TabListContentProvider(TabbedPropertyRegistry registry) {
37         this.registry = registry;
38     }
39     
40     /**
41      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
42      */

43     public Object JavaDoc[] getElements(Object JavaDoc inputElement) {
44         Assert.isTrue(inputElement instanceof ISelection);
45             return registry
46             .getTabDescriptors(currentPart, (ISelection) inputElement);
47     }
48
49     /**
50      * @see org.eclipse.jface.viewers.IContentProvider#dispose()
51      */

52     public void dispose() {
53         /* not used */
54     }
55
56     /**
57      * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
58      */

59     public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
60         this.currentPart = ((TabbedPropertyViewer)viewer).getWorkbenchPart();
61     }
62 }
63
Popular Tags