01: /*******************************************************************************
02: * Copyright (c) 2001, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.views.properties.tabbed.view;
11:
12: import org.eclipse.core.runtime.Assert;
13: import org.eclipse.jface.viewers.ISelection;
14: import org.eclipse.jface.viewers.IStructuredContentProvider;
15: import org.eclipse.jface.viewers.Viewer;
16: import org.eclipse.ui.IWorkbenchPart;
17:
18: /**
19: * The default implementation of the content provider for the
20: * tabbed property sheet page's list of tabs.
21: *
22: * @author Anthony Hunter
23: */
24: public class TabListContentProvider implements
25: IStructuredContentProvider {
26:
27: protected TabbedPropertyRegistry registry;
28:
29: protected IWorkbenchPart currentPart;
30:
31: /**
32: * Constructor for TabListContentProvider.
33: * @param registry the tabbed property registry.
34: */
35: public TabListContentProvider(TabbedPropertyRegistry registry) {
36: this .registry = registry;
37: }
38:
39: /**
40: * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
41: */
42: public Object[] getElements(Object inputElement) {
43: Assert.isTrue(inputElement instanceof ISelection);
44: return registry.getTabDescriptors(currentPart,
45: (ISelection) inputElement);
46: }
47:
48: /**
49: * @see org.eclipse.jface.viewers.IContentProvider#dispose()
50: */
51: public void dispose() {
52: /* not used */
53: }
54:
55: /**
56: * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
57: */
58: public void inputChanged(Viewer viewer, Object oldInput,
59: Object newInput) {
60: this .currentPart = ((TabbedPropertyViewer) viewer)
61: .getWorkbenchPart();
62: }
63: }
|