|
Re: GraphitiUi.getUiLayoutService().calculateTextSize [message #819499 is a reply to message #810209] |
Tue, 13 March 2012 01:21 |
Aljoscha Hark Messages: 24 Registered: March 2012 |
Junior Member |
|
|
i came across the same problem (in the same situation @ an handler started by the "create from existing"-wizard) and filed bug @374020 (cannot post a link by now)
a workaround (of course not recommended) could be to create a wrapper for "GraphitiUi.getUiLayoutService().calculateTextSize(String, Font)" which runs the method synchronously in the UI thread. all accesses to the method which could be processed during the "dark feature" should use this wrapper method.
example:
public class CalculateUtil {
private static class CalculateRunnable implements Runnable {
private final String text;
private final Font font;
private IDimension dimension;
public CalculateRunnable(String text, Font font) {
this.text = text;
this.font = font;
}
@Override
public void run() {
dimension = GraphitiUi.getUiLayoutService().calculateTextSize(text, font);
}
public IDimension getDimension() {
return dimension;
}
}
public static IDimension calculateTextSize(String text, Font font) {
CalculateRunnable runnable = new CalculateRunnable(text, font);
PlatformUI.getWorkbench().getDisplay().syncExec(runnable);
return runnable.getDimension();
}
}
[Updated on: Tue, 13 March 2012 01:22] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03398 seconds