Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338555

Summary: Alternative code for "widget is disposed" with sub-menus on tree item click
Product: [Technology] SWTBot Reporter: Mariot Chauvin <mariot.chauvin>
Component: SWTBotAssignee: Patrick Tasse <patrick.tasse>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: itac, patrick.tasse, shabs.shetty, steffen.felbinger
Version: 2.0.2   
Target Milestone: 2.4.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 479091    
Bug Blocks:    
Attachments:
Description Flags
Util class main entry
none
a ContextMenu kind of widget
none
a ContextMenu finder which find the first entry
none
a ContextMenu kind of widget
none
improved context menu class none

Description Mariot Chauvin CLA 2011-03-01 11:23:14 EST

    
Comment 1 Mariot Chauvin CLA 2011-03-01 11:23:42 EST
Created attachment 190054 [details]
Util class main entry
Comment 2 Mariot Chauvin CLA 2011-03-01 11:24:57 EST
Created attachment 190055 [details]
a ContextMenu kind of widget
Comment 3 Mariot Chauvin CLA 2011-03-01 11:25:34 EST
Created attachment 190056 [details]
a ContextMenu finder which find the first entry
Comment 4 Mariot Chauvin CLA 2011-03-01 11:28:30 EST
Here are some code I want to share.
The code allows one to click on a Tree item context menu, and avoid the common "widget is disposed" error.

Code license is EPL.
Comment 5 Mariot Chauvin CLA 2011-03-21 01:42:56 EDT
Created attachment 191593 [details]
a ContextMenu kind of widget
Comment 6 Justin Bangerter CLA 2011-09-27 10:05:04 EDT
Created attachment 204081 [details]
improved context menu class

I ran into a problem with the previous SWTBotContextMenu.  The context menu was not always found when invoked on TreeItems.  I added a "showContextMenu" that invokes treeItme.contextMenu(String) if this context menu belongs to a treeItem.  This executes the private methods within TreeItem that help to ensure the menu's availability.  The SWTException thrown by this invocation is ignored (because the whole point of this code is to get around it).
Comment 7 Mariot Chauvin CLA 2011-09-28 08:45:22 EDT
(In reply to comment #6)
> Created attachment 204081 [details]
> improved context menu class
> 
> I ran into a problem with the previous SWTBotContextMenu.  The context menu was
> not always found when invoked on TreeItems.  I added a "showContextMenu" that
> invokes treeItme.contextMenu(String) if this context menu belongs to a
> treeItem.  This executes the private methods within TreeItem that help to
> ensure the menu's availability.  The SWTException thrown by this invocation is
> ignored (because the whole point of this code is to get around it).

Thanks Justin !
Comment 8 Shabari shetty CLA 2012-12-26 18:35:52 EST
Can someone please tell me how to use these classes to cick on th subMeu of the context menu.

For ex : I right click on a Java Class and say Run As->Then select Run on Server.

Here Java class is a treeI item and Run As is a context menu on this. Run As has two sub menus Run on Server and Run COnfigurations. I want to click Run on Server. Can someone please help me with it asap
Comment 9 Shabari shetty CLA 2012-12-26 18:49:18 EST
Can someone please tell me how to use these classes to cick on th subMeu of the context menu.

For ex : I right click on a Java Class and say Run As->Then select Run on Server.

Here Java class is a treeI item and Run As is a context menu on this. Run As has two sub menus Run on Server and Run COnfigurations. I want to click Run on Server. Can someone please help me with it asap
Comment 10 Patrick Tasse CLA 2015-10-22 12:48:35 EDT
Fixed by bug 479091.