use of com.biglybt.core.util.AERunnableObject in project BiglyBT by BiglySoftware.
the class ClipboardCopy method copyFromClipboard.
public static String copyFromClipboard() {
if (Utils.isSWTThread()) {
Clipboard clipboard = new Clipboard(Display.getDefault());
String text = (String) clipboard.getContents(TextTransfer.getInstance());
clipboard.dispose();
return (text);
} else {
return ((String) Utils.execSWTThreadWithObject("copyFromClipboard", new AERunnableObject() {
@Override
public Object runSupport() {
Clipboard clipboard = new Clipboard(Display.getDefault());
String text = (String) clipboard.getContents(TextTransfer.getInstance());
clipboard.dispose();
return (text);
}
}, 10 * 1000));
}
}
use of com.biglybt.core.util.AERunnableObject in project BiglyBT by BiglySoftware.
the class SWTSkinObjectContainer method getChildren.
public SWTSkinObject[] getChildren() {
if (isDisposed()) {
return new SWTSkinObject[0];
}
SWTSkinObject[] so = (SWTSkinObject[]) Utils.execSWTThreadWithObject("getChildren", new AERunnableObject() {
@Override
public Object runSupport() {
if (control.isDisposed()) {
return new SWTSkinObject[0];
}
Control[] swtChildren = ((Composite) control).getChildren();
ArrayList<SWTSkinObject> list = new ArrayList<>(swtChildren.length);
for (int i = 0; i < swtChildren.length; i++) {
Control childControl = swtChildren[i];
SWTSkinObject so = (SWTSkinObject) childControl.getData("SkinObject");
if (so != null) {
list.add(so);
}
}
return list.toArray(new SWTSkinObject[list.size()]);
}
}, 2000);
if (so == null) {
System.err.println("Tell Tux to fix this " + Debug.getCompressedStackTrace());
return oldgetChildren();
}
return so;
}