1 package org
.argeo
.demo
.i18n
.editors
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
5 import org
.argeo
.demo
.i18n
.I18nDemoMessages
;
6 import org
.eclipse
.swt
.SWT
;
7 import org
.eclipse
.swt
.layout
.GridData
;
8 import org
.eclipse
.swt
.layout
.GridLayout
;
9 import org
.eclipse
.swt
.widgets
.Composite
;
10 import org
.eclipse
.swt
.widgets
.Text
;
11 import org
.eclipse
.ui
.forms
.AbstractFormPart
;
12 import org
.eclipse
.ui
.forms
.IManagedForm
;
13 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
14 import org
.eclipse
.ui
.forms
.editor
.FormPage
;
15 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
16 import org
.eclipse
.ui
.forms
.widgets
.ScrolledForm
;
17 import org
.eclipse
.ui
.forms
.widgets
.Section
;
18 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
22 * Offers two main sections : one to display a text area with a summary of all
23 * variations between a version and its predecessor and one tree view that
26 public class MultiSectionPage
extends FormPage
{
27 private final static Log log
= LogFactory
.getLog(MultiSectionPage
.class);
29 // this page UI components
30 private FormToolkit tk
;
32 public MultiSectionPage(FormEditor editor
, String title
) {
33 super(editor
, "MultiSectionPage", title
);
36 protected void createFormContent(IManagedForm managedForm
) {
37 ScrolledForm form
= managedForm
.getForm();
38 tk
= managedForm
.getToolkit();
39 GridLayout twt
= new GridLayout(1, false);
40 twt
.marginWidth
= twt
.marginHeight
= 5;
41 Composite body
= form
.getBody();
44 createHistorySection(form
.getBody());
45 createTreeSection(form
.getBody());
48 protected void createTreeSection(Composite parent
) {
49 // Section Layout & MetaData
50 Section section
= tk
.createSection(parent
, Section
.TWISTIE
);
51 section
.setLayoutData(new GridData(GridData
.FILL_BOTH
));
52 section
.setText(I18nDemoMessages
.get().MultiSelectionPage_DescriptionSectionTitle
);
55 Composite body
= tk
.createComposite(section
, SWT
.FILL
);
56 // WARNING : 2 following lines are compulsory or body won't be
58 body
.setLayout(new GridLayout());
59 section
.setClient(body
);
61 body
.setLayoutData(new GridData(GridData
.FILL_BOTH
));
62 section
.setExpanded(true);
65 protected void createHistorySection(Composite parent
) {
68 Section section
= tk
.createSection(parent
, Section
.TWISTIE
);
69 section
.setLayoutData(new GridData(TableWrapData
.FILL_GRAB
));
70 TableWrapLayout twt
= new TableWrapLayout();
71 section
.setLayout(twt
);
73 // Set title of the section
74 section
.setText(I18nDemoMessages
.get().MultiSelectionPage_DetailsSectionTitle
);
76 final Text styledText
= tk
.createText(section
, "", SWT
.FULL_SELECTION
77 | SWT
.BORDER
| SWT
.MULTI
| SWT
.WRAP
| SWT
.V_SCROLL
);
78 styledText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
79 section
.setClient(styledText
);
80 styledText
.setEditable(false);
81 section
.setExpanded(false);
83 AbstractFormPart part
= new AbstractFormPart() {
84 public void commit(boolean onSave
) {
87 public void refresh() {
91 getManagedForm().addPart(part
);
95 public void setActive(boolean active
) {
96 super.setActive(active
);