35
Eclipse Paolo Gasti Paolo Gasti

Eclipse Paolo Gasti. The Problem ■ There is the need for a new development environment ■ It has to help software designers and implementers to do their

  • View
    217

  • Download
    1

Embed Size (px)

Citation preview

Eclipse

Paolo GastiPaolo Gasti

The Problem

■ There is the need for a There is the need for a newnew development development environmentenvironment

■ It has to help software designers and implementers It has to help software designers and implementers to do their jobs faster and easierto do their jobs faster and easier

■ There are so many approaches to software There are so many approaches to software development that no tool can be development that no tool can be thethe solutionsolution

■ We need to fill the blank left by tools such as EmacsWe need to fill the blank left by tools such as Emacs

What is Eclipse?

“Eclipse is a kind of universal tool platform – an open extensible IDE for anything and nothing in particular.”

– – eclipse.orgeclipse.org

Eclipse is more than a Java IDE…

““In many ways Eclipse is the Emacs for the 21st century.” – In many ways Eclipse is the Emacs for the 21st century.” – Martin Fowler Martin Fowler

The Way to Eclipse

1999 20032000 2001 2002

Eclipse

19981997

NovOpen Sourceannouncement

VisualAge/Java

VisualAge Micro edition

March v. 2.1

Octv. 1.0

June v. 2.0

June Tech Preview

Design Goals

• Provide an open platform for the construction of tools for application development

• Support an unrestricted set of tool providers

• Support tools to manipulate arbitrary content types (language neutral)

• Seamless integration of tools within and across different content types and tool providers

• Availability on a wide range of platforms

Plug-in Architecture Goals

■ Easy to developEasy to develop– Java Development Tools + Plug-in development Java Development Tools + Plug-in development

environmentenvironment

■ Scale-up to hundreds of installed plug-insScale-up to hundreds of installed plug-ins– It tries to reduce start-up timeIt tries to reduce start-up time– Out-of-the-shelf Eclipse consists of 80 plug-insOut-of-the-shelf Eclipse consists of 80 plug-ins– Lazy loadingLazy loading

■ Easy to discover, install, and updateEasy to discover, install, and update– install/update supportinstall/update support

■ Easy to manage an installationEasy to manage an installation– managed configurations managed configurations

Why Open Source

■ Many partners can contribute during all the life cycle of Many partners can contribute during all the life cycle of a toola tool

■ It provides less dependency on a single vendorIt provides less dependency on a single vendor

■ Every partner can implement its own product without Every partner can implement its own product without the need to stipulate any contract with IBMthe need to stipulate any contract with IBM

■ The community canThe community can– provide feedback to the developersprovide feedback to the developers– submit patchessubmit patches– answering user’s questionsanswering user’s questions

Implications

■ Vendors can concentrate on their own special Vendors can concentrate on their own special area of expertise providing higher valuearea of expertise providing higher value

■ Improved integration of tools from multiple Improved integration of tools from multiple vendorsvendors

■ The interface can be customized to fit any The interface can be customized to fit any function, format or stylefunction, format or style

■ Plug-ins can be free or commercialPlug-ins can be free or commercial

■ A flourishing business gravitates around A flourishing business gravitates around Eclipse (WebSphere etc…)Eclipse (WebSphere etc…)

Eclipse Architecture

■ Plug-in, the smallest unit of Eclipse functionPlug-in, the smallest unit of Eclipse function■ Eclipse is a platform with a small runtime Kernel and Eclipse is a platform with a small runtime Kernel and

several layers of plug-in built on itseveral layers of plug-in built on it

■ Everybody can be a tool smithEverybody can be a tool smith■ SWT (Standard Widget Toolkit) offers significant SWT (Standard Widget Toolkit) offers significant

advantages over AWT and Swingadvantages over AWT and Swing

PlatformPlatform Extensible IDEExtensible IDE

IDE

Plug-ins

Runtime

Plug-ins

Eclipse Architecture

Java VM

Platform

JDT

PDE

SDK

Resources, Team, Debug, Help, Update, SWT, UI,…

Compiler, Refactoring, JDT UI, JDT Debug,…

PDE Core, PDE Build, PDE UI

Eclipse Architecture

Platform Runtime

Workspace

Help

Team

Workbench

JFace

SWT

Eclipse Project

JavaDevelopment

Toolkit(JDT)

Their Tool

Your Tool

AnotherTool

Plug-inDevelopmentEnvironment

(PDE)

