17 package com.generalrobotix.ui.util;
19 import org.eclipse.jface.dialogs.MessageDialog;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.events.SelectionEvent;
22 import org.eclipse.swt.events.SelectionListener;
23 import org.eclipse.swt.events.ModifyEvent;
24 import org.eclipse.swt.events.ModifyListener;
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.FileDialog;
30 import org.eclipse.swt.widgets.Label;
31 import org.eclipse.swt.widgets.Text;
32 import org.eclipse.swt.widgets.TabFolder;
33 import org.eclipse.osgi.util.NLS;
70 pluginManager_ = pluginManager;
71 serverManager_ = manager;
73 Composite localPanel =
this;
74 localPanel.setLayoutData(
new GridData(GridData.HORIZONTAL_ALIGN_FILL |
75 GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
77 GridLayout localGridLayout =
new GridLayout(4,
false);
79 localGridLayout.marginLeft = 0;
80 localGridLayout.horizontalSpacing = 0;
81 localPanel.setLayout(localGridLayout);
83 Label localLabelPath =
new Label(localPanel, SWT.RIGHT);
84 localLabelPath.setText(
MessageBundle.
get(
"GrxServerManagerPanel.label.path"));
85 GridData labelPathGridData =
new GridData();
88 pathText_ =
new Text(localPanel, SWT.BORDER);
89 GridData pathGridData =
new GridData(GridData.FILL_HORIZONTAL);
93 pathText_.addModifyListener(
new ModifyListener() {
94 public void modifyText(ModifyEvent e){
95 pathStr_ =
new String( pathText_.getText().trim());
99 Button localRefButton =
new Button(localPanel, SWT.PUSH);
100 localRefButton.setText(
"...");
101 GridData refbtnGridData =
new GridData();
105 restartButton_ =
new Button(localPanel, SWT.PUSH);
106 restartButton_.setText(RESTART_);
107 GridData rstbtnGridData =
new GridData();
111 Label localLabelArgs =
new Label(localPanel, SWT.RIGHT);
112 localLabelArgs.setText(
MessageBundle.
get(
"GrxServerManagerPanel.label.args"));
113 GridData labelArgsGridData =
new GridData();
116 argsText_ =
new Text(localPanel, SWT.BORDER);
117 GridData argsGridData =
new GridData(GridData.FILL_HORIZONTAL);
119 argsText_.setText(processInfo_.
args);
120 argsStr_ = processInfo_.
args;
121 argsText_.addModifyListener(
new ModifyListener() {
122 public void modifyText(ModifyEvent e){
123 argsStr_ =
new String(argsText_.getText().trim());
127 toggleButton_ =
new Button(localPanel, SWT.PUSH);
131 toggleButton_.setText(STOP_);
132 restartButton_.setVisible(
true);
134 toggleButton_.setText(START_);
135 restartButton_.setVisible(
false);
138 localRefButton.addSelectionListener(
new SelectionListener() {
139 public void widgetDefaultSelected(SelectionEvent e) {}
141 public void widgetSelected(SelectionEvent e) {
146 toggleButton_.addSelectionListener(
new SelectionListener() {
147 public void widgetDefaultSelected(SelectionEvent e) {}
149 public void widgetSelected(SelectionEvent e) {
154 restartButton_.addSelectionListener(
new SelectionListener() {
155 public void widgetDefaultSelected(SelectionEvent e) {}
157 public void widgetSelected(SelectionEvent e) {
162 GridData btnGridData =
new GridData();
165 btnGridData.horizontalAlignment = SWT.END;
166 btnGridData.horizontalSpan = 2;
168 Label localLabelAuto =
new Label(localPanel, SWT.RIGHT | SWT.FILL);
169 localLabelAuto.setText(
MessageBundle.
get(
"GrxServerManagerPanel.label.start"));
170 GridData labelAutoGridData =
new GridData(GridData.FILL_HORIZONTAL);
171 labelAutoGridData.horizontalSpan = 2;
172 labelAutoGridData.widthHint = LABEL_LENGTH_ +
TEXT_LENGTH_;
174 autoChkBox_ =
new Button(localPanel, SWT.CHECK);
175 GridData chkbtnGridData =
new GridData();
177 autoChkBox_.setSelection(processInfo_.
autoStart);
179 autoChkBox_.addSelectionListener(
new SelectionListener() {
180 public void widgetDefaultSelected(SelectionEvent e){}
182 public void widgetSelected(SelectionEvent e){
183 bAuto_ = autoChkBox_.getSelection();
187 Label localLabelUseORB =
new Label(localPanel, SWT.RIGHT | SWT.FILL);
188 localLabelUseORB.setText(
MessageBundle.
get(
"GrxServerManagerPanel.label.useeRef"));
189 GridData labelUseORBGridData =
new GridData(GridData.FILL_HORIZONTAL);
190 labelUseORBGridData.horizontalSpan = 2;
191 labelUseORBGridData.widthHint = LABEL_LENGTH_ +
TEXT_LENGTH_;
193 useORBChkBox_ =
new Button(localPanel, SWT.CHECK);
194 GridData UseORBchkbtnGridData =
new GridData();
196 useORBChkBox_.setSelection(processInfo_.
useORB);
197 bUseORB_ = processInfo_.
useORB;
198 useORBChkBox_.addSelectionListener(
new SelectionListener() {
199 public void widgetDefaultSelected(SelectionEvent e){}
201 public void widgetSelected(SelectionEvent e){
202 bUseORB_ = useORBChkBox_.getSelection();
206 localLabelPath.setLayoutData(labelPathGridData);
207 pathText_.setLayoutData(pathGridData);
208 localRefButton.setLayoutData(refbtnGridData);
209 restartButton_.setLayoutData(rstbtnGridData);
210 localLabelArgs.setLayoutData(labelArgsGridData);
211 argsText_.setLayoutData(argsGridData);
212 toggleButton_.setLayoutData(btnGridData);
213 localLabelAuto.setLayoutData(labelAutoGridData);
214 autoChkBox_.setLayoutData(chkbtnGridData);
215 localLabelUseORB.setLayoutData(labelUseORBGridData);
216 useORBChkBox_.setLayoutData(UseORBchkbtnGridData);
233 String[] filterNames =
new String[] {
MessageBundle.
get(
"GrxServerManagerPanel.filedialog.filterName") };
234 String[] filterExtensions =
new String[] {
"*" };
238 fileDlg.setFilterNames(filterNames);
239 fileDlg.setFilterExtensions(filterExtensions);
241 String strServerName = processInfo_.
id;
242 fileDlg.setText(
MessageBundle.
get(
"GrxServerManagerPanel.filedialog.title") + strServerName);
243 pathText_.setText(fileDlg.open());
248 String mes =
MessageBundle.
get(
"GrxServerManagerPanel.dialog.message.update");
249 mes = NLS.bind(mes,
new String[]{toggleButton_.getText()});
254 MessageBundle.
get(
"GrxServerManagerPanel.dialog.title.update") + toggleButton_.getText(),
260 toggleButton_.setText(STOP_);
261 restartButton_.setVisible(
true);
263 toggleButton_.setText(START_);
264 restartButton_.setVisible(
false);
271 String mes =
MessageBundle.
get(
"GrxServerManagerPanel.dialog.message.restart");
272 String title =
MessageBundle.
get(
"GrxServerManagerPanel.dialog.title.update") + restartButton_.getText();
289 toggleButton_.setText(STOP_);
290 restartButton_.setVisible(
true);
292 toggleButton_.setText(START_);
293 restartButton_.setVisible(
false);
295 this.getShell(),title,
304 toggleButton_.setText(STOP_);
305 restartButton_.setVisible(
true);
307 this.getShell(),title,
314 toggleButton_.setText(START_);
315 restartButton_.setVisible(
false);
317 this.getShell(),title,
322 toggleButton_.setText(STOP_);
323 restartButton_.setVisible(
true);
332 restartFlag_ =
false;
336 toggleButton_.setText(START_);
337 restartButton_.setVisible(
false);
static final String get(String key)
#define null
our own NULL pointer
static final int LOCAL_REF_BUTTON_LENGTH_
static final int TEXT_LENGTH_
static final int LABEL_LENGTH_
boolean toggleProcess(ProcessInfo pInfo)
サーバプログラムの起動トグル
GrxPluginManager pluginManager_
GrxServerManager serverManager_
static Shell getCurrentShell()
GrxServerManagerPanel(GrxServerManager manager, TabFolder parent, int style, int index, GrxPluginManager pluginManager)
static final int BUTTON_LENGTH_
GrxBaseItem getItem(Class<? extends GrxBaseItem > cls, String name)
static final String START_
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
AProcess get(String name)
Vector< ProcessInfo > getServerInfo()
vecServerInfoの取得
static final String RESTART_
static final String STOP_
static final int HORIZON_INDENT_