Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 149605 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylar/internal/jira/ui/wizards/FilterSummaryPage.java (-99 / +633 lines)
Lines 14-19 Link Here
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.Iterator;
15
import java.util.Iterator;
16
import java.util.List;
16
import java.util.List;
17
import org.eclipse.jface.viewers.ComboViewer;
17
18
18
import org.eclipse.jface.viewers.IColorProvider;
19
import org.eclipse.jface.viewers.IColorProvider;
19
import org.eclipse.jface.viewers.ILabelProvider;
20
import org.eclipse.jface.viewers.ILabelProvider;
Lines 26-32 Link Here
26
import org.eclipse.jface.viewers.SelectionChangedEvent;
27
import org.eclipse.jface.viewers.SelectionChangedEvent;
27
import org.eclipse.jface.viewers.StructuredSelection;
28
import org.eclipse.jface.viewers.StructuredSelection;
28
import org.eclipse.jface.viewers.Viewer;
29
import org.eclipse.jface.viewers.Viewer;
29
import org.eclipse.jface.wizard.IWizardPage;
30
import org.eclipse.jface.wizard.WizardPage;
30
import org.eclipse.jface.wizard.WizardPage;
31
import org.eclipse.mylar.internal.jira.JiraCustomQuery;
31
import org.eclipse.mylar.internal.jira.JiraCustomQuery;
32
import org.eclipse.mylar.internal.jira.JiraServerFacade;
32
import org.eclipse.mylar.internal.jira.JiraServerFacade;
Lines 43-48 Link Here
43
import org.eclipse.swt.events.SelectionEvent;
43
import org.eclipse.swt.events.SelectionEvent;
44
import org.eclipse.swt.graphics.Color;
44
import org.eclipse.swt.graphics.Color;
45
import org.eclipse.swt.graphics.Image;
45
import org.eclipse.swt.graphics.Image;
46
import org.eclipse.swt.layout.FillLayout;
46
import org.eclipse.swt.layout.GridData;
47
import org.eclipse.swt.layout.GridData;
47
import org.eclipse.swt.layout.GridLayout;
48
import org.eclipse.swt.layout.GridLayout;
48
import org.eclipse.swt.widgets.Button;
49
import org.eclipse.swt.widgets.Button;
Lines 51-62 Link Here
51
import org.eclipse.swt.widgets.Label;
52
import org.eclipse.swt.widgets.Label;
52
import org.eclipse.swt.widgets.Text;
53
import org.eclipse.swt.widgets.Text;
53
import org.tigris.jira.core.model.Component;
54
import org.tigris.jira.core.model.Component;
55
import org.tigris.jira.core.model.IssueType;
56
import org.tigris.jira.core.model.Priority;
54
import org.tigris.jira.core.model.Project;
57
import org.tigris.jira.core.model.Project;
58
import org.tigris.jira.core.model.Resolution;
59
import org.tigris.jira.core.model.Status;
55
import org.tigris.jira.core.model.Version;
60
import org.tigris.jira.core.model.Version;
56
import org.tigris.jira.core.model.filter.ComponentFilter;
61
import org.tigris.jira.core.model.filter.ComponentFilter;
57
import org.tigris.jira.core.model.filter.ContentFilter;
62
import org.tigris.jira.core.model.filter.ContentFilter;
63
import org.tigris.jira.core.model.filter.CurrentUserFilter;
58
import org.tigris.jira.core.model.filter.FilterDefinition;
64
import org.tigris.jira.core.model.filter.FilterDefinition;
65
import org.tigris.jira.core.model.filter.IssueTypeFilter;
66
import org.tigris.jira.core.model.filter.NobodyFilter;
67
import org.tigris.jira.core.model.filter.PriorityFilter;
59
import org.tigris.jira.core.model.filter.ProjectFilter;
68
import org.tigris.jira.core.model.filter.ProjectFilter;
69
import org.tigris.jira.core.model.filter.ResolutionFilter;
70
import org.tigris.jira.core.model.filter.SpecificUserFilter;
71
import org.tigris.jira.core.model.filter.StatusFilter;
72
import org.tigris.jira.core.model.filter.UserFilter;
73
import org.tigris.jira.core.model.filter.UserInGroupFilter;
60
import org.tigris.jira.core.model.filter.VersionFilter;
74
import org.tigris.jira.core.model.filter.VersionFilter;
61
import org.tigris.jira.core.service.JiraServer;
75
import org.tigris.jira.core.service.JiraServer;
62
76
Lines 82-102 Link Here
82
96
83
	final Placeholder NO_COMPONENT = new Placeholder("No Component");
97
	final Placeholder NO_COMPONENT = new Placeholder("No Component");
84
98
99
	// attributes
100
	
101
	final Placeholder ANY_ISSUE_TYPE = new Placeholder("Any");
102
103
	final Placeholder ANY_RESOLUTION = new Placeholder("Any");
104
105
	final Placeholder UNRESOLVED = new Placeholder("Unresolved");
106
107
	final Placeholder UNASSIGNED = new Placeholder("Unassigned");
108
109
	final Placeholder ANY_REPORTER = new Placeholder("Any");
110
111
	final Placeholder NO_REPORTER = new Placeholder("No Reporter");
112
113
	final Placeholder CURRENT_USER_REPORTER = new Placeholder("Current User");
114
115
	final Placeholder SPECIFIC_USER_REPORTER = new Placeholder("Specified User");
116
117
	final Placeholder SPECIFIC_GROUP_REPORTER = new Placeholder("Specified Group");
118
119
	final Placeholder ANY_ASSIGNEE = new Placeholder("Any");
120
121
	final Placeholder CURRENT_USER_ASSIGNEE = new Placeholder("Current User");
122
123
	final Placeholder SPECIFIC_USER_ASSIGNEE = new Placeholder("Specified User");
124
125
	final Placeholder SPECIFIC_GROUP_ASSIGNEE = new Placeholder("Specified Group");
126
127
	final Placeholder ANY_STATUS = new Placeholder("Any");
128
129
	final Placeholder ANY_PRIORITY = new Placeholder("Any");
130
131
	
85
	private final JiraServer server;
132
	private final JiraServer server;
86
133
134
	private Text name;
135
	
87
	private ListViewer project;
136
	private ListViewer project;
88
137
89
	private ListViewer reportedIn;
138
	private ListViewer reportedIn;
90
139
91
	private ListViewer components;
140
	private ListViewer listViewer;
92
141
93
	private ListViewer fixFor;
142
	private ListViewer fixFor;
143
	
144
	private ListViewer issueType;
145
	
146
	private ListViewer status;
147
	
148
	private ListViewer resolution;
149
	
150
	private ListViewer priority;
151
	
152
	private ComboViewer assigneeType;
94
153
95
	private final FilterDefinition workingCopy;
154
	private Text assignee;
96
155
97
	private Text name;
156
	private ComboViewer reporterType;
98
157
99
	private Text description;
158
	private Text reporter;
100
159
101
	private Text queryString;
160
	private Text queryString;
102
161
Lines 110-119 Link Here
110
169
111
	private final boolean isNew;
170
	private final boolean isNew;
112
171
113
	private IssueAttributesPage issueAttributesPage;
114
115
	private final TaskRepository repository;
172
	private final TaskRepository repository;
116
173
174
	private final FilterDefinition workingCopy;
175
176
177
	
