Your SlideShare is downloading. ×
1
Getting Started
Extending NetBeans IDE
(Learn how to create NetBeans plugins for fun and profit!)

2
Me
 Twitter: @geertjanw
 Facebook: www.facebook.com/geertjanw
 E-Mail: geertjan.wielenga@oracle.com

3
Free Tool Box
 HTML
 JavaScript
 CSS
 Java EE
 NetBeans

4
What is NetBeans?
Increase Developer Productivity
 Ready to use out of the box
 Support for latest Java

specifications ...
What is NetBeans?
Increase Developer Productivity
 Works out of the box
 Freely available

 Open source
 Support for J...
What is NetBeans?
Increase Developer Productivity
 Works out of the box
 Freely available

 Open source
 Support for J...
NetBeans IDE
Menu Items
Toolbar Buttons
Keyboard Shortcuts
8
NetBeans IDE
Menu Items
Toolbar Buttons
Windows
Keyboard Shortcuts

Positions
Groups

9
NetBeans IDE
Options Window
Menu Items
Primary Tabs
Toolbar Buttons
Secondary Tabs
Windows
Keyboard Shortcuts
Positions
Gr...
Progress Bar
Status Bar
NetBeans IDE
Output
Options Window
Menu Items
Primary Tabs
Toolbar Buttons
Secondary Tabs
Windows
...
Files
Editors
Popup Menus Progress Bar
Status Bar
NetBeans IDE
Output
Options Window
Menu Items
Primary Tabs
Toolbar Butto...
Files
Projects
External Tools Editors
Popup Menus Progress Bar
Status Bar
NetBeans IDE
Output
Options Window
Menu Items
Pr...
Key Concepts
 Module
 Action
 Filesystem
 TopComponent
 Options Window
 Lookup
14
Module
 Most features in NetBeans IDE are found within a single module.
 If a feature is complex and consists of differe...
Module
 Most features in NetBeans IDE are found within a single module.
 If a feature is complex and consists of differe...
Workshop
 Let’s create a module!

17
Actions
 Actions are invoked from menu items, toolbar buttons, and keyboard shortcuts.
 Actions consist of
– ActionListe...
Actions
 Actions are invoked from menu items, toolbar buttons, and keyboard shortcuts.
 Actions consist of
– ActionListe...
Filesystem
 Features in modules are registered in an XML file called “layer.xml” file.
 Each module has at most one “lay...
Workshop
 Let’s create an Action and register it in the Filesystem!

21
Workshop
 Try to create an Action without using a wizard!

22
Workshop
 Create a new Module that registers an Action in the Toolbar!

23
TopComponents
 TopComponents are windows.
 Windows are displayed in modes, i.e., positions or tabs.
 Predefined modes i...
TopComponents
 TopComponents are windows.
 Windows are displayed in modes, i.e., positions or tabs.
 Predefined modes i...
Workshop
 Let’s create a TopComponent!

26
Workshop
 Try to create a TopComponent without using a wizard!

27
Options Window
 The Options window is a centralized dialog for all customizations in NetBeans IDE.
 Each module can cont...
Options Window
 The Options window is a centralized dialog for all customizations in NetBeans IDE.
 Each module can cont...
Workshop
 Let’s create a new Options panel!

30
Lookup
 Lookup provides context sensitivity to NetBeans IDE.
 Task:

31

Make a change in an editor and look at what hap...
Lookup
 Lookup provides context sensitivity to NetBeans IDE.
 Task:

Make a change in an editor and look at what happens...
Workshop
 Let’s listen to the global context for Projects!

33
Workshop
 Display information about all the selected projects

in a window displayed in the Properties mode.

34
Summary

35
Key Concepts
 Module
 Action
 Filesystem
 TopComponent
 Options Window
 Lookup

36
Me
 Twitter: @geertjanw
 Facebook: www.facebook.com/geertjanw
 E-Mail: geertjan.wielenga@oracle.com

37
Extending NetBeans IDE
Upcoming SlideShare
Loading in...5
×

Extending NetBeans IDE

4,226

Published on

Learn how to extend NetBeans IDE for fun and profit!

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,226
On Slideshare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Extending NetBeans IDE"

  1. 1. 1
  2. 2. Getting Started Extending NetBeans IDE (Learn how to create NetBeans plugins for fun and profit!) 2
  3. 3. Me  Twitter: @geertjanw  Facebook: www.facebook.com/geertjanw  E-Mail: geertjan.wielenga@oracle.com 3
  4. 4. Free Tool Box  HTML  JavaScript  CSS  Java EE  NetBeans 4
  5. 5. What is NetBeans? Increase Developer Productivity  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! 5
  6. 6. What is NetBeans? Increase Developer Productivity  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 6
  7. 7. What is NetBeans? Increase Developer Productivity  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? 7
  8. 8. NetBeans IDE Menu Items Toolbar Buttons Keyboard Shortcuts 8
  9. 9. NetBeans IDE Menu Items Toolbar Buttons Windows Keyboard Shortcuts Positions Groups 9
  10. 10. NetBeans IDE Options Window Menu Items Primary Tabs Toolbar Buttons Secondary Tabs Windows Keyboard Shortcuts Positions Groups 10
  11. 11. Progress Bar Status Bar NetBeans IDE Output Options Window Menu Items Primary Tabs Toolbar Buttons Secondary Tabs Windows Keyboard Shortcuts Positions Groups 11
  12. 12. Files Editors Popup Menus Progress Bar Status Bar NetBeans IDE Output Options Window Menu Items Primary Tabs Toolbar Buttons Secondary Tabs Windows Keyboard Shortcuts Positions Groups 12
  13. 13. Files Projects External Tools Editors Popup Menus Progress Bar Status Bar NetBeans IDE Output Options Window Menu Items Primary Tabs Toolbar Buttons Secondary Tabs Windows Keyboard Shortcuts Positions Groups 13
  14. 14. Key Concepts  Module  Action  Filesystem  TopComponent  Options Window  Lookup 14
  15. 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 15
  16. 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. 16
  17. 17. Workshop  Let’s create a module! 17
  18. 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. 18
  19. 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: 19 Find two always enabled actions and two contextually enabled actions …and explain why!
  20. 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”. 20
  21. 21. Workshop  Let’s create an Action and register it in the Filesystem! 21
  22. 22. Workshop  Try to create an Action without using a wizard! 22
  23. 23. Workshop  Create a new Module that registers an Action in the Toolbar! 23
  24. 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. 24
  25. 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: 25 Identify three windows displayed by default in the “explorer”, “editor”, and “output” mode.
  26. 26. Workshop  Let’s create a TopComponent! 26
  27. 27. Workshop  Try to create a TopComponent without using a wizard! 27
  28. 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. 28
  29. 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: 29 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. 30. Workshop  Let’s create a new Options panel! 30
  31. 31. Lookup  Lookup provides context sensitivity to NetBeans IDE.  Task: 31 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. 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. 32
  33. 33. Workshop  Let’s listen to the global context for Projects! 33
  34. 34. Workshop  Display information about all the selected projects in a window displayed in the Properties mode. 34
  35. 35. Summary 35
  36. 36. Key Concepts  Module  Action  Filesystem  TopComponent  Options Window  Lookup 36
  37. 37. Me  Twitter: @geertjanw  Facebook: www.facebook.com/geertjanw  E-Mail: geertjan.wielenga@oracle.com 37
  38. 38. 38

×