Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: eef92411656514c77af43cccdc42c2e075519ecf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*******************************************************************************
 * Copyright (c) 2005, 2013 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.externaltools.internal.ui;

import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

/**
 * Dialog to alter the triggers of an ICommand that represents a builder.
 */
public class EditCommandDialog extends Dialog {

	private Button fFullButton;
	private Button fIncrementalButton;
	private Button fAutoButton;
	private Button fCleanButton;

	private ICommand fCommand;

	public EditCommandDialog(Shell parentShell, ICommand command) {
		super(parentShell);
		fCommand= command;
	}

	@Override
	protected Control createDialogArea(Composite parent) {

		getShell().setText(ExternalToolsUIMessages.EditCommandDialog_0);
		Composite composite = (Composite)super.createDialogArea(parent);

		Label label= new Label(composite, SWT.NONE);
		label.setText(ExternalToolsUIMessages.EditCommandDialog_1);

		fFullButton = new Button(composite, SWT.CHECK);
		fFullButton.setText(ExternalToolsUIMessages.EditCommandDialog_2);
		fFullButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD));
		fIncrementalButton = new Button(composite, SWT.CHECK);
		fIncrementalButton.setText(ExternalToolsUIMessages.EditCommandDialog_3);
		fIncrementalButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD));
		fAutoButton = new Button(composite, SWT.CHECK);
		fAutoButton.setText(ExternalToolsUIMessages.EditCommandDialog_4);
		fAutoButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD));

		fCleanButton = new Button(composite, SWT.CHECK);
		fCleanButton.setText(ExternalToolsUIMessages.EditCommandDialog_5);
		fCleanButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD));
		applyDialogFont(composite);
		return composite;
	}

	@Override
	protected void okPressed() {
		fCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, fFullButton.getSelection());
		fCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, fIncrementalButton.getSelection());
		fCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, fAutoButton.getSelection());
		fCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, fCleanButton.getSelection());

		super.okPressed();
	}
}

Back to the top