NetBeansDeveloperFAQ
(→Actions: How to add things to Files, Folders, Menus, Toolbars and more: How do I create an action which can be invoked by a macro) |
(→Deploying Changes through AutoUpdate and using Autoupdate API: How to change the update center URL via code) |
||
Line 494: | Line 494: | ||
* [[DevFaqNBMPack200| How to deal with pack200 compression in NBM?]] (''since NB6.9'') | * [[DevFaqNBMPack200| How to deal with pack200 compression in NBM?]] (''since NB6.9'') | ||
* [[DevFaqAutoUpdateCheckEveryStartup| How to force to check for updates at every startup?]] | * [[DevFaqAutoUpdateCheckEveryStartup| How to force to check for updates at every startup?]] | ||
+ | * [[DevFaqHowToChangeUpdateCenterURL|How to change the update center URL via code?]] | ||
===Deployment using installers / NBI=== | ===Deployment using installers / NBI=== |
Current revision as of 14:18, 18 September 2016
This is the developer-oriented FAQ for NetBeans IDE 4.x, 5.x, 6.x, 7.x and 8.x. Developer in this context means "person writing NetBeans extension modules (plug-ins), or applications based on the NetBeans Platform". Don't see your developer-oriented question here? Ask on dev@platform.netbeans.org (subscribe to post). Not writing modules? See the list of other FAQs.
Want the whole FAQ in one big HTML file? Download it here for offline reading (rebuilt daily).
Here's How To Add FAQ Entries. One Big Important Thing about adding developer FAQ entries: If they don't start with "DevFaq" they are not going to get indexed properly. Please add items, but please follow this simple guideline.
Getting Started
- What is a module?
- Becoming a proficient module developer
- How do I get sources for NetBeans using Mercurial (hg)?
- How do I get zipped sources for a periodic build?
- What API do I want to use for x, y or z?
- I have fixed a bug in NetBeans. Can I contribute the patch?
- I have written a module. Can I sell it?
- Why are some packages org.netbeans.api.something and others are org.netbeans.something.api?
- What is netbeans.exe, who compiles it and why is it there?
- How do I get commit access to NetBeans source repository?
- Where can I find Javadoc for the IDE and Platform?
- Where is the Platform and how can I build it?
- How do I set up a NetBeans Platform in the IDE?
- There sure are a lot of modules in the source tree. What are they for?
- In the Libraries tab of my application's Project Properties, there sure are a lot of modules listed. What are they for?
Tutorials and important starting points
- What are the basic things I should know about NetBeans' architecture to get started creating NetBeans Platform applications?
- Any tutorials out there, please?
- NetBeans API starting point
- NetBeans Annotation Cheat Sheet
Getting support, where to find examples
- NetBeans mailing lists - get help from experts all around the globe
- Search the support list for module developers
- Search the NetBeans development mailing list
- Filing a bug report
- Examples of how to use various APIs
- Browse Samples Online
- Where can I find more documentation on certain APIs?
- Consider all of these support options
- Can I get training material for the NetBeans Certification course?
Application Lifecycle and Hooks
Development issues, module basics and classpath issues, and information about RCP/Platform application configuration
- My module uses some libraries. I've tried setting CLASSPATH but it doesn't work. Help!
- How do module dependencies/classloading work?
- How do I have two source directories within one module?
- What classloaders are created by the module system?
- Why can't I load properties using UIDefaults?
- I need to package some third party libraries with my module. How do I do that?
- What is an "NBM"?
- Can I sign NBMs I create?
- What is an SPI? How is it different from an API?
- My module requires JDK 6 - how do I keep it from being loaded on an older release?
- What is a library wrapper module and how do I use it?
- When should I use a library wrapper module and when should I just package the library into my module?
- How to store external libraries in the NetBeans Hg repository
- How do I add native libraries?
- What is an implementation dependency and what/how/when should I use one?
- My module uses class XYZ from NetBeans' APIs. It compiles, but I get a NoClassDefFoundError at runtime. Why?
- What is a module cluster?
- What is the difference between a suite and a cluster?
- How can I reuse my modules in several RCP applications?
- Can I use modules from update center in my RCP application?
- My project.xml lists more dependencies than I really need. How can I fix it?
- Can I work on just one or two modules from the NetBeans source base by themselves?
- Is there a standard way to provide user documentation (help) for my module?
- Where is TopManager? I'm trying to do the examples from the O'Reilly book
- There is a class under org.netbeans.core that does what I need. Can I depend on it?
- Common calls that should be done slightly differently in NetBeans than standard Swing apps (loading images, localized strings, showing dialogs)
- How do I create a patch for a preexisting NetBeans module?
- I want to use one version of the Platform with another version of the build harness. Can I?
- I am developing a NetBeans module. What performance criteria should it satisfy?
- I want to set some flags or CLI arguments for running my NB RCP/Platform based application (such as disable assertions). How do I do that?
- How can I fix memory leaks?
- How to run module with more PermGen and Heap memory?
- What is a WeakListener?
- When should I use a WeakListener?
- How can I profile NetBeans?
- Can I test changes to the IDE without going through the license check and so on?
- How can I customize the build process?
- How can I customize the default project directory for my application, replacing "NetBeansProjects"?
- Migrating to a newer version of the Platform
- How can I launch an Ant Task on all modules of my suite?
- Do I need to restart NetBeans every time to debug new changes?
- How can I have my application compiled in a specific version of the platform?
- How do I develop and debug annotations for NetBeans platform apps?
Mavenized Builds
- See also plugin documentation
- How can I create localization modules using Maven?
- Why can't I use system scope for a library wrapper module?
- Can I use JRebel to speed up development?
- How to convert an ANT-based NetBeans Module to a Maven-based NetBeans Module?
Configuration: How Modules Install Things
- What are the ways a module can influence the system?
- What is the "default Lookup"?
- How do I run some code when my module starts/loads/unloads?
- What is an XML layer?
- What is the system filesystem?
- How can I see the filesystem?
- What are .instance files?
- What are .settings files?
- What are .shadow files?
- What is the user directory, what is in it, and why do I need one?
- How do I specify the order for my menu items/toolbar buttons/files in the system filesystem?
- Can I dynamically change the contents of the System Filesystem at runtime?
- Can I bundle some additional files with my module? If so, how can I find those files to use them from my module?
When There Are Multiple Ways To Do Something...
- Installing things declaratively vs. installing things programmatically
- I need to register some object to be found at runtime, or run some code on startup. Which way should I use?
- Which way should I register an object in the default Lookup?
- Should I register an object in my layer file using .instance or .settings files? What about .shadow files?
Actions: How to add things to Files, Folders, Menus, Toolbars and more
- How do I add an action to the main menu?
- How do I add an action to a toolbar in the main window?
- How do I add a toggle-able action to the toolbar/main menu?
- How do I add an action to the toolbar of the editor?
- How do I make an action that is automatically enabled/disabled depending on what's selected?
- How do I make a checkable/toggle-able action that represents a preference option?
- What is the Actions folder in the system filesystem, and why should I use it?
- How do I add an action (incl. shortcut) at runtime?
- How do I add an action to all files of a given mime-type?
- How do I add an action to the context menu of a specific editor?
- How do I add an action to the context menu of all editors?
- How do I add an action to a project popup menu?
- How do I add an action to a project popup menu of a specific project type?
- How do I add an action to a project popup menu of my own project type?
- How do I add an action to a folder?
- How do I add an action to any folder?
- How do I add an action to an Java package?
- How do I add an action to the tools menu?
- How do I add an action to my custom node?
- How do I make my Node have a submenu on its popup menu?
- How do I add an action to the global popup menu of tabs?
- How do I add a dropdown menu to toolbar?
- How do I add a dropdown menu to toolbar that is selectively enabled/disabled?
- How do I hide/remove default toolbar buttons and/or menu items?
- How do I hide/show toolbar dynamically?
- Some module in the IDE etc. already has a menu item I like, but I just want to rename it. Can I?
- Can I change the contents of a menu according to the selected file in the editor, or hide or show a whole menu?
- Can I install submenus into popups or other menus, instead of a regular action?
- How do i change the closing action of the MainWindow?
- How do I get the Open File item on the File menu into my platform application?
- Looking at the UI how do I find a module that implements a menu item
- How can I add a JSeparator to the main toolbar?
- How do I remove Menu Item, Toolbar Button from plug-in's XML Layer?
- How do I have only Shortcut Keys for an Action?
- How do I change the appearance of the menu items and toolbar buttons for my Action
- How do I invoke the IDE-Log upon Startup?
- Which NetBeans Platform Action Class Should I Use?
- How to Make the NetBeans Platform Sensitive to Customers
- How do I add content to the Global Context?
- How do I add an icon to the context menu?
- How do I add an action to the context menu of the members or hierarchy view?
- How do I invoke an action programmatically?
- How can I reuse and/or organise actions only by using annotations (@ActionReferences)?
- How can I fix "WARNING [org.openide.util.Utilities]: findContextMenuImpl, getPopupPresenter returning null for" when using a PopupPresenter ?
- How do I define and localise the keymap category of an action?
- How do I create an action which can be invoked by a macro?
Key Bindings
- How do key bindings work?
- Binding one key to more than one action
- Why should I use D- for Ctrl and O- for Alt? I thought C- stood for Ctrl and A- stood for Alt!
- I want my action to appear between two existing items/in a specific place in the menu. Can I do that?
- What about editor-specific keybindings?
- Which keybindings are already being used?
- How do I add default shortcuts for SystemActions (like cut, paste, etc)?
- How to get the shortcut/shortkey of an action at runtime?
- How to set the shortcut of an action outside of your own module?
Lookup
- What is a Lookup?
- What uses Lookup?
- Why use Lookup - wouldn't a Map be good enough?
- How do I use Java generics with Lookup?
- What is the "default Lookup"?
- How can I override an instance in the Lookup?
- What is the difference between getCookie(Class), SharedClassObject.findObject(Class) and Lookup.lookup(Class)?
- How do I implement my own lookup or proxy another one?
- If there is more than one of a type in a Lookup, which instance will I get?
- How can I find out what is in a Lookup
- How can I add support for lookups on nodes representing my file type?
- When should I use Lookup in my own APIs?
- After adding my class to Lookup I get a "ClassNotFoundException" when trying to look it up, why?
- Event Bus in NetBeans
- How do I lazy-load an item in the lookup?
- Register instances via custom annotations
- How can I register services into the lookup using the system filesystem?
Files and Data Objects
- How does NetBeans recognize files?
- What is a FileObject?
- What is a FileSystem?
- What are file attributes?
- What is a DataObject?
- What is a DataLoader?
- How can I be notified when a file is modified and saved?
- How can I be notified when a file is opened?
- How do I add a menu item to the popup menu of every folder in the system?
- Can I add a menu item to the context menu of every Java source file?
- I'm having trouble implementing this filesystem....
- How do I add support for an XML type with a different extension?
- The next button is never enabled when I create my DataObject from a template. Help!
- How can I create a FileObject in memory?
- How can I create declarative MIMEResolver and add new file type?
- I am listening for changes in a folder/file but when there are changes I do not receive an event
- I want to listen for changes in a file that may not exist or may be deleted and re-created
- I need to show a file chooser. How can I remember most-recently-used directories?
Converting between common data types and finding things
- FileObjects versus Files
- URIs and URLs
- How do I get a java.io.File for a FileObject?
- How do I get a FileObject for a File?
- How do I get a DataObject for a FileObject?
- How do I get a FileObject for a DataObject?
- How do I get a Node for a DataObject?
- How do I get a DataObject for a Node?
- How do I get a reference to the system filesystem?
- I have a .instance file. How do I get an actual object instance?
- I have a folder full of .instance files. How do I get any/all of the object instances?
Editor and Edited Files
- How can I get a list of open editors/documents?
- How can I get the currently open document in the selected editor?
- How can I track what file the user is currently editing?
- How can I get the position of the caret/line in the selected editor?
- How can I open a file in the editor in read-only mode?
- How can I open a file in the editor at a particular line number and column?
- How to get mime type from Document or JTextComponent?
- Is it safe to programmatically modify a file which is open in the editor?
- I want to make some programmatic changes to the edited file. How can I do it so one Undo undoes it all?
- Can I add syntax coloring for my own data object/MIME type?
- How to add code completion to any JEditorPane
- What is MimePath?
- What is MimeLookup?
- How is MimeLookup composed?
- How can I create JEditorPane for a specific document type?
- Project Encoding vs. File Encoding - What are the precedence rules used in NetBeans 6.0?
- I want to add annotations to my editor, for errors, or other reasons. How?
- Can I add a menu item to the context menu of the Java source editor?
- How to use the diff view in my own application/plugin?
- How to reuse XML syntax highlighting in your own editor
- How to add code templates?
File Management (within the IDE/Application)
Module System
- I want my module to disable some of the modules that would normally be enabled. Possible?
- How do I debug a module I'm building?
- Can I disable Auto Update (for example, while running tests)?
- How can I change the NetBeans splash screen shown when an installed module requires restart?
- How can I obfuscate a module?
- Why am I getting a ClassCastException when the class is clearly of the right type?
- Can two or more modules contain the same package?
- Can I create a console or server (non-GUI) app with the NetBeans Platform?
- How can code in one module be notified when other modules are loaded or unloaded?
- What is an autoload module?
- How fix module dependencies automatically?
Nodes and Explorer
- What is a Node?
- What is "explorer"?
- What is an ExplorerManager?
- What is an Explorer View?
- How do I show a Node in my explorer view?
- I need to create my own Nodes. What should I subclass?
- How to serialize my nodes?
- I need to show Nodes for objects that are slow to create. How do I compute Node children on a background thread?
- How do I create a TopComponent (tab in the main window) to show some Nodes?
- I have a reference to an existing Node from some other module. Can I add cookies/properties/children?
- Can I add, remove or reorder children of a node on the fly?
- How do I make a particular node visible in the Explorer, and maybe select it?
- How do I get at the file that a particular node represents?
- Tracking selections in the Explorer
- I need to add to/remove from/customize the content of my Node/DataObject/TopComponent's Lookup. How do I do it?
- I need to write some code that tracks the global selection. What should I do?
- How do I "decorate" nodes that come from another module (i.e. add icons, actions)?
- How do I preserve the column attributes of a TreeTableView?
- How do I remove the "..." buttons of a TreeTableView?
- How can I make sortable columns in a TreeTableView?
- How can I add a "View" capability for data my node represents?
- How can I implement "Select all/Deselect all/Invert selection" features?
- Why do my nodes in the Explorer always have an expand-box by them, even though they have no children?
- How can I prevent (or override) the node deletion dialog?
- How can I change my node's appearance?
- How do I handle cut, copy and paste?
- How can I graphically create a ChoiceView?
- How can I design explorer views in Mantisse GUI editor?
- I have a Node.Property for a file. How can I control the file chooser that is the custom editor?
- I have a Node.Property. I want to control its appearance or custom editor somehow. Can I do that without writing my own property editor?
- I want to allow other modules to inject objects into my Node's Lookup, or Actions into its actions
- How can I add horizontal scrolling support to the OutlineView component?
Tasks and Progressbar
- How to use the Progress API?
- Cancellable Tasks and Progress Indicators
- How to execute a long running task from an action without blocking the GUI?
- How to run/execute an external program?
Command Line Parsing
- Can something that the user sets on the command line determine whether a menu item is enabled?
- Same as the above, but this time for enabling/disabling modules?
- How to pass command line arguments to a NetBeans Platform application when run inside the IDE
- Platform parsing command line arguments
Threading
- What is a background thread and why do I need one?
- I need to run some code on a background thread. Can the platform help me?
- When should I use RequestProcessor.getDefault() and when should I create my own RequestProcessor?
- What APIs come with built-in background thread handling?
- How can I run an operation occasionally on a background thread, but reschedule it if something happens to delay it?
Creating a Custom Programming Language
- How do I add syntax highlighting for my language?
- How can I create a custom Debugger for my language?
Settings
- How do I let the user set preferences/options/customization/configuration for my module/application?
- Can I add new panels to the Options window?
- How to register options for export/import to module's layer?
- How do I change the application's Java start parameters?
- How can I configure my options panel to be found by global quicksearch or options search?
- How do you open the option dialog with a preselected category?
- How do you change the configuration of other modules?
Window System
- What is the window system
- What are Modes?
- What are TopComponents?
- How do I use Matisse/GroupLayout (new form editor/layout manager in 5.0) in my windowing system components
- I want to show my own component(s) in the main window - where do I start?
- Windows and dialogs
- How does the XML API for installing window system components work?
- How do I use .wstcrf/.wsmode/.settings files to install my module's components in the window system?
- My TopComponent always opens in the editor area, but I want it to open in the same place as XYZ
- Why does TopComponent have a getLookup() method? What is it for?
- I want to disable the popup menu on the toolbars in the main window. How do I do that?
- How can I change the executable's icon?
- How does the window system really work?
- How can I replace the Window System?
- How do I set the initial size of the main window?
- Secrets of the NetBeans Window System
- I want to create a TopComponent class to use as an editor, not a singleton
- How can I change my TopComponent to not be a singleton?
- I have a non-singleton TopComponent. Can I write actions which show all available instances in the main menu?
- Which TopComponents are open?
- How to override the default size of an existing window?
- How to create a custom window mode?
- How to change main title contents?
- How can I customize the window system via the latest 7.1 techniques/enhancements?
- How to mix lightweight (Swing) and heavyweight (AWT) components?
- How to maximize a TopComponent?
Dialogs API
XML Multiview API
- How do I get started with the XML Multiview API? (Part 1)
- How do I get started with the XML Multiview API? (Part 2)
- How do I get started with the XML Multiview API? (Part 3)
- How do I get started with the XML Multiview API? (Part 4)
- How do I get started with the XML Multiview API? (Part 5)
- How do I get started with the XML Multiview API? (Part 6)
- How do I get started with the XML Multiview API? (Part 7)
- How to change selected tab of Multiview?
Project Handling
- How can I open a Project programatically?
- How to get the project of the active file in the editor?
- How to get the name or icon of a project?
- How to get the name of the active project group?
- How to listen for projects to be opened/closed?
Project Types
- Is it possible to extend an existing project type?
- How to add a new panel to a Project Properties dialog?
- How do I add an action to a project popup menu?
- How do I add an action to a project popup menu of a specific project type?
- How do I identify the "main project"?
- How do I register a "ProjectCustomizer" to multiple project types?
- How determine all available project types?
- How can I define the available File types when the user right-clicks the project folder and chooses "New"?
Also see BuildSystemDesign and ProjectGroups.
Saving
Versioning
Printing
HTML Browser
Wizards and Templates
- How do I make a file template which actually creates a set of files at once?
- I am creating a non-IDE application. How do I enable/control templates?
- How do I get started using FreeMarker to generate my templates? (and this plugin might help too)
- How do I show that a user has filled an invalid input into my wizard?
- How to open files in editor after project creation?
- How to customize the button text of default buttons of a wizard (Finish, Cancel, etc.)?
Properties and PropertySheet
- How do I change the default behavior of PropertySheet editors?
- How do I show my node's properties in the Properties view?
- How do I display different groups of properties on buttons in the property sheet the way Matisse does?
- How do I color the cells in a property sheet?
- How do I display an icon in my property sheet?
- How do I hide the description area in property window?
- How do I add a readonly property?
Output Window
- How do I create my own tab in the output window and write to it?
- How do I route the output from an external process to the output window?
- How to implement custom IOProvider?
- How do I embed output window tab to another component?
- How to use color text in Output Window?
- How to get user input in the Output Window?
Using Enterprise Resources from NetBeans module
- Java EE Application Client on top of NetBeans Platform Tutorial
- How to call EJB from NetBeans module
Running and Writing tests
- Using NbModuleSuite & friends
- Running tests on a platform application
- Typical Test Patterns
- NetBeans Developer Test FAQ
- Testing things that use FileObjects
- Writing Tests for DataObjects and DataLoaders
- How do I test something which uses the System Filesystem?
Branding your application
- Branding About Dialog
- Branding Updater Splash
- How do I set the version number?
- How do I remove the status bar?
- Translating a NetBeans Module
Authentication and Authorization in Platform Apps
- Building a Login Screen for a NetBeans Platform Application: Part 1, Part 2 and Part 3
- Other strategies for authentication and authorization
Logging and Error Handling
- Using java.util.logging in NetBeans
- UI Logging through Gestures Collector
- How can I suppress the Unexpected Exception dialog?
- How can I customize the Unexpected Exception dialog?
- How can I add a timestamp to the logs?
JavaHelp
- JavaHelp integration guide
- How do I fix problems about 'ide.welcome'?
- How do I change the default help topic?
- How do I remove the helpset?
- How do I connect ui to JavaHelp?
- Why doesn't my JavaHelp content show up?
- How can I hook up JavaHelp to property sets or individual properties?
- How can I override JavaHelp to display my own custom help or documentation?
Look and Design
- How can I set the Swing look and feel on startup?
- I have a custom component. How can I make it respond to --fontsize like the rest of NetBeans?
- How to provide non-inverted images for dark LookAndFeels like DarkMetal/Darcula?
Deploying Changes through AutoUpdate and using Autoupdate API
- How can I use AutoUpdate to deploy updates and new modules for my application?
- How can I update the splash screen, title bar and other branding items via AutoUpdate?
- How can I set the interval at which AutoUpdate checks its servers?
- How can I find Javadoc of Autoupdate API with hints to use it?
- What other documentation is available about AutoUpdate?
- How to specify post-install code in NBM?
- How can I run the installer for something else during module installation? (since NB6.5)
- How to update NetBeans Platform Application silently?
- How to deal with pack200 compression in NBM? (since NB6.9)
- How to force to check for updates at every startup?
- How to change the update center URL via code?
Deployment using installers / NBI
Programmatic access to Java Sources
The following applies only to NetBeans 6.0 and later.
- How do I Get All Methods/Fields/Constructors of a Class?
- How can I programmatically modify a Java source file?
- How to obtain a source file for a Java class and open in the editor?
- How can I scan a classpath to find all classes of a particular type?
- See Java_DevelopersGuide for more specific FAQ entries
When things go wrong: Troubleshooting
- I've got a class not found error/exception. How can I fix it?
- I find files missing from the source ZIP file
Licensing Issues
- NetBeans Platform and 3rd party components
- Where to download sources of MPL third-party components?
- Where to download sources of LGPL third-party components?
- Where to download sources of EPL third-party components?
Using Sounds
Contributor Agreement
- What is the Contributor Agreement ("CA")?
- Do I have to fill out a CA?
- How do I file a completed CA?
- Can I file my completed CA by e-mail?
- I've already signed a JCA; do I still have to sign the CA?
- I've already signed a CA for another Oracle project, do I need to sign another one for NetBeans?
- I've already signed a recent version of the CA, do I need to sign the newest version?
- Do I have to file a CA for every contribution?
- Once I have a CA on file, can I change my mind and cancel?
- I tried to make a contribution to netbeans.org and signed a CA, but my contribution was not accepted. What is the result?
- Why does NetBeans request a CA?
- I have a CA or JCA on file and I have made a code contribution to netbeans.org. Can I get listed on the copyright notice?
- If my company wants me to contribute changes, who should sign the CA, me or my company?
- Can my company sign a blanket JCA for all its employees?