KickJava   Java API By Example, From Geeks To Geeks.

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


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.layout.FormAttachment;
15 import org.eclipse.swt.layout.FormData;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.ui.IWorkbenchPart;
18 import org.eclipse.ui.views.properties.PropertySheetPage;
19
20 /**
21  * An advanced section that is intended to show the original table format properties view
22  * provided by base Eclipse.
23  *
24  * @author Anthony Hunter
25  */

26 public class AdvancedPropertySection
27     extends AbstractPropertySection {
28
29     /**
30      * The Property Sheet Page.
31      */

32     protected PropertySheetPage page;
33
34     /**
35      * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
36      * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
37      */

38     public void createControls(Composite parent,
39             TabbedPropertySheetPage tabbedPropertySheetPage) {
40         super.createControls(parent, tabbedPropertySheetPage);
41         Composite composite = getWidgetFactory()
42             .createFlatFormComposite(parent);
43         page = new PropertySheetPage();
44
45         page.createControl(composite);
46         FormData data = new FormData();
47         data.left = new FormAttachment(0, 0);
48         data.right = new FormAttachment(100, 0);
49         data.top = new FormAttachment(0, 0);
50         data.bottom = new FormAttachment(100, 0);
51         page.getControl().setLayoutData(data);
52     }
53
54     /**
55      * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
56      * org.eclipse.jface.viewers.ISelection)
57      */

58     public void setInput(IWorkbenchPart part, ISelection selection) {
59         super.setInput(part, selection);
60         page.selectionChanged(part, selection);
61     }
62
63     /**
64      * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
65      */

66     public void dispose() {
67         super.dispose();
68
69         if (page != null) {
70             page.dispose();
71             page = null;
72         }
73
74     }
75
76     /**
77      * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
78      */

79     public void refresh() {
80         page.refresh();
81     }
82
83     /**
84      * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
85      */

86     public boolean shouldUseExtraSpace() {
87         return true;
88     }
89 }
90
Popular Tags