UI not blocked during a long event. [message #1047195] |
Mon, 22 April 2013 22:52 |
|
Hi,
I'm having troubles because one of the events of my application takes to long to process and I've notice the user can still do changes in the UI while this is processing.
I create a little example to simulate this situation, in this example I just put a button with a selection event and 2 text controls, and at the button's selection event I put a code that takes 10 seconds to finish and then set a string to a text control.
So if the button is clicked or selected and the 10 seconds hasn't passed yet, the user still can do changes in the controls.
protected void createContents(Composite parent) {
parent.setLayout(new FillLayout);
Button button = new Button(parent, SWT.PUSH);
button.setText("Button");
Text txt = new Text(parent, SWT.BORDER);
final Text txt2 = new Text(parent, SWT.BORDER);
button.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
Long initial = Calendar.getInstance().getTimeInMillis(); while((initial+10000)>Calendar.getInstance().getTimeInMillis());
txt2.setText("Button click!!");
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
});
I was expecting that the UI should be blocked until the 10 seconds have passed and the string was set to the text control, I mean the user can not do any change in the UI until the event finishes.
My question would be is this the behavior of RAP?
If it is, can I do something to change it, in order to block the UI while the event hasn't finished?
I hope you can help me with this.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03203 seconds