19 package com.generalrobotix.ui.util;
21 import org.eclipse.swt.SWT;
22 import org.eclipse.swt.events.SelectionEvent;
23 import org.eclipse.swt.events.SelectionListener;
24 import org.eclipse.swt.layout.GridData;
25 import org.eclipse.swt.layout.GridLayout;
26 import org.eclipse.swt.widgets.Button;
27 import org.eclipse.swt.widgets.Composite;
28 import org.eclipse.swt.widgets.Label;
29 import org.eclipse.swt.widgets.MessageBox;
30 import org.eclipse.swt.widgets.Text;
32 @SuppressWarnings(
"serial")
34 private MessageBox dialog_ =
null;
36 private Label labelNs =
null;
37 private Text multiText =
null;
38 private Text textNsHost_ =
null;
39 private Text textNsPort_ =
null;
43 this.setLayout(
new GridLayout(1,
false));
45 Composite northPane =
new Composite(
this, SWT.NONE);
46 northPane.setLayoutData(
new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
47 GridLayout gridLayout =
new GridLayout(5,
false);
48 gridLayout.marginWidth = 5;
49 gridLayout.horizontalSpacing = 5;
50 northPane.setLayout(gridLayout);
52 Button button =
new Button(northPane, SWT.PUSH);
54 GridData btnGridData =
new GridData();
55 btnGridData.widthHint = 80;
56 btnGridData.heightHint = 26;
57 button.setLayoutData(btnGridData);
58 button.addSelectionListener(
new SelectionListener() {
59 public void widgetDefaultSelected(SelectionEvent e) {}
60 public void widgetSelected(SelectionEvent e) {
65 new Label(northPane, SWT.NONE).setText(
MessageBundle.
get(
"GrxORBMonitor.label.host"));
67 textNsHost_ =
new Text(northPane, SWT.SINGLE | SWT.BORDER);
69 GridData textGridData =
new GridData();
70 textGridData.widthHint = 100;
71 textNsHost_.setLayoutData(textGridData);
73 new Label(northPane, SWT.NONE).setText(
MessageBundle.
get(
"GrxORBMonitor.label.port"));
75 textNsPort_ =
new Text(northPane, SWT.SINGLE | SWT.BORDER);
77 textNsPort_.setText(nsPort.toString());
78 textNsPort_.setLayoutData(textGridData);
80 multiText =
new Text(
this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
81 multiText.setEditable(
false);
82 multiText.setLayoutData(
new GridData(GridData.FILL_BOTH));
84 labelNs =
new Label(
this, SWT.SHADOW_NONE);
86 labelNs.setLayoutData(
new GridData(GridData.FILL_HORIZONTAL));
100 if (dialog_ ==
null) {
101 dialog_ =
new MessageBox(
null, SWT.OK);
112 multiText.setText(
"");
117 String nsHost = textNsHost_.getText();
118 String nsPort = textNsPort_.getText();
119 if (nsHost ==
null || nsPort ==
null) {
122 int nsPortInt = Integer.parseInt(nsPort);
123 labelNs.setText(
MessageBundle.
get(
"GrxORBMonitor.label.NSURL1") + nsHost +
":" + nsPort +
"/NameService");
126 multiText.setText(
"");
130 for (
int i = 0;
i < s.length;
i++) {
135 GrxDebugUtil.
println(
"[GrxORBMonitor] " + s[i] +
" is not in " + nsHost +
":" + nsPortInt +
" active");
138 multiText.append(str);
145 return textNsHost_.getText();
149 return textNsPort_.getText();
static final String get(String key)
#define null
our own NULL pointer
static String nsHost()
get hostname where naming server is running
GrxORBMonitor(Composite parent, int style)
static void println(String s)
static int nsPort()
get port number where naming server is listening
static boolean isConnected(org.omg.CORBA.Object obj)
static String [] getObjectNameList()