Eclipse Platform

Debug

UpdateUpdate

Eclipse Platform Start Up

■ Eclipse Platform Runtime handles start upEclipse Platform Runtime handles start up

– Discovers plug-ins installed on diskDiscovers plug-ins installed on disk

– Matches up extensions with extension pointsMatches up extensions with extension points

– Builds global plug-in registryBuilds global plug-in registry

– Caches registry on disk for next timeCaches registry on disk for next time

Eclipse Platform

■ The Platform is divided into componentsThe Platform is divided into components

■ The standard components, provided with the installation file The standard components, provided with the installation file freely downloadable from eclipse.org, arefreely downloadable from eclipse.org, are

– Ant Ant – Universal Compare– Universal Compare– CoreCore – Release Engineering– Release Engineering– Platform CVS IntegrationPlatform CVS Integration – Debug – Debug

frameworkframework– Platform help systemPlatform help system – Text editor framework– Text editor framework– Support for Platform scriptingSupport for Platform scripting – Platform user interface– Platform user interface– Integrated search facility Integrated search facility – WebDAV integration – WebDAV integration – SWT (Standard Widget Toolkit) SWT (Standard Widget Toolkit) – Generic Team support– Generic Team support– Dynamic Update/Install ServiceDynamic Update/Install Service

Plug-in Architecture

■ Extension pointExtension point - named entity for collecting - named entity for collecting “contributions”“contributions”

■ ExtensionExtension - - a contributiona contribution

■ Each plug-inEach plug-in– Contributes to 1 or more extension pointsContributes to 1 or more extension points– Optionally declares new extension points – programmers Optionally declares new extension points – programmers

can extend good plug-ins to fit their needscan extend good plug-ins to fit their needs– Depends on a set of other plug-insDepends on a set of other plug-ins– Contains Java code libraries and other filesContains Java code libraries and other files

■ Details spelled out in the Details spelled out in the plug-in manifestplug-in manifest– Manifest declares contributionsManifest declares contributions– Code implements contributions and provides APICode implements contributions and provides API

Extension Points Principles

■ Let others contribute to your contributionsLet others contribute to your contributions

■ Lazy loading rule: load extensions only when they Lazy loading rule: load extensions only when they are about to be calledare about to be called

■ Contributions do notContributions do not– override existing behavioroverride existing behavior– remove or replace existing componentremove or replace existing component– harm existing or future contributionsharm existing or future contributions

Extension configuration in XML

<plugin id=“org.eclipse.ui”> <extension-point name=“Prefs" id=“preferencepages“ schema="schema/prefs.exsd"/> …</plugin>

<plugin id=“myPlugin”> <extension point="org.eclipse.ui.preferencepages"> <page id=“com.example.myprefpage" icon="icons/image.gif" title=“My title" class=“com.example.mywizard"> </page> </extension> …</plugin>

Extension contribution

Extension point definition

Plug-in Manifest

<plugin id = “com.example.tool“ version = “2.1.0” name = “Example Plug-in Tool" class = "com.example.tool.ToolPlugin"> <requires> <import plugin = "org.eclipse.core.resources“ version=“2.0.0”/> <import plugin = "org.eclipse.ui“ version = “2.0.1”/> </requires> <runtime> <library name = “tool.jar"/> </runtime> <extension point = "org.eclipse.ui.preferencepages"> <page id = "com.example.tool.preferences" icon = "icons/knob.gif" title = “Tool Knobs" class = "com.example.tool.ToolPreferenceWizard“/> </extension> <extension-point name = “Frob Providers“ id = "com.example.tool.frobProvider"/></plugin>

Declare contributionthis plug-in makes

Declare new extension point open to contributions from other plug-ins

Location of plug-in’s code

Other plug-ins needed

Plug-in identification

Contribution architecture

My Plug-in

class GreyFilter

extension-pointimageFilters

extensioncontributes

■ Declares extension point: <extension-point id=“imageFilters”/>

■ Declares interface: interface IImageFilter {

Image filter(Image image); }

■ Contributes extension: <extension point=“….imageFilters”/> …class=“GreyFilter”</extension>

■ Implements interface: class GreyFilter implements IImageFilter {}

interface IImageFilter

calls

implements

ImageViewer Plugin

Contribution architecture

My Plug-in

class GreyFilter

extension-pointimageFilters

extensioncontributes

■ Declares extension point: <extension-point id=“imageFilters”/>

■ Declares interface: interface IImageFilter {

Image filter(Image image); }

