X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=demo%2Fplugins%2Forg.argeo.demo.i18n%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fdemo%2Fi18n%2Feditors%2FMultiSectionPage.java;fp=demo%2Fplugins%2Forg.argeo.demo.i18n%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fdemo%2Fi18n%2Feditors%2FMultiSectionPage.java;h=0000000000000000000000000000000000000000;hb=720a273bacf7f64e9a3ac46449614a64b6da7c17;hp=8f8addf18fb69dc6d7f255f233719541b4b81900;hpb=c1742bece3a0d15600aa9212f3a07df9be1d70d2;p=lgpl%2Fargeo-commons.git diff --git a/demo/plugins/org.argeo.demo.i18n/src/main/java/org/argeo/demo/i18n/editors/MultiSectionPage.java b/demo/plugins/org.argeo.demo.i18n/src/main/java/org/argeo/demo/i18n/editors/MultiSectionPage.java deleted file mode 100644 index 8f8addf18..000000000 --- a/demo/plugins/org.argeo.demo.i18n/src/main/java/org/argeo/demo/i18n/editors/MultiSectionPage.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.demo.i18n.editors; - -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.editor.FormEditor; -import org.eclipse.ui.forms.editor.FormPage; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.ScrolledForm; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.ui.forms.widgets.TableWrapData; - -/** - * Offers two main sections : one to display a text area with a summary of all - * variations between a version and its predecessor and one tree view that - * enable browsing - * */ -public class MultiSectionPage extends FormPage { - // private final static Log log = LogFactory.getLog(MultiSectionPage.class); - - // this page UI components - private FormToolkit tk; - - public MultiSectionPage(FormEditor editor, String title) { - super(editor, "MultiSectionPage", title); - } - - protected void createFormContent(IManagedForm managedForm) { - ScrolledForm form = managedForm.getForm(); - tk = managedForm.getToolkit(); - GridLayout twt = new GridLayout(1, false); - twt.marginWidth = twt.marginHeight = 5; - Composite body = form.getBody(); - body.setLayout(twt); - - createDetailsSection(form.getBody()); - createDescriptionSection(form.getBody()); - } - - 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().MultiSectionPage_DescriptionSectionTitle); - - // Section Body - Composite body = tk.createComposite(section, SWT.FILL); - // WARNING : 2 following lines are compulsory or body won't be - // displayed. - body.setLayout(new GridLayout()); - section.setClient(body); - - 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 createDetailsSection(Composite parent) { - - // Section Layout - Section section = tk.createSection(parent, Section.TWISTIE); - section.setLayoutData(new GridData(TableWrapData.FILL_GRAB)); - GridLayout gd = new GridLayout(); - section.setLayout(gd); - - // Set title of the section - section.setText(I18nDemoMessages.get().MultiSectionPage_DetailsSectionTitle); - - final Text styledText = tk.createText(section, "", SWT.FULL_SELECTION - | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); - styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - styledText.setEditable(false); - styledText - .setText(I18nDemoMessages.get().MultiSectionPage_DescriptionSectionTxt); - section.setExpanded(false); - - section.setClient(styledText); - - AbstractFormPart part = new AbstractFormPart() { - public void commit(boolean onSave) { - } - - public void refresh() { - super.refresh(); - } - }; - getManagedForm().addPart(part); - } - - @Override - public void setActive(boolean active) { - super.setActive(active); - } -}