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.ui.tests.views.properties.tabbed.model.Element;
13: import org.eclipse.ui.tests.views.properties.tabbed.model.Error;
14: import org.eclipse.ui.tests.views.properties.tabbed.model.Information;
15: import org.eclipse.ui.tests.views.properties.tabbed.model.Warning;
16: import org.eclipse.ui.tests.views.properties.tabbed.override.items.ErrorItem;
17: import org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem;
18: import org.eclipse.ui.tests.views.properties.tabbed.override.items.InformationItem;
19: import org.eclipse.ui.tests.views.properties.tabbed.override.items.WarningItem;
20:
21: /**
22: * The basic tab list is displayed when Information, Warning or Error is the
23: * selected element in the override tests view.
24: * <p>
25: * The OverrideTestsView TabbedPropertySheetPage example is a look at the
26: * properties view after the migration of a TabFolder/TabItem framework to the
27: * tabbed properties view. In the case of a TabFolder, the folder (provider)
28: * knows both the tab labels and tab items. This aligns to the tabbed properties
29: * view, but the tab labels are tab descriptors and tab items are section
30: * descriptions. This does not work with the default framework as the tabs
31: * provide the sections. In this case, the IOverridableTabListContentProvider
32: * framework has been provided.
33: * <p>
34: * The overridable tab list is a content provider that provides both the
35: * sections and the tab labels.
36: *
37: * @author Anthony Hunter
38: * @since 3.4
39: */
40: public class BasicTabList extends AbstractTabList {
41:
42: private IOverrideTestsItem[] overrideTestsItems;
43:
44: /*
45: * (non-Javadoc)
46: *
47: * @see org.eclipse.ui.tests.views.properties.tabbed.override.tablist.AbstractTabList#appliesTo(org.eclipse.ui.tests.views.properties.tabbed.model.Element)
48: */
49: public boolean appliesTo(Element element) {
50: return ((element instanceof Information)
51: || (element instanceof Warning) || (element instanceof Error));
52: }
53:
54: /*
55: * (non-Javadoc)
56: *
57: * @see org.eclipse.ui.tests.views.properties.tabbed.override.tablist.IOverrideTestsTabList#getItems()
58: */
59: public IOverrideTestsItem[] getItems() {
60: if (overrideTestsItems == null) {
61: overrideTestsItems = new IOverrideTestsItem[] {
62: new InformationItem(), new WarningItem(),
63: new ErrorItem() };
64: }
65: return overrideTestsItems;
66: }
67:
68: }
|