Slide 1

Slide 1 text

EASEy IDE extensions without Plugins EclipseCon Europe 2018

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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)

Slide 5

Slide 5 text

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)

Slide 6

Slide 6 text

First Script 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

Slide 7

Slide 7 text

First Script //name: Label //toolbar: Package Explorer loadModule('/System/UI'); println("Hello World") showInfoDialog("Hello World") 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

Slide 8

Slide 8 text

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)

Slide 9

Slide 9 text

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)

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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)

Slide 12

Slide 12 text

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)

Slide 13

Slide 13 text

Demo E4 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

Slide 14

Slide 14 text

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)

Slide 15

Slide 15 text

Demo Eclipse 3.x 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

Slide 16

Slide 16 text

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)

Slide 17

Slide 17 text

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)

Slide 18

Slide 18 text

EASE Examples Repo https://git.eclipse.org/r/ease/org.eclipse.ease.scripts 24.10.2018 EclipseCon Europe / EASEy Extensions (@rgransberger)

Slide 19

Slide 19 text

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)

Slide 20

Slide 20 text

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)

Slide 21

Slide 21 text

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)

Slide 22

Slide 22 text

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)