Problem with Thread Understanding [message #790029] |
Fri, 03 February 2012 18:21 |
fan Missing name Messages: 7 Registered: June 2011 |
Junior Member |
|
|
Hello
I got a problem with the understanding why some of my code doesnt work. I wrote some code to search a label in a shell :
private void init(){
labels=new ArrayList<Label>();
PlatformUI.createDisplay().syncExec(new Runnable() {
@Override
public void run(){
Control[] children = parentShell.getChildren();
for(Control control : children){
if (control instanceof Composite)
findLabels((Composite)control);
else if (control instanceof Label)
labels.add((Label)control);
}
boolean found = false;
for (Label label : labels){
if (label.getToolTipText()!= null && label.getToolTipText().equals(buttonTooltip)){
transButton = label;
found =true;
}
if ( !found )
throw new WidgetNotFoundException("Widget with Tooltip\" "+buttonTooltip+" \" not found! ");
}
}
});
}
My problem is, that I need the Shell, in which the label is to be searched. So that I can do:
Control[] children = parentShell.getChildren(); ( line 6 in the method)
So how do I get this Shell? I tried parentShell = botShell.widget() ( botShell is a SWTBotShell), but that doenst work. If I debug it and look what I get, the parenShell has the text "Wrong Thread". I must admit that I don´t know much about the Thread concept, so can someone plz explain to me why it doens´t work, and how it should be done.
[Updated on: Fri, 03 February 2012 18:22] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04102 seconds