package org.argeo.demo.i18n.editors;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.demo.i18n.I18nDemoMessages;
+import org.argeo.demo.i18n.I18nDemoPlugin;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.AbstractFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
/**
* Offers two main sections : one to display a text area with a summary of all
* enable browsing
* */
public class MultiSectionPage extends FormPage {
- private final static Log log = LogFactory.getLog(MultiSectionPage.class);
+ // private final static Log log = LogFactory.getLog(MultiSectionPage.class);
// this page UI components
private FormToolkit tk;
Composite body = form.getBody();
body.setLayout(twt);
- createHistorySection(form.getBody());
- createTreeSection(form.getBody());
+ createDetailsSection(form.getBody());
+ createDescriptionSection(form.getBody());
}
- protected void createTreeSection(Composite parent) {
+ protected void createDescriptionSection(Composite parent) {
// Section Layout & MetaData
Section section = tk.createSection(parent, Section.TWISTIE);
section.setLayoutData(new GridData(GridData.FILL_BOTH));
- section.setText(I18nDemoMessages.get().MultiSelectionPage_DescriptionSectionTitle);
+ section.setText(I18nDemoMessages.get().MultiSectionPage_DescriptionSectionTitle);
// Section Body
Composite body = tk.createComposite(section, SWT.FILL);
body.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setExpanded(true);
+
+ // button line
+ Button b1 = new Button(body, SWT.PUSH | SWT.FILL);
+ b1.setText(I18nDemoMessages.get().MultiSectionPage_Btn1Lbl);
+ Button b2 = new Button(body, SWT.PUSH | SWT.FILL);
+ b2.setText(I18nDemoMessages.get().MultiSectionPage_Btn2Lbl);
+ Button b3 = new Button(body, SWT.PUSH | SWT.FILL);
+ b3.setText(I18nDemoMessages.get().MultiSectionPage_Btn3Lbl);
+
+ addAListener(b1);
+ addAListener(b2);
+ addAListener(b3);
+ }
+
+ private void addAListener(Button b) {
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MessageBox mb = new MessageBox(I18nDemoPlugin.getDefault()
+ .getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.OK);
+ // Title
+ mb.setText(I18nDemoMessages.get().MultiSectionPage_PopupTitle);
+ // Message
+ mb.setMessage(I18nDemoMessages.get().MultiSectionPage_PopupText);
+ mb.open();
+ }
+ });
}
- protected void createHistorySection(Composite parent) {
+ protected void createDetailsSection(Composite parent) {
// Section Layout
Section section = tk.createSection(parent, Section.TWISTIE);
section.setLayoutData(new GridData(TableWrapData.FILL_GRAB));
- TableWrapLayout twt = new TableWrapLayout();
- section.setLayout(twt);
+ GridLayout gd = new GridLayout();
+ section.setLayout(gd);
// Set title of the section
- section.setText(I18nDemoMessages.get().MultiSelectionPage_DetailsSectionTitle);
+ section.setText(I18nDemoMessages.get().MultiSectionPage_DetailsSectionTitle);
final Text styledText = tk.createText(section, "", SWT.FULL_SELECTION
- | SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- section.setClient(styledText);
styledText.setEditable(false);
+ styledText
+ .setText(I18nDemoMessages.get().MultiSectionPage_DescriptionSectionTxt);
section.setExpanded(false);
+ section.setClient(styledText);
+
AbstractFormPart part = new AbstractFormPart() {
public void commit(boolean onSave) {
}