the menu item run method not called

Eclipse SDK Version: 3.4.1

BlackBerry JDE plugin for Eclipse Version: 1.0.0.50

BlackBerry JDE component package Version: 4.5.0.14

I added a menu item to the contacts list. I would like to get the context when the user clicks the menu item, but the run method is not entered. When the user clicks the item in the menu the main routine is entered with correct arguments. Should not called run with the context method? No exception is thrown.

 

Import net.rim.blackberry.api.menuitem.ApplicationMenuItem;
Import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
Import net.rim.device.api.system.Application;
Import net.rim.device.api.system.ApplicationDescriptor;

SerializableAttribute public class BwMain extends Application {}
private static final long APP_ID = 0xf46f5a7867d69ff0L;
private static final String ARG_LAUNCH_BW = "1";

public BwMain() {}
long menuItemLocation = ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST;
ContactsBwMenuItem menuItem = new ContactsBwMenuItem();
ToolBarMenuButton.AddMenuItem (menuItemLocation, ARG_LAUNCH_BW, menuItem);
System.Exit (0);
}

Public Shared Sub main (String [] args) {}
If (args == null | args.length == 0) {}
BwMain bwMain = new BwMain();
bwMain.enterEventDispatcher ();
}
else {}
System.out.println ("App launched from the menu");
}
}

private public static Sub ToolBarMenuButton.AddMenuItem (long location, String argOfAppl, ApplicationMenuItem appMenuItem) {}
Amir ApplicationMenuItemRepository = ApplicationMenuItemRepository.getInstance ();
ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor ();
app = new ApplicationDescriptor (app, new String [] {ARG_LAUNCH_BW});
amir.addMenuItem (location, appMenuItem, app);
}

private static class ContactsBwMenuItem extends ApplicationMenuItem {}
{ContactsBwMenuItem()}
Super (20);
}

public String toString() {}
return "PC connection";
}

public Object execute (object context) {}
try {}
System.out.println ("input run method");
} catch (Exception e) {}
e.printStackTrace ();
}
Returns a null value.
}
}
}

You call system.exit() in the Builder before entering the EventDispatcher. I'm guessing that you add the menu item, but leave the application, and when the menu item is called it is more a reference to the context of the application and decides not to continue. The menu item will not remove itself when the application closes.

Tags: BlackBerry Developers