117
	/**
178
	/**
118
	 * @param pageName
179
	 * @param pageName
119
	 * @param title
180
	 * @param title
Lines 132-138 Link Here
132
193
133
	public void createControl(Composite parent) {
194
	public void createControl(Composite parent) {
134
		Composite c = new Composite(parent, SWT.NONE);
195
		Composite c = new Composite(parent, SWT.NONE);
135
		c.setLayout(new GridLayout(5, false));
196
		c.setLayout(new GridLayout(3, false));
136
197
137
		Label lblName = new Label(c, SWT.NONE);
198
		Label lblName = new Label(c, SWT.NONE);
138
		final GridData gridData = new GridData();
199
		final GridData gridData = new GridData();
Lines 140-146 Link Here
140
		lblName.setText("Name:");
201
		lblName.setText("Name:");
141
202
142
		name = new Text(c, SWT.BORDER);
203
		name = new Text(c, SWT.BORDER);
143
		name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1));
204
		name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
144
		name.addModifyListener(new ModifyListener() {
205
		name.addModifyListener(new ModifyListener() {
145
206
146
			public void modifyText(ModifyEvent e) {
207
			public void modifyText(ModifyEvent e) {
Lines 149-183 Link Here
149
210
150
		});
211
		});
151
212
152
		if (!isNew) {
213
		SashForm sashForm = new SashForm(c, SWT.VERTICAL);
153
			name.setEnabled(false);
214
		sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 3, 1));
154
		}
155
156
		Label lblDescription = new Label(c, SWT.NONE);
157
		lblDescription.setText("Description:");
158
		lblDescription.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
159
160
		description = new Text(c, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
161
		GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1);
162
		gd.heightHint = 40;
163
		description.setLayoutData(gd);
164
		description.addFocusListener(new FocusAdapter() {
165
166
			public void focusLost(FocusEvent e) {
167
				validatePage();
168
			}
169
170
		});
171
215
172
		{
216
		{
173
			SashForm cc = new SashForm(c, SWT.HORIZONTAL);
217
			SashForm cc = new SashForm(sashForm, SWT.HORIZONTAL);
174
			cc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 5, 1));
175
218
176
			{
219
			{
177
				Composite comp = new Composite(cc, SWT.NONE);
220
				Composite comp = new Composite(cc, SWT.NONE);
178
				GridLayout gridLayout = new GridLayout(1, false);
221
				GridLayout gridLayout = new GridLayout(1, false);
179
				gridLayout.marginWidth = 0;
222
				gridLayout.marginWidth = 0;
180
				gridLayout.marginHeight = 0;
181
				comp.setLayout(gridLayout);
223
				comp.setLayout(gridLayout);
182
				
224
				
183
				Label label = new Label(comp, SWT.NONE);
225
				Label label = new Label(comp, SWT.NONE);
Lines 189-195 Link Here
189
				Composite comp = new Composite(cc, SWT.NONE);
231
				Composite comp = new Composite(cc, SWT.NONE);
190
				GridLayout gridLayout = new GridLayout(1, false);
232
				GridLayout gridLayout = new GridLayout(1, false);
191
				gridLayout.marginWidth = 0;
233
				gridLayout.marginWidth = 0;
192
				gridLayout.marginHeight = 0;
193
				comp.setLayout(gridLayout);
234
				comp.setLayout(gridLayout);
194
				
235
				
195
				new Label(comp, SWT.NONE).setText("Fix For:");
236
				new Label(comp, SWT.NONE).setText("Fix For:");
Lines 200-206 Link Here
200
				Composite comp = new Composite(cc, SWT.NONE);
241
				Composite comp = new Composite(cc, SWT.NONE);
201
				GridLayout gridLayout = new GridLayout(1, false);
242
				GridLayout gridLayout = new GridLayout(1, false);
202
				gridLayout.marginWidth = 0;
243
				gridLayout.marginWidth = 0;
203
				gridLayout.marginHeight = 0;
204
				comp.setLayout(gridLayout);
244
				comp.setLayout(gridLayout);
205
				
245
				
206
				new Label(comp, SWT.NONE).setText("In Components:");
246
				new Label(comp, SWT.NONE).setText("In Components:");
Lines 211-231 Link Here
211
				Composite comp = new Composite(cc, SWT.NONE);
251
				Composite comp = new Composite(cc, SWT.NONE);
212
				GridLayout gridLayout = new GridLayout(1, false);
252
				GridLayout gridLayout = new GridLayout(1, false);
213
				gridLayout.marginWidth = 0;
253
				gridLayout.marginWidth = 0;
214
				gridLayout.marginHeight = 0;
215
				comp.setLayout(gridLayout);
254
				comp.setLayout(gridLayout);
216
255
217
				Label label = new Label(comp, SWT.NONE);
256
				Label label = new Label(comp, SWT.NONE);
218
				label.setText("Reported In:");
257
				label.setText("Reported In:");
219
				createReportedInViewer(comp);
258
				createReportedInViewer(comp);
220
			}
259
			}
221
			// cc.setWeights(new int[] {1,1,1,1});
260
			cc.setWeights(new int[] {1,1,1,1});
222
		}
261
		}
223
262
263
		{
264
			SashForm cc = new SashForm(sashForm, SWT.NONE);
265
266
			ISelectionChangedListener selectionChangeListener = new ISelectionChangedListener() {
267
				public void selectionChanged(SelectionChangedEvent event) {
268
					validatePage();
269
				}
270
			};
271
272
			{
273
				Composite comp = new Composite(cc, SWT.NONE);
274
				GridLayout gridLayout = new GridLayout();
275
				gridLayout.marginWidth = 0;
276
				comp.setLayout(gridLayout);
277
		
278
				Label typeLabel = new Label(comp, SWT.NONE);
279
				typeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
280
				typeLabel.setText("Type:");
281
		
282
				issueType = new ListViewer(comp, SWT.BORDER);
283
				issueType.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
284
				
285
				issueType.setContentProvider(new IStructuredContentProvider() {
286
287
					public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
288
					}
289
290
					public void dispose() {
291
					}
292
293
					public Object[] getElements(Object inputElement) {
294
						JiraServer server = (JiraServer) inputElement;
295
						Object[] elements = new Object[server.getIssueTypes().length + 1];
296
						elements[0] = ANY_ISSUE_TYPE;
297
						System.arraycopy(server.getIssueTypes(), 0, elements, 1, server.getIssueTypes().length);
298
299
						return elements;
300
					}
301
				});
302
303
				issueType.setLabelProvider(new LabelProvider() {
304
305
					public String getText(Object element) {
306
						if (element instanceof Placeholder) {
307
							return ((Placeholder) element).getText();
308
						}
309
310
						return ((IssueType) element).getName();
311
					}
312
313
				});
314
315
				issueType.addSelectionChangedListener(selectionChangeListener);
316
317
				issueType.setInput(server);
318
			}
319
	
320
			{
321
				Composite comp = new Composite(cc, SWT.NONE);
322
				GridLayout gridLayout = new GridLayout();
323
				gridLayout.marginWidth = 0;
324
				comp.setLayout(gridLayout);
325
		
326
				Label statusLabel = new Label(comp, SWT.NONE);
327
				statusLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
328
				statusLabel.setText("Status:");
329
		
330
				status = new ListViewer(comp, SWT.BORDER);
331
				status.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
332
				
333
				status.setContentProvider(new IStructuredContentProvider() {
334
335
					public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
336
					}
337
338
					public void dispose() {
339
					}
340
341
					public Object[] getElements(Object inputElement) {
342
						JiraServer server = (JiraServer) inputElement;
343
						Object[] elements = new Object[server.getStatuses().length + 1];
344
						elements[0] = ANY_STATUS;
345
						System.arraycopy(server.getStatuses(), 0, elements, 1, server.getStatuses().length);
346
347
						return elements;
348
					}
349
				});
350
351
				status.setLabelProvider(new LabelProvider() {
352
353
					public String getText(Object element) {
354
						if (element instanceof Placeholder) {
355
							return ((Placeholder) element).getText();
356
						}
357
358
						return ((Status) element).getName();
359
					}
360
361
				});
362
363
				status.addSelectionChangedListener(selectionChangeListener);
364
				status.setInput(server);
365
			}
366
	
367
			{
368
				Composite comp = new Composite(cc, SWT.NONE);
369
				GridLayout gridLayout = new GridLayout();
370
				gridLayout.marginWidth = 0;
371
				comp.setLayout(gridLayout);
372
		
373
				Label resolutionLabel = new Label(comp, SWT.NONE);
374
				resolutionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
375
				resolutionLabel.setText("Resolution:");
376
		
377
				resolution = new ListViewer(comp, SWT.BORDER);
378
				resolution.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
379
380
				resolution.setContentProvider(new IStructuredContentProvider() {
381
382
					public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
383
					}
384
385
					public void dispose() {
386
					}
387
388
					public Object[] getElements(Object inputElement) {
389
						JiraServer server = (JiraServer) inputElement;
390
						Object[] elements = new Object[server.getResolutions().length + 2];
391
						elements[0] = ANY_RESOLUTION;
392
						elements[1] = UNRESOLVED;
393
						System.arraycopy(server.getResolutions(), 0, elements, 2, server.getResolutions().length);
394
395
						return elements;
396
					}
397
				});
398
399
				resolution.setLabelProvider(new LabelProvider() {
400
401
					public String getText(Object element) {
402
						if (element instanceof Placeholder) {
403
							return ((Placeholder) element).getText();
404
						}
405
406
						return ((Resolution) element).getName();
407
					}
408
409
				});
410
411
				resolution.addSelectionChangedListener(selectionChangeListener);
412
				resolution.setInput(server);
413
			}
414
	
415
			{
416
				Composite comp = new Composite(cc, SWT.NONE);
417
				GridLayout gridLayout = new GridLayout();
418
				gridLayout.marginWidth = 0;
419
				comp.setLayout(gridLayout);
420
		
421
				Label priorityLabel = new Label(comp, SWT.NONE);
422
				priorityLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
423
				priorityLabel.setText("Priority:");
424
		
425
				priority = new ListViewer(comp, SWT.BORDER);
426
				priority.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
427
428
				priority.setContentProvider(new IStructuredContentProvider() {
429
430
					public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
431
					}
432
433
					public void dispose() {
434
					}
435
436
					public Object[] getElements(Object inputElement) {
437
						JiraServer server = (JiraServer) inputElement;
438
						Object[] elements = new Object[server.getPriorities().length + 1];
439
						elements[0] = ANY_PRIORITY;
440
						System.arraycopy(server.getPriorities(), 0, elements, 1, server.getPriorities().length);
441
442
						return elements;
443
					}
444
				});
445
446
				priority.setLabelProvider(new LabelProvider() {
447
448
					public String getText(Object element) {
449
						if (element instanceof Placeholder) {
450
							return ((Placeholder) element).getText();
451
						}
452
453
						return ((Priority) element).getName();
454
					}
455
456
				});
457
				priority.addSelectionChangedListener(selectionChangeListener);
458
				priority.setInput(server);
459
			}
460
			
461
			cc.setWeights(new int[] {1, 1, 1, 1 });
462
		}
463
		sashForm.setWeights(new int[] {1, 1 });
464
224
		Label lblQuery = new Label(c, SWT.NONE);
465
		Label lblQuery = new Label(c, SWT.NONE);
225
		lblQuery.setLayoutData(new GridData());
466
		lblQuery.setLayoutData(new GridData());
226
		lblQuery.setText("Query:");
467
		lblQuery.setText("Query:");
227
		queryString = new Text(c, SWT.BORDER);
468
		queryString = new Text(c, SWT.BORDER);
228
		queryString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1));
469
		queryString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
229
		// TODO put content assist here and a label describing what is available
470
		// TODO put content assist here and a label describing what is available
230
471
231
		queryString.addFocusListener(new FocusAdapter() {
472
		queryString.addFocusListener(new FocusAdapter() {
Lines 238-288 Link Here
238
479
239
		Label lblFields = new Label(c, SWT.NONE);
480
		Label lblFields = new Label(c, SWT.NONE);
240
		lblFields.setText("Fields:");
481
		lblFields.setText("Fields:");
241
		lblFields.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
482
		lblFields.setLayoutData(new GridData());
242
483
243
		searchSummary = new Button(c, SWT.CHECK);
484
		{
244
		searchSummary.setLayoutData(new GridData());
485
			SelectionAdapter selectionAdapter = new SelectionAdapter() {
245
		searchSummary.setText("Summary");
486
				public void widgetSelected(SelectionEvent e) {
246
		searchSummary.addSelectionListener(new SelectionAdapter() {
487
					validatePage();
488
				}
489
			};
247
490
248
			public void widgetSelected(SelectionEvent e) {
491
			Composite comp = new Composite(c, SWT.NONE);
249
				validatePage();
492
			comp.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
250
			}
493
			comp.setLayout(new FillLayout());
494
	
495
			searchSummary = new Button(comp, SWT.CHECK);
496
			searchSummary.setText("Summary");
497
			searchSummary.addSelectionListener(selectionAdapter);
498
	
499
			searchDescription = new Button(comp, SWT.CHECK);
500
			searchDescription.setText("Description");
501
			searchDescription.addSelectionListener(selectionAdapter);
502
	
503
			searchComments = new Button(comp, SWT.CHECK);
504
			searchComments.setText("Comments");
505
			searchComments.addSelectionListener(selectionAdapter);
506
	
507
			searchEnvironment = new Button(comp, SWT.CHECK);
508
			searchEnvironment.setText("Environment");
509
			searchEnvironment.addSelectionListener(selectionAdapter);
510
		}
511
		
512
		{
513
			Label reportedByLabel = new Label(c, SWT.NONE);
514
			reportedByLabel.setText("Reported By:");
251
515
252
		});
516
			reporterType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY);
517
			GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER, false, false);
518
			gridData_1.widthHint = 133;
519
			reporterType.getControl().setLayoutData(gridData_1);
520
	
521
			reporterType.setContentProvider(new IStructuredContentProvider() {
522
	
523
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
524
				}
525
	
526
				public void dispose() {
527
				}
528
	
529
				public Object[] getElements(Object inputElement) {
530
					return new Object[] { ANY_REPORTER, NO_REPORTER, CURRENT_USER_REPORTER, SPECIFIC_USER_REPORTER,
531
							SPECIFIC_GROUP_REPORTER };
532
				}
533
	
534
			});
535
	
536
			reporterType.setLabelProvider(new LabelProvider() {
537
				public String getText(Object element) {
538
					return ((Placeholder) element).getText();
539
				}
540
			});
541
	
542
			reporterType.setInput(server);
543
			
544
			reporter = new Text(c, SWT.BORDER);
545
			reporter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
546
			reporter.setEnabled(false);
547
			
548
			reporter.addModifyListener(new ModifyListener() {
253
549
254
		searchDescription = new Button(c, SWT.CHECK);
550
				public void modifyText(ModifyEvent e) {
255
		searchDescription.setLayoutData(new GridData());
551
					validatePage();
256
		searchDescription.setText("Description");
552
				}
257
		searchDescription.addSelectionListener(new SelectionAdapter() {
258
553
259
			public void widgetSelected(SelectionEvent e) {
554
			});
260
				validatePage();
555
		}
261
			}
262
556
263
		});
557
		{
558
			Label assignedToLabel = new Label(c, SWT.NONE);
559
			assignedToLabel.setText("Assigned To:");
560
	
561
			assigneeType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY);
562
			GridData gridData_2 = new GridData(SWT.FILL, SWT.CENTER, false, false);
563
			gridData_2.widthHint = 133;
564
			assigneeType.getCombo().setLayoutData(gridData_2);
565
	
566
			assigneeType.setContentProvider(new IStructuredContentProvider() {
264
567
265
		searchComments = new Button(c, SWT.CHECK);
568
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
266
		searchComments.setLayoutData(new GridData());
569
				}
267
		searchComments.setText("Comments");
268
		searchComments.addSelectionListener(new SelectionAdapter() {
269
570
270
			public void widgetSelected(SelectionEvent e) {
571
				public void dispose() {
271
				validatePage();
572
				}
272
			}
273
573
274
		});
574
				public Object[] getElements(Object inputElement) {
575
					return new Object[] { ANY_ASSIGNEE, UNASSIGNED, CURRENT_USER_ASSIGNEE, SPECIFIC_USER_ASSIGNEE,
576
							SPECIFIC_GROUP_ASSIGNEE };
577
				}
275
578
276
		searchEnvironment = new Button(c, SWT.CHECK);
579
			});
277
		searchEnvironment.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
278
		searchEnvironment.setText("Environment");
279
		searchEnvironment.addSelectionListener(new SelectionAdapter() {
280
580
281
			public void widgetSelected(SelectionEvent e) {
581
			assigneeType.setLabelProvider(new LabelProvider() {
282
				validatePage();
283
			}
284
582
285
		});
583
				public String getText(Object element) {
584
					return ((Placeholder) element).getText();
585
				}
586
587
			});
588
589
			assigneeType.addSelectionChangedListener(new ISelectionChangedListener() {
590
591
				public void selectionChanged(SelectionChangedEvent event) {
592
					Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
593
					if (SPECIFIC_USER_ASSIGNEE.equals(selection) || SPECIFIC_GROUP_ASSIGNEE.equals(selection)) {
594
						assignee.setEnabled(true);
595
					} else {
596
						assignee.setEnabled(false);
597
						assignee.setText(""); //$NON-NLS-1$
598
					}
599
					validatePage();
600
				}
601
602
			});
603
604
			assigneeType.setInput(server);
605
			
606
			assignee = new Text(c, SWT.BORDER);
607
			assignee.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
608
			assignee.setEnabled(false);
609
			assignee.addModifyListener(new ModifyListener() {
610
611
				public void modifyText(ModifyEvent e) {
612
					validatePage();
613
				}
614
615
			});
616
		}
286
		
617
		
287
		// Need to turn off validation here
618
		// Need to turn off validation here
288
		if (isNew) {
619
		if (isNew) {
Lines 294-313 Link Here
294
		setControl(c);
625
		setControl(c);
295
	}
626
	}
296
627
297
	public IWizardPage getNextPage() {
298
		if (issueAttributesPage == null) {
299
			issueAttributesPage = new IssueAttributesPage(repository, workingCopy, isNew);
300
			issueAttributesPage.setWizard(getWizard());
301
		}
302
303
		return issueAttributesPage;
304
	}
305
306
	private void createReportedInViewer(Composite c) {
628
	private void createReportedInViewer(Composite c) {
307
		reportedIn = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
629
		reportedIn = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
308
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
630
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
309
		gridData.heightHint = 200;
631
		gridData.heightHint = 60;
310
		gridData.widthHint = 80;
632
		gridData.widthHint = 90;
311
		reportedIn.getControl().setLayoutData(gridData);
633
		reportedIn.getControl().setLayoutData(gridData);
312
634
313
		reportedIn.setContentProvider(new IStructuredContentProvider() {
635
		reportedIn.setContentProvider(new IStructuredContentProvider() {
Lines 347-359 Link Here
347
	}
669
	}
348
670
349
	private void createComponentsViewer(Composite c) {
671
	private void createComponentsViewer(Composite c) {
350
		components = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
672
		listViewer = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
351
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
673
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
352
		gridData.heightHint = 200;
674
		gridData.heightHint = 60;
353
		gridData.widthHint = 80;
675
		gridData.widthHint = 90;
354
		components.getControl().setLayoutData(gridData);
676
		listViewer.getControl().setLayoutData(gridData);
355
677
356
		components.setContentProvider(new IStructuredContentProvider() {
678
		listViewer.setContentProvider(new IStructuredContentProvider() {
357
			private Project project;
679
			private Project project;
358
680
359
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
681
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
Lines 377-391 Link Here
377
			}
699
			}
378
700
379
		});
701
		});
380
		components.setLabelProvider(new ComponentLabelProvider());
702
		listViewer.setLabelProvider(new ComponentLabelProvider());
381
		components.setInput(null);
703
		listViewer.setInput(null);
382
	}
704
	}
383
705
384
	private void createFixForViewer(Composite c) {
706
	private void createFixForViewer(Composite c) {
385
		fixFor = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
707
		fixFor = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
386
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
708
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
387
		gridData.heightHint = 200;
709
		gridData.heightHint = 60;
388
		gridData.widthHint = 80;
710
		gridData.widthHint = 90;
389
		fixFor.getControl().setLayoutData(gridData);
711
		fixFor.getControl().setLayoutData(gridData);
390
712
391
		fixFor.setContentProvider(new IStructuredContentProvider() {
713
		fixFor.setContentProvider(new IStructuredContentProvider() {
Lines 427-434 Link Here
427
	private void createProjectsViewer(Composite c) {
749
	private void createProjectsViewer(Composite c) {
428
		project = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
750
		project = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
429
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
751
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
430
		gridData.heightHint = 200;
752
		gridData.heightHint = 60;
431
		gridData.widthHint = 120;
753
		gridData.widthHint = 90;
432
		project.getControl().setLayoutData(gridData);
754
		project.getControl().setLayoutData(gridData);
433
		
755
		
434
		project.setContentProvider(new IStructuredContentProvider() {
756
		project.setContentProvider(new IStructuredContentProvider() {
Lines 481-487 Link Here
481
803
482
	void updateCurrentProject(Project project) {
804
	void updateCurrentProject(Project project) {
483
		this.fixFor.setInput(project);
805
		this.fixFor.setInput(project);
484
		this.components.setInput(project);
806
		this.listViewer.setInput(project);
485
		this.reportedIn.setInput(project);
807
		this.reportedIn.setInput(project);
486
808
487
	}
809
	}
Lines 501-506 Link Here
501
		project.setSelection(new StructuredSelection(new Placeholder("All Projects")));
823
		project.setSelection(new StructuredSelection(new Placeholder("All Projects")));
502
		searchSummary.setSelection(true);
824
		searchSummary.setSelection(true);
503
		searchDescription.setSelection(true);
825
		searchDescription.setSelection(true);
826
		
827
		issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE));
828
		reporterType.setSelection(new StructuredSelection(ANY_REPORTER));
829
		assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE));
830
		status.setSelection(new StructuredSelection(ANY_STATUS));
831
		resolution.setSelection(new StructuredSelection(ANY_RESOLUTION));
832
		priority.setSelection(new StructuredSelection(ANY_PRIORITY));
833
		
504
	}
834
	}
505
835
506
	private void loadFromWorkingCopy() {
836
	private void loadFromWorkingCopy() {
Lines 509-515 Link Here
509
		}
839
		}
510
840
511
		if (workingCopy.getDescription() != null) {
841
		if (workingCopy.getDescription() != null) {
512
			description.setText(workingCopy.getDescription());
513
		}
842
		}
514
843
515
		if (workingCopy.getProjectFilter() != null) {
844
		if (workingCopy.getProjectFilter() != null) {
Lines 563-580 Link Here
563
892
564
		if (workingCopy.getComponentFilter() != null) {
893
		if (workingCopy.getComponentFilter() != null) {
565
			if (workingCopy.getComponentFilter().hasNoComponent()) {
894
			if (workingCopy.getComponentFilter().hasNoComponent()) {
566
				components.setSelection(new StructuredSelection(NO_COMPONENT));
895
				listViewer.setSelection(new StructuredSelection(NO_COMPONENT));
567
			} else {
896
			} else {
568
				components.setSelection(new StructuredSelection(workingCopy.getComponentFilter().getComponents()));
897
				listViewer.setSelection(new StructuredSelection(workingCopy.getComponentFilter().getComponents()));
569
			}
898
			}
570
		} else {
899
		} else {
571
			components.setSelection(new StructuredSelection(ANY_COMPONENT));
900
			listViewer.setSelection(new StructuredSelection(ANY_COMPONENT));
572
		}
901
		}
902
903
	    // attributes
904
		
905
		if (workingCopy.getIssueTypeFilter() != null) {
906
			issueType.setSelection(new StructuredSelection(workingCopy.getIssueTypeFilter().getIsueTypes()));
907
		} else {
908
			issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE));
909
		}
910
911
		if (workingCopy.getReportedByFilter() != null) {
912
			UserFilter reportedByFilter = workingCopy.getReportedByFilter();
913
			if (reportedByFilter instanceof NobodyFilter) {
914
				reporterType.setSelection(new StructuredSelection(NO_REPORTER));
915
			} else if (reportedByFilter instanceof CurrentUserFilter) {
916
				reporterType.setSelection(new StructuredSelection(CURRENT_USER_REPORTER));
917
			} else if (reportedByFilter instanceof SpecificUserFilter) {
918
				reporterType.setSelection(new StructuredSelection(SPECIFIC_USER_REPORTER));
919
				reporter.setText(((SpecificUserFilter) reportedByFilter).getUser());
920
			} else if (reportedByFilter instanceof UserInGroupFilter) {
921
				reporterType.setSelection(new StructuredSelection(SPECIFIC_GROUP_REPORTER));
922
				reporter.setText(((UserInGroupFilter) reportedByFilter).getGroup());
923
			}
924
		} else {
925
			reporterType.setSelection(new StructuredSelection(ANY_REPORTER));
926
		}
927
928
		if (workingCopy.getAssignedToFilter() != null) {
929
			UserFilter assignedToFilter = workingCopy.getAssignedToFilter();
930
			if (assignedToFilter instanceof NobodyFilter) {
931
				assigneeType.setSelection(new StructuredSelection(UNASSIGNED));
932
			} else if (assignedToFilter instanceof CurrentUserFilter) {
933
				assigneeType.setSelection(new StructuredSelection(CURRENT_USER_ASSIGNEE));
934
			} else if (assignedToFilter instanceof SpecificUserFilter) {
935
				assigneeType.setSelection(new StructuredSelection(SPECIFIC_USER_ASSIGNEE));
936
				assignee.setText(((SpecificUserFilter) assignedToFilter).getUser());
937
			} else if (assignedToFilter instanceof UserInGroupFilter) {
938
				assigneeType.setSelection(new StructuredSelection(SPECIFIC_GROUP_ASSIGNEE));
939
				assignee.setText(((UserInGroupFilter) assignedToFilter).getGroup());
940
			}
941
		} else {
942
			assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE));
943
		}
944
945
		if (workingCopy.getStatusFilter() != null) {
946
			status.setSelection(new StructuredSelection(workingCopy.getStatusFilter().getStatuses()));
947
		} else {
948
			status.setSelection(new StructuredSelection(ANY_STATUS));
949
		}
950
951
		if (workingCopy.getResolutionFilter() != null) {
952
			Resolution[] resolutions = workingCopy.getResolutionFilter().getResolutions();
953
			if(resolutions.length==0) {
954
				resolution.setSelection(new StructuredSelection(UNRESOLVED));
955
			} else {
956
				resolution.setSelection(new StructuredSelection(resolutions));
957
			}
958
		} else {
959
			resolution.setSelection(new StructuredSelection(ANY_RESOLUTION));
960
		}
961
962
		if (workingCopy.getPriorityFilter() != null) {
963
			priority.setSelection(new StructuredSelection(workingCopy.getPriorityFilter().getPriorities()));
964
		} else {
965
			priority.setSelection(new StructuredSelection(ANY_PRIORITY));
966
		}
967
		
573
	}
968
	}
574
969
575
	/* default */void applyChanges() {
970
	/* default */void applyChanges() {
576
		workingCopy.setName(this.name.getText());
971
		workingCopy.setName(this.name.getText());
577
		workingCopy.setDescription(this.description.getText());
578
		if (this.queryString.getText().length() > 0 || this.searchSummary.getSelection()
972
		if (this.queryString.getText().length() > 0 || this.searchSummary.getSelection()
579
				|| this.searchDescription.getSelection() || this.searchEnvironment.getSelection()
973
				|| this.searchDescription.getSelection() || this.searchEnvironment.getSelection()
580
				|| this.searchComments.getSelection()) {
974
				|| this.searchComments.getSelection()) {
Lines 674-680 Link Here
674
			}
1068
			}
675
		}
1069
		}
676
1070
677
		IStructuredSelection componentsSelection = (IStructuredSelection) components.getSelection();
1071
		IStructuredSelection componentsSelection = (IStructuredSelection) listViewer.getSelection();
678
		if (componentsSelection.isEmpty()) {
1072
		if (componentsSelection.isEmpty()) {
679
			workingCopy.setComponentFilter(null);
1073
			workingCopy.setComponentFilter(null);
680
		} else {
1074
		} else {
Lines 705-710 Link Here
705
				workingCopy.setComponentFilter(null);
1099
				workingCopy.setComponentFilter(null);
706
			}
1100
			}
707
		}
1101
		}
1102
		
1103
		// attributes
1104
		
1105
		// TODO support standard and subtask issue types
1106
		IStructuredSelection issueTypeSelection = (IStructuredSelection) issueType.getSelection();
1107
		if (issueTypeSelection.isEmpty()) {
1108
			workingCopy.setIssueTypeFilter(null);
1109
		} else {
1110
			boolean isAnyIssueTypeSelected = false;
1111
1112
			List<IssueType> selectedIssueTypes = new ArrayList<IssueType>();
1113
1114
			for (Iterator i = issueTypeSelection.iterator(); i.hasNext();) {
1115
				Object selection = i.next();
1116
				if (ANY_ISSUE_TYPE.equals(selection)) {
1117
					isAnyIssueTypeSelected = true;
1118
				} else if (selection instanceof IssueType) {
1119
					selectedIssueTypes.add((IssueType) selection);
1120
				}
1121
			}
1122
1123
			if (isAnyIssueTypeSelected) {
1124
				workingCopy.setIssueTypeFilter(null);
1125
			} else {
1126
				workingCopy.setIssueTypeFilter(
1127
					new IssueTypeFilter(selectedIssueTypes.toArray(new IssueType[selectedIssueTypes.size()])));
1128
			}
1129
		}
1130
1131
		IStructuredSelection reporterSelection = (IStructuredSelection) reporterType.getSelection();
1132
		if (reporterSelection.isEmpty()) {
1133
			workingCopy.setReportedByFilter(null);
1134
		} else {
1135
			if (ANY_REPORTER.equals(reporterSelection.getFirstElement())) {
1136
				workingCopy.setReportedByFilter(null);
1137
			} else if (NO_REPORTER.equals(reporterSelection.getFirstElement())) {
1138
				workingCopy.setReportedByFilter(new NobodyFilter());
1139
			} else if (CURRENT_USER_REPORTER.equals(reporterSelection.getFirstElement())) {
1140
				workingCopy.setReportedByFilter(new CurrentUserFilter());
1141
			} else if (SPECIFIC_GROUP_REPORTER.equals(reporterSelection.getFirstElement())) {
1142
				workingCopy.setReportedByFilter(new UserInGroupFilter(reporter.getText()));
1143
			} else if (SPECIFIC_USER_REPORTER.equals(reporterSelection.getFirstElement())) {
1144
				workingCopy.setReportedByFilter(new SpecificUserFilter(reporter.getText()));
1145
			} else {
1146
				workingCopy.setReportedByFilter(null);
1147
			}
1148
		}
1149
1150
		IStructuredSelection assigneeSelection = (IStructuredSelection) assigneeType.getSelection();
1151
		if (assigneeSelection.isEmpty()) {
1152
			workingCopy.setAssignedToFilter(null);
1153
		} else {
1154
			if (ANY_REPORTER.equals(assigneeSelection.getFirstElement())) {
1155
				workingCopy.setAssignedToFilter(null);
1156
			} else if (UNASSIGNED.equals(assigneeSelection.getFirstElement())) {
1157
				workingCopy.setAssignedToFilter(new NobodyFilter());
1158
			} else if (CURRENT_USER_REPORTER.equals(assigneeSelection.getFirstElement())) {
1159
				workingCopy.setAssignedToFilter(new CurrentUserFilter());
1160
			} else if (SPECIFIC_GROUP_REPORTER.equals(assigneeSelection.getFirstElement())) {
1161
				workingCopy.setAssignedToFilter(new UserInGroupFilter(assignee.getText()));
1162
			} else if (SPECIFIC_USER_REPORTER.equals(assigneeSelection.getFirstElement())) {
1163
				workingCopy.setAssignedToFilter(new SpecificUserFilter(assignee.getText()));
1164
			} else {
1165
				workingCopy.setAssignedToFilter(null);
1166
			}
1167
		}
1168
1169
		IStructuredSelection statusSelection = (IStructuredSelection) status.getSelection();
1170
		if (statusSelection.isEmpty()) {
1171
			workingCopy.setStatusFilter(null);
1172
		} else {
1173
			boolean isAnyStatusSelected = false;
1174
1175
			List<Status> selectedStatuses = new ArrayList<Status>();
1176
1177
			for (Iterator i = statusSelection.iterator(); i.hasNext();) {
1178
				Object selection = i.next();
1179
				if (ANY_STATUS.equals(selection)) {
1180
					isAnyStatusSelected = true;
1181
				} else if (selection instanceof Status) {
1182
					selectedStatuses.add((Status) selection);
1183
				}
1184
			}
1185
1186
			if (isAnyStatusSelected) {
1187
				workingCopy.setStatusFilter(null);
1188
			} else {
1189
				workingCopy.setStatusFilter(
1190
					new StatusFilter(selectedStatuses.toArray(new Status[selectedStatuses.size()])));
1191
			}
1192
		}
1193
1194
		IStructuredSelection resolutionSelection = (IStructuredSelection) resolution.getSelection();
1195
		if (resolutionSelection.isEmpty()) {
1196
			workingCopy.setResolutionFilter(null);
1197
		} else {
1198
			boolean isAnyResolutionSelected = false;
1199
1200
			List<Resolution> selectedResolutions = new ArrayList<Resolution>();
1201
1202
			for (Iterator i = resolutionSelection.iterator(); i.hasNext();) {
1203
				Object selection = i.next();
1204
				if (ANY_RESOLUTION.equals(selection)) {
1205
					isAnyResolutionSelected = true;
1206
				} else if (selection instanceof Resolution) {
1207
					selectedResolutions.add((Resolution) selection);
1208
				}
1209
			}
1210
1211
			if (isAnyResolutionSelected) {
1212
				workingCopy.setResolutionFilter(null);
1213
			} else {
1214
				workingCopy.setResolutionFilter(
1215
					new ResolutionFilter(selectedResolutions.toArray(new Resolution[selectedResolutions.size()])));
1216
			}
1217
		}
1218
1219
		IStructuredSelection prioritySelection = (IStructuredSelection) priority.getSelection();
1220
		if (prioritySelection.isEmpty()) {
1221
			workingCopy.setPriorityFilter(null);
1222
		} else {
1223
			boolean isAnyPrioritiesSelected = false;
1224
1225
			List<Priority> selectedPriorities = new ArrayList<Priority>();
1226
1227
			for (Iterator i = prioritySelection.iterator(); i.hasNext();) {
1228
				Object selection = i.next();
1229
				if (ANY_PRIORITY.equals(selection)) {
1230
					isAnyPrioritiesSelected = true;
1231
				} else if (selection instanceof Priority) {
1232
					selectedPriorities.add((Priority) selection);
1233
				}
1234
			}
1235
1236
			if (isAnyPrioritiesSelected) {
1237
				workingCopy.setPriorityFilter(null);
1238
			} else {
1239
				workingCopy.setPriorityFilter(
1240
					new PriorityFilter(selectedPriorities.toArray(new Priority[selectedPriorities.size()])));
1241
			}
1242
		}
708
	}
1243
	}
