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.items;
11:
12: import org.eclipse.swt.graphics.Image;
13: import org.eclipse.swt.layout.FormData;
14: import org.eclipse.swt.widgets.Composite;
15: import org.eclipse.swt.widgets.Label;
16: import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
17:
18: /**
19: * An item for the emply selection when there is no selected element in the
20: * override tests view.
21: *
22: * @author Anthony Hunter
23: * @since 3.4
24: */
25: public class EmptyItem implements IOverrideTestsItem {
26:
27: private Composite composite;
28:
29: /*
30: * (non-Javadoc)
31: *
32: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#createControls(org.eclipse.swt.widgets.Composite)
33: */
34: public void createControls(Composite parent) {
35: TabbedPropertySheetWidgetFactory factory = new TabbedPropertySheetWidgetFactory();
36: composite = factory.createFlatFormComposite(parent);
37: Label label = factory.createLabel(composite,
38: "Empty Item (no selected element)"); //$NON-NLS-1$
39: label.setLayoutData(new FormData());
40: }
41:
42: /*
43: * (non-Javadoc)
44: *
45: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#dispose()
46: */
47: public void dispose() {
48: if (composite != null && !composite.isDisposed()) {
49: composite.dispose();
50: composite = null;
51: }
52: }
53:
54: /*
55: * (non-Javadoc)
56: *
57: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#getComposite()
58: */
59: public Composite getComposite() {
60: return composite;
61: }
62:
63: /*
64: * (non-Javadoc)
65: *
66: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#getElement()
67: */
68: public Class getElement() {
69: return null;
70: }
71:
72: /*
73: * (non-Javadoc)
74: *
75: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#getImage()
76: */
77: public Image getImage() {
78: return null;
79: }
80:
81: /*
82: * (non-Javadoc)
83: *
84: * @see org.eclipse.ui.tests.views.properties.tabbed.override.items.IOverrideTestsItem#getText()
85: */
86: public String getText() {
87: return "Empty Item"; //$NON-NLS-1$
88: }
89: }
|