© 2009 IBM Corporation 1 Commands in Eclipse 4: Understanding who does what Paul Webster – IBM Rational Canada Remy Suen – IBM Rational Canada 23 March.

Slides:



Advertisements
Similar presentations
The following 10 questions test your knowledge of desired configuration management in Configuration Manager Configuration Manager Desired Configuration.
Advertisements

Copyright © IBM Corp., All rights reserved. The presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. RESTful Service Oriented.
Copyright © IBM Corp., Introducing the new Web Tools JavaScript™ Features Phil Berkland IBM Software Group 9/26/2007.
RTC Agile Planning Component
® IBM Software Group © 2007 IBM Corporation Achieving Harmony IBM's Platform and Methodology for Systems Engineering and Embedded Software Development.
© Copyright 2008 IBM Corp. All rights reserved. This presentation is licensed under Creative Commons Att. Nc Nd 2.5 license Using Commands and Menu Contributions.
® IBM Software Group © 2013 IBM Corporation Innovation for a smarter planet Timeboxes in a New Paradigm of Behavior Modeling Barclay Brown, ESEP IBM
© 2011 IBM Corporation Overview on Modeling RESTful Services August, 2011 Manoj Paul, Software Developer, Rational,
Copyright © IBM Corp., All rights reserved. Plastic Surgery For Eclipse: Custom SWT Widgets, RCP Customization, and more Benjamin Pasero.
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 20, 2008 | Short Talk Standards based systems management: An.
Copyright © IBM Corp., All rights reserved. This presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. OpenDocument Format.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 19, 2008 | Short Talk Extending TPTP for TTCN-3 Paul Slauenwhite.
Copyright © IBM Corp., The Eclipse™ Babel Project Translation Server Kit Lo IBM™ Corporation.
© 2009 IBM Corporation Select View/Master/Slide Master to add Session Number Here The Enterprise Architecture Workspace: Your Architecture Blueprint Martin.
Copyright © IBM Corp., All rights reserved. From SWT to RCP: Experiences implementing RSSOwl 2.0 with RCP Benjamin Pasero.
June 5–9 Orlando, Florida IBM Innovate 2011 Session Track Template Rainer Ersch Senior Research Scientist Siemens AG ALM-1180.
© 2008 by Matt Flaherty & Mary Ruddy; made available under the EPL v1.0 Security & Identity : From present to future Matt Flaherty, IBM Mary Ruddy, Meristic.
ABC of Platform Workspace | Copyright © IBM Corp., ABC of Platform Workspace Szymon Brandys Tomasz Zarna IBM Krakow Software Lab.
Copyright © IBM Corp., | March | Creating Robust Scalable DSLs with UML Tutorial (172) James Bruck, Christian Damus IBM Rational Software.
Copyright © IBM Corp., Introduction to the Eclipse™ Babel Project Kit Lo IBM™ Corporation.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 18, 2008 | Nitin Dahyabhai What can the WTP Snippets View do.
Functional Testing with Eclipse TPTP | Copyright © IBM Corp., All rights reserved. Source code in this presentation is made available under.
© 2006 by IBM; made available under the EPL v1.0 | March 20, 2006 | Jeffrey Liu Release Lead IBM Rational Managing APIs with Eclipse API Scanner.
Connect with the Experts Managing Tealeaf CX with TMS (Tealeaf Management Server) Ron Sires – Tealeaf Support Engineer January 21 st, 2016 This session.
Eclipse Debug Views Update Policy. 2 Copyright (c) 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are.
Domino iSeries Multi-Versioning © 2002 IBM Corporation | Lotus software © 2002 IBM Corporation Domino Multi-Versioning Mike Gordon – IBM Global Services.
© 2013 IBM Corporation IBM UrbanCode Deploy v6.0.1 Support Enablement Training Source Configuration and Database Upgrades Michael Malinowski
© 2007 by IBM; made available under the EPL v1.0 | Jan 9 th, 2007 Darin Wright IBM Rational Software Debug Platform 3.3.
IBM Software Group ® Jazz Team Build – Part 1 Overview Jonathan.
© 2013 IBM Corporation IBM Security Systems © 2012 IBM Corporation Offense Magnitude.
IBM Innovate 2012 Title Presenter’s Name Presenter’s Title, Organization Presenter’s Address Session Track Number (if applicable)
Comparison between EPF Composer and Rational Method Composer
IBM Software Group ® Jazz Process Component —Process Template Management Thomas.
© 2009 IBM Corporation 1 Commands in Eclipse 3.x: the 10 most common patterns Paul Webster – IBM Rational Canada 23 March 2011.
Office 365 Development July 2014.
David Hatten Developer, UrbanCode 17 October 2013
The Features and Functions of WMS and TMS
Kristy Foster – L2 Software Engineer October 16, 2014
Tech·Ed North America /18/2018 2:05 PM
Microsoft Build /4/2018 6:08 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Upgrading Your C# Programming Skills to Be a More Effective Developer
Kristy Foster – L2 Software Engineer March 18, 2014
Deploy Plugins Developer 29 October 2013
Manual testing of Windows Metro style apps built using HTML
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 1.1
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 2.0
Integrating Data With Cognos
Entity Based Staging SQL Server 2012 Tyler Graham
Microsoft Build /10/2018 3:26 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Automation in an XML Authoring Environment
UML Class Diagram.
Implementing Listening Producers in IBM Sterling Filegateway
Introducing Microsoft SQL Server 2008 R2 Master Data Services
Data Driven ASP.NET Web Forms Applications Deep Dive
Tech Ed North America /1/2019 2:58 AM Required Slide
Embedded Software (ESW) Engineering Practices Introduction
Peter Provost Sr. Program Manager Microsoft Session Code: DEV312
Object Constraint Language (MDT OCL) 1
From Development to Production: Optimizing for Continuous Delivery
Microsoft Office 4/3/2019 Deep Dive into native Universal App development with the Office 365 APIs Speaker name Title Microsoft Corporation © 2012 Microsoft.
From Development to Production: Optimizing for Continuous Delivery
XAML Deep Dive for Windows & Windows Phone Apps Jump Start
4/28/2019 6:13 PM HW-889P Advanced driver code analysis techniques Tips and tricks to develop more secure & reliable drivers Dave Sielaff Principal Software.
Office 365 Development July 2014.
Tech Ed North America /6/2019 2:07 PM Required Slide
Presentation transcript:

