Skip to content

Commit 98f67f8

Browse files
committed
Fixes #103: IllegalStateException: Must be called in the UI thread
1 parent a8cac68 commit 98f67f8

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

ReleaseNotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Eclipse Update Site:
1313

1414
### Fixed Issues
1515

16+
* [#103](https://github.com/pmd/pmd-eclipse-plugin/issues/103): IllegalStateException: Must be called in the UI thread
17+
1618
### API Changes
1719

1820
### External Contributions

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/ShapePainter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package net.sourceforge.pmd.eclipse.ui;
66

7-
import org.eclipse.swt.SWT;
87
import org.eclipse.swt.graphics.GC;
98
import org.eclipse.swt.graphics.Image;
109
import org.eclipse.swt.graphics.ImageData;
@@ -19,6 +18,8 @@
1918
*
2019
*/
2120
public class ShapePainter {
21+
private static final RGB RGB_BLACK = new RGB(0, 0, 0);
22+
2223
private ShapePainter() {
2324
}
2425

@@ -35,7 +36,7 @@ public static Image newDrawnImage(Display display, int width, int height, Shape
3536
gc.setBackground(PMDPlugin.getDefault().colorFor(transparentColour));
3637
gc.fillRectangle(0, 0, width, height);
3738

38-
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
39+
gc.setForeground(PMDPlugin.getDefault().colorFor(RGB_BLACK));
3940
gc.setBackground(PMDPlugin.getDefault().colorFor(fillColour));
4041

4142
drawShape(width - 1, height - 1, shape, gc, 0, 0, null);

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/priority/PriorityDescriptor.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,9 @@ public void dispose() {
239239
}
240240

241241
/**
242-
* Eagerly create the images. This must be called in a UI thread!
242+
* Eagerly create the images.
243243
*/
244244
public void refreshImages() {
245-
if (Display.getCurrent() == null) {
246-
throw new IllegalStateException("Must be called in the UI thread");
247-
}
248-
249245
dispose();
250246
Image image = getAnnotationImage();
251247
if (image == null) {

0 commit comments

Comments
 (0)