How to test context or popup Menus for a Composite.

Hello SWTBot gurus and fellow users,
Question: I'm wondering if it is possible and, if so, how to test a context (popup, right-click) Menu that is set for a Composite.
So far, I've only seen examples where the context Menu is for an item in a Tree. I've also tried using the built-in context Menu finders with no luck.
I have some sample code below for a simple Composite with a context Menu and SWTBot test code.
Thanks in advance for any pointers, clues, etc.
Jordan
Example: Here are a couple of test classes to demonstrate the problem.
The Composite being tested. A simple Composite with a context Menu set for it. The Menu is built using a JFace MenuManager.
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
public class TestComposite extends Composite {
public boolean menuItemClicked = false;
public TestComposite(Composite parent) {
super(parent, SWT.NONE);
setLayout(new FillLayout());
final MenuManager menuManager = new MenuManager();
menuManager.add(new Action("bleh") {
@Override
public void run() {
menuItemClicked = true;
System.out.println("bleh clicked...");
setMenu(menuManager.createContextMenu(this));
return;
The SWTBot test code.
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class TestCompositeTester extends SWTBotTestCase {
private Shell s;
private TestComposite c;
@Test
public void checkContextMenuItem() {
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
@Override
public void run() {
s = new Shell(display);
c = new TestComposite(s);
SWTBotShell botShell = new SWTBotShell(s);
botShell.contextMenu("bleh").click();
assertTrue(c.menuItemClicked);
The failure trace when running the SWTBot test code.
org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find context menu with text: bleh
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:437)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:411)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:399)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.contextMenu(AbstractSWTBot.java:442)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.contextMenu(AbstractSWTBot.java:423)
at sandbox.plugin.TestCompositeTester.checkContextMenuItem(TestCompositeTester.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
at org.eclipse.e4.ui.internal.workbench.swt.E4Testable$1.run(E4Testable.java:73)
at java.lang.Thread.run(Unknown Source)

Your DBA should be able to help you..........

Similar Messages

  • How can we create a popup window for confirmation while clicking of button

    HI Friends,
    I am creating a application, In which I want to create a popup window for confirmation on clicking of a button.
    I also need two buttons on popup window i.e. 'Yes' & 'No'.
    On yes i want to perform some operation and on No i want to cancel that operation.

    Hi Narendra,
    try using the following code in ONACTION of ur button for popup :
    * Popup
       *  Generate Popup
        DATA lo_window_manager TYPE REF TO if_wd_window_manager.
        DATA lo_api_component  TYPE REF TO if_wd_component.
        DATA lo_window         TYPE REF TO if_wd_window.
        lo_api_component  = wd_comp_controller->wd_get_api( ).
        lo_window_manager = lo_api_component->get_window_manager( ).
        lo_window         = lo_window_manager->create_window(
          window_name          = 'W_POPUP'
         window_position = if_wd_window=>co_center
          message_display_mode = if_wd_window=>co_msg_display_mode_selected
          button_kind          = if_wd_window=>co_buttons_yesno
          message_type         = if_wd_window=>co_msg_type_none
          default_button       = if_wd_window=>co_button_yes
        DATA:  l_api TYPE REF TO if_wd_view_controller.
        l_api = wd_this->wd_get_api( ).
        " subscribe action for Ok button
        lo_window->subscribe_to_button_event(
                     button            = if_wd_window=>co_button_yes
                     action_name       = 'OK_POPUP'
                     action_view       = l_api
                     is_default_button = abap_true ).
        lo_window->open( ).
    regds,
    amit

  • How can I get the position stream for a composition?

    I am writing an AEGP plugin for AfterFx and I need to get the position stream for a composition. I have based my plugin on ProjDumper.
    Can anyone help?

    Hi Shachar,
    Many thanks, that goes some way to explain it.
    However I am creating a composition adding text layers to it and animating the positions of the individual text layers. Then I create a second composition and include the first as a nested composition and I animate the position of the first composition within the second composition.
    When I run my plugin I only see the animations I added to the individual text layers, they are not combined with the overall animation attached to the first compisition within the second composition.  The animation data for the first composition must be stored somewhere. Do you know where ?
    I have been looking at source items and markers neither seem to provide the information I am interested in. Any clues would be very helpful.
    Thanks in advance.

  • How do I un-block popups just for a single site?

    So in every other browser I use (I use all the big ones for testing -- Chrome, I.E., Firefox -- because I do web-development work) I can enable pop-ups for a single site (or a list of sites) without disabling the pop-up blocker entirely.
    However, in Safari (version 7.0.3 on a MacBook Air running OS X 10.9.2) the only option I see in the Preferences window enables pop-up blocking for all sites, or none of them -- there is no way to allow pop-ups from a single site, or a list of sites.
    How do I do this?
    Thanks,
    Laurence MacNeill
    Mableton, Georgia, USA

    Settings > Safari > Block Popups
    Turn it on to block all Popups or turn it off to allow Popups. You cannot block or allow Popups on a site specific basis.

  • How to test basic sql queries online(for Sql Server 2012 and up versions) ?

    Hi,
    I need to test basic sql queries using sql server without installing Sql Server on to the system.
    Do we have such readymade online help, which can solve such difficulties ?
    Please sugest some of url's.
    Thanks.

    Thanks for reply.
    I am looking specific Sql Server.
    Hi Maggy,
    I strongly recommend you install SQL Server 2012 express edit and test your T-SQL queries. We can download it from the following site:
    Microsoft® SQL Server® 2012 Express:
    http://www.microsoft.com/en-hk/download/details.aspx?id=29062
    Regards,
    Elvis Long
    TechNet Community Support

  • How to open a Google popup window for an APEX 3.2.1 aplication ...

    Hi folks,
    I am implementing an APEX application that presents a report with a search field with a checkbox (search google ON/OFF).
    If this checkbox is activated by the user and he clicks on GO button, the application will filter the APEX report. At the same time, it will open in a separate window with the google search tool, using the same parameters existents in the APEX report search field.
    If the checkbox is not activated, only the filtered report is displayed, without the google window.
    Is it possible to implement on APEX 3.2.1? How could i do it?
    I'm trying to use the examples in the forum (ex: javascript function in the HTML page header, and activating function by a branch).
    I'm working with APEX to version 3.2.1, with Oracle Database 10g XE.
    Best regards,
    Sergio Coutinho

    Hi Sergio,
    Do you need of opening a google search within application page, then you do this.
    Create a HTML region and specify the following as the region source
    <iframe src="http://www.google.com" height="980" width="650"></iframe>Regards
    Mini
    Mark Answers promptly

  • How to test the firewall is opened for a internal server

    should I use
    ping -t <IP of the internal server>  36<nr>?
    Thanks! Points!

    Hi Jennifer
    try to execute the following command from the shell prompt
    tracert -d  <Ip address for the internal server>
    try to note down the IP address where the packets are not transferring to other hops
    ask your network person to resolve the IP to pass the packet to next hop
    if your tracert session has been ended with all resolved IPs
    then try to telnet <IP address for the Internal server> 36<nr>
    if not, then Firewall has been blocking you, or Portal not yet configured proper.
    REgards
    Anwer Waseem

  • Disabling Right Click Menus for Network Magic's System Tray Icons for Standard and Guest Accounts

    OK, so I want to know how to disable the right click menus for Network Magic's system tray icons only for Vista's standard and Guest accounts?   I don't want other users signed in as a Standard account or guest account having the ability to disable the system tray icons for network magic.

    Hi, currently it's not possible to disable NM from being accessed by a Limited user account, but that is a good idea.
    My Cisco Network Magic Configuration:
    Router: D-Link WBR-2310 A1 FW:1.04, connected to Comcast High Speed Internet
    Desktop, iMac: NM is on the Windows Partition, using Boot camp to access Windows, Windows 7 Pro 32-bit RTM, Broadcom Wireless N Card, McAfee Personal Firewall 2009,
    Mac Partition of the iMac is using Mac OS X 10.6.1 Snow Leopard
    Laptop: Windows XP Pro SP3, Intel PRO/Wireless 2200BG, McAfee Personal Firewall 2008
    Please note that though I am a beta tester for Network Magic, I am not a employee of Linksys/Cisco and am volunteering my time here to help other NM users.

  • Creating Context Menus for reports

    Hi All,
    I have a classic report with some fields. Whenever I right click on any of the values in the report column, a context menu should appear with the options I define.
    Any idea abt how to do this?
    Regards,
    Sushma.

    Hi,
    <u><b>Context Menus for Lists</b></u>
    As with normal screens, the system creates a standard context menu when you use a dialog status in a list. You can call this standard context menu using the right-hand mouse button (Shift + F10). It displays all of the functions assigned to function keys.
    You can define context menus for list lines in the same way as for screen elements. To do this, you must assign a special function code to the function key Shift+F10 in the dialog status of the list. To define context menus for a list, you must first have defined a dialog status for the list and set it using SET PF-STATUS.
    In this dialog status, which you will normally create using the List status template, the List with context menu option must be selected in the function key setting attributes. To do this, place the cursor on a function key setting in the Menu Painter and choose Attributes or Goto   Attributes   F key setting. The function code %CTX is assigned to function key ShiftF10. Since the introduction of context menus on lists, it is no longer possible to assign ShiftF10 freely to any
    function in the Menu Painter. In any existing dialog status where a function code was assigned to ShiftF10, it has been reassigned to ShiftCtrl+0. You must activate the function code %CTX manually before it has any effect in the dialog status.
    As on screens, context menus on lists are generated dynamically in ABAP programs as objects of the class CL_CTMENU.
    For context menus on lists, you must program a callback routine in the ABAP program:
    FORM on_ctmenu_request USING <l_menu> TYPE REF TO cl_ctmenu.
    ENDFORM.
    In this subroutine, you can define a context menu using the object reference <l_menu> as described in the Context Menus [Page 639] section. To define a specific context menu, for example, you could get the cursor position on the list using GET CURSOR. If required, you may need to find out the current list level from the corresponding system fields (for example, SYLISTI).
    When you right-click a list line (or choose Shift+F10), the callback routine is executed, and the context menu defined in it is displayed. If the user chooses a menu item, the system carries on processing according to the function code assigned to it. The function is either executed by the runtime environment, or the corresponding event is triggered (in which case, the function code is placed in the system field SY-UCOMM).
    If you right-click outside a list line, the system displays the standard context menu.
    Ex.
    REPORT demo_list_context_menu .
    DATA: wa_spfli TYPE spfli,
    wa_sflight TYPE sflight.
    START-OF-SELECTION.
    SET PF-STATUS 'BASIC'.
    SELECT * FROM spfli INTO wa_spfli.
    WRITE: / wa_spfli-carrid,
    wa_spfli-connid,
    wa_spfli-cityfrom,
    wa_spfli-cityto.
    HIDE: wa_spfli-carrid, wa_spfli-connid.
    ENDSELECT.
    CLEAR wa_spfli.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'DETAIL'.
    CHECK NOT wa_spfli IS INITIAL.
    WRITE sy-lisel COLOR COL_HEADING.
    SELECT * FROM sflight INTO wa_sflight
    WHERE carrid = wa_spfli-carrid
    AND connid = wa_spfli-connid.
    WRITE / wa_sflight-fldate.
    ENDSELECT.
    ENDCASE.
    FORM on_ctmenu_request USING l_menu TYPE REF TO cl_ctmenu.
    DATA lin TYPE i.
    IF sy-listi = 0.
    GET CURSOR LINE lin.
    IF lin > 2.
    CALL METHOD l_menu->add_function
    EXPORTING fcode = 'DETAIL'
    text = text-001.
    ENDIF.
    CALL METHOD l_menu->add_function
    EXPORTING fcode = 'BACK'
    text = text-002.
    ENDIF.
    ENDFORM.
    In the dialog status BASIC for the basic list, %CTX is assigned to Shift+F10. In the
    callback routine, a context menu is defined. The definition depends on the cursor
    position and the list currently displayed.
    If the user right-clicks the two-line default page header on the basic list, the system displays a single-line context menu. The Back function is executed by the runtime environment. If you right-click a list line, a two-line context menu is displayed. The Detail function triggers the event AT USER-COMMAND.
    Regards,
    Bhaskar

  • How to test VOFM routine for output cntrol-issue o/p when certain conds met

    Hai,
    I have created a vofm routine 903 for  the output type 'ZSH1'.This is for sales order output.
    The 903 routine changes the sy-subrc value to non zero if certain conditions met.
    My doubt is how to test this vofm routine? where can we check the status of the output processed?
    This output is to trigger a smartform.
    In my case the output smart form got displayed when I click on print preview even if the condtions met (or) dont met.
    Is this the correct way of testing?
    Regards,
    Bhaskar

    Hai All,
    Thanks for your replies.
    here my question is,
    how to test the VOFM (not manual )& where we can check the status of output issued or not issued?
    see the step 1.
    Step1: goto->va02->from the menu select 'issue output'->select the codition type in the displayed popup->click OK.
    after this where can I check the status of the output issued?
    or is the way I described in Step 1 is correct or not ?
    other way Step 2:
    goto VA02->enter order number->goto overview page->from Extras->output->header->edit
    in this page maintain the output type & click Save.
    after Save , is this the time to check whether the output issued or not? if yes where to check the status?
    or again is this the right way to test the VOFM.
    Regards,
    Bhaskar
    Edited by: Mbhaskar_comps on Dec 15, 2010 7:00 AM

  • How can I add a popup for right mouse click for anywhere on application?

    I have never used popup menus before but need to add on to my application.
    This is a swing application with several pages that are basically panels that are added and removed as needed.
    I need to have a popup menu that appears anywhere on the application when the right mouse button is clicked,
    no matter which component the cursor is over.
    I have been able to add one for a specific panel, but that is not what needs to be done, since there are dozens
    of separate panels in the application.
    Could someone point me to an example of how to make the popup active for anywhere on the application?
    Thanks.

    You are correct, I have not yet read the tutorial you suggested. I will do so tomorrow and try to move farther up the learning curve.
    My response was intended to acknowledge your reply and let you know where I am in trying to resolve this issue.
    You are also correct in that creating a popup may be a simple task, but, like I stated in my original post, I have never used popups in the past.
    And, like I said, things that are second nature for someone who uses certain components are not always intuitive for people who have not.
    I did do some research before posting my question, but all the examples I found were related to popups tied to a specific panel.
    I am able to create that, but the problem I ran into was that I needed to have a popup menu that was application general, not panel specific.
    It was not obvious to me how to do that and none of the examples I found explained how to do that.
    Hence, my question to the forum, hoping that someone who has gone through this exercise would impart knowledge to help me resolve this issue.
    It is not uncommon for persons to post examples or direct one to web sites that specifically address the issues in question.
    That is what I was hoping for, but I am not adverse to doing follow-up research on leads that are provided.
    My main issue is trying to figure out how to find a parent component (or panel) for the popup.
    You stated that I should be able to get that from the event listener.
    I'm not sure how to do that, but hopefully one of the event listener get methods will provide that information
    Hopefully, I will be able to resolve this with the feedback you provided, but if necessary, I will post code for a simple example to illustrate my problem.
    Thanks again for the feedback.

  • I have a Windows 8.1 machine.  I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    There is no application called "Adobe" - you are either working with Adobe Acrobat or the free Adobe Reader. Open up the preferences for the application (Edit>Preferences), then go to the "General" category and modify the settings for "Scale for screen resolution". You will have to restart the application after you do that. Does that fix your problems?

  • How do I get rid of the SPAM Popup Ad for an External HDD

    A spam popup ad for an external HDD came down with supposed Lenovo system updates.  This ad pops up every few hours and I can figure out how to get rid of it.  There is a check box that says 'don't show again' but I check it and it doesn't work.  I am extreemly disappointed they have invaded my system with an ad that was part of a system update.  I have 15 thinkpad users and it hasn't happened to all of them yet but they'll be screaming at me when it does.
    Solved!
    Go to Solution.

    How do I disable this crap?
    http://i183.photobucket.com/albums/x57/UrsusMorologus/lenovo-desktop-spam.jpg

  • How to close a popup window for system events?

    Hi,
    I have a screen 110 which shows several input field in popup mode.
    The Cancel button can close the screen.
    But my question is how to close the popup window for the following system events?
    1, Customer clicks the cross button in top-right corner
    2, Customer clicks the system icon in top-left corner and then select either: "Close" or "Stop Session"
    The PAI subroutine of the screen has not been triggered for the above system events.
    Thanks for the coming help.
    Best Regards,
    David

    Hi Siddharth,
    I did check with another very experienced ABAP developer.
    The solution was the same as what Arunima Rudra provided.
    And I got a sample program which did work properly.
    The headache is that the system events in my program still cannot be triggered even after I have all the same changes.
    Anyway, I suggest you to try the solution as provided by Arunima Rudra.
    It should work for 2 system events:
    1, Customer clicks the cross button in top-right corner
    2, Customer clicks the system icon in top-left corner and then select either: "Close"
    For "Stop Session", it should not be handled by popup.
    You can observe the same behavior in ALV sorting configuration popup.
    Good luck!
    Regards,
    David

  • How can i connect popup menus?

    hi i need to connect 2 popup menu, for example my first popup menu would be fruit, meat then if i choose fruit next popup menu will populate banana and apple then if i choose meat next popup menu will populate beef and mutton.

    Hi Bathuu,
    I think that is called a hierarchical menu, but I don't think that Pop-Up Menus in Numbers support that.
    One way could be to have all you food items in one column. Type them, select them all, then Format Panel > Cell > Data Format > Pop-Up Menu:
    Start with Blank (it will show None) is handy if you want to cancel an entry. In the Format Panel you can drag menu items to reorder them, or double click to rename.
    Another way (if you want to distiguish different food groups) is to have another column with Pop-Ups for Fruit and Meat:
    Then you can sort the table by Food group or Food.
    Regards,
    Ian.

Maybe you are looking for

  • ITunes install error for windows! How do I fix?

    When I try to install itunes I get the following error: Error 1406. Could not write value to key \Software\Classes\.cdda\OpenWithList\iTunes.exe. Verify that you have sufficient access to that key or contact your support personnel. How do I fix this

  • Installed ram, how to check it for faults?

    I've ordered my first Mac, (27 inch iMac) and I've ordered some ram to install in the iMac when it arrives. I was wondering, how do I check the installed ram for faults? Is there a application etc with Mountain Lion that would allow me to do this? Th

  • Platform migration vi storage replication?

    We have a 10.2.0.4 database running on HPUX platform which uses EMC for it's storage. We want to migrate the database to an AIX server. Is it possible to just clone the luns where the datafiles live using the EMC utilities and then bring up a databas

  • Cannot deactivate delta load of materials from R/3

    Hi, we have a problem deactivating the delta load of materials from R/3. I deactivated the adapter objects MATERIAL and PRODUCT_MAT in R3AC1. I even deleted the class MATERIAL in R3AC4. The Bdoc's are not created any more, but the queues are still ge

  • Deinterlace/Interlace?

    I have noticed in CS4 Pro that when I am scrubbing and watching playpack when I view the image on the screen (external monitor) I see jagged edges on my subjects. The clips are of dancers on a well lit stage with camera pans. This looks just like I u