VisualVM Application Type Template - plugin detail

Template for VisualVM application application type extensions.

NetBeans Plugin - VisualVM Application Type Template
Plugin owner: geertjan
Added: 2008-03-23
License: CDDL
Category: NetBeans Rich Client Platform
Downloaded: 909 times
 0, by 0 users

Plugin Log Show log

Versions available

Download plugin   Download size: 0.01 MB   Last Update: 2008-05-30

What's new in this version

1.2: Updated to VisualVM Beta 2 APIs. 1.3: Dropped the Installer (because it conflicted with other VVM templates) and changed the icon.

Verifications for NetBeans versions

Plugin is not subject to any verification


Creates a new template in the New File wizard's "Module Development" category, for VisualVM application type extensions. After installing the plugin, do the following:

Register VisualVM in Tools > NetBeans Platforms. Create a new module and make sure to set VisualVM as your platform. In the New File wizard, select the VisualVM Application template: Click Next and fill in a prefix (display name for the node in VisualVM and prefix of generated classes) and the main class (necessary for identifying your application): Click Finish. Now you have two new classes: import; import; import; import; public class AnagramApplicationTypeProvider extends MainClassApplicationTypeFactory { @Override public ApplicationType createApplicationTypeFor(Application app, Jvm jvm, String mainClass) { //TODO: Specify the name of the application's main class here: if ("com.toy.anagrams.ui.Anagrams".equals(mainClass)) { return new AnagramApplicationType(app.getPid()); } return null; } } import; import java.awt.Image; import org.openide.util.Utilities; public class AnagramApplicationType extends ApplicationType { protected final int appPID; public AnagramApplicationType(int pid) { appPID = pid; } @Override public String getName() { return "Anagram"; } @Override public String getVersion() { return "1.0"; } @Override public String getDescription() { return "Application type for Anagram"; } @Override public Image getIcon() { return Utilities.loadImage("com/sun/tools/visualvm/core/ui/resources/snapshot.png", true); } } Right-click the project node, choose New | Other, and then Module Development | Module Installer. Click Finish and then you have an Installer class, registered in the Manifest file, with the correct dependencies set in the project.xml file. Use it to initialize the module as follows: public class Installer extends ModuleInstall { private static AnagramApplicationTypeProvider INSTANCE = new AnagramApplicationTypeProvider(); @Override public void restored() { ApplicationTypeFactory.getDefault().registerProvider(INSTANCE); } @Override public void uninstalled() { ApplicationTypeFactory.getDefault().unregisterProvider(INSTANCE); } } Run the module. A new instance of VisualVM starts up. If an instance of the application for which you defined the module is not running, you'll see nothing new in VisualVM. Once the application is running, you'll see the icon you specific as well as the display name, beneath the Applications node, as shown below: All the default tabs are provided. You can now create new tabs for your application type and you can create new menu items on the node in the explorer view.

[ You have to be logged in to be able to comment. ]

User Comments

There are no comments yet.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo