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
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Mylyn project committers 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
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.bugs.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.internal.tasks.bugs.AttributeTaskMapper;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* @author Steffen Pingel
*/
public class ReportErrorPage extends WizardPage {
private final IStatus status;
private final AttributeTaskMapper mapper;
protected TaskRepository taskRepository;
public ReportErrorPage(AttributeTaskMapper mapper, IStatus status) {
super("reportError");
this.mapper = mapper;
this.status = status;
setTitle("Report as Bug");
setMessage("An unexpected error has occured in plug-in " + status.getPlugin() + "");
}
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, true));
// Group errorGroup = new Group(composite, SWT.NONE);
// GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(errorGroup);
// errorGroup.setText("Details");
// errorGroup.setLayout(new GridLayout(1, true));
Label label = new Label(composite, SWT.NONE);
label.setText("Details:");
Text text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);
text.setText(status.getMessage());
GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(text);
// space
new Label(composite, SWT.NONE);
if (mapper.isMappingComplete()) {
final Button defaultRepositoryButton = new Button(composite, SWT.RADIO);
defaultRepositoryButton.setText("Report to: " + mapper.getTaskRepository().getRepositoryLabel());
defaultRepositoryButton.setSelection(true);
final Button selectRepositoryButton = new Button(composite, SWT.RADIO);
selectRepositoryButton.setText("Select repository");
defaultRepositoryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (defaultRepositoryButton.getSelection()) {
selectRepositoryButton.setSelection(false);
}
taskRepository = mapper.getTaskRepository();
getContainer().updateButtons();
}
});
selectRepositoryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (selectRepositoryButton.getSelection()) {
defaultRepositoryButton.setSelection(false);
}
taskRepository = null;
getContainer().updateButtons();
}
});
taskRepository = mapper.getTaskRepository();
} else {
taskRepository = null;
}
setControl(composite);
}
@Override
public boolean canFlipToNextPage() {
return taskRepository == null;
}
public TaskRepository getTaskRepository() {
return taskRepository;
}
@Override
public boolean isPageComplete() {
return true;
}
}
|