© 2009 IBM Corporation 1 Commands in Eclipse 4: Understanding who does what Paul Webster – IBM Rational Canada Remy Suen – IBM Rational Canada 23 March 2011

© 2011 IBM Corporation. Licensed under EPL, v1.0 2 About the Speaker ■ Paul Webster –Senior Software Developer, Platform UI Committer –Works for IBM Rational Software since he joined the Eclipse TM Platform UI team in May 2005 –Works with part lifecycle, commands/handlers, keybindings, and menu contributions –Eclipse 4 compatibility ■ Remy Suen –Software Developer, Platform UI Committer –Works for IBM Rational Software since he joined the Eclipse TM Platform UI team in July 2009 –Works on everything.... Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 3 Overview ■ Deep dive under the covers of the Eclipse 4 command framework ■ How handlers work in the system ■ Where handlers get their information Commands in Eclipse 3.x: the 10 most common patterns

© 2011 IBM Corporation. Licensed under EPL, v1.0 4 Commands ■ The concepts for commands in Eclipse 4 are similar to 3.x ■ A command is an abstraction of some semantic behaviour. – id, name, description, parameters ■ A command is not an implementation of that behaviour. ■ A command is not the visual presentation of that behaviour. Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 5 Handlers ■ To do something, we need an implementation of that behaviour –A method we can execute ■ Has access to variables –activePart, selection, activeContexts ■ Has access to services –EModelService, ESelectionService ■ We need to understand where the handler gets its information Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 6 Handlers – Pick One ■ In Eclipse 4 there is basic containment relationship of the “moving parts” ■ Workbench: Window: Perspective: View/Editor Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 7 Handlers – Pick One ■ In Eclipse 4 model based applications, handlers can be contributed at most levels ■ There is one handler per command per level ■ The handler is either there, or it's not ■ When executing a command, a part is active ■ To find the appropriate handler –First we check the part –Then we check the window –Then we check the application Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 8 Handlers – Do Something ■ Or as we say in the ■ All handlers must provide method public void IStylingEngine Shell shell) {... } ■ Parameter lookup follows our rules for Dependeny Injection... IEclipseContext ■ Invocation is treated differently than Injection Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v1.0 9 Handlers – Do Something public void IStylingEngine Shell shell) {... } ■ Ask for services by parameter type ■ Ask for variables using annotation –“activeShell” ■ if a null value is permitted Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Handlers – Can I do something? ■ A handler may provide method Contact contact) { return contact != null; } ■ If no method is supplied, the answer defaults to true ■ Called by the framework when needed –Menu about to show –Toolbar items are a special case Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Handlers – What is available from the context? ■ We're still collecting variables and services that would be of interested in Eclipse 4 RCP applications – – ■ Examples of Services that are available –org.eclipse.e4.core.commands.EHandlerService –org.eclipse.e4.workbench.modeling.EPartService –org.eclipse.e4.workbench.modeling.EModelService –org.eclipse.e4.workbench.modeling.ESelectionService –org.eclipse.e4.ui.services.EContextService –org.eclipse.e4.core.services.StatusReporter –org.eclipse.e4.core.services.Logger –org.eclipse.e4.core.services.events.IEventBroker –org.eclipse.e4.workbench.ui.IPresentationEngine ■ Some services provide 2 levels of access, like EContextService and ACTIVE_CONTEXTS Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Handlers – What is available from the context? ■ Useful Model information is also available – MApplication app = context.get(MApplication.class); ■ Some of the variables listed in org.eclipse.ui.ISources – activeContexts – activeShell – e4ActivePart (MPart) – selection ■ Preferences using annotation public void String pref) {... } Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Differences: Eclipse 3.x and Eclipse 4 ■ Commands in Eclipse 4 have no state attributes ■ Enabled is not a state of the command in Eclipse 4, it's a question in context –The user-visible element asks the question –The model determines the context starting point Main menu: Window View menu: view part View context menu: view context menu ■ Multiple handler contributions for one command are a simple lookup in Eclipse 4. In Eclipse 3.x, conflict resolution is applied to a set of active handlers for a given command. Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Contexts – Where a handler gets its information ■ As with most communication, it's all about context ■ Introducing the IEclipseContext –Sits between the contributed code and the framework –Brokers interactions with the framework –Provides variables and services ■ public interface IEclipseContext { public T get(Class clazz); public Object get(String name); public void remove(String name); public void set(String name, Object value); } Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Contexts – Variables ■ IRendererFactory factory = context.get(IRendererFactory.class); Collection ids = (Collection) context.get("activeContexts"); ■ Services are accessed through their FQCN. ■ Each variable can either be a POJO or an IContextFunction ■ An IContextFunction represents a strategy for calculating a variable's value ■ IContextFunctions are evaluated on a context.get(*) request ■ IContextFunctions can be used to delay potentially expensive calculations ■ IContextFunction results are cached unless a dependency changes Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Contexts – Lookup Hierarchy ■ Contexts are hierarchical – requests that cannot be satisfied are delegated to a parent context Source If Applicable Context Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Contexts – Lookup Hierarchy ■ We create child contexts to tweak or override aspects of the parent context's behaviour ■ We can customize application code's view of the world by inserting another context ■ public interface IEclipseContext { public void activate(); public IEclipseContext createChild(); public void deactivate(); public IEclipseContext getActiveChild(); public IEclipseContext getActiveLeaf(); public IEclipseContext getParent(); } Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Contexts – Lookup Hierarchy ■ Parent chain is constant. Child chain constantly changes. ■ A handler executes in the most active context Source If Applicable Context Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Handlers - Recap ■ To do something, we need a method we can execute ■ The handler must have access to the application state –Data –Services ■ The information comes from the IEclipseContext hierarchy. It provides application state while allowing that state to be customized within difference scopes of the application. Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v More Information ■ You can get general information from the wiki: – – – ■ You can contact us and ask questions: –On IRC: irc://freenode.net/#eclipse-e4 –On the mailing list: devhttps://dev.eclipse.org/mailman/listinfo/e4- dev –On the newsgroup: Eclipse Projects > e4http:// Source If Applicable Commands in Eclipse 4: Understanding who does what

© 2011 IBM Corporation. Licensed under EPL, v Legal Notices ■ Copyright © IBM Corp., All rights reserved. This presentation and the source code in it are made available under the EPL, v1.0. ■ Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc. ■ IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. ■ Rational and the Rational logo are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries or both. ■ Other company, product, or service names may be trademarks or service marks of others. ■ THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE Source If Applicable Commands in Eclipse 4: Understanding who does what