Enhance your IDE - write a plugin for
Anton Sarov
Codepot, Warszawa 2015
Eclipse, IntelliJ and NetBeans!
About me
Eclipse RCP developer
@duxanton

Play Framework enthusiast
97% of developers use an IDE*
>= 93% of them use either Eclipse or IntelliJ or NetBeans
http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-2014/6/
https://www.java.net/poll/i-do-most-my-coding-using



Plugin Repositories
-
Eclipse (https://marketplace.eclipse.org)
1526
-
IntelliJ IDEA (https://plugins.jetbrains.com/?idea)
1433
-
NetBeans (http://plugins.netbeans.org/PluginPortal)
943
Today's task
Learn to write a simple IDE plugin in 30 minutes!
Today's task
Simple means:
-
one basic functionality
-
no fancy UI (standard input dialog instead)
Today's task
search for posts (having a specific term) on Stack Overflow
Setup
Eclipse
Eclipse
1) File -> New -> Plug-in Project
check 'plug-in will make contributions to the UI'
set create a 3.x rich client application to 'No'
Eclipse
Extension

Extension Point
Eclipse
Menus
Commands
Bindings
Handlers
org.eclipse.ui.menus
org.eclipse.ui.commands
org.eclipse.ui.bindings
IHandler interface
Eclipse
Ctrl / Cmd
Shift
Alt
M1
M2
M3
scheme ID: org.eclipse.ui.defaultAcceleratorConfiguration
context ID: org.eclipse.ui.contexts.window
Bindings Tips and Tricks
Eclipse
extend AbstractHandler instead of implementing IHandler
use the HandlerUtil class for UI interaction
Handlers Tips and Tricks
Eclipse
Launching the plugin
right click on the project -> Run As -> Eclipse Application
or
define a Run Configuration (of type Eclipse Application) manually
Eclipse
Distribute your plugin
Export plug-in in directory / as archive
or
Create a feature wrapping your plugin and then provide it via an update site
Eclipse
Distribute your plugin (with a Feature)
1) File -> New -> Feature Project
2) Select your plugin
3) Export your feature as Deployable feature to some location (e.g. local folder)
4) Use the Eclipse Install New Software wizard to install your feature from the above location
Eclipse
Recommended starting points
IntelliJ IDEA
IntelliJ IDEA
1) File -> New -> Project -> IntelliJ Platform Plugin
2) New Project SDK -> Java SDK (if not already set) -> Home directory for IntelliJ Platform Plugin (CE installation)
IntelliJ IDEA
1. on 'src' folder -> New -> Action
2. fill neccessary information
3. implement custom logic
or ...
IntelliJ IDEA
1. Write a class which extends AnAction
2. Implement the only method
public void actionPerformed(AnActionEvent e);
3. Reference the class in the META-INF/plugin.xml (and edit plugin.xml further if needed)
IntelliJ IDEA
Launching the plugin
Run -> Edit configurations -> Add new Plugin configuration
Tips:
check 'Single instance only'
check 'Show idea.log'
IntelliJ IDEA
Distribute your plugin
Build -> Prepare Plugin Module ... For Deployment
IntelliJ IDEA
Recommended starting points
NetBeans
NetBeans
File -> New Project -> NetBeans Modules -> Module
NetBeans
1) Write a class which implements ActionListener
2) Implement the only method
public void actionPerformed(ActionEvent e);
NetBeans
Ctrl+Shift+S
Alt+Enter
Alt+Shift+S
DS-S
O-ENTER
OS-S
ActionReference Shortcuts
NetBeans
Run -> Run Project
or
right-click on the Module -> Install/Reload in Development IDE (not recommended)
Launching the plugin
NetBeans
right-click on the Module -> Create NBM
Distribute your plugin
NetBeans
Recommended starting points
Thank you for attending this workshop!
A very short survey about your experience
http://goo.gl/forms/0kKlcpdM2R
Enhance your IDE - write a plugin for Eclipse, IntelliJ and NetBeans!
By duxanton
Enhance your IDE - write a plugin for Eclipse, IntelliJ and NetBeans!
Slides for the IDE workshop at Codepot, Warszawa
- 1,162