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