| 
| Focus in Tree Viewer [message #242639] | Mon, 10 December 2007 08:24 |  | 
| Eclipse User  |  |  |  |  | Hi, 
 In a tree viewer When an data from one model is copied to another model
 through some action, the focus from the tree viewer and from workbench is
 getting lost.
 
 If the Last focus was in explorer or IDE or mailbox before the action was
 executed, the focus is getting returned over there rather than on the
 viewer as soon as the action is performed.
 
 The below piece of code is being run in the runnableProgress ,
 
 public void doRefresh() {
 
 IProgressService progressService =
 PlatformUI.getWorkbench().getProgressService();
 
 
 IRunnableWithProgress runnable = new IRunnableWithProgress() {
 
 public void run(IProgressMonitor monitor) {
 
 monitor.setTaskName("Refreshing data.....");
 /* try {
 Thread.sleep(800);
 } catch (InterruptedException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }*/
 diffInput.refresh();
 listInput.refresh();  }
 
 };
 
 try {
 progressService.run(true, false, runnable);
 }
 catch (InvocationTargetException e) {
 CemPlugin.getDefault().log(e);
 }
 catch (InterruptedException e) {
 CemPlugin.getDefault().log(e);
 }
 
 }
 
 
 As per the above code, if the commented code is uncommented then the focus
 is being set to TreeViewer itself irrespective of last focus. Please let
 me know if this is right way to handle the problem.
 
 Thanks in Advance.
 
 Regards,
 
 Kiran
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.07934 seconds