Skip to main content
summaryrefslogtreecommitdiffstats
blob: 06cc57808d7875877a756ee5c610ac2979892265 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*******************************************************************************
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.bugzilla.ui.tasklist;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
 * @author Shawn Minto
 * @author Mik Kersten
 */
public class BugzillaCustomQueryDialog extends Dialog {
	private String url;

	private String name = ""; //$NON-NLS-1$

	private String startingUrl = null;

	private String maxHits;

	private Text maxHitsText;

	private Text nameText;

	private Text queryText;

	public BugzillaCustomQueryDialog(Shell parentShell, String queryString, String description, String maxHits) {
		super(parentShell);
		this.startingUrl = queryString;
		this.maxHits = maxHits;
		this.name = description;
	}

	public String getName() {
		return name;
	}

	public String getUrl() {
		return url;
	}

	public String getMaxHits() {
		return maxHits;
	}

	@Override
	protected Control createContents(Composite parent) {
		Composite custom = new Composite(parent, SWT.NONE);
		GridLayout gl = new GridLayout(2, false);
		custom.setLayout(gl);

		Label l = new Label(custom, SWT.NONE);
		l.setText(Messages.BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name);

		nameText = new Text(custom, SWT.BORDER | SWT.SINGLE);
		if (name != null) {
			nameText.setText(name);
		}
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.widthHint = 300;
		nameText.setLayoutData(gd);

		l = new Label(custom, SWT.NONE);
		l.setText(Messages.BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_);

		maxHitsText = new Text(custom, SWT.BORDER | SWT.SINGLE);
		if (maxHits != null) {
			maxHitsText.setText(maxHits);
		}
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.widthHint = 300;
		maxHitsText.setLayoutData(gd);

		l = new Label(custom, SWT.NONE);
		l.setText(Messages.BugzillaCustomQueryDialog_Query_URL);

		queryText = new Text(custom, SWT.BORDER | SWT.SINGLE);
		if (startingUrl != null) {
			queryText.setText(startingUrl);
		}
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.widthHint = 300;
		queryText.setLayoutData(gd);

		Control c = super.createContents(parent);

		return c;
	}

	@Override
	protected void okPressed() {
		// TODO validate the values
		url = queryText.getText();
		name = nameText.getText();
		maxHits = maxHitsText.getText();
		super.okPressed();
	}

}

Back to the top