KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > PDEMasterDetailsBlock


1 /*******************************************************************************
2  * Copyright (c) 2003, 2007 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.pde.internal.ui.editor;
12
13 import org.eclipse.swt.layout.GridData;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.ui.forms.DetailsPart;
16 import org.eclipse.ui.forms.IManagedForm;
17 import org.eclipse.ui.forms.MasterDetailsBlock;
18 import org.eclipse.ui.forms.widgets.Section;
19
20 public abstract class PDEMasterDetailsBlock extends MasterDetailsBlock {
21     private PDEFormPage fPage;
22     private PDESection fSection;
23     
24     public PDEMasterDetailsBlock(PDEFormPage page) {
25         fPage = page;
26     }
27     
28     public PDEFormPage getPage() {
29         return fPage;
30     }
31     
32     protected void createMasterPart(final IManagedForm managedForm,
33             Composite parent) {
34         Composite container = managedForm.getToolkit().createComposite(parent);
35         container.setLayout(FormLayoutFactory.createMasterGridLayout(false, 1));
36         container.setLayoutData(new GridData(GridData.FILL_BOTH));
37         fSection = createMasterSection(managedForm, container);
38         managedForm.addPart(fSection);
39         Section section = fSection.getSection();
40         section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
41         section.setLayoutData(new GridData(GridData.FILL_BOTH));
42     }
43     
44     protected void createToolBarActions(IManagedForm managedForm) {}
45     
46     protected abstract PDESection createMasterSection(IManagedForm managedForm, Composite parent);
47     
48     public void createContent(IManagedForm managedForm) {
49         super.createContent(managedForm);
50         managedForm.getForm().getBody().setLayout(FormLayoutFactory.createFormGridLayout(false, 1));
51     }
52     
53     /**
54      * @return
55      */

56     public DetailsPart getDetailsPart() {
57         return detailsPart;
58     }
59     
60 }
61
Popular Tags