01: /*******************************************************************************
02: * Copyright (c) 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.tests.views.properties.tabbed.override.tablist;
11:
12: import org.eclipse.jface.viewers.ISelection;
13: import org.eclipse.ui.IWorkbenchPart;
14: import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor;
15: import org.eclipse.ui.views.properties.tabbed.ISection;
16:
17: /**
18: * Section descriptor for the override tests example.
19: * <p>
20: * The OverrideTestsView TabbedPropertySheetPage example is a look at the
21: * properties view after the migration of a TabFolder/TabItem framework to the
22: * tabbed properties view. In the case of a TabFolder, the folder (provider)
23: * knows both the tab labels and tab items. This aligns to the tabbed properties
24: * view, but the tab labels are tab descriptors and tab items are section
25: * descriptions. This does not work with the default framework as the tabs
26: * provide the sections. In this case, the IOverridableTabListContentProvider
27: * framework has been provided.
28: * <p>
29: * The overridable tab list is a content provider that provides both the
30: * sections and the tab labels.
31: *
32: * @author Anthony Hunter
33: * @since 3.4
34: */
35: public class OverrideTestsSectionDescriptor extends
36: AbstractSectionDescriptor {
37:
38: private ISection section;
39:
40: /*
41: * (non-Javadoc)
42: *
43: * @see org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart,
44: * org.eclipse.jface.viewers.ISelection)
45: */
46: public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
47: return true;
48: }
49:
50: /*
51: * (non-Javadoc)
52: *
53: * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getId()
54: */
55: public String getId() {
56: return "org.eclipse.ui.tests.views.properties.tabbed.override"; //$NON-NLS-1$
57: }
58:
59: /*
60: * (non-Javadoc)
61: *
62: * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getSectionClass()
63: */
64: public ISection getSectionClass() {
65: if (section == null) {
66: this .section = new OverrideTestsSection();
67: }
68: return section;
69: }
70:
71: /*
72: * (non-Javadoc)
73: *
74: * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getTargetTab()
75: */
76: public String getTargetTab() {
77: return "org.eclipse.ui.tests.views.properties.tabbed.override"; //$NON-NLS-1$
78: }
79: }
|