Similar Questions

  • Question about the menu item displays do not correctly the status of 'active '.

    Hello

    I've reproduced for purposes of training "Influence," tutorial site

    and my questions are the following:

    As you can see on the site

    Homepage 

    (1) the order of top menu contact us, has the same features as the other components (speakers, time and place) - see picture attached.

    However, when the user clicks about us contact.

    the menu item is not barred to the outside like any other.

    I checked the condition of the assets is correct.

    The anchor link is placed on the foot of page, designed on the page A-master separately from the Home Page.Active.JPG

    I tried to place the anchor to the Home Page at the last point before the beginning of footer, but no result.

    (2) also if you do a simple test, you will see that by clicking on the heading "Contact us", the menu Time & Place is highlighted

    and if you click on the 'Top' menu, or if you are in "Time and place" content and you click on 'Top', the 'Speakers' menu is also highlighted.

    Please note that this behavior is also indicated to the site of origin INFLUENCE ...

    What I am doing wrong?

    BR

    Nektarios

    Replied here: https://forums.adobe.com/thread/2063776

  • Why the menu items change automatically?

    As I'm changed some stuff around on my test Business Catalyst site, I noticed that if I change the URL of a given page (I've changed the 'Shop' page to / sponsor), the menu item URL has not changed automatically. I don't even know the name of it has changed (I can understand as a 'function'). I thought it was a reason to use a CMS like this, that a lot of things like link exchange occur automatically. I'm sure other CMS like Drupal and Joomla do this automatically. There are chances that this will change in the future? Or maybe there is a reason why it's like that I forget?

    Thank you!

    Hi umiwangu,

    In my experience with BC as well as other systems, it is important to note that the pages and menu items are separated from each other.

    When a user creates a page it is not automatically added to a menu. Similarly, when a user changes the URL of a page that has been added to a menu, the menu item URL in question not is not updated automatically.

    So, if you changed a URL of the page that ends by "/ shop" to "/ sponsor ' you should be able to easily view this new URL in a browser. However, if you want the menu item that is linked to the old URL to reflect the new URL, then you will need to change the URL of item of the menu so they can talk to each other in the future.

    Yes, it's an extra step (crucial) update your menu items, but (in my experience) URL decisions are not something that is changed frequently - especially when it comes to SEO.

    In any case, I hope it helps! -Alex

    PS - If you haven't already, you can check zero to hero of gurus of the BC. They put together a huge set of training Sessions of BC (FREE) that are amazing!

  • Need to give only the menu item organization to an admin, how

    Hello

    I have a requirement that there should be a Director of the organization that will be able to see only the Organization menu items such as create and manage. It should be able to create new organizations as well as to manage the existing organization.

    I did these steps:
    1 has created a group of orgAdmin. Given A menuitems - create & manage org and gave all the permissions.

    I created a user and gave that group membership.
    But when this user logs in, he is able to see only the menu items and is not able to create or manage organizations. He is not able to create or search existing org.

    Help, please.

    Try ading the group administrator of the organization...

    concerning
    VM

  • Call a "invokeAction' of the Menu item button

    Hello

    If I have a button and you wrote the code for the invokeAction method is, it is possible to call this button to a menu item invokeAction method?

    I guess I could just copy the code from this button and add it to the menu. I'm really wondering if there is an easier way.

    (Sorry if this has already been achieved in this forum, I'm not sure what kind of search terms I would use to find a solution to my question.)

    Thank you!

    invokeAction is protected, so you can not call it directly. You can play games such as deriving from a subclass with invokeAction made public. But it is usually easier to have just the listening port of the button and the listener of the element menu to call a common method. It's simple and obvious if the listeners are in the same module of code and a little more complicated if they are not, of course.  In general the code duplication is a bad idea, but it's even worse if duplicates are in different modules.

  • Messages arrive, but the "Inbox" or any other folder open even if the content still there (and almost all the menu items do not work)!

    Using last Thunderbird on Windows 7. Had problems with the operating system and had to use a system restore. When I opened TB, it displays the folders in the left pane, but the credits of "Thunderbird Mail-...» "and the 3 topics: E-mail; Accounts; and advanced features. None of the files would open. I used the "Search messages" function and has been able to show existing and new messages in the 'Inbox '. Also wanted to know if files are always in my 'profile'... and they were all there where they should be. (And almost all the menu items are disabled).
    I wonder if I need to reinstall Thunderbird... maybe the OS issues this morning - and restore - have corrupted or damaged key elements of the program?
    Thank you...

    System Restore is not always a very good thing for applications.

    Reinstall is unlikely to help. But if your accounts are all imap and that you do not have a lot of other data (address book, for example) in Thunderbird, you could start from scratch.

    But before that, you should try Thunderbird started in SafeMode https://support.mozilla.org/en-US/kb/safe-mode-thunderbird

  • menu of hyperlink is displayed when text is selected, not when the Menu item is selected. And of course does not display the available links. Where I'm wrong?

    Try to make hyperlinks in a menu item. If I select the menu item, the menu of hyperlinks is not displayed in the menu bar. If I click on new and then the tex in the link is selected, the hyperlink menu appears but the drop down menu does not offer the available links. Where I'm wrong?

    I think you use a menu by default on the page?

    It's design of menu by default, because they are already linked with the respective pages that you can't change.

    You can try to create the menu manual.

    Thank you

    Sanjit

  • my muse site, the menu item will not open unless you press twice

    On my version Tablet and phone of my muse site, the menu item does not open except if you press two times the menu item. This happens only on the menu items that have submenus. Help, please! Thank you!

    Thank you for posting.

    This is the default behavior of the tablet or mobile devices. When press once, the submenu opens, and when you tap again once, the menu items opens. Please let me know if I'm missing something. In addition, please provide us with the URL of the site if you need help.

    Kind regards

    Aish

  • Why the menu items would not be poster?

    I am trying to solve a problem, a user has with Bridge CS3. Several selections in the menu 'Tools' have disappeard (not gray out, but actually missing). What he seeks is the Board Contact InDesign command. He used to have them, and now they are gone. I compared my preferences with his and they are identical. He is running Tiger and I'm on Leopard.

    Here's another weird thing. My version is 2.1.1.9 and its 2.1.0.100. Yet when I run the software updates and the Adobe update on his computer, he brings back that everything is up-to-date. Even if our versions are different, as well as an operating systems different, this does not explain why he used to have and is no longer made.

    Any thoughts?

    Hello

    To make sure that I'm clear, you must have the "Workflow Script Loader" ticked startup script, not only the startup script "Adobe InDesign CS3". If it is present and active, and there is still no tools > InDesign > Board-Contact create InDesign let me know.

    Kind regards

    Steve

  • Add the menu item for the sequence of batch processing?

    Hello

    I created a folder level script that runs at startup of Acrobat. The script adds a menu item, that when clicked, calls another function.

    I wonder if I can create a batch sequence and add a menu item for that also? I mainly want to avoid going through the whole advanced-> processing statement->... Processing batch-> find the command sequence, and then click Run.

    I've seen a lot of examples for adding menu items that call the folder level scripts, but nothing about batch sequences. Has anyone already done this?

    Thanks in advance!

    You cannot create an element of a sequence of commands menu. Nearest you

    can get is to open the batch sequences window, using the execMenuItem()

    method and "BatchEdit" as the name of the command (I'm not sure that it is still

    the same in Acrobat X).

  • Help with the Menu item

    I created an action that...

    1. Select a Smart Object Layer, called YOUR IMAGE
    2. Selects the Menu item > layer > Smart Object > replace content

    Action 100% work, but when I convert the action of a script and run it, the IMAGE of YOUR gets selected the menu Item does not show.

    Can anyone help please.

    cTID = function(s) { return app.charIDToTypeID(s); };
    sTID = function(s) { return app.stringIDToTypeID(s); };
    
    //==================== Load Image ==============
    function LoadImage() {
      // Select
      function step1(enabled, withDialog) {
        if (enabled != undefined && !enabled)
          return;
        var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
        var desc1 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putName(cTID('Lyr '), "YOUR IMAGE");
        desc1.putReference(cTID('null'), ref1);
        desc1.putBoolean(cTID('MkVs'), false);
        var list1 = new ActionList();
        list1.putInteger(9);
        desc1.putList(cTID('LyrI'), list1);
        executeAction(cTID('slct'), desc1, dialogMode);
      };
    
    
      // Select
      function step2(enabled, withDialog) {
        if (enabled != undefined && !enabled)
          return;
        var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
        var desc1 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putEnumerated(cTID('Mn  '), cTID('MnIt'), sTID("placedLayerReplaceContents"));
        desc1.putReference(cTID('null'), ref1);
        executeAction(cTID('slct'), desc1, dialogMode);
      };
      step1();      // Select
      step2();      // Select
    };
    LoadImage.main = function () {
      LoadImage();
    };
    LoadImage.main();
    

    You have the withDialog variable, but I don't see how define you it. Is a UI checkbox if you don't understand? How do populate you this value?

  • The Java Exception: java.lang.reflect.InvocationTargetException: during the java.lang.reflect.Method .invoke call.

    Local channel & xquery = 'Test Apache';

    Local chain & xquery1 = "test map";

    Local JavaObject & XSSFWorkbook = CreateJavaObject ("org.apache.poi.xssf.usermodel.XSSFWorkbook");

    Local JavaObject & jClass = GetJavaClass ("java.lang.Class");

    Local JavaObject & jCompileArgTypes = CreateJavaObject ("java.lang.Class []" & jClass.forName ("java.lang.String"));

    Local JavaObject & jCompileMethod = & XSSFWorkbook.getClass () .getDeclaredMethod ("createSheet", & jCompileArgTypes);

    Local JavaObject & sheet1 = jCompileMethod.invoke (& XSSFWorkbook, CreateJavaObject ("java.lang.Object [] ' and xquery"));

    Local JavaObject & Sheet2 = & jCompileMethod.invoke (& XSSFWorkbook, CreateJavaObject ("java.lang.Object []", & xquery1));

    Local JavaObject & int = GetJavaClass ("java.lang.Integer");

    Local JavaObject & IntType = GetJavaClass ("java.lang.Integer"). TYPE;

    Local JavaObject & jIntArgTypes = CreateJavaObject ("java.lang.Class []", & IntType);

    Local JavaObject & jcreateRow = & sheet1.getClass () .getDeclaredMethod ("createRow", & jIntArgTypes);

    Local number I & k;

    & k = 1;

    For & i = 1 to 40000

    Local JavaObject & rank = & jcreateRow.invoke (& sheet1, CreateJavaObject ("java.lang.Object []" & i));

    Local JavaObject & jcreatecell = & Row.getClass () .getDeclaredMethod ("createCell", & jIntArgTypes);

    Local JavaObject & cell = jcreatecell.invoke (& Row, CreateJavaObject ("java.lang.Object []" and k));

    Local JavaObject & setCellValue = cell.getClass () .getDeclaredMethod ("setCellValue", & jCompileArgTypes);

    Local JavaObject & cellvalue = setCellValue.invoke (& cell, CreateJavaObject ("java.lang.Object []", "interesting it's nice"));

    -End;

    REM JavaObject Local & autoSizeColumn = & sheet1.getClass () .getDeclaredMethod ("autoSizeColumn", & jIntArgTypes);

    REM JavaObject Local & autoSize = autoSizeColumn.invoke (& sheet1, CreateJavaObject ("java.lang.Object []", 0));

    Local JavaObject & out = CreateJavaObject ("java.io.FileOutputStream", "/ psoft/fs9devt/UserUpload/ap/comments12.xlsx", True);

    & XSSFWorkbook.write(&out);

    & out.close ();

    get error below when running the code above through driving the demand, but he worked for 1 print the line, but when it's on a loop, it throws this error.

    The Java Exception: java.lang.reflect.InvocationTargetException: during the java.lang.reflect.Method .invoke call.

    I came across the same thing as you. I did a lot of experimenting and found it works:

    var result = (function() {
        var ReflectiveArray = java.lang.reflect.Array;
        var CreateSQL = Packages.PeopleSoft.PeopleCode.Func.CreateSQL;
        var columns = ReflectiveArray.newInstance(java.lang.Object, 1 /* number of selected columns */);
        var results = [];
    
        SQL = CreateSQL("SELECT OPRDEFNDESC FROM PSOPRDEFN WHERE ROWNUM < 10");
        while (SQL.Fetch(columns)) {
            results.push(columns[0]);
        }
    
        return results.join();
    
    }());
    

    He seems to have been a problem with translation between the JavaScript array and the Java array Object []. I solved this by using java.lang.reflect.Array.newInstance to create a new instance of the object [1].

    Next issue to deal with is your memory problem. In the error message, it seems to have something to do with the Garbage Collection and a lot of temporary objects. You declare you line and cell by using the var =... line and cell var =...? If not, then they are in the global namespace and properties of the global object. At the end of each iteration of the loop, use delete line and delete cells. If you declare the var, then set their value null at the end of each iteration. Based on your code, I expect each time through the loop would decrease the number of references, but I saw where setting explicitly using null. The only other temporary object I see is the value in the table. Just for fun, I added this at the end of each loop, and he ran very well:

    columns[0] = null;
    
  • Code to change the search option to search QD on the field in the Configuration item on a specific call screen

    We have an obligation to change the search option to search QD on the field in the Configuration item on a specific call screen.

    By default, all our leaders tend to have the default value 'Client' on the field Configuration point QD.  This is the case after that they took the customer on the call screen, when they enter the CI field and press ENTER, it refreshes automatically just the IC, where the selected customer is the owner of the aircraft.

    However, on a screen specific IPK call status, we want the search Configuration option to point QD to always change the option "Config Item Title', not 'customer '.

    No idea how to change this option only if you are using this specific screen and the default value remains the same for all the other forms of appeal?

    Thanks for any help,

    Ian

    Hey Ian!

    Appearently, you can take full control over the default search with a custom script menu item. This is an example how to do this in the Custom_InCallDetails.js file:

    function CustomLoad() {
      var ciqd = da.BTN_ITEM_REFQD;
      if(ciqd){
        var etp = da.ENTITY_TYPE;
        if(etp && etp.value=='7') ciqd.DefaultMenu = "CITYPEQUICK"
        else ciqd.DefaultMenu = "CUSTQUICK";
      }
    }
    

    (change the number 7 to the entity type Ref you need)

    Unfortunately this change script default for a user permanently. So if he had put any custom value before it is crushed.

    If you need to keep the default values personalized search menu, maybe you need further customization to store the user selected value in a wrapper environment and set the value to return if necessary (just an idea).

    Best regards, Gytis

  • Definition programmatically the menu item &amp; quot; permit &amp; quot;.

    I have a soft LOOK that offers a menu point which, when selected launches a dialog box.

    I need set the enabled property of the item of menu false after it is selected, that only one instance of this dialog box is expected to be launched, and I don't want to make the modal dialog box. I also need to set the property enabled to true when the dialog box is closed.

    I do this through the defaultDataDescriptor?

    BTW, the dialog box that starts is not a popup, it's in an AIR application in the main window, in what I call the 'activities '.

    I don't know if that's how I had to do, but I create an associative array object and when I disable a menu item in the ItemClick event (if it is a menu item that needs to be deactivated at the time), I store a reference to the menu item in the object. Then when I close the dialog box I have uses the reference to re - activate the menu item.

  • Where is the menu item "update iTunes game"?

    I am on iTunes 12.4 (Mac) and the menu item "Update of iTunes game" has disappeared from this version. The music library on my Macbook Pro is not sync to the cloud to be available on my iPhone, even if both are signed on the same account and my game subscription is current/paid.

    Thank you, Apple, to make things more difficult that they'll be removing the menu option to force a sync

    Now, how do I just that... force my laptop to update the game?

    The button 'Update iTunes game' old responsibility now 'Updated iCloud music library' file/library.

Maybe you are looking for

  • 'Settings' icon missing

    Settings icon is missing. Please spare me self-righteous excuses, denial and nonsense. The settings option is simply gone, kaput, no more. Rather than assuming that the user is always bad, consider resolved the bug instead.

  • Is there a way to have Firefox respects the audio output device by default when it has been modified while Firefox is open?

    I've been a Firefox user for many years and I still use it as my main browser. A problem that has bothered me for years lies in the fact that when Firefox is open and I change my audio output device by default, Firefox does not respect this change an

  • Cannot start up satellite M40 136

    Hello I have a Satellite M40 136 2.5 years old. I used it yesterday and then closed the lid then it shut down as usual. About half an hour later, I realized that I had to check a file so I opened the lid and normally he would back automatically, but

  • Reset the IP address on Photosmart D110a

    I had to update my wireless network and I forgot to update the IP address of my printer.  It connects to my wireless but I can't print or logon to it because the IP of the printer is in another network (10.0.0.235).  My new network is 192.168.2.100 -

  • U3014, does not and no display?

    I turned on my PC this morning and after a few seconds, the monitor went dark. I bought the monitor a few months ago. I use a nvidia geforce GTX 690 with the latest drivers. I am connected via the display U3014 port to 690 GTX. I daisy chained a U241