|
Lines 13-23
Link Here
|
| 13 |
import java.io.PrintWriter; |
13 |
import java.io.PrintWriter; |
| 14 |
import java.io.StringWriter; |
14 |
import java.io.StringWriter; |
| 15 |
|
15 |
|
| 16 |
import org.eclipse.core.runtime.IStatus; |
|
|
| 17 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 18 |
import org.eclipse.swt.SWT; |
16 |
import org.eclipse.swt.SWT; |
| 19 |
import org.eclipse.swt.events.SelectionAdapter; |
17 |
import org.eclipse.swt.events.SelectionAdapter; |
| 20 |
import org.eclipse.swt.events.SelectionEvent; |
18 |
import org.eclipse.swt.events.SelectionEvent; |
|
|
19 |
import org.eclipse.swt.graphics.Color; |
| 21 |
import org.eclipse.swt.graphics.Image; |
20 |
import org.eclipse.swt.graphics.Image; |
| 22 |
import org.eclipse.swt.layout.FillLayout; |
21 |
import org.eclipse.swt.layout.FillLayout; |
| 23 |
import org.eclipse.swt.layout.GridData; |
22 |
import org.eclipse.swt.layout.GridData; |
|
Lines 29-34
Link Here
|
| 29 |
import org.eclipse.swt.widgets.Label; |
28 |
import org.eclipse.swt.widgets.Label; |
| 30 |
import org.eclipse.swt.widgets.Text; |
29 |
import org.eclipse.swt.widgets.Text; |
| 31 |
|
30 |
|
|
|
31 |
import org.eclipse.core.runtime.IStatus; |
| 32 |
|
| 33 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 34 |
|
| 32 |
/** |
35 |
/** |
| 33 |
* @since 3.1 |
36 |
* @since 3.1 |
| 34 |
*/ |
37 |
*/ |
|
Lines 41-46
Link Here
|
| 41 |
private IStatus reason; |
44 |
private IStatus reason; |
| 42 |
|
45 |
|
| 43 |
public StatusPart(final Composite parent, IStatus reason_) { |
46 |
public StatusPart(final Composite parent, IStatus reason_) { |
|
|
47 |
Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND); |
| 48 |
Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND); |
| 49 |
|
| 50 |
parent.setBackground(bgColor); |
| 51 |
parent.setForeground(fgColor); |
| 52 |
|
| 44 |
this.reason = reason_; |
53 |
this.reason = reason_; |
| 45 |
GridLayout layout = new GridLayout(); |
54 |
GridLayout layout = new GridLayout(); |
| 46 |
|
55 |
|
|
Lines 57-65
Link Here
|
| 57 |
parent.setLayout(layout); |
66 |
parent.setLayout(layout); |
| 58 |
|
67 |
|
| 59 |
Label imageLabel = new Label(parent, SWT.NONE); |
68 |
Label imageLabel = new Label(parent, SWT.NONE); |
|
|
69 |
imageLabel.setBackground(bgColor); |
| 60 |
Image image = getImage(); |
70 |
Image image = getImage(); |
| 61 |
if (image != null) { |
71 |
if (image != null) { |
| 62 |
image.setBackground(imageLabel.getBackground()); |
72 |
image.setBackground(bgColor); |
| 63 |
imageLabel.setImage(image); |
73 |
imageLabel.setImage(image); |
| 64 |
imageLabel.setLayoutData(new GridData( |
74 |
imageLabel.setLayoutData(new GridData( |
| 65 |
GridData.HORIZONTAL_ALIGN_CENTER |
75 |
GridData.HORIZONTAL_ALIGN_CENTER |
|
Lines 67-78
Link Here
|
| 67 |
} |
77 |
} |
| 68 |
|
78 |
|
| 69 |
Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); |
79 |
Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); |
| 70 |
text.setBackground(text.getDisplay().getSystemColor( |
80 |
text.setBackground(bgColor); |
| 71 |
SWT.COLOR_WIDGET_BACKGROUND)); |
81 |
text.setForeground(fgColor); |
| 72 |
|
82 |
|
| 73 |
//text.setForeground(JFaceColors.getErrorText(text.getDisplay())); |
83 |
//text.setForeground(JFaceColors.getErrorText(text.getDisplay())); |
| 74 |
text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); |
84 |
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
| 75 |
text.setText(reason.getMessage()); |
85 |
text.setText(reason.getMessage()); |
| 76 |
|
86 |
|
| 77 |
detailsButton = new Button(parent, SWT.PUSH); |
87 |
detailsButton = new Button(parent, SWT.PUSH); |
| 78 |
detailsButton.addSelectionListener(new SelectionAdapter() { |
88 |
detailsButton.addSelectionListener(new SelectionAdapter() { |
|
Lines 81-92
Link Here
|
| 81 |
} |
91 |
} |
| 82 |
}); |
92 |
}); |
| 83 |
|
93 |
|
| 84 |
detailsButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); |
94 |
detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); |
| 85 |
detailsButton.setVisible(reason.getException() != null); |
95 |
detailsButton.setVisible(reason.getException() != null); |
| 86 |
|
96 |
|
| 87 |
updateDetailsText(); |
97 |
updateDetailsText(); |
| 88 |
|
98 |
|
| 89 |
detailsArea = new Composite(parent, SWT.NONE); |
99 |
detailsArea = new Composite(parent, SWT.NONE); |
|
|
100 |
detailsArea.setBackground(bgColor); |
| 101 |
detailsArea.setForeground(fgColor); |
| 90 |
GridData data = new GridData(GridData.FILL_BOTH); |
102 |
GridData data = new GridData(GridData.FILL_BOTH); |
| 91 |
data.horizontalSpan = 3; |
103 |
data.horizontalSpan = 3; |
| 92 |
data.verticalSpan = 1; |
104 |
data.verticalSpan = 1; |
|
Lines 98-110
Link Here
|
| 98 |
/** |
110 |
/** |
| 99 |
* Return the image for the upper-left corner of this part |
111 |
* Return the image for the upper-left corner of this part |
| 100 |
* |
112 |
* |
| 101 |
* @return |
113 |
* @return the image |
| 102 |
*/ |
114 |
*/ |
| 103 |
private Image getImage() { |
115 |
private Image getImage() { |
| 104 |
Display d = Display.getCurrent(); |
116 |
Display d = Display.getCurrent(); |
| 105 |
|
117 |
|
| 106 |
switch(reason.getSeverity()) { |
118 |
switch(reason.getSeverity()) { |
| 107 |
case IStatus.ERROR: |
119 |
case IStatus.ERROR: |
| 108 |
return d.getSystemImage(SWT.ICON_ERROR); |
120 |
return d.getSystemImage(SWT.ICON_ERROR); |
| 109 |
case IStatus.WARNING: |
121 |
case IStatus.WARNING: |
| 110 |
return d.getSystemImage(SWT.ICON_WARNING); |
122 |
return d.getSystemImage(SWT.ICON_WARNING); |
|
Lines 129-135
Link Here
|
| 129 |
|
141 |
|
| 130 |
if (showingDetails) { |
142 |
if (showingDetails) { |
| 131 |
detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); |
143 |
detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); |
| 132 |
Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL |
144 |
Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL |
| 133 |
| SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT); |
145 |
| SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT); |
| 134 |
detailsText.setText(getDetails(reason)); |
146 |
detailsText.setText(getDetails(reason)); |
| 135 |
detailsText.setBackground(detailsText.getDisplay().getSystemColor( |
147 |
detailsText.setBackground(detailsText.getDisplay().getSystemColor( |