Making a Menu Item or Shortcut for a Specific Ant Target


If you have a target in your build script that you use often but that is not represented by a menu item or keyboard shortcut, you can create such a menu item and a shortcut:

  1. In the Files window, expand the projects nbproject folder and expand the build-impl.xml node.

  2. Right-click the target you want to map and choose Create Shortcut.

A wizard opens that enables you to set a menu item, toolbar item, and a keyboard shortcut for the target. Because the IDE records these custom menu items and shortcuts as Ant files, you can customize the way the shortcuts are called by selecting the Customize Generated Ant Code checkbox in the wizard.

Shortcuts set in this way are not global. They apply only to the build script on which they are set.

The wizard prevents you from overriding existing custom shortcuts, but it does not prevent you from overriding standard IDE shortcuts. If you inadvertently use a key combination for your new shortcut that is used elsewhere in the IDE, your new shortcut takes precedence.


Removing a Custom Menu Item or Shortcut

If you have added a menu item or shortcut for an Ant target and would like to remove it, you can do so manually. The IDE stores these customizations in your user directory in small XML files that work as mini-Ant scripts.

To remove a shortcut to an Ant target:

  1. In your IDE's user directory, expand the config folder. (If you are not sure where your IDE user directory is, choose Help | About and click the Details tab to find out.)

  2. Look in the following subfolders (and possibly their subfolders) for an XML file with the name of the Ant target or the keyboard shortcut:

    Menu (if you have created menu items)

    Shortcuts (if you have created keyboard shortcuts)

    Toolbar (if you have added a toolbar item)

  3. Manually delete the XML file that represents the shortcut.

Changing a Custom Menu Item or Shortcut

You can change a custom menu item for an Ant target by doing one of the following:

  • Deleting the mini Ant script for the target and creating a new shortcut.

  • Editing the mini Ant script for the target. For example, you can change the build script that a shortcut applies to by changing the antfile attribute in the shortcut's script.

To manually edit the file for the custom menu item or shortcut:

  1. In your IDE's user directory, expand the config folder. (If you are not sure where your user IDE directory is, choose Help | About and click the Details tab to find out.)

  2. Look in the following subfolders (and possibly their subfolders) for an XML file with the name of the Ant target or the keyboard shortcut:

    Menu (if you have created menu items)

    Shortcuts (if you have created keyboard shortcuts)

    Toolbar (if you have added a toolbar item)

  3. Double-click the node for the menu item or shortcut to open it in the Source Editor.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net