■ Contributes extension: <extension point=“….imageFilters”/> …class=“GreyFilter”</extension>

■ Implements interface: class GreyFilter implements IImageFilter {}

interface IImageFilter

Instantiated via reflectioncalls

implements

ImageViewer Plugin

uses

Plug-in Activation

■ Each plug-in gets its own Java class loader and has its own Each plug-in gets its own Java class loader and has its own class pathclass path– Delegates class load requests to required plug-insDelegates class load requests to required plug-ins

■ Contributions processed without plug-in activationContributions processed without plug-in activation– Example: Menu constructed from manifest info for contributed Example: Menu constructed from manifest info for contributed

itemsitems■ Plug-ins are activated only as neededPlug-ins are activated only as needed

– When a class is loaded by the class loaderWhen a class is loaded by the class loader Scalable for large base of installed plug-insScalable for large base of installed plug-ins

Java UI

UI

Resources

Java Corerequires

requires

requires

requires

requires

More than a Java IDEEclipse vs. NetBeans

■ LanguagesLanguages– C#C#– C/C++C/C++– PythonPython– CobolCobol– PhpPhp– Several UMLSeveral UML

■ Programming ToolsProgramming Tools– ANTLR Parser GeneratorANTLR Parser Generator– Graphical Editing Framework (GEF)Graphical Editing Framework (GEF)– AspectJ toolsAspectJ tools– Modeling (EMF)Modeling (EMF)– Several DB toolsSeveral DB tools– Jalopy Java Source Code Formatter Jalopy Java Source Code Formatter – Japple – RADJapple – RAD– Jasper report designerJasper report designer– LombozLomboz– Java SpiderJava Spider

■ Source & configuration mgt.Source & configuration mgt.– PerforcePerforce– Microsoft VSS Plug-inMicrosoft VSS Plug-in– ClearcaseClearcase– StellationStellation

■ Web developmentWeb development– Sysdeo - Eclipse Tomcat Launcher Sysdeo - Eclipse Tomcat Launcher – WebLogic managerWebLogic manager– Several StrutsSeveral Struts– Spindle for TapestrySpindle for Tapestry

■ Testing / PerformanceTesting / Performance– Resin Plug-inResin Plug-in– MockCreator MockCreator – Solex Solex – HyadesHyades

http://www.eclipse.org/community/plugins.html

The UML 2 plug-ins

■ There are several UML 2 compliant plug-insThere are several UML 2 compliant plug-ins

■ Most of them provide support forMost of them provide support for

– Reverse-engineering of source code (often also from Reverse-engineering of source code (often also from binaries)binaries)

– Code generationCode generation– Code SynchronizationCode Synchronization– Code analysisCode analysis– Documentation generationDocumentation generation– Automatic diagram altering after code alteringAutomatic diagram altering after code altering

Slime UML 2 plug-in

■ Guides the team through all the development Guides the team through all the development processprocess

■ It is very light-weight: only 1 MBIt is very light-weight: only 1 MB

Refactoring Support

■ RefactoringRefactoring is changing the structure of a program is changing the structure of a program without changing its functionalitywithout changing its functionality

■ There are many reasons to do refactoringThere are many reasons to do refactoring– The team of a project disappears and you need to The team of a project disappears and you need to

add/improve the functionality of its (quite obscure) add/improve the functionality of its (quite obscure) codecode

– A new requirement is introduced because of a design A new requirement is introduced because of a design mistake or an iterative approach (such as XP)mistake or an iterative approach (such as XP)

– Once familiar with this tool, a programmer can Once familiar with this tool, a programmer can generate code in the first place, then use it to conform generate code in the first place, then use it to conform its code to some standards (such as the use of its code to some standards (such as the use of getter/setter methods)getter/setter methods)

Refactoring Support

■ Eclipse provides three types of RefactoringEclipse provides three types of Refactoring

– Physical organization and renamingPhysical organization and renaming

– Logical organization at the class levelLogical organization at the class level

– Change the code within a classChange the code within a class

Physical organization and renaming

■ Avoid the need to edit many files to update Avoid the need to edit many files to update importimport and and packagepackage statements statements

■ Automatically checks the context, not only the Automatically checks the context, not only the namesnames

■ Allows to automaticallyAllows to automatically– Rename fieldsRename fields– Rename variablesRename variables– Rename classes and interfacesRename classes and interfaces– Move packages and classesMove packages and classes

Logical organization at the class level