709
1244
710
	final class ComponentLabelProvider implements ILabelProvider {
1245
	final class ComponentLabelProvider implements ILabelProvider {
Lines 876-882 Link Here
876
1411
877
	public AbstractRepositoryQuery getQuery() {
1412
	public AbstractRepositoryQuery getQuery() {
878
		this.applyChanges();
1413
		this.applyChanges();
879
		issueAttributesPage.applyChanges();
880
		if (isNew) {
1414
		if (isNew) {
881
			server.addLocalFilter(workingCopy);
1415
			server.addLocalFilter(workingCopy);
882
		}
1416
		}
(-)src/org/eclipse/mylar/internal/jira/ui/wizards/IssueAttributesPage.java (-716 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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
 *     Brock Janiczak - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylar.internal.jira.ui.wizards;
13
14
import java.util.ArrayList;
15
import java.util.Iterator;
16
import java.util.List;
17
18
import org.eclipse.jface.viewers.ComboViewer;
19
import org.eclipse.jface.viewers.ISelectionChangedListener;
20
import org.eclipse.jface.viewers.IStructuredContentProvider;
21
import org.eclipse.jface.viewers.IStructuredSelection;
22
import org.eclipse.jface.viewers.LabelProvider;
23
import org.eclipse.jface.viewers.ListViewer;
24
import org.eclipse.jface.viewers.SelectionChangedEvent;
25
import org.eclipse.jface.viewers.StructuredSelection;
26
import org.eclipse.jface.viewers.Viewer;
27
import org.eclipse.jface.wizard.WizardPage;
28
import org.eclipse.mylar.internal.jira.JiraServerFacade;
29
import org.eclipse.mylar.tasks.core.TaskRepository;
30
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.events.ModifyEvent;
32
import org.eclipse.swt.events.ModifyListener;
33
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridLayout;
35
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Label;
37
import org.eclipse.swt.widgets.Text;
38
import org.tigris.jira.core.model.IssueType;
39
import org.tigris.jira.core.model.Priority;
40
import org.tigris.jira.core.model.Resolution;
41
import org.tigris.jira.core.model.Status;
42
import org.tigris.jira.core.model.filter.CurrentUserFilter;
43
import org.tigris.jira.core.model.filter.FilterDefinition;
44
import org.tigris.jira.core.model.filter.IssueTypeFilter;
45
import org.tigris.jira.core.model.filter.NobodyFilter;
46
import org.tigris.jira.core.model.filter.PriorityFilter;
47
import org.tigris.jira.core.model.filter.ResolutionFilter;
48
import org.tigris.jira.core.model.filter.SpecificUserFilter;
49
import org.tigris.jira.core.model.filter.StatusFilter;
50
import org.tigris.jira.core.model.filter.UserFilter;
51
import org.tigris.jira.core.model.filter.UserInGroupFilter;
52
import org.tigris.jira.core.service.JiraServer;
53
54
/**
55
 * @author Brock Janiczak
56
 * @author Eugene Kuleshov (layout and other improvements)
57
 */
58
public class IssueAttributesPage extends WizardPage {
59
	final Placeholder ANY_ISSUE_TYPE = new Placeholder("Any");
60
61
	final Placeholder ANY_RESOLUTION = new Placeholder("Any");
62
63
	final Placeholder UNRESOLVED = new Placeholder("Unresolved");
64
65
	final Placeholder UNASSIGNED = new Placeholder("Unassigned");
66
67
	final Placeholder ANY_REPORTER = new Placeholder("Any");
68
69
	final Placeholder NO_REPORTER = new Placeholder("No Reporter");
70
71
	final Placeholder CURRENT_USER_REPORTER = new Placeholder("Current User");
72
73
	final Placeholder SPECIFIC_USER_REPORTER = new Placeholder("Specified User");
74
75
	final Placeholder SPECIFIC_GROUP_REPORTER = new Placeholder("Specified Group");
76
77
	final Placeholder ANY_ASSIGNEE = new Placeholder("Any");
78
79
	final Placeholder CURRENT_USER_ASSIGNEE = new Placeholder("Current User");
80
81
	final Placeholder SPECIFIC_USER_ASSIGNEE = new Placeholder("Specified User");
82
83
	final Placeholder SPECIFIC_GROUP_ASSIGNEE = new Placeholder("Specified Group");
84
85
	final Placeholder ANY_STATUS = new Placeholder("Any");
86
87
	final Placeholder ANY_PRIORITY = new Placeholder("Any");
88
89
//	private final TaskRepository repository;
90
91
	private final JiraServer jiraServer;
92
93
	private final FilterDefinition workingCopy;
94
95
	private final boolean isNew;
96
97
	private ListViewer issueType;
98
99
	private ComboViewer reporterType;
100
101
	private ComboViewer assigneeType;
102
103
	private ListViewer status;
104
105
	private ListViewer resolution;
106
107
	private ListViewer priority;
108
109
	Text assignee;
110
111
	Text reporter;
112
113
	/**
114
	 * @param repository
115
	 * @param pageName
116
	 * @param title
117
	 * @param titleImage
118
	 * @param server
119
	 */
120
	protected IssueAttributesPage(TaskRepository repository, FilterDefinition workingCopy, boolean isNew) {
121
		super("issueAttributes", "Issue Attributes", null);
122
		this.jiraServer = JiraServerFacade.getDefault().getJiraServer(repository);
123
		this.workingCopy = workingCopy;
124
		this.isNew = isNew;
125
126
		setPageComplete(false);
127
	}
128
129
	/*
130
	 * (non-Javadoc)
131
	 * 
132
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
133
	 */
134
	public void createControl(Composite parent) {
135
		GridData gd;
136
137
		Composite cc = new Composite(parent, SWT.NONE);
138
		cc.setLayout(new GridLayout(1, false));
139
140
		{
141
			Composite c = new Composite(cc, SWT.NONE);
142
			final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
143
			gridData.widthHint = 515;
144
			c.setLayoutData(gridData);
145
			c.setLayout(new GridLayout(3, false));
146
147
			Label lblReportedBy = new Label(c, SWT.NONE);
148
			lblReportedBy.setText("Reported By:");
149
			lblReportedBy.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
150
151
			reporterType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY);
152
			final GridData gridData_1 = new GridData(SWT.FILL, SWT.FILL, false, false);
153
			gridData_1.widthHint = 133;
154
			reporterType.getControl().setLayoutData(gridData_1);
155
156
			reporterType.setContentProvider(new IStructuredContentProvider() {
157
158
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
159
				}
160
161
				public void dispose() {
162
				}
163
164
				public Object[] getElements(Object inputElement) {
165
					return new Object[] { ANY_REPORTER, NO_REPORTER, CURRENT_USER_REPORTER, SPECIFIC_USER_REPORTER,
166
							SPECIFIC_GROUP_REPORTER };
167
				}
168
169
			});
170
171
			reporterType.setLabelProvider(new LabelProvider() {
172
173
				public String getText(Object element) {
174
					return ((Placeholder) element).getText();
175
				}
176
177
			});
178
179
			reporterType.setInput(jiraServer);
180
181
			reporter = new Text(c, SWT.BORDER);
182
			reporter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
183
			reporter.setEnabled(false);
184
185
			reporter.addModifyListener(new ModifyListener() {
186
187
				public void modifyText(ModifyEvent e) {
188
					validatePage();
189
				}
190
191
			});
192
193
			Label lblAssignedTo = new Label(c, SWT.NONE);
194
			lblAssignedTo.setText("Assigned To:");
195
			lblAssignedTo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
196
197
			assigneeType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY);
198
			final GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, false, false);
199
			gridData_2.widthHint = 118;
200
			assigneeType.getControl().setLayoutData(gridData_2);
201
202
			assigneeType.setContentProvider(new IStructuredContentProvider() {
203
204
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
205
				}
206
207
				public void dispose() {
208
				}
209
210
				public Object[] getElements(Object inputElement) {
211
					return new Object[] { ANY_ASSIGNEE, UNASSIGNED, CURRENT_USER_ASSIGNEE, SPECIFIC_USER_ASSIGNEE,
212
							SPECIFIC_GROUP_ASSIGNEE };
213
				}
214
215
			});
216
217
			assigneeType.setLabelProvider(new LabelProvider() {
218
219
				public String getText(Object element) {
220
					return ((Placeholder) element).getText();
221
				}
222
223
			});
224
225
			assigneeType.setInput(jiraServer);
226
			assigneeType.addSelectionChangedListener(new ISelectionChangedListener() {
227
228
				public void selectionChanged(SelectionChangedEvent event) {
229
					Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
230
					if (SPECIFIC_USER_ASSIGNEE.equals(selection) || SPECIFIC_GROUP_ASSIGNEE.equals(selection)) {
231
						assignee.setEnabled(true);
232
					} else {
233
						assignee.setEnabled(false);
234
						assignee.setText(""); //$NON-NLS-1$
235
					}
236
					validatePage();
237
				}
238
239
			});
240
241
			reporterType.addSelectionChangedListener(new ISelectionChangedListener() {
242
243
				public void selectionChanged(SelectionChangedEvent event) {
244
					Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
245
					if (SPECIFIC_USER_REPORTER.equals(selection) || SPECIFIC_GROUP_REPORTER.equals(selection)) {
246
						reporter.setEnabled(true);
247
					} else {
248
						reporter.setEnabled(false);
249
					}
250
				}
251
252
			});
253
254
			assignee = new Text(c, SWT.BORDER);
255
			assignee.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
256
			assignee.setEnabled(false);
257
258
			assignee.addModifyListener(new ModifyListener() {
259
260
				public void modifyText(ModifyEvent e) {
261
					validatePage();
262
				}
263
264
			});
265
266
		}
267
268
		{
269
			Composite c = new Composite(cc, SWT.NONE);
270
			final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
271
			gridData.heightHint = 149;
272
			c.setLayoutData(gridData);
273
			c.setLayout(new GridLayout(4, false));
274
275
			Label lblIssueType = new Label(c, SWT.NONE);
276
			lblIssueType.setText("Type:");
277
278
			Label lblStatus = new Label(c, SWT.NONE);
279
			lblStatus.setText("Status:");
280
281
			Label lblResolution = new Label(c, SWT.NONE);
282
			lblResolution.setText("Resolution:");
283
284
			Label lblPriority = new Label(c, SWT.NONE);
285
			lblPriority.setText("Priority:");
286
			
287
			issueType = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
288
			gd = new GridData(SWT.FILL, SWT.FILL, true, true);
289
			gd.heightHint = 40;
290
			issueType.getControl().setLayoutData(gd);
291
292
			issueType.setContentProvider(new IStructuredContentProvider() {
293
294
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
295
				}
296
297
				public void dispose() {
298
				}
299
300
				public Object[] getElements(Object inputElement) {
301
					JiraServer server = (JiraServer) inputElement;
302
					Object[] elements = new Object[server.getIssueTypes().length + 1];
303
					elements[0] = ANY_ISSUE_TYPE;
304
					System.arraycopy(server.getIssueTypes(), 0, elements, 1, server.getIssueTypes().length);
305
306
					return elements;
307
				}
308
			});
309
310
			issueType.setLabelProvider(new LabelProvider() {
311
312
				public String getText(Object element) {
313
					if (element instanceof Placeholder) {
314
						return ((Placeholder) element).getText();
315
					}
316
317
					return ((IssueType) element).getName();
318
				}
319
320
			});
321
322
			issueType.addSelectionChangedListener(new ISelectionChangedListener() {
323
324
				public void selectionChanged(SelectionChangedEvent event) {
325
					validatePage();
326
				}
327
328
			});
329
			issueType.setInput(jiraServer);
330
331
			status = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
332
			gd = new GridData(SWT.FILL, SWT.FILL, true, true);
333
			gd.heightHint = 40;
334
			status.getControl().setLayoutData(gd);
335
336
			status.setContentProvider(new IStructuredContentProvider() {
337
338
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
339
				}
340
341
				public void dispose() {
342
				}
343
344
				public Object[] getElements(Object inputElement) {
345
					JiraServer server = (JiraServer) inputElement;
346
					Object[] elements = new Object[server.getStatuses().length + 1];
347
					elements[0] = ANY_STATUS;
348
					System.arraycopy(server.getStatuses(), 0, elements, 1, server.getStatuses().length);
349
350
					return elements;
351
				}
352
			});
353
354
			status.setLabelProvider(new LabelProvider() {
355
356
				public String getText(Object element) {
357
					if (element instanceof Placeholder) {
358
						return ((Placeholder) element).getText();
359
					}
360
361
					return ((Status) element).getName();
362
				}
363
364
			});
365
366
			status.addSelectionChangedListener(new ISelectionChangedListener() {
367
368
				public void selectionChanged(SelectionChangedEvent event) {
369
					validatePage();
370
				}
371
372
			});
373
			status.setInput(jiraServer);
374
375
			resolution = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
376
			gd = new GridData(SWT.FILL, SWT.FILL, true, true);
377
			gd.heightHint = 40;
378
			resolution.getControl().setLayoutData(gd);
379
			resolution.setContentProvider(new IStructuredContentProvider() {
380
381
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
382
				}
383
384
				public void dispose() {
385
				}
386
387
				public Object[] getElements(Object inputElement) {
388
					JiraServer server = (JiraServer) inputElement;
389
					Object[] elements = new Object[server.getResolutions().length + 2];
390
					elements[0] = ANY_RESOLUTION;
391
					elements[1] = UNRESOLVED;
392
					System.arraycopy(server.getResolutions(), 0, elements, 2, server.getResolutions().length);
393
394
					return elements;
395
				}
396
			});
