Use Eclipse technologies to build a modern embedded IDE

1,721 views
1,595 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,721
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Use Eclipse technologies to build a modern embedded IDE

  1. 1. Developer Suite<br />Use Eclipse technologiesto build a modern embedded IDE<br />Benjamin CabéGaétan MoriceEclipseCon 2010 <br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />1<br />
  2. 2. Requirements<br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />2<br />
  3. 3. Requirements<br />Whatis M2M ?<br />Definition : “M2M refers to data communication between machines.”<br />API/Web Services<br />Connectivity Network<br />Asset<br />Customer Application<br />Communication Device<br />
  4. 4. Requirements<br />Connectivity Network<br />Asset<br />Customer Application<br />Communication Device<br />API/Web Services<br /><ul><li>Hosted and operated M2M services platform. Highly scalable, available and secure.Provides APIs to develop web-based custom designed applications.</li></ul>Operated & Hosted <br />M2M Services Platform<br /><ul><li>Open embedded agent integrated in virtually any cell devices (Airlink box, modules embedded in OEM equipment, custom box etc. bothfrom Sierra or other 3rd party).
  5. 5. Patented world class Eclipse based IDE to develop embedded applicationsand to generate widgets for end-users.</li></li></ul><li>Requirements<br />Embedded development (Machine-to-Machine)<br />Modelingenvironment<br />Component-orientedapproach<br />
  6. 6. Requirements<br />Users profiles<br />Newbies<br />Solution providers<br />Multiple targets<br />Sierra Wireless devices<br />Embedded Linux<br />…<br />
  7. 7. Technical solution<br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />7<br />
  8. 8. Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Compilation<br />Navigator<br />Target<br />Navigator<br />Communication<br />Features<br />
  9. 9. Model<br />Features<br />
  10. 10. Modeling<br />EMF - Eclipse Modeling Framework<br />The model is the pillar of the tool<br />Used to model what an embeddedprojectis<br />Benefitsfrom EMF<br />Notifications<br />Serialization<br />Reflective API<br />… all the incredible EMF tools (GMF, Validation, Xpand, Ecore Tools, …)<br />
  11. 11. Modeling<br />
  12. 12. Navigator<br />Model<br />Features<br />
  13. 13. Navigator<br />Objectives<br />1:1 Mapping between Project and Model<br />Display informations in the model as project’s artefacts<br />
  14. 14. Navigator<br />Workspaceintegration<br />AdapterFactorytransforms<br />IProjectinto Model Project<br />Model Project intoIproject<br />publicclassProjectAdapterFactoryimplementsIAdapterFactory{<br /> @Override<br /> public Object getAdapter(Object adaptableObject, Class adapterType) {<br /> Object result = null;<br /> // Bi-directional adapter IProject <----> M2MProject<br /> if (adaptableObjectinstanceofIProject && adapterType.equals(Project.class)) {<br />result = adaptToModel((IProject) adaptableObject);<br /> }<br /> elseif (adaptableObjectinstanceof Project && adapterType.equals(IProject.class)) {<br />result = adaptIProject((Project) adaptableObject, adapterType);<br /> }<br /> returnresult;<br /> }<br />}<br />
  15. 15. Navigator<br />Workspaceintegration<br />EMF Transaction<br />Global model repository<br />TransactionalEditing Domain<br />publicclassProjectActivatorextendsPlugin{<br /> publicstaticfinal String TRANSACTIONAL_EDITING_DOMAIN_ID = "com.anwrt.ec598.project.editingDomain";<br />...<br /> publicTransactionalEditingDomaingetEditingDomain(){<br />TransactionalEditingDomainshared = TransactionalEditingDomain.Registry.INSTANCE<br />.getEditingDomain(TRANSACTIONAL_EDITING_DOMAIN_ID);<br /> returnshared;<br /> }<br /> ...<br />}<br />
  16. 16. Navigator<br />Project Explorer<br />Displays model objects as the Project structure<br />Based on Common Navigator Framework<br />Extensible treeview<br />Rathercomplex API<br />But reallypowerful<br />We use an internal model to define the structure (nodesonlyused to group or display informations)<br />Extension Points:org.eclipse.ui.navigator.*<br />Excellent tutorial: “Building a Common Navigator based viewer”<br />
  17. 17. Navigator<br />Project Explorer<br />Result<br />
  18. 18. Editors<br />Navigator<br />Features<br />Model<br />
  19. 19. Model dition<br />Forms editors<br />Forms + EMF + databinding<br />Create UI<br />Bind UI to model<br />privatevoidcreateContent(FormToolkittoolkit, Composite parent) {<br /> Composite composite = toolkit.createComposite(parent, SWT.NONE);<br />GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);<br />GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);<br />toolkit.createLabel(composite, "Name:", SWT.NONE);<br />_textName = toolkit.createText(composite, "", SWT.BORDER);<br />GridDataFactory.fillDefaults().grab(true, false).applyTo(_textName);<br />}<br />privatevoidbind() {<br />DataBindingContextbindingContext = newEMFDataBindingContext();<br /> // -- Bind the Name<br />bindingContext.bindValue(SWTObservables.observeText(_textName, SWT.FocusOut),<br />EMFEditObservables.observeDetailValue(Realm.getDefault(), getEditingDomain(),<br />_myEObject, M2MPackage.eINSTANCE.getINamedElement_Name()));<br />}<br />
  20. 20. Model edition<br />Forms editors<br />Result<br />Available in PDE Incubator:<br />EMF-FormsEditor to beused for next-generation PDE editors<br />
  21. 21. Model edition<br />Graphical Editor: GMF<br />Uses GMF generator to bootstrap<br />Heavy use of GMF Runtime<br />Model<br />GMF generation<br />Generatededitor<br />Customization<br />Modified editor<br />
  22. 22. Model edition<br />Graphical Editor: GMF<br />Otherfeatures<br />Rotation<br />Automatic port creation<br />HTML Tooltips<br />Extensible presentation<br />Custom figures canbedefinedusing an extension point<br />
  23. 23. Model edition<br />Graphical Editor: GMF<br />Result<br />
  24. 24. Editors<br />Navigator<br />Validation<br />Features<br />Model<br />
  25. 25. Model validation<br />EMF Validation<br />Extensible (needed for specific-targetconstraints)<br />Constraints are registeredusing an extension point<br />We use only the batch mode<br />Extension points: org.eclipse.emf.validation.*<br />publicIStatusvalidate (EObject model, IProgressMonitor monitor) {<br />IBatchValidatorbatchValidator = ModelValidationService.getInstance()<br /> .newValidator(EvaluationMode.BATCH);<br />batchValidator.setIncludeLiveConstraints(true);<br />batchValidator.setReportSuccesses(false);<br /> returnbatchValidator.validate(model, monitor);<br />}<br />
  26. 26. Model validation<br />Integrated in a builder<br />Transparent and automatic (on save)<br />Uses Problem Markers<br />Coupledwith quick fixes for a better user experience<br />
  27. 27. Editors<br />Navigator<br />Validation<br />Code<br />Features<br />Model<br />
  28. 28. Code generation<br />Xpand<br />Performance issue<br />Workflowistoo slow then use only Java API<br />Example of template<br />«IMPORT model»<br />«DEFINE file FORSourceComponentClass»<br />«FILE project.name.toLowerCase() + "/" + name + ".java"-»<br />package «project.name.toLowerCase()»;<br />publicclass «name» extendsComponentClass{<br />«IFmethods.select(m | m.kind.toString() == "EVENT").size > 0»<br /> publicvoidreceiveEvent(intinputEventMethod,Objectvalue){<br />«FOREACHmethods.select(m | m.kind.toString() == "EVENT") AS m-»<br /> //TODOhandleEvent:"+ «m.name.toUpperCase()»:<br />«ENDFOREACH-»<br /> }<br />«ENDIF»<br />}<br />«ENDFILE»<br />«ENDDEFINE»<br />
  29. 29. Code generation<br />Xpand<br />Call the Xpandgeneratorprogrammatically<br />publicvoid generate(finalEObject object, IProgressMonitor monitor) throwsCoreException {<br />Generatorgenerator = newGenerator();<br /> // define the metamodelused in the template<br />MetaModel m2mMetamodel = newEmfMetaModel(M2MPackage.eINSTANCE);<br />generator.addMetaModel(m2mMetamodel);<br /> // define the template<br />generator.setExpand("templates::SourceComponentClass::file FOR component");<br /> // define the output folder<br /> Outlet outlet = new Outlet("C:/myOutput/src");<br />generator.addOutlet(outlet);<br /> // configure protectedregions<br />generator.setPrSrcPaths("C:/myOutput/src");<br />generator.setPrDefaultExcludes(true);<br /> // define the EObject input<br />WorkflowContextDefaultImplctx = newWorkflowContextDefaultImpl();<br /> ctx.set("component", object);<br /> // run the generator<br />generator.invoke(ctx, newProgressMonitorAdapter(monitor), newIssuesImpl());<br />}<br />
  30. 30. Code generation<br />Integrated in a builder<br />Transparent and automatic (on save)<br />Synchronizationbetween model and code<br />Incrementalgeneration<br />
  31. 31. Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Navigator<br />Features<br />
  32. 32. Code editors and navigator<br />CDT<br />Code navigation<br />Syntaxhighlight<br />Content assist<br />Refactoring<br />…<br />LuaEclipse<br />Based on DLTK 2<br />
  33. 33. Code editors and navigator<br />CDT<br />
  34. 34. Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Navigator<br />Features<br />
  35. 35. Round-tripping<br />Mandatory for a good user experience<br />Be able to edit code or model indifferently<br />Continuoussynchronization<br />First study: EMF Compare<br />Good candidate but toorich for ourneeds<br />Solution: Direct modification of existingmodels<br />
  36. 36. Round-tripping<br />Solution<br />Integrated in a builder<br />Synchronize Model and AST<br />From code to model:<br />Code<br />Based on existingparser<br />AST<br />Java transformation<br />Model<br />(extractfrom code)<br />Model<br />(previous version)<br />Merge<br />Model<br />(new version)<br />
  37. 37. Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Compilation<br />Navigator<br />Features<br />Code<br />
  38. 38. Compilation<br />CDT - ManagedBuild System (MBS)<br />Declarative creation of custom tool chains<br />Through MBS Extension point<br />Direct integration in CDT builder and preference<br />A bit complex<br />Mechanism of scanner discovery profiles to find tools binaries<br />Extension Point: org.eclipse.ui.managebuilder.core.buildDefinition<br />Excellent tutorial: CDT Plug-in Developer Guide<br />Extension Point: org.eclipse.cdt.make.core.ScannerConfigurationDisccoveryProfile<br />
  39. 39. Compilation<br />CDT – MBS<br />Result<br />
  40. 40. Compilation<br />CDT - Dependencies management<br />Dependencies management<br />Difficult with CDT<br />Configuration, build artefacts, libraries include, header include to manage<br />No generic rule => have to be hand craft<br />Use of CDT API to access projects description<br />Managed by refactoring process<br />
  41. 41. Compilation<br />CDT - Dependencies management<br />publicclassModifyCProjectDependenciesChangeextends Change {<br />privatefinalIProjectproject;<br />...<br />public Change perform(IProgressMonitor pm) throws CoreException {<br />ICProjectDescriptionprojectDescription = CDTPropertyManager.getProjectDescription(project);<br />ICConfigurationDescription[] configurationDescription = projectDescription.getConfigurations();<br />...<br />}<br />...<br />}<br />
  42. 42. Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Compilation<br />Navigator<br />Target<br />Features<br />
  43. 43. Features<br />Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Compilation<br />Navigator<br />Target<br />Communication<br />
  44. 44. Target communication <br />Objectives<br />Make device’s services available<br />Download<br />Terminal<br />…<br />De-coupling of services and communication channel<br />Extensible<br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />44<br />
  45. 45. Target communication <br />Target Communication Framework - TCF<br />Embedded agent<br />Asynchronous<br />Protocol based on<br />Command, Result<br />Event<br />Launch Config<br />TerminalView<br />Download Service<br />Terminal Service<br />Channel<br />TCF<br />Connection Manager<br />Embedded Agent<br />
  46. 46. Features<br />Editors<br />Navigator<br />Validation<br />Model<br />Editor<br />Code<br />Compilation<br />Navigator<br />Target<br />Navigator<br />Communication<br />
  47. 47. Target navigator<br />Remote System Explorer - RSE<br />GUI framework<br />Tree Explorer<br />Match well with TCF<br />
  48. 48. Target navigator<br />Remote System Explorer<br />
  49. 49. Editors<br />Navigator<br />Validation<br />Forms<br />EMF Validation<br />GMF<br />Project Explorer + CNF<br />Model<br />Xpand<br />AST<br />Editor<br />CDT<br />Code<br />Compilation<br />CDT + DLTK<br />Navigator<br />TCF<br />RSE<br />Target<br />Navigator<br />Communication<br />Features<br />
  50. 50. Demo<br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />50<br />
  51. 51. Conclusion<br />January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />51<br />
  52. 52. The benefits of a large ecosystem<br />Allows to createreallycomplexenvironmentquickly<br />Coversdifferentskinds of domains<br />Offersreactive support with the community<br />Allows to focus on real added value<br />
  53. 53. January 21, 2010<br />Sierra Wireless Proprietary and Confidential<br />53<br />Questions?<br />
  54. 54. Gaétan Morice<br />gmorice@sierrawireless.com<br />Benjamin Cabé<br />bcabe@sierrawireless.com<br />

×