KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > schema > SchemaDocPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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.schema;
12
13 import org.eclipse.pde.internal.ui.IHelpContextIds;
14 import org.eclipse.pde.internal.ui.PDEUIMessages;
15 import org.eclipse.pde.internal.ui.editor.PDEFormEditor;
16 import org.eclipse.pde.internal.ui.editor.PDEFormPage;
17 import org.eclipse.pde.internal.ui.editor.text.ColorManager;
18 import org.eclipse.pde.internal.ui.editor.text.IColorManager;
19 import org.eclipse.swt.layout.GridData;
20 import org.eclipse.swt.layout.GridLayout;
21 import org.eclipse.ui.PlatformUI;
22 import org.eclipse.ui.forms.IManagedForm;
23 import org.eclipse.ui.forms.widgets.ScrolledForm;
24
25 public class SchemaDocPage extends PDEFormPage {
26     
27     public static final String JavaDoc PAGE_ID = "doc"; //$NON-NLS-1$
28
private IColorManager colorManager = ColorManager.getDefault();
29     private DocSection docSection;
30     public SchemaDocPage(PDEFormEditor editor) {
31         super(editor, PAGE_ID, PDEUIMessages.SchemaEditor_DocPage_title);
32     }
33     
34     /**
35      * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#becomesInvisible(IFormPage)
36      */

37     public void setActive(boolean active) {
38         if (!active)
39             getManagedForm().commit(false);
40         super.setActive(active);
41     }
42     protected void createFormContent(IManagedForm managedForm) {
43         super.createFormContent(managedForm);
44         ScrolledForm form = managedForm.getForm();
45         GridLayout layout = new GridLayout();
46         layout.marginWidth = 10;
47         layout.horizontalSpacing=15;
48         //layout.setMarginWidth
49
form.getBody().setLayout(layout);
50
51         GridData gd;
52
53         docSection = new DocSection(this, form.getBody(), colorManager);
54         gd = new GridData(GridData.FILL_BOTH);
55         docSection.getSection().setLayoutData(gd);
56
57         managedForm.addPart(docSection);
58         
59         PlatformUI.getWorkbench().getHelpSystem().setHelp(form.getBody(), IHelpContextIds.SCHEMA_EDITOR_DOC);
60         form.setText(PDEUIMessages.SchemaEditor_DocForm_title);
61     }
62     
63     public void dispose() {
64         colorManager.dispose();
65         super.dispose();
66     }
67
68     public void updateEditorInput(Object JavaDoc obj) {
69         docSection.updateEditorInput(obj);
70     }
71
72     public boolean selectReveal(Object JavaDoc object) {
73         docSection.checkForPendingChanges();
74         return super.selectReveal(object);
75     }
76     
77 }
78
Popular Tags