1 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 PAGE_ID = "doc"; 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 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 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 obj) { 69 docSection.updateEditorInput(obj); 70 } 71 72 public boolean selectReveal(Object object) { 73 docSection.checkForPendingChanges(); 74 return super.selectReveal(object); 75 } 76 77 } 78 | Popular Tags |