extending netbeans ide
DESCRIPTION
Learn how to extend NetBeans IDE for fun and profit!TRANSCRIPT
1
2
Getting Started Extending NetBeans IDE (Learn how to create NetBeans plugins for fun and profit!)
4
Free Tool Box
HTML
JavaScript
CSS
Java EE
NetBeans
5
What is NetBeans?
Ready to use out of the box
Support for latest Java
specifications & standards
Support for HTML,
JavaScript, and CSS
Intuitive workflow
Debugger, Profiler,
Editing & Refactoring Tools
Binaries and ZIPs for Mac OS,
Linux, and Windows
Simply download and run on any operating system!
Increase Developer Productivity
6
What is NetBeans?
Works out of the box
Freely available
Open source
Support for Java standards &
other popular platforms, such as HTML5
Deeply integrated Maven support
Extensible Java desktop framework
Powerful, award winning GUI Builder
Profiling and debugging tools
Customizable and extensible
Increase Developer Productivity
7
What is NetBeans?
Works out of the box
Freely available
Open source
Support for Java standards &
other popular platforms, such as HTML5
Deeply integrated Maven support
Extensible Java desktop framework
Powerful, award winning GUI Builder
Profiling and debugging tools
Customizable and extensible
Task: What are your favorite two features in NetBeans IDE?
Increase Developer Productivity
8
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
9
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
Windows Positions Groups
10
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
Options Window Primary Tabs Secondary Tabs Windows
Positions Groups
11
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
Options Window Primary Tabs Secondary Tabs Windows
Positions Groups
Progress Bar Status Bar Output
12
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
Options Window Primary Tabs Secondary Tabs Windows
Positions Groups
Progress Bar Status Bar Output
Files Editors Popup Menus
13
NetBeans IDE
Menu Items Toolbar Buttons Keyboard Shortcuts
Options Window Primary Tabs Secondary Tabs Windows
Positions Groups
Progress Bar Status Bar Output
Files Editors Popup Menus
Projects External Tools
14
Key Concepts
Module
Action
Filesystem
TopComponent
Options Window
Lookup
15
Module
Most features in NetBeans IDE are found within a single module.
If a feature is complex and consists of different parts, it consists of multiple modules.
A module is:
– a JAR file
– with special manifest entries
– distributed as an NBM file
16
Module
Most features in NetBeans IDE are found within a single module.
If a feature is complex and consists of different parts, it consists of multiple modules.
A module is:
– a JAR file
– with special manifest entries
– distributed as an NBM file
Task: Choose your favorite two modules in Tools | Plugins | Available Plugins.
17
Workshop
Let’s create a module!
18
Actions
Actions are invoked from menu items, toolbar buttons, and keyboard shortcuts.
Actions consist of
– ActionListener
– Display name
– Icon
Some actions are always enabled and some actions are contextually enabled.
19
Actions
Actions are invoked from menu items, toolbar buttons, and keyboard shortcuts.
Actions consist of
– ActionListener
– Display name
– Icon
Some actions are always enabled and some actions are contextually enabled.
Task: Find two always enabled actions and two contextually enabled actions
…and explain why!
20
Filesystem
Features in modules are registered in an XML file called “layer.xml” file.
Each module has at most one “layer.xml” file.
Entries in the “layer.xml” file:
– Come from annotations in Java classes.
– Come from manually typing in the file.
When NetBeans IDE starts, it merges all “layer.xml” files and creates the filesystem.
The filesystem has fixed folders, e.g., “Menu” and “Toolbars”.
21
Workshop
Let’s create an Action and register it in the Filesystem!
22
Workshop
Try to create an Action without using a wizard!
23
Workshop
Create a new Module that registers an Action in the Toolbar!
24
TopComponents
TopComponents are windows.
Windows are displayed in modes, i.e., positions or tabs.
Predefined modes include “editor”, “explorer”, “output”, and “properties”.
Annotations on the TopComponent define its default Mode.
25
TopComponents
TopComponents are windows.
Windows are displayed in modes, i.e., positions or tabs.
Predefined modes include “editor”, “explorer”, “output”, and “properties”.
Annotations on the TopComponent define its default Mode.
Task: Identify three windows displayed by default in
the “explorer”, “editor”, and “output” mode.
26
Workshop
Let’s create a TopComponent!
27
Workshop
Try to create a TopComponent without using a wizard!
28
Options Window
The Options window is a centralized dialog for all customizations in NetBeans IDE.
Each module can contribute new panels to the Options window.
There are primary panels and secondary panels.
Changes in the Options window can be persisted across restarts of NetBeans IDE.
29
Options Window
The Options window is a centralized dialog for all customizations in NetBeans IDE.
Each module can contribute new panels to the Options window.
There are primary panels and secondary panels.
Changes in the Options window can be persisted across restarts of NetBeans IDE.
Task: Go to the Miscellaneous category in the Options window and
make the tabs of NetBeans IDE appear along the bottom and
then experiment with other settings you find there.
30
Workshop
Let’s create a new Options panel!
31
Lookup
Lookup provides context sensitivity to NetBeans IDE.
Task: Make a change in an editor and look at what happens to the Save button.
Click the Save button and notice what happens.
Do you think the Save button is in the same module as the editor?
Try to make some guesses about how it works.
32
Lookup
Lookup provides context sensitivity to NetBeans IDE.
Task: Make a change in an editor and look at what happens to the Save button.
Click the Save button and notice what happens.
Do you think the Save button is in the same module as the editor?
Try to make some guesses about how it works.
Context sensitivity is provided by an event listening mechanism:
– The Save action is listening to the global context for a typed object.
– When a change is made in the editor, the typed object is published into the global context.
– The Save action calls a method on the type.
33
Workshop
Let’s listen to the global context for Projects!
34
Workshop
Display information about all the selected projects
in a window displayed in the Properties mode.
35
Summary
36
Key Concepts
Module
Action
Filesystem
TopComponent
Options Window
Lookup
38