397
398
			resolution.setLabelProvider(new LabelProvider() {
399
400
				public String getText(Object element) {
401
					if (element instanceof Placeholder) {
402
						return ((Placeholder) element).getText();
403
					}
404
405
					return ((Resolution) element).getName();
406
				}
407
408
			});
409
410
			resolution.addSelectionChangedListener(new ISelectionChangedListener() {
411
412
				public void selectionChanged(SelectionChangedEvent event) {
413
					validatePage();
414
				}
415
416
			});
417
			resolution.setInput(jiraServer);
418
419
			priority = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
420
			gd = new GridData(SWT.FILL, SWT.FILL, true, true);
421
			gd.heightHint = 40;
422
			priority.getControl().setLayoutData(gd);
423
424
			priority.setContentProvider(new IStructuredContentProvider() {
425
426
				public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
427
				}
428
429
				public void dispose() {
430
				}
431
432
				public Object[] getElements(Object inputElement) {
433
					JiraServer server = (JiraServer) inputElement;
434
					Object[] elements = new Object[server.getPriorities().length + 1];
435
					elements[0] = ANY_PRIORITY;
436
					System.arraycopy(server.getPriorities(), 0, elements, 1, server.getPriorities().length);
437
438
					return elements;
439
				}
440
			});
441
442
			priority.setLabelProvider(new LabelProvider() {
443
444
				public String getText(Object element) {
445
					if (element instanceof Placeholder) {
446
						return ((Placeholder) element).getText();
447
					}
448
449
					return ((Priority) element).getName();
450
				}
451
452
			});
453
			priority.addSelectionChangedListener(new ISelectionChangedListener() {
454
455
				public void selectionChanged(SelectionChangedEvent event) {
456
					validatePage();
457
				}
458
459
			});
460
			priority.setInput(jiraServer);
461
		}
462
463
		if (isNew) {
464
			loadFromDefaults();
465
		} else {
466
			loadFromWorkingCopy();
467
		}
468
469
		setControl(cc);
470
	}
471
472
	void validatePage() {
473
474
	}
475
476
	/* default */void applyChanges() {
477
		if(issueType==null) {
478
			return;
479
		}
480
		
481
		// TODO support standard and subtask issue types
482
		IStructuredSelection issueTypeSelection = (IStructuredSelection) issueType.getSelection();
483
		if (issueTypeSelection.isEmpty()) {
484
			workingCopy.setIssueTypeFilter(null);
485
		} else {
486
			boolean isAnyIssueTypeSelected = false;
487
488
			List<IssueType> selectedIssueTypes = new ArrayList<IssueType>();
489
490
			for (Iterator i = issueTypeSelection.iterator(); i.hasNext();) {
491
				Object selection = i.next();
492
				if (ANY_ISSUE_TYPE.equals(selection)) {
493
					isAnyIssueTypeSelected = true;
494
				} else if (selection instanceof IssueType) {
495
					selectedIssueTypes.add((IssueType) selection);
496
				}
497
			}
498
499
			if (isAnyIssueTypeSelected) {
500
				workingCopy.setIssueTypeFilter(null);
501
			} else {
502
				workingCopy.setIssueTypeFilter(
503
					new IssueTypeFilter(selectedIssueTypes.toArray(new IssueType[selectedIssueTypes.size()])));
504
			}
505
		}
506
507
		IStructuredSelection reporterSelection = (IStructuredSelection) reporterType.getSelection();
508
		if (reporterSelection.isEmpty()) {
509
			workingCopy.setReportedByFilter(null);
510
		} else {
511
			if (ANY_REPORTER.equals(reporterSelection.getFirstElement())) {
512
				workingCopy.setReportedByFilter(null);
513
			} else if (NO_REPORTER.equals(reporterSelection.getFirstElement())) {
514
				workingCopy.setReportedByFilter(new NobodyFilter());
515
			} else if (CURRENT_USER_REPORTER.equals(reporterSelection.getFirstElement())) {
516
				workingCopy.setReportedByFilter(new CurrentUserFilter());
517
			} else if (SPECIFIC_GROUP_REPORTER.equals(reporterSelection.getFirstElement())) {
518
				workingCopy.setReportedByFilter(new UserInGroupFilter(reporter.getText()));
519
			} else if (SPECIFIC_USER_REPORTER.equals(reporterSelection.getFirstElement())) {
520
				workingCopy.setReportedByFilter(new SpecificUserFilter(reporter.getText()));
521
			} else {
522
				workingCopy.setReportedByFilter(null);
523
			}
524
		}
525
526
		IStructuredSelection assigneeSelection = (IStructuredSelection) assigneeType.getSelection();
527
		if (assigneeSelection.isEmpty()) {
528
			workingCopy.setAssignedToFilter(null);
529
		} else {
530
			if (ANY_REPORTER.equals(assigneeSelection.getFirstElement())) {
531
				workingCopy.setAssignedToFilter(null);
532
			} else if (UNASSIGNED.equals(assigneeSelection.getFirstElement())) {
533
				workingCopy.setAssignedToFilter(new NobodyFilter());
534
			} else if (CURRENT_USER_REPORTER.equals(assigneeSelection.getFirstElement())) {
535
				workingCopy.setAssignedToFilter(new CurrentUserFilter());
536
			} else if (SPECIFIC_GROUP_REPORTER.equals(assigneeSelection.getFirstElement())) {
537
				workingCopy.setAssignedToFilter(new UserInGroupFilter(assignee.getText()));
538
			} else if (SPECIFIC_USER_REPORTER.equals(assigneeSelection.getFirstElement())) {
539
				workingCopy.setAssignedToFilter(new SpecificUserFilter(assignee.getText()));
540
			} else {
541
				workingCopy.setAssignedToFilter(null);
542
			}
543
		}
544
545
		IStructuredSelection statusSelection = (IStructuredSelection) status.getSelection();
546
		if (statusSelection.isEmpty()) {
547
			workingCopy.setStatusFilter(null);
548
		} else {
549
			boolean isAnyStatusSelected = false;
550
551
			List<Status> selectedStatuses = new ArrayList<Status>();
552
553
			for (Iterator i = statusSelection.iterator(); i.hasNext();) {
554
				Object selection = i.next();
555
				if (ANY_STATUS.equals(selection)) {
556
					isAnyStatusSelected = true;
557
				} else if (selection instanceof Status) {
558
					selectedStatuses.add((Status) selection);
559
				}
560
			}
561
562
			if (isAnyStatusSelected) {
563
				workingCopy.setStatusFilter(null);
564
			} else {
565
				workingCopy.setStatusFilter(
566
					new StatusFilter(selectedStatuses.toArray(new Status[selectedStatuses.size()])));
567
			}
568
		}
569
570
		IStructuredSelection resolutionSelection = (IStructuredSelection) resolution.getSelection();
571
		if (resolutionSelection.isEmpty()) {
572
			workingCopy.setResolutionFilter(null);
573
		} else {
574
			boolean isAnyResolutionSelected = false;
575
576
			List<Resolution> selectedResolutions = new ArrayList<Resolution>();
577
578
			for (Iterator i = resolutionSelection.iterator(); i.hasNext();) {
579
				Object selection = i.next();
580
				if (ANY_RESOLUTION.equals(selection)) {
581
					isAnyResolutionSelected = true;
582
				} else if (selection instanceof Resolution) {
583
					selectedResolutions.add((Resolution) selection);
584
				}
585
			}
586
587
			if (isAnyResolutionSelected) {
588
				workingCopy.setResolutionFilter(null);
589
			} else {
590
				workingCopy.setResolutionFilter(
591
					new ResolutionFilter(selectedResolutions.toArray(new Resolution[selectedResolutions.size()])));
592
			}
593
		}
594
595
		IStructuredSelection prioritySelection = (IStructuredSelection) priority.getSelection();
596
		if (prioritySelection.isEmpty()) {
597
			workingCopy.setPriorityFilter(null);
598
		} else {
599
			boolean isAnyPrioritiesSelected = false;
600
601
			List<Priority> selectedPriorities = new ArrayList<Priority>();
602
603
			for (Iterator i = prioritySelection.iterator(); i.hasNext();) {
604
				Object selection = i.next();
605
				if (ANY_PRIORITY.equals(selection)) {
606
					isAnyPrioritiesSelected = true;
607
				} else if (selection instanceof Priority) {
608
					selectedPriorities.add((Priority) selection);
609
				}
610
			}
611
612
			if (isAnyPrioritiesSelected) {
613
				workingCopy.setPriorityFilter(null);
614
			} else {
615
				workingCopy.setPriorityFilter(
616
					new PriorityFilter(selectedPriorities.toArray(new Priority[selectedPriorities.size()])));
617
			}
618
		}
619
	}
620
621
	private void loadFromDefaults() {
622
		issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE));
623
		reporterType.setSelection(new StructuredSelection(ANY_REPORTER));
624
		assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE));
625
		status.setSelection(new StructuredSelection(ANY_STATUS));
626
		resolution.setSelection(new StructuredSelection(ANY_RESOLUTION));
627
		priority.setSelection(new StructuredSelection(ANY_PRIORITY));
628
	}
629
630
	private void loadFromWorkingCopy() {
631
		if (workingCopy.getIssueTypeFilter() != null) {
632
			issueType.setSelection(new StructuredSelection(workingCopy.getIssueTypeFilter().getIsueTypes()));
633
		} else {
634
			issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE));
635
		}
636
637
		if (workingCopy.getReportedByFilter() != null) {
638
			UserFilter reportedByFilter = workingCopy.getReportedByFilter();
639
			if (reportedByFilter instanceof NobodyFilter) {
640
				reporterType.setSelection(new StructuredSelection(NO_REPORTER));
641
			} else if (reportedByFilter instanceof CurrentUserFilter) {
642
				reporterType.setSelection(new StructuredSelection(CURRENT_USER_REPORTER));
643
			} else if (reportedByFilter instanceof SpecificUserFilter) {
644
				reporterType.setSelection(new StructuredSelection(SPECIFIC_USER_REPORTER));
645
				reporter.setText(((SpecificUserFilter) reportedByFilter).getUser());
646
			} else if (reportedByFilter instanceof UserInGroupFilter) {
647
				reporterType.setSelection(new StructuredSelection(SPECIFIC_GROUP_REPORTER));
648
				reporter.setText(((UserInGroupFilter) reportedByFilter).getGroup());
649
			}
650
		} else {
651
			reporterType.setSelection(new StructuredSelection(ANY_REPORTER));
652
		}
653
654
		if (workingCopy.getAssignedToFilter() != null) {
655
			UserFilter assignedToFilter = workingCopy.getAssignedToFilter();
656
			if (assignedToFilter instanceof NobodyFilter) {
657
				assigneeType.setSelection(new StructuredSelection(UNASSIGNED));
658
			} else if (assignedToFilter instanceof CurrentUserFilter) {
659
				assigneeType.setSelection(new StructuredSelection(CURRENT_USER_ASSIGNEE));
660
			} else if (assignedToFilter instanceof SpecificUserFilter) {
661
				assigneeType.setSelection(new StructuredSelection(SPECIFIC_USER_ASSIGNEE));
662
				assignee.setText(((SpecificUserFilter) assignedToFilter).getUser());
663
			} else if (assignedToFilter instanceof UserInGroupFilter) {
664
				assigneeType.setSelection(new StructuredSelection(SPECIFIC_GROUP_ASSIGNEE));
665
				assignee.setText(((UserInGroupFilter) assignedToFilter).getGroup());
666
			}
667
		} else {
668
			assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE));
669
		}
670
671
		if (workingCopy.getStatusFilter() != null) {
672
			status.setSelection(new StructuredSelection(workingCopy.getStatusFilter().getStatuses()));
673
		} else {
674
			status.setSelection(new StructuredSelection(ANY_STATUS));
675
		}
676
677
		if (workingCopy.getResolutionFilter() != null) {
678
			resolution.setSelection(new StructuredSelection(workingCopy.getResolutionFilter().getResolutions()));
679
		} else {
680
			resolution.setSelection(new StructuredSelection(ANY_RESOLUTION));
681
		}
682
683
		if (workingCopy.getPriorityFilter() != null) {
684
			priority.setSelection(new StructuredSelection(workingCopy.getPriorityFilter().getPriorities()));
685
		} else {
686
			priority.setSelection(new StructuredSelection(ANY_PRIORITY));
687
		}
688
	}
689
690
	private final class Placeholder {
691
		private final String text;
692
693
		public Placeholder(String text) {
694
			this.text = text;
695
		}
696
697
		/*
698
		 * (non-Javadoc)
699
		 * 
700
		 * @see java.lang.Object#equals(java.lang.Object)
701
		 */
702
		public boolean equals(Object obj) {
703
			if (obj == null)
704
				return false;
705
			if (!(obj instanceof Placeholder))
706
				return false;
707
708
			Placeholder that = (Placeholder) obj;
709
			return this.text.equals(that.text);
710
		}
711
712
		public String getText() {
713
			return this.text;
714
		}
715
	}
716
}

Return to bug 149605