EASEy IDE extensions without Plugins

EASEy IDE extensions without Plugins

EclipseCon Europe 2018

363cf27411356afc37199a73bb58bcfe?s=128

Rabea Gransberger

October 24, 2018
Tweet

Transcript

  1. EASEy IDE extensions without Plugins EclipseCon Europe 2018

  2. 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
  3. 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
  4. 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)
  5. 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)
  6. First Script 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

  7. First Script //name: Label //toolbar: Package Explorer loadModule('/System/UI'); println("Hello World")

    showInfoDialog("Hello World") 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)
  8. 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)
  9. 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)
  10. 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
  11. 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)
  12. 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)
  13. Demo E4 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

  14. 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)
  15. Demo Eclipse 3.x 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

  16. 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)
  17. 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)
  18. EASE Examples Repo https://git.eclipse.org/r/ease/org.eclipse.ease.scripts 24.10.2018 EclipseCon Europe / EASEy Extensions

    (@rgransberger)
  19. 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)
  20. 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)
  21. 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)
  22. Q & A Slides: https://speakerdeck.com/rgra/easey-ide-extensions-without-plugins Code: https://github.com/rgra/EclipseCon2018 Twitter: @rgransberger Feedback

    Welcome! 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)