]>
git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/editors/RunInOsgiPage.java
1 package org
.argeo
.slc
.client
.ui
.dist
.editors
;
5 import org
.argeo
.slc
.SlcException
;
6 import org
.argeo
.slc
.SlcNames
;
7 import org
.eclipse
.swt
.SWT
;
8 import org
.eclipse
.swt
.events
.SelectionAdapter
;
9 import org
.eclipse
.swt
.events
.SelectionEvent
;
10 import org
.eclipse
.swt
.layout
.GridData
;
11 import org
.eclipse
.swt
.layout
.GridLayout
;
12 import org
.eclipse
.swt
.widgets
.Button
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Text
;
15 import org
.eclipse
.ui
.forms
.IManagedForm
;
16 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
17 import org
.eclipse
.ui
.forms
.editor
.FormPage
;
18 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
19 import org
.eclipse
.ui
.forms
.widgets
.ScrolledForm
;
22 * Enable launch of the current distribution in a separate osgi run time.
23 * Display also a console to interract with the launched runtime
25 public class RunInOsgiPage
extends FormPage
implements SlcNames
{
27 final static String PAGE_ID
= "RunInOsgiPage";
30 private Node modularDistribution
;
33 private Button launchBtn
;
34 private Text consoleTxt
;
36 private FormToolkit tk
;
38 public RunInOsgiPage(FormEditor formEditor
, String title
,
39 Node modularDistribution
) {
40 super(formEditor
, PAGE_ID
, title
);
41 this.modularDistribution
= modularDistribution
;
45 protected void createFormContent(IManagedForm managedForm
) {
46 ScrolledForm form
= managedForm
.getForm();
47 tk
= managedForm
.getToolkit();
49 Composite body
= form
.getBody();
50 GridLayout layout
= new GridLayout();
51 layout
.marginTop
= layout
.marginWidth
= 0;
52 body
.setLayout(layout
);
55 Composite header
= tk
.createComposite(body
);
56 header
.setLayoutData(new GridData(SWT
.FILL
, SWT
.TOP
, true, false));
57 createHeaderPart(header
);
60 Composite console
= tk
.createComposite(body
);
61 console
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
62 createConsolePart(console
);
66 private void createHeaderPart(Composite parent
) {
67 GridLayout layout
= new GridLayout();
68 parent
.setLayout(layout
);
70 // Text Area to filter
71 launchBtn
= tk
.createButton(parent
, " Launch ", SWT
.PUSH
);
72 launchBtn
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.TOP
, true, false));
74 launchBtn
.addSelectionListener(new SelectionAdapter() {
75 private static final long serialVersionUID
= -1633658484882130602L;
78 public void widgetSelected(SelectionEvent e
) {
79 super.widgetSelected(e
);
80 throw new SlcException("Implement this");
85 private void createConsolePart(Composite parent
) {
86 parent
.setLayout(new GridLayout());
87 consoleTxt
= tk
.createText(parent
, "OSGi > ", SWT
.MULTI
| SWT
.WRAP
89 consoleTxt
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
93 public void setFocus() {