■ While not as useful as the other kind of refactorings, While not as useful as the other kind of refactorings, it allows to automaticallyit allows to automatically

– Turn anonymous classes into nested classesTurn anonymous classes into nested classes

– Turn nested classes into top-level classesTurn nested classes into top-level classes

– Create interfaces from concrete classesCreate interfaces from concrete classes

– Move methods or fields from a class to a subclass or Move methods or fields from a class to a subclass or superclasssuperclass

Change the code within a class

■ Allows you to automaticallyAllows you to automatically

– Turn local variables into class fieldsTurn local variables into class fields

– Turn selected code in a method into a separate Turn selected code in a method into a separate methodmethod

– Generate getter and setter methods for fieldsGenerate getter and setter methods for fields

– Change method signature (doesn’t fit exactly here…)Change method signature (doesn’t fit exactly here…)

Refactoring Support

■ The power of Eclipse’s refactoring capability is to The power of Eclipse’s refactoring capability is to allow an user to do a safe refactoring with some allow an user to do a safe refactoring with some mouse clicksmouse clicks

Eclipse’s Cons

■ Windows-centric (ActiveX, OLE)Windows-centric (ActiveX, OLE)

■ Slow and often unstable under UnixSlow and often unstable under Unix

■ Forces developers to use its own directory Forces developers to use its own directory structurestructure

■ Sun does not like it exists, having its own Sun does not like it exists, having its own NetBeans (but Eclipse is supported by NetBeans (but Eclipse is supported by IBM…)IBM…)

Case of Study: the JavaCard Plug-in

■ It offers the complete class library of the JavaCard It offers the complete class library of the JavaCard platformplatform

■ Allows developers to simulate IBM’s smart card Allows developers to simulate IBM’s smart card hardwarehardware

■ Offers an advanced debuggerOffers an advanced debugger

■ Lets Eclipse connect to real smart cardsLets Eclipse connect to real smart cards

■ Offer complex functionalitiesOffer complex functionalities

Case of Study: the JavaCard Plug-in

■ Offers concrete advantages against the stand-alone Offers concrete advantages against the stand-alone versionversion

■ The Java Editor provided with Eclipse is much better The Java Editor provided with Eclipse is much better than the editor provided with JavaCardthan the editor provided with JavaCard

■ Allows the developer to edit and test the code with Allows the developer to edit and test the code with the same interfacethe same interface

■ Can be used together with other tools such us an Can be used together with other tools such us an UML 2 plug-inUML 2 plug-in

■ Shows the power of the Eclipse platform when Shows the power of the Eclipse platform when developing highly specialized softwaredeveloping highly specialized software

Summary

■ All functionality is provided by plug-ins and All functionality is provided by plug-ins and fragmentsfragments– Includes all aspects of Eclipse Platform itselfIncludes all aspects of Eclipse Platform itself

■ Contributions are made via extension pointsContributions are made via extension points– Extensions are created lazilyExtensions are created lazily

■ Plug-ins are packaged into separately installable Plug-ins are packaged into separately installable featuresfeatures– DownloadableDownloadable

Summary

Everybody can contribute plug-insEverybody can contribute plug-ins

Every programmer can be a Every programmer can be a tool smithtool smith

Creating opportunities for further extension makes Creating opportunities for further extension makes

it possible for the tool smith to benefit from the it possible for the tool smith to benefit from the

work of otherswork of others

The same environment can be used to develop The same environment can be used to develop

applications applications and and to develop tools for itselfto develop tools for itself

References

■ Refactoring For Everyone by IBM (Refactoring For Everyone by IBM (http://www-106.ibm.com/developerworks/opensource/librhttp://www-106.ibm.com/developerworks/opensource/library/os-ecref/ary/os-ecref/))

■ Eclipse Platform Technical Overview – eclipse.orgEclipse Platform Technical Overview – eclipse.org■ The Mathaino Project - Department of Computing Science, The Mathaino Project - Department of Computing Science,

University of AlbertaUniversity of Alberta■ Eclipse Platform on-line helpEclipse Platform on-line help■ Omondo whitepaper – Omondo whitepaper – www.omondo.comwww.omondo.com■ Eclipse.org plug-ins documentation - Eclipse.org plug-ins documentation -

http://www.eclipse.org/community/plugins.htmlhttp://www.eclipse.org/community/plugins.html■ OOPSLA 2003 documentation – OOPSLA 2003 documentation – www.oopsla.orgwww.oopsla.org