KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > externaltools > internal > ui > EditCommandDialog


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.externaltools.internal.ui;
12
13 import org.eclipse.core.resources.ICommand;
14 import org.eclipse.core.resources.IncrementalProjectBuilder;
15 import org.eclipse.jface.dialogs.Dialog;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.widgets.Button;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.swt.widgets.Control;
20 import org.eclipse.swt.widgets.Label;
21 import org.eclipse.swt.widgets.Shell;
22
23 /**
24  * Dialog to alter the triggers of an ICommand that represents a builder.
25  */

26 public class EditCommandDialog extends Dialog {
27
28     private Button fFullButton;
29     private Button fIncrementalButton;
30     private Button fAutoButton;
31     private Button fCleanButton;
32     
33     private ICommand fCommand;
34     
35     public EditCommandDialog(Shell parentShell, ICommand command) {
36         super(parentShell);
37         fCommand= command;
38     }
39     
40     /* (non-Javadoc)
41      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
42      */

43     protected Control createDialogArea(Composite parent) {
44         
45         getShell().setText(ExternalToolsUIMessages.EditCommandDialog_0);
46         Composite composite = (Composite)super.createDialogArea(parent);
47         
48         Label label= new Label(composite, SWT.NONE);
49         label.setText(ExternalToolsUIMessages.EditCommandDialog_1);
50         
51         fFullButton = new Button(composite, SWT.CHECK);
52         fFullButton.setText(ExternalToolsUIMessages.EditCommandDialog_2);
53         fFullButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD));
54         fIncrementalButton = new Button(composite, SWT.CHECK);
55         fIncrementalButton.setText(ExternalToolsUIMessages.EditCommandDialog_3);
56         fIncrementalButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD));
57         fAutoButton = new Button(composite, SWT.CHECK);
58         fAutoButton.setText(ExternalToolsUIMessages.EditCommandDialog_4);
59         fAutoButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD));
60         
61         fCleanButton = new Button(composite, SWT.CHECK);
62         fCleanButton.setText(ExternalToolsUIMessages.EditCommandDialog_5);
63         fCleanButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD));
64         applyDialogFont(composite);
65         return composite;
66     }
67     
68     /* (non-Javadoc)
69      * @see org.eclipse.jface.dialogs.Dialog#okPressed()
70      */

71     protected void okPressed() {
72         fCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, fFullButton.getSelection());
73         fCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, fIncrementalButton.getSelection());
74         fCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, fAutoButton.getSelection());
75         fCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, fCleanButton.getSelection());
76         
77         super.okPressed();
78     }
79 }
80
Popular Tags