KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > properties > tabbed > AbstractPropertySection


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.views.properties.tabbed;
12
13 import org.eclipse.jface.viewers.ISelection;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.ui.IWorkbenchPart;
17
18 /**
19  * An abstract implementation of a section in a tab in the tabbed property sheet
20  * page.
21  *
22  * @author Anthony Hunter
23  */

24 public abstract class AbstractPropertySection
25     implements ISection {
26
27     /**
28      * The standard label width when labels for sections line up on the left
29      * hand side of the composite.
30      */

31     public static final int STANDARD_LABEL_WIDTH = 85;
32
33     /**
34      * The tabbed property sheet page
35      */

36     private TabbedPropertySheetPage tabbedPropertySheetPage;
37
38     /**
39      * The current workbench selection.
40      */

41     private ISelection selection;
42
43     /**
44      * The current active workbench part.
45      */

46     private IWorkbenchPart part;
47
48     /**
49      * Get the widget factory for the property sheet page.
50      *
51      * @return the widget factory.
52      */

53     public TabbedPropertySheetWidgetFactory getWidgetFactory() {
54         return tabbedPropertySheetPage.getWidgetFactory();
55     }
56
57     /**
58      * Get the current workbench selection.
59      *
60      * @return the current workbench selection.
61      */

62     public ISelection getSelection() {
63         return selection;
64     }
65
66     /**
67      * @return Returns the part.
68      */

69     public IWorkbenchPart getPart() {
70         return part;
71     }
72
73     /**
74      * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
75      * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
76      */

77     public void createControls(Composite parent,
78             TabbedPropertySheetPage aTabbedPropertySheetPage) {
79         this.tabbedPropertySheetPage = aTabbedPropertySheetPage;
80     }
81
82     /**
83      * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
84      * org.eclipse.jface.viewers.ISelection)
85      */

86     public void setInput(IWorkbenchPart part, ISelection selection) {
87         this.selection = selection;
88         this.part = part;
89     }
90
91     /**
92      * @see org.eclipse.ui.views.properties.tabbed.ISection#aboutToBeShown()
93      */

94     public void aboutToBeShown() {
95         /* empty default implementation */
96     }
97
98     /**
99      * @see org.eclipse.ui.views.properties.tabbed.ISection#aboutToBeHidden()
100      */

101     public void aboutToBeHidden() {
102         /* empty default implementation */
103     }
104
105     /**
106      * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
107      */

108     public void dispose() {
109         /* empty default implementation */
110     }
111
112     /**
113      * @see org.eclipse.ui.views.properties.tabbed.ISection#getMinimumHeight()
114      */

115     public int getMinimumHeight() {
116         return SWT.DEFAULT;
117     }
118
119     /**
120      * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
121      */

122     public boolean shouldUseExtraSpace() {
123         return false;
124     }
125
126     /**
127      * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
128      */

129     public void refresh() {
130         /* empty default implementation */
131     }
132 }
133
Popular Tags