Hello RCP experts,
I added a Refresh Button to the Toolbar. When the user clicks the refresh button, it updates the Table Model. I use Swing Worker to perform the task. It works fine.
But the problem is the agressive user sometimes clicks Refresh button multiple times without waiting until the previous request is completed.
Code:private class RefreshExecutor extends AbstractActionCommandExecutor { public boolean isAuthorized() { return super.isAuthorized(); } /** * Execute this command. */ public void execute() { // Refresh Table... final ProgressMonitor bar = getActiveWindow().getStatusBar().getProgressMonitor(); final SwingWorker worker = new SwingWorker() { public Object construct() { getControl().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); return new TableRefreshTask(getApplicationContext(), bar); } public void finished() { bar.done(); getControl().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; worker.start(); } }
There must be a simple way to freeze the entire window when a task is running. Any ideas?
Thanks.
Kanugula.


Reply With Quote