Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Get event generation source from ExecutionEvent object(Issues in getting the source of generating the Selection event for the Command Handler in multi-threaded environment)
icon5.gif  Get event generation source from ExecutionEvent object [message #1014920] Tue, 26 February 2013 19:29
rrahul s is currently offline rrahul s
Messages: 2
Registered: June 2011
Junior Member
Hello All,

Is there any way to figure out, which view or UI part is the source of the generated ExecutionEvent Event for a Command Handler?

I was writing down the code for an RCP application using typical Command-Handler framework. I've created my own views and have certain commands available in the toolbar. The View is such that you can open multiple instances of the view at the same time.

Several commands execute various actions over the active page over active view, hence using the PlatformUI, I call my method from the view.

This is how the Handler's code look like-
***********************************************
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();

if(part instanceof MyView){
MyView view = (MyView)part;
view.callingMyMethods();

}
return null;
}
***********************************************

This code is working fine in case of single threaded application. But few of these toolbar items serve different operations which start execution of seperate threads which display their output in some other view.
In such scenerio, it becomes impossible to use the 'PlatformUI' and get the active part of workbench to execute 'myView.callingMyMethods()', because in that scenerio, as another thread is processing and displaying data over another view, 'myView' wll be no longer the active view. Even after pressing the command button over the toolbar, this Handler is executed, but because of an another parallel thread in execution, focus again jumps to another view where the thread is buzy in displaying the output.

Request all to suggest any alternates possible, so that 'myView.callingMyMethods()' can be executed in for the view from which the command call is generated.
Is there any way to figure out, which view or UI part is the source of the generated Event.

Thanks in advance.
Previous Topic:BUG with Jgit and amazon-s3 using specific secretkey
Next Topic:android adding external libraries to index
Goto Forum:
  


Current Time: Sat Sep 20 07:58:58 GMT 2014

Powered by FUDForum. Page generated in 0.02297 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software