44 *
55 * This program and the accompanying materials are made available under
66 * the terms of the Eclipse Public License v1.0 which accompanies this
7- * distribution, and is available at
8- * http://www.eclipse.org/legal/epl-v10.html
7+ * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
98 */
109
1110package com .maccasoft .propeller ;
@@ -59,6 +58,8 @@ public class ExternalToolDialog extends Dialog {
5958 Text program ;
6059 Text arguments ;
6160 Map <String , Button > editorAction ;
61+ Button showConsole ;
62+ Button runInBackground ;
6263
6364 ExternalTool externalTool ;
6465
@@ -211,12 +212,42 @@ protected Control createDialogArea(Composite parent) {
211212 name .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
212213 name .addFocusListener (textFocusListener );
213214
214- label = new Label (composite , SWT .NONE );
215- label .setText ("Program" );
216- label = new Label (composite , SWT .NONE );
217- label .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
215+ createExecutableGroup (composite );
216+ createArgumentsGroup (composite );
217+ createSettingsGroup (composite );
218218
219- Composite programGroup = new Composite (composite , SWT .NONE );
219+ if (externalTool == null ) {
220+ externalTool = new ExternalTool ();
221+ }
222+ name .setText (externalTool .getName ());
223+ program .setText (externalTool .getProgram ());
224+ arguments .setText (externalTool .getArguments ());
225+ runInBackground .setSelection (externalTool .isRunInBackground ());
226+ showConsole .setSelection (externalTool .isShowConsole ());
227+
228+ Button button = editorAction .get (externalTool .getEditorAction ());
229+ if (button != null ) {
230+ button .setSelection (true );
231+ }
232+
233+ name .addModifyListener (textModifyListener );
234+ program .addModifyListener (textModifyListener );
235+ arguments .addModifyListener (textModifyListener );
236+
237+ return composite ;
238+ }
239+
240+ void createExecutableGroup (Composite parent ) {
241+ Composite container = new Composite (parent , SWT .NONE );
242+ container .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 2 , 1 ));
243+ GridLayout layout = new GridLayout (1 , false );
244+ layout .marginWidth = layout .marginHeight = 0 ;
245+ container .setLayout (layout );
246+
247+ Label label = new Label (container , SWT .NONE );
248+ label .setText ("Executable" );
249+
250+ Composite programGroup = new Composite (container , SWT .NONE );
220251 layout = new GridLayout (2 , false );
221252 layout .marginWidth = layout .marginHeight = 0 ;
222253 programGroup .setLayout (layout );
@@ -249,14 +280,20 @@ public void widgetSelected(SelectionEvent e) {
249280 }
250281
251282 });
283+ }
252284
253- label = new Label (composite , SWT .NONE );
285+ void createArgumentsGroup (Composite parent ) {
286+ Composite container = new Composite (parent , SWT .NONE );
287+ container .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 2 , 1 ));
288+ GridLayout layout = new GridLayout (1 , false );
289+ layout .marginWidth = layout .marginHeight = 0 ;
290+ container .setLayout (layout );
291+
292+ Label label = new Label (container , SWT .NONE );
254293 label .setText ("Arguments" );
255- label = new Label (composite , SWT .NONE );
256- label .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
257294
258- Composite argumentsGroup = new Composite (composite , SWT .NONE );
259- argumentsGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 2 , 1 ));
295+ Composite argumentsGroup = new Composite (container , SWT .NONE );
296+ argumentsGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
260297 layout = new GridLayout (1 , false );
261298 layout .marginWidth = layout .marginHeight = 0 ;
262299 layout .verticalSpacing = 0 ;
@@ -291,12 +328,20 @@ public void widgetSelected(SelectionEvent e) {
291328 adapter .setPropagateKeys (true );
292329 adapter .setAutoActivationDelay (500 );
293330 adapter .setProposalAcceptanceStyle (ContentProposalAdapter .PROPOSAL_REPLACE );
331+ }
294332
295- label = new Label (composite , SWT .NONE );
296- label .setText ("Auto-save Editor" );
333+ void createSettingsGroup (Composite parent ) {
334+ Composite container = new Composite (parent , SWT .NONE );
335+ container .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 2 , 1 ));
336+ GridLayout layout = new GridLayout (2 , false );
337+ layout .marginWidth = layout .marginHeight = 0 ;
338+ container .setLayout (layout );
339+
340+ Label label = new Label (container , SWT .NONE );
341+ label .setText ("Check editor state" );
297342 label .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false ));
298343
299- Composite radioGroup = new Composite (composite , SWT .NONE );
344+ Composite radioGroup = new Composite (container , SWT .NONE );
300345 radioGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false ));
301346 layout = new GridLayout (3 , false );
302347 layout .marginWidth = layout .marginHeight = 0 ;
@@ -305,37 +350,27 @@ public void widgetSelected(SelectionEvent e) {
305350 editorAction = new HashMap <>();
306351
307352 Button button = new Button (radioGroup , SWT .RADIO );
308- button .setText ("Yes" );
309- button .setLayoutData (new GridData (SWT .BEGINNING , SWT .CENTER , false , false ));
310- editorAction .put (ExternalTool .EDITOR_AUTOSAVE , button );
311-
312- button = new Button (radioGroup , SWT .RADIO );
313- button .setText ("No" );
353+ button .setText ("None" );
314354 button .setLayoutData (new GridData (SWT .BEGINNING , SWT .CENTER , false , false ));
315355 editorAction .put (ExternalTool .EDITOR_NONE , button );
316356
317357 button = new Button (radioGroup , SWT .RADIO );
318- button .setText ("Ask " );
358+ button .setText ("Warn unsaved " );
319359 button .setLayoutData (new GridData (SWT .BEGINNING , SWT .CENTER , false , false ));
320360 editorAction .put (ExternalTool .EDITOR_WARN_UNSAVED , button );
321361
322- if (externalTool == null ) {
323- externalTool = new ExternalTool ();
324- }
325- name .setText (externalTool .getName ());
326- program .setText (externalTool .getProgram ());
327- arguments .setText (externalTool .getArguments ());
328-
329- button = editorAction .get (externalTool .getEditorAction ());
330- if (button != null ) {
331- button .setSelection (true );
332- }
362+ button = new Button (radioGroup , SWT .RADIO );
363+ button .setText ("Auto-save" );
364+ button .setLayoutData (new GridData (SWT .BEGINNING , SWT .CENTER , false , false ));
365+ editorAction .put (ExternalTool .EDITOR_AUTOSAVE , button );
333366
334- name . addModifyListener ( textModifyListener );
335- program . addModifyListener ( textModifyListener );
336- arguments . addModifyListener ( textModifyListener );
367+ new Label ( container , SWT . NONE );
368+ runInBackground = new Button ( container , SWT . CHECK );
369+ runInBackground . setText ( "Run in Background" );
337370
338- return composite ;
371+ new Label (container , SWT .NONE );
372+ showConsole = new Button (container , SWT .CHECK );
373+ showConsole .setText ("Show Console when Run" );
339374 }
340375
341376 @ Override
@@ -375,6 +410,8 @@ protected void okPressed() {
375410 break ;
376411 }
377412 }
413+ externalTool .setRunInBackground (runInBackground .getSelection ());
414+ externalTool .setShowConsole (showConsole .getSelection ());
378415 super .okPressed ();
379416 }
380417
0 commit comments