Upgrade to Pro — share decks privately, control downloads, hide ads and more …

EASEy IDE extensions without Plugins

EASEy IDE extensions without Plugins

EclipseCon Europe 2018

Rabea Gransberger

October 24, 2018
Tweet

More Decks by Rabea Gransberger

Other Decks in Programming

Transcript

  1. Rabea Gransberger • Computer Science Diploma 2008 • Java Developer,

    Project Lead at MEKOS, Germany • Java Champion • Organization Team JUG Bremen, JCrete, JAlba 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger) By Karte: NordNordWest, Lizenz: Creative Commons by-sa-3.0 de, CC BY-SA 3.0 de, https://commons.wikimedia.org/w/index.php?curid=35392837
  2. Eclipse Advanced Scripting Environment (EASE) • Extend Eclipse with your

    own Actions with little scripts, no Plugins needed • Launch Scripts from Menus, Toolbars, Shortcut or on Events • Supported languages: Python, Groovy, Javascript and more 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger) EASE Groovy …. RCP Application (Eclipse) Python Javascript
  3. History • Started by Christian Pontesegger 2012 • First Release

    2015 (prior as eScript from 2013 on) • Won the Community Award for Most Innovative Project 2016 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  4. Install • EASE Main Page: https://www.eclipse.org/ease • From Repo: http://download.eclipse.org/ease/update/release

    • For Python: http://eclipse.py4j.org/ • For Groovy: https://github.com/groovy/groovy-eclipse/wiki 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  5. First Script //name: Label //toolbar: Package Explorer loadModule('/System/UI'); println("Hello World")

    showInfoDialog("Hello World") 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  6. Changing EASE Optional Params Groovy • org.eclipse.ease.lang.groovy.GroovyCodeFactory.createFunctionWrapper // build parameter

    string final StringBuilder parameterList = new StringBuilder(); for (final Parameter parameter : parameters) { parameterList.append(", ").append(parameter.getName()); if (parameter.isOptional()) { parameterList.append("=") .append(getDefaultValue(parameter)); } } 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  7. Overview of EASE Functions • Script Shell with Code completion/help

    • Directly launch/debug your scripts • Modules (write once, available for all supported languages) • Add your own libraries (JARs by loadJar) • Wrap/Instantiate existing Java classes • Write Unit Tests and Test Suites • Integrate directly in UI/Events with special Headers • Share Scripts on network share 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  8. Available Headers/Keywords • name • description • toolbar Bind to

    view toolbar • menu Bind to view menu • popup Bind to popup menu • keyboard Binds to shortcut • image Add a dedicated toolbar/menu image • onStartup Run on startup • onShutdown Run on shutdown • onSave Run on editor save action • onResourceChange Run on res. change • onEventBus Run scripts when a specific event is posted on the OSGI message bus 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger) https://wiki.eclipse.org/EASE/Scripts
  9. Available Modules • System • Build • Environment • JVM

    • Launch • OSGI • P2 • Platform • Resources • Scripting • UI • Charts • Modeling • Ecore • Papyrus • SYSML • UML 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  10. Choosing the language • Javascript is close to Java •

    Python is easy to learn • Python and Javascript (Rhino engine) provide debugging support • Groovy is close to Java and typesafe • Groovy is slow to start • Maybe JAVA REPL will be available in the future? 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  11. Demo E4 • Context Menu on Package "Add View" •

    Adding a E4 View to a plugin contributing to an application • Create plugin.xml if not exists • Create fragment.e4xmi if not exists and register in plugin.xml • Create a POJO View class with E4 methods • Create a Part in fragment.e4xmi registered with Stack in App and bound to the POJO • Removing the view again 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  12. Demp Eclipse 3.x • New Empty Plugin • Create plugin.xml

    if not exists • Create a Database contribution and register in plugin.xml • Create an Entity and register with Database • Create a RightProvider for managing user permissions • Create a View register in plugin.xml and with RightProvider • View contains an autogenerated Table from the Entity 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  13. Templates • Simple templates are provided by the IDE already

    • Window->Preferences->Java->Editor->Templates • Window->Preferences->Java->Code Style->Code Templates 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  14. EASE Examples Repo • Copy example Code to pastebin •

    Check if files start with the correct header, else add warning marker • Write changelog each time a file changes • Show all Mylyn task due for today on startup • Add a task to a local list and remind when exiting • Create a chart • Write Unit Tests in Javascript an Python • Use other libraries 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  15. Summary • Extending Eclipse is easier when using EASE •

    Sooo many possibilities • If your products are based on RCP provide EASE to let users extend it 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  16. Other talks • SysBox: An Eclipse Story, today 11:55 -

    12:30 • EASE-ily make the most of Eclipse with Python (watch on youtube) • Elevate your IDE with scripts (watch on youtube) • EclipseCon Europe 2015 • I love scripting (watch on youtube) • EclipseCon Europe 2013 • Scripting, baby! (watch on youtube) 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)