Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Problem with Thread Understanding
Problem with Thread Understanding [message #790029] Fri, 03 February 2012 13:21
fan Missing name is currently offline 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 13:22]

Report message to a moderator

Previous Topic:Using DropDownButton
Next Topic:SWTBot handling of "obscure" keyboard layouts
Goto Forum:
  


Current Time: Thu Jul 31 05:38:03 EDT 2014

Powered by FUDForum. Page generated in 0.01464 seconds