]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/editors/RunInOsgiPage.java
37241b72a1b99eb7fd6a9edf7fb6490b71727222
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.dist
.editors
;
18 import javax
.jcr
.Node
;
20 import org
.argeo
.slc
.SlcException
;
21 import org
.argeo
.slc
.jcr
.SlcNames
;
22 import org
.eclipse
.swt
.SWT
;
23 import org
.eclipse
.swt
.events
.SelectionAdapter
;
24 import org
.eclipse
.swt
.events
.SelectionEvent
;
25 import org
.eclipse
.swt
.layout
.GridData
;
26 import org
.eclipse
.swt
.layout
.GridLayout
;
27 import org
.eclipse
.swt
.widgets
.Button
;
28 import org
.eclipse
.swt
.widgets
.Composite
;
29 import org
.eclipse
.swt
.widgets
.Text
;
30 import org
.eclipse
.ui
.forms
.IManagedForm
;
31 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
32 import org
.eclipse
.ui
.forms
.editor
.FormPage
;
33 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
34 import org
.eclipse
.ui
.forms
.widgets
.ScrolledForm
;
37 * Enable launch of the current distribution in a separate osgi run time.
38 * Display also a console to interract with the launched runtime
40 public class RunInOsgiPage
extends FormPage
implements SlcNames
{
42 final static String PAGE_ID
= "RunInOsgiPage";
45 private Node modularDistribution
;
48 private Button launchBtn
;
49 private Text consoleTxt
;
51 private FormToolkit tk
;
53 public RunInOsgiPage(FormEditor formEditor
, String title
,
54 Node modularDistribution
) {
55 super(formEditor
, PAGE_ID
, title
);
56 this.modularDistribution
= modularDistribution
;
60 protected void createFormContent(IManagedForm managedForm
) {
61 ScrolledForm form
= managedForm
.getForm();
62 tk
= managedForm
.getToolkit();
64 Composite body
= form
.getBody();
65 GridLayout layout
= new GridLayout();
66 layout
.marginTop
= layout
.marginWidth
= 0;
67 body
.setLayout(layout
);
70 Composite header
= tk
.createComposite(body
);
71 header
.setLayoutData(new GridData(SWT
.FILL
, SWT
.TOP
, true, false));
72 createHeaderPart(header
);
75 Composite console
= tk
.createComposite(body
);
76 console
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
77 createConsolePart(console
);
81 private void createHeaderPart(Composite parent
) {
82 GridLayout layout
= new GridLayout();
83 parent
.setLayout(layout
);
85 // Text Area to filter
86 launchBtn
= tk
.createButton(parent
, " Launch ", SWT
.PUSH
);
87 launchBtn
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.TOP
, true, false));
89 launchBtn
.addSelectionListener(new SelectionAdapter() {
91 public void widgetSelected(SelectionEvent e
) {
92 super.widgetSelected(e
);
93 throw new SlcException("Implement this");
98 private void createConsolePart(Composite parent
) {
99 parent
.setLayout(new GridLayout());
100 consoleTxt
= tk
.createText(parent
, "OSGi > ", SWT
.MULTI
| SWT
.WRAP
102 consoleTxt
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
106 public void setFocus() {
107 launchBtn
.setFocus();