Top Banner
Component-Based Development Component-Based Development 2004-2005 Marco Scotto ([email protected])
120

Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

Aug 06, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

Component-Based Development

Component-Based Development

2004-2005Marco Scotto ([email protected])

Page 2: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

2Component-Based Development

Outline

Introduction to Eclipse• Plug-in Architecture• Platform• JDT• PDE

HelloWorld ExamplePDE Views

Page 3: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

3Component-Based Development

Eclipse Project AimsProvide open platform for application development tools• Run on a wide range of operating systems• GUI and non-GUI

Language-neutral• Permit unrestricted content types• HTML, Java, C, JSP, EJB, XML, GIF, …

Facilitate seamless tool integration• At UI and deeper• Add new tools to existing installed products

Attract community of tool developers• Including independent software vendors (ISVs)• Capitalize on popularity of Java for writing tools

Page 4: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

4Component-Based Development

Eclipse Overview

Platform Runtime

Workspace

Help

Team

Workbench

JFace

SWT

Eclipse Project

JavaDevelopment

Tools(JDT)

Their Tool

Your Tool

AnotherTool

Plug-inDevelopmentEnvironment

(PDE)

Eclipse Platform

Debug

Page 5: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

5Component-Based Development

Eclipse OriginsEclipse created by OTI and IBM teams responsible for IDE products• IBM VisualAge/Smalltalk (Smalltalk IDE) • IBM VisualAge/Java (Java IDE)• IBM VisualAge/Micro Edition (Java IDE)

Initially staffed with 40 full-time developersGeographically dispersed development teams• OTI Ottawa, OTI Minneapolis, OTI Zurich, IBM Toronto, OTI

Raleigh, IBM RTP, IBM St. Nazaire (France)Effort transitioned into open source project• IBM donated initial Eclipse code base

Platform, JDT, PDE

Page 6: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

6Component-Based Development

Brief History of Eclipse1999

April - Work begins on Eclipse inside OTI/IBM2000

June - Eclipse Tech Preview ships2001

March - http://www.eclipsecorner.org/ opensJune - Eclipse 0.9 shipsOctober - Eclipse 1.0 shipsNovember - IBM donates Eclipse source base

- eclipse.org board announced- http://www.eclipse.org/ opens

2002June - Eclipse 2.0 shipsSeptember - Eclipse 2.0.1 shipsNovember - Eclipse 2.0.2 ships

2003March - Eclipse 2.1 ships

Page 7: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

7Component-Based Development

What is Eclipse?Eclipse is a universal platformfor integrating development toolsOpen, extensible architecture based on plug-ins

Java VMStandard Java2Virtual Machine

PlatformEclipse Platform

Java developmenttools

JDT

PDEPlug-in developmentenvironment

Page 8: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

8Component-Based Development

Eclipse Plug-in Architecture

Plug-in - smallest unit of Eclipse function• Big example: HTML editor• Small example: Action to create zip files

Extension point - named entity for collecting “contributions”• Example: extension point for workbench preference UI

Extension - a contribution• Example: specific HTML editor preferences

Page 9: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

9Component-Based Development

Eclipse Plug-in Architecture

Each plug-in• Contributes to 1 or more extension points• Optionally declares new extension points• Depends on a set of other plug-ins• Contains Java code libraries and other files• May export Java-based APIs for downstream plug-ins• Lives in its own plug-in subdirectory

Details spelled out in the plug-in manifest• Manifest declares contributions• Code implements contributions and provides API• plugin.xml file in root of plug-in subdirectory

Page 10: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

10Component-Based Development

Plug-in Manifestplugin.xml

<pluginid = “com.example.tool"name = “Example Plug-in Tool"class = "com.example.tool.ToolPlugin">

<requires><import plugin = "org.eclipse.core.resources"/><import plugin = "org.eclipse.ui"/>

</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

Page 11: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

11Component-Based Development

Eclipse Plug-in ArchitectureTypical arrangementplug-in A plug-in B

class Cinterface I

extensionpoint P

extension

Plug-in A• Declares extension point P• Declares interface I to go with P

Plug-in B• Implements interface I with its own class C• Contributes class C to extension point P

Plug-in A instantiates C and calls its I methods

contributes

implements

creates, calls

Page 12: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

12Component-Based Development

Eclipse Platform Architecture

Eclipse Platform Runtime is micro-kernel• All functionality supplied by plug-ins

Eclipse Platform Runtime handles start up• Discovers plug-ins installed on disk• Matches up extensions with extension points• Builds global plug-in registry• Caches registry on disk for next time

Page 13: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

13Component-Based Development

Plug-in Activation

Each plug-in gets its own Java class loader• Delegates to required plug-ins• Restricts class visibility to exported APIs

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

items

Plug-ins are activated only as needed• Example: Plug-in activated only when user selects its menu item• Scalable for large base of installed plug-ins• Helps avoid long start up times

Page 14: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

14Component-Based Development

Plug-in Fragments

Plug-in fragments holds some of plug-in’s files• Separately installable

Each fragment has separate subdirectory• Separate manifest file

Logical plug-in = Base plug-in + fragmentsPlug-in fragments used for• Isolation of OS dependencies• Internalization – fragments hold translations

Page 15: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

15Component-Based Development

Plug-in Install

Features group plug-ins into installable chunks• Feature manifest file

Plug-ins and features bear version identifiers• major . minor . service• Multiple versions may co-exist on disk

Features downloadable from web site• Using Eclipse Platform update manager• Obtain and install new plug-ins• Obtain and install updates to existing plug-ins

Page 16: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

16Component-Based Development

Plug-in Architecture - Summary

All functionality provided by plug-ins• Includes all aspects of Eclipse Platform itself

Communication via extension points• Contributing does not require plug-in activation

Packaged into separately installable features• Downloadable

Eclipse has open, Eclipse has open, extensibleextensiblearchitecture based on plugarchitecture based on plug--insins

Page 17: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

17Component-Based Development

Eclipse PlatformEclipse Platform is the common baseConsists of several key components

Platform Runtime

Eclipse Platform

Workspace

Workbench

SWTJFace

Team Help Debug

Ant“Core”

“UI”

Page 18: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

18Component-Based Development

Workspace ComponentTools operate on files in user’s workspace

Projects map to directories in file system

{Files, Folders, Projects} termed resources

Workspace holds 1 or more top-level projects

Tree of folders and files

Tools read, create, modify, and delete resources in workspacePlug-ins access via workspace and resource APIs

Page 19: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

19Component-Based Development

Workspace and Resource API

Allows fast navigation of workspace resource treeResource change listener for monitoring activity• Resource deltas describe batches of changes

Maintains limited history of changed/deleted filesSeveral kinds of extensible resource metadata• Persistent resource properties• Session resource properties• Markers• Project natures

Workspace session lifecycle• Workspace save, exit, restore

Incremental project builders

Page 20: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

20Component-Based Development

Incremental Project Builders

Problem: coordinated analysis and transformation of thousands of files• Compiling all source code files in project• Checking for broken links in HTML files

Scalable solution requires incremental reanalysisIncremental project builder API/framework• Builders are passed resource delta• Delta describes all changes since previous build• Basis for incremental tools

Extensible – plug-ins define new types of builders• JDT defines Java builder

Configurable – any number of builders per project

Page 21: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

21Component-Based Development

Workbench Component

Workbench

SWTJFace

SWT – generic low-level graphics and widget setJFace – UI frameworks for common UI tasksWorkbench – UI personality of Eclipse Platform

Page 22: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

22Component-Based Development

SWTSWT = Standard Widget ToolkitGeneric graphics and GUI widget set• buttons, lists, text, menus, trees, styled text...

SimpleSmallFastOS-independent APIUses native widgets where availableEmulates widgets where unavailable

Page 23: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

23Component-Based Development

Why SWT?

Consensus: hard to produce professional looking shrink-wrapped products using Swing and AWT

SWT provides• Tight integration with native window system• Authentic native look and feel• Good performance• Good portability• Good base for robust GUIs

The proof of the pudding is in the eating…

Page 24: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

24Component-Based Development

Why SWT?

Eclipse Platform on Windows XP

Page 25: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

25Component-Based Development

Why SWT?Eclipse Platform on Windows XP (skinned)

Page 26: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

26Component-Based Development

Why SWT?Eclipse Platform on Linux - GTK 2.0

Page 27: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

27Component-Based Development

Why SWT?Eclipse Platform on Linux - Motif

Page 28: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

28Component-Based Development

Why SWT?Eclipse Platform on Mac OS X - Carbon

Page 29: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

29Component-Based Development

JFace

JFace is set of UI frameworks for common UI tasksDesigned to be used in conjunction with SWTClasses for handling common UI tasksAPI and implementation are window-system independent

Page 30: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

30Component-Based Development

JFace APIs

Image and font registriesDialog, preference, and wizard frameworksStructured viewers• Model-aware adapters for SWT tree, table, list widgets

Text infrastructure• Document model for SWT styled text widget• Coloring, formatting, partitioning, completion

Actions• Location-independent user commands• Contribute action to menu, tool bar, or button

Page 31: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

31Component-Based Development

Workbench Component

Workbench is UI personality of Eclipse Platform

UI paradigm centered around• Editors• Views• Perspectives

Page 32: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

32Component-Based Development

Workbench TerminologyTool bar

PerspectiveandFast Viewbar

ResourceNavigatorview

Stackedviews

Propertiesview

Tasksview

Outlineview

Bookmarksview

Menu bar

Messagearea

EditorStatusarea

Texteditor

Page 33: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

33Component-Based Development

EditorsEditors appear in workbench editor areaContribute actions to workbench menu and tool barsOpen, edit, save, close lifecycleOpen editors are stacked

Extension point for contributing new types of editorsExample: JDT provides Java source file editorEclipse Platform includes simple text file editorWindows only: embed any document as editorExtensive text editor API and framework

Page 34: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

34Component-Based Development

ViewsViews provide information on some objectViews augment editors• Example: Outline view summarizes content

Views augment other views• Example: Properties view describes selection

Extension point for new types of viewsEclipse Platform includes many standard views• Resource Navigator, Outline, Properties, Tasks, Bookmarks,

Search, …

View API and framework• Views can be implemented with JFace viewers

Page 35: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

35Component-Based Development

PerspectivesPerspectives are arrangements of views and editorsDifferent perspectives suited for different user tasksUsers can quickly switch between perspectivesTask orientation limits visible views, actions• Scales to large numbers of installed tools

Perspectives control• View visibility• View and editor layout• Action visibility

Extension point for new perspectivesEclipse Platform includes standard perspectives• Resource, Debug, …

Perspective API

Page 36: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

36Component-Based Development

Other Workbench Features

Tools may also• Add global actions• Add actions to existing views and editors• Add views, action sets to existing perspectives

Eclipse Platform is accessible (Section 508)Accessibility mechanisms available to all plug-ins

Page 37: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

37Component-Based Development

Workbench Responsibilities

Eclipse Platform manages windows and perspectivesEclipse Platform creates menu and tool bars• Labels and icons listed in plug-in manifest• Contributing plug-ins not activated

Eclipse Platform creates views and editors• Instantiated only as needed

Scalable to large numbers of installed tools

Page 38: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

38Component-Based Development

Team ComponentVersion and configuration management (VCM)Share resources with team via a repositoryRepository associated at project levelExtension point for new types of repositoriesRepository provider API and frameworkEclipse Platform includes CVS repository providerAvailable repository providers*• ChangeMan (Serena) - AllFusion Harvest (CA)• ClearCase (Rational) - Perforce• CM Synergy (Telelogic) - Source Integrity (MKS)• PVCS (Merant) - TeamCode (Interwoven)• Microsoft Visual Source Safe

* March 2003

Page 39: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

39Component-Based Development

Team ComponentRepository providers have wide latitude• Provide actions suited to repository• No built-in process model

Integrate into workbench UI via• Share project configuration wizard• Actions on Team menu• Resource decorators• Repository-specific preferences• Specialized views for repository browsing, …

Page 40: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

40Component-Based Development

Debug ComponentCommon debug UI and underlying debug model

Page 41: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

41Component-Based Development

Debug ComponentLaunch configurations• How to run a program (debug mode option)

Generic debug model• Standard debug events: suspended, exit, …• Standard debug actions: resume, terminate, step, …• Breakpoints• Expressions• Source code locator

Generic debug UI• Debug perspective• Debug views: stack frames, breakpoints, …

Example: JDT supplies Java launcher and debugger• Java debugger based on JPDA

Debug mechanisms available to other plug-ins

Page 42: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

42Component-Based Development

Ant ComponentEclipse incorporates Apache AntAnt is Java-based build tool• “Kind of like Make…without Make's wrinkles”

XML-based build files instead of makefilesAvailable from workbench External Tools menuRun Ant targets in build files inside or outside workspacePDE uses Ant for building deployed form of plug-in

Page 43: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

43Component-Based Development

Help ComponentHelp is presented in a standard web browser

Page 44: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

44Component-Based Development

Help ComponentHelp books are HTML websExtension points for contributing• entire books• sections to existing books• F1-help pop ups

Eclipse Platform contributes• “Workbench User Guide”• “Platform Plug-in Developer Guide” (APIs)• F1-help for views, editors, dialogs, …

JDT and PDE contribute their own helpHelp mechanisms available to all plug-ins• Help search engine based on Apache Lucene• Headless help server based on Apache Tomcat

Page 45: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

45Component-Based Development

Internationalization

Eclipse Platform is internationalized2.0 translations available for following languagesEnglish GermanSpanish ItalianFrench Portugese (Brazil)Japanese KoreanChinese (Traditional) Chinese (Simplified)

Translations live in plug-in fragments• Separately shippable

Internalization mechanisms available to all plug-ins

Page 46: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

46Component-Based Development

Product InformationWindowimage

WelcomepagesSplash

screen

Aboutproduct

infoAboutfeature

info

Page 47: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

47Component-Based Development

Product Information

Primary feature controls product information• Splash screen• Window image• About product info• Initial welcome page• Default perspective• Preference default overrides

All features can provide• Welcome page• About feature info

Page 48: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

48Component-Based Development

Eclipse Platform - Summary

Eclipse Platform is the nucleus of IDE productsPlug-ins, extension points, extensions• Open, extensible architecture

Workspace, projects, files, folders• Common place to organize & store development artifacts

Workbench, editors, views, perspectives• Common user presentation and UI paradigm

Key building blocks and facilities• Help, team support, internationalization, …

Eclipse is a universal platform forEclipse is a universal platform forintegrating development toolsintegrating development tools

Page 49: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

49Component-Based Development

Java Development ToolsJDT = Java development toolsState of the art Java development environment

Built atop Eclipse Platform• Implemented as Eclipse plug-ins• Using Eclipse Platform APIs and extension points

Included in Eclipse Project releases• Available as separately installable feature• Part of Eclipse SDK drops

Page 50: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

50Component-Based Development

JDT Goals

Goal: To be #1 Java IDEGoal: To make Java programmers smile

Page 51: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

51Component-Based Development

Java PerspectiveJava-centric view of files in Java projects• Java elements meaningful for Java

programmers

Javaproject

package

class

field

method

Javaeditor

Page 52: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

52Component-Based Development

Java PerspectiveBrowse type hierarchies• “Up” hierarchy to supertypes• “Down” hierarchy to subtypes

Typehierarchy

Selectedtype’s

members

Page 53: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

53Component-Based Development

Java PerspectiveSearch for Java elements• Declarations or references• Including libraries and other projects

Hitsflaggedin marginof editor

All search results

Page 54: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

54Component-Based Development

Java Editor

Hovering over identifier shows Javadocspec

Page 55: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

55Component-Based Development

Java EditorMethod completion in Java editor

List of plausible methods Doc for method

Page 56: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

56Component-Based Development

Java Editor

On-the-fly spell check catches errors early

Preview

Clickto seefixes

ProblemQuickfixes

Page 57: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

57Component-Based Development

Java Editor

Code templates help with drudgery

Statementtemplate Preview

Page 58: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

58Component-Based Development

Java Editor

Java editor creates stub methods

Method stub insertionfor inherited methods

Method stub insertion for anonymous inner types

Page 59: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

59Component-Based Development

Java EditorJava editor helps programmers write good Java code

Variable namesuggestion

Argument hints andproposed argumentnames

JavaDoccode assist

Page 60: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

60Component-Based Development

Java Editor

Other features of Java editor include• Local method history• Code formatter• Source code for binary libraries• Built-in refactoring

Page 61: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

61Component-Based Development

Refactoring

JDT has actions for refactoring Java code

Page 62: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

62Component-Based Development

RefactoringRefactoring actions rewrite source code• Within a single Java source file• Across multiple interrelated Java source files

Refactoring actions preserve program semantics• Does not alter what program does• Just affects the way it does it

Encourages exploratory programmingEncourages higher code quality• Makes it easier to rewrite poor code

Page 63: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

63Component-Based Development

RefactoringFull preview of all ensuing code changes• Programmer can veto individual changes

List of changes

“before”vs. “after”

Page 64: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

64Component-Based Development

RefactoringGrowing catalog of refactoring actions• Organize imports• Rename {field, method, class, package}• Move {field, method, class}• Extract {method, local variable, interface}• Inline {method, local variable}• Reorder method parameters• Push members down…

Page 65: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

65Component-Based Development

Eclipse Java CompilerEclipse Java compiler• JCK-compliant Java compiler (selectable 1.3 and 1.4)• Helpful error messages• Generates runnable code even in presence of errors• Fully-automatic incremental recompilation• High performance• Scales to large projects

Multiple other uses besides the obvious• Syntax and spell checking• Analyze structure inside Java source file• Name resolution• Content assist• Refactoring• Searches

Page 66: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

66Component-Based Development

Eclipse Java Debugger

Run or debug Java programs

Threads and stack

frames

Editor with breakpoint

marks

Console I/O

Local variables

Page 67: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

67Component-Based Development

Eclipse Java DebuggerRun Java programs• In separate target JVM (user selectable)• Console provides stdout, stdin, stderr• Scrapbook pages for executing Java code snippets

Debug Java programs• Full source code debugging• Any JPDA-compliant JVM

Debugger features include• Method and exception breakpoints• Conditional breakpoints• Watchpoints• Step over, into, return; run to line• Inspect and modify fields and local variables• Evaluate snippets in context of method• Hot swap (if target JVM supports)

Page 68: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

68Component-Based Development

JDT APIsJDT APIs export functionality to other plug-ins

Java model• Java-centric analog of workspace• Tree of Java elements (down to individual methods)• Java element deltas• Type hierarchies• Model accurate independent of builds

Building blocks• Java scanner• Java class file reader • Java abstract syntax trees (down to expressions)

Many others…

Page 69: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

69Component-Based Development

Eclipse JDT - SummaryJDT is a state of the art Java IDEJava views, editor, refactoring• Helps programmer write and maintain Java code

Java compiler• Takes care of translating Java sources to binaries

Java debugger• Allows programmer to get inside the running program

Eclipse Javaprogrammers

Page 70: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

70Component-Based Development

Plug-in Development Environment

PDE = Plug-in development environmentSpecialized tools for developing Eclipse plug-ins

Built atop Eclipse Platform and JDT• Implemented as Eclipse plug-ins• Using Eclipse Platform and JDT APIs and extension points

Included in Eclipse Project releases• Separately installable feature• Part of Eclipse SDK drops

Page 71: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

71Component-Based Development

PDE Goals

Goals • To make it easier to develop Eclipse plug-ins• Support self-hosted Eclipse development

Page 72: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

72Component-Based Development

PDEPDE templates for creating simple plug-in projects

Page 73: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

73Component-Based Development

PDESpecialized PDE editor for plug-in manifest files

Page 74: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

74Component-Based Development

PDEPDE runs and debugs another Eclipse workbench

1. Workbenchrunning PDE

(host)

2. Run-timeworkbench

(target)

Page 75: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

75Component-Based Development

PDE - Summary

PDE makes it easier to develop Eclipse plug-insPDE also generates Ant build scripts• Compile and create deployed form of plug-in

PDE is basis for selfPDE is basis for self--hostedhostedEclipse developmentEclipse development

Page 76: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

76Component-Based Development

Eclipse Operating Environments

Eclipse Platform currently* runs on• Microsoft® Windows® XP, 2000, NT, ME, 98SE• Linux® on Intel x86 - Motif, GTK

RedHat Linux 8.0 x86SuSE Linux 8.1 x86

• Sun Solaris 8 SPARC – Motif• HP-UX 11i hp9000 – Motif• IBM® AIX 5.1 on PowerPC – Motif• Apple Mac OS® X 10.2 on PowerPC – Carbon• QNX® Neutrino® RTOS 6.2.1 - Photon®

* Eclipse 2.1 - March 2003

Page 77: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

77Component-Based Development

Other Operating EnvironmentsMost Eclipse plug-ins are 100% pure Java• Freely port to new operating environment• Java2 and Eclipse APIs insulate plug-in from OS and window

system

Gating factor: porting SWT to native window systemJust added in 2.1*• Mac OS X PowerPC – Carbon window system• QNX Neutrino RTOS Intel x86 - Photon window system

Eclipse Platform also runs “headless”• Example: help engine running on server

* March 2003

Page 78: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

78Component-Based Development

Who’s on Board?

*As of August 2002

Wide range of software vendors on Eclipse boardRepresent various development tool markets

Page 80: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

80Component-Based Development

Who’s Shipping on Eclipse?

Commercial products*10 Technology – Visual PADAssisi – V4ALL Assisi GUI-BuilderBocaloco – XMLBuddyBorland – Together Edition for WebSphere StudioCatalyst Systems – OpenmakeComputer Associates – AllFusion Harvest Change Manager VCMEnsemble Systems – Glider for EclipseFujitsu – InterstageGenuitec – EASIE Plug-insHP – OpenCall Media Platform OClet Development EnvironmentJames Holmes – Struts ConsoleInstantiations – CodePro Studio

* As of March 2003

Page 81: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

81Component-Based Development

Who’s Shipping on Eclipse?

IBM uses Eclipse for• WebSphere® Studio Family

WebSphere Studio Homepage BuilderWebSphere Studio Site Developer (WSSD)WebSphere Studio Application Developer (WSAD)WebSphere Studio Application Developer Integration Edition(WSADIE)WebSphere Studio Enterprise Developer (WSED)WebSphere Studio Device Developer (WSDD)WebSphere Development Studio for iSeries

• Rational® XDE Professional: Java Platform Edition• Tivoli Monitoring Workbench

* As of March 2003

Page 82: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

82Component-Based Development

Who’s Shipping on Eclipse?Commercial products*Interwoven – TeamSite repositoryIntland – CodeBeamerLegacyJ – PERCobolMerant – PVCS Version ManagerMKS – Source Integrity Enterprise plug-inMobile Media – Grand-Rapid Browsermvmsoft – Slime UMLNo Magic Inc. – MagicDraw UMLObject Edge – Weblogic Plug-inObjectLearn – LombozOmondo – EclipseUMLOntogenics – hyperModel

* As of March 2003

Page 83: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

83Component-Based Development

Who’s Shipping on Eclipse?Commercial products*Parasoft – JtestProSyst – Eclipse OSGi Plug-inQNX – QNX MomenticsQuest Software – JProbe integrationSerena Software – ChangeMan DSSlickEdit – Visual SlickEdit Plug-inSystinet – WASP DeveloperTHOUGHT – CocoBase Enterprise O/RTimeSys – TimeStorm 2.0xored – WebStudio IDE for PHP

* As of March 2003

Page 84: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

84Component-Based Development

Who’s Building on Eclipse?

Plus more than 40* other open source projects based on EclipseSee http://eclipse.org/community/plugins.html

* As of March 2003

Page 85: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

85Component-Based Development

HelloWorld example

Creating a plug-in projectReviewing the generated codeBuilding a productInstalling and running the product

Page 86: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

86Component-Based Development

Hello Button

We want to contribute a button to Eclipse First, we have to create a projectEclipse has wizards to automate tedious work

Page 87: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

87Component-Based Development

Hello Button

Open the new wizard

Page 88: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

88Component-Based Development

Hello Button

Select Plug-in Project

Page 89: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

89Component-Based Development

Hello Button

Define the name of the plug-in project

Page 90: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

90Component-Based Development

Hello Button

Define the settings related to the plug-in structure

Page 91: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

91Component-Based Development

Hello Button

This wizard has a number of different code generation options for creating sample plug-in code such as views, editors, and actionsCreate a blank plug-in project without using any of the code generation wizards

Page 92: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

92Component-Based Development

Hello Button

Now we have a plug-in, but it does not do anythingClicking Run As > Eclipse Application will bring up another instance of Eclipse, but this one has our new plug-in loaded

Page 93: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

93Component-Based Development

Hello ButtonNext we need to contribute a button. Here’s how we specify or button appearance:

<extension point="org.eclipse.ui.actionSets"><actionSetid="it.unibz.contribution.hello.actionSet"label ="Hello Action Set"><action id="it.unibz.contribution.hello.HelloAction"label="Hello"toolbarPath="helloGroup">

</action></actionSet>

</extension>

Page 94: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

94Component-Based Development

Hello Button

We can see our action set in Window > Customize Perspective…

Page 95: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

95Component-Based Development

Hello Button

Our button

Page 96: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

96Component-Based Development

Saying “Hello”

We have finished the user visible appearance of our plug-inNow it is time to fill-in the implementation sizeAccording to the Lazy Loading Rule, contributions are only loaded when they are first invoked• Eclipse waits until the button is clicked, then

looks for code to invoke

Page 97: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

97Component-Based Development

Saying “Hello”

The code is represented as a Java Class, so the name of the class has to be part of the definition of the actionEach action has the name of a Java class associated with it:

<action id="it.unibz.contribution.hello.HelloAction"label="Hello"

toolbarPath="helloGroup">class="it.unibz.contribution.hello.HelloAction">

</action>

Page 98: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

98Component-Based Development

Saying “Hello”

When we start the run-time workbench and click our button, the console in the host workbench tells us that the class cannot be found:

Could not create action delegate for id:

it.unibz.contribution.hello.HelloActionReason:Executable extension definition for "class" not

found.

Page 99: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

99Component-Based Development

Saying “Hello”

To make the action work, we need to create a class called it.unibz.contribution.hello.HelloActionHow will the action be invoked?• Eclipse needs a protocol common to all

actions• This protocol is defined in the interface

IWorkbenchWindowActionDelegate

Page 100: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

100Component-Based Development

Saying “Hello”

Before we can define an implementor of IWorkbenchWindowActionDelegate we have to help Eclipse find it within our plug-inEclipse does not use the usual classpathmechanism of Java to find classes • Each plug-in has its own class lookup path

Page 101: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

101Component-Based Development

Saying “Hello”

The interface we want to implement is defined in the org.eclipse.ui plugin, so our plug-in needs to depend on itWe add the following to our manifest:

<requires><import plugin=“org.eclipse.ui”/></requires>

Page 102: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

102Component-Based Development

Saying “Hello”

Now we can define our HelloActionClass1. Create a package it.unibz.contribution.hello

in the source folder src of our project2. Create a class HelloAction implementing the

interface IWorkbenchWindowActionDelegate

Page 103: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

103Component-Based Development

Saying “Hello”

Eclipse fills in default implementation for the four methods in the signature of the interface:

public void dispose() { }

public void init(IWorkbenchWindow window) { }

public void run(IAction action) { }public void selectionChanged(IAction action,

ISelection selection) {}

Page 104: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

104Component-Based Development

Saying “Hello”

We replace the implementation of HelloAction.run() with the following:

public void run(IAction action) {

MessageDialog.openInformation(null, null, "Hello, Eclipse world");

}

Page 105: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

105Component-Based Development

Saying “Hello”

Now when we start the run-time workbench and click the button, we see the message we have been expecting:

Page 106: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

106Component-Based Development

Building a product

Building a product involves packaging up only those elements to be delivered to the customer in a form that the customer can install into their environmentYou can build the product in several different ways including manually, using a Windows batch script, a Unix shell script, or using an Ant scriptYou can deliver the end product as a single compressed file or as a stand-alone executable

Page 107: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

107Component-Based Development

Building manually

Building the product manually involves launching an Eclipse export wizard, filling out a few fields, and clicking the Finishbutton

Page 108: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

108Component-Based Development

Building manually

Select the File >Export command to launch the desired export wizard. On the first wizard page select Deployable plug-ins and fragments and click the Next button

Page 109: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

109Component-Based Development

Building manually

On the second page of the export wizard select the plug-ins to be exported and enter the name of the zip file to contain the result

Page 110: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

110Component-Based Development

Building manually

The created zip file contains the plug-in and its source code as specified in the export wizard:• plugins/it.unibz.contribution.hello_1.0.0/hello.jar• plugins/it.unibz.contribution.hello_1.0.0/plugin.xml

Page 111: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

111Component-Based Development

Building with Apache Ant

An Apache Ant script provides a reliable, flexible and repeatable process for building a commercial plug-in projectThere is a little more up-front work to setup an Ant script, but it is much less error prone over time than building the product manually

Page 112: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

112Component-Based Development

Building with Apache AntFor the Favorites plug-in, create a build.xml file in the it.unibz.contribution.hello project and enter the following script:

<?xml version="1.0" encoding="UTF-8"?><project name=“hello" basedir="." default="product"><target name="product"><!-- Temporary directory used to build the product...

will be deleted --><property name="temp_dir"

location="C:/eclipse/workspace/it.unibz.contribution.hello/temp"/><!-- Product directory where final product will be placed --><property name="product_dir"

location="C:/eclipse/workspace/it.unibz.contribution.hello"/>

<!-- Current product version number --><property name="product_version"

value="1.0.0"/><!-- Plugin directory... sub-directory of temp directory --><property name="plugin_dir"

location="${temp_dir}/plugins/it.unibz.contribution.hello_${product_version}"/>

Page 113: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

113Component-Based Development

Building with Apache Ant<!-- Clear out the temp directory --><delete dir="${temp_dir}"/><mkdir dir="${plugin_dir}"/><mkdir dir="${product_dir}"/>

<!-- Assemble the product in the temp directory --><jar jarfile="${plugin_dir}/hello.jar">

<fileset dir="bin"/></jar><copy todir="${plugin_dir}">

<fileset dir="." includes="plugin.xml"/><fileset dir="." includes="icons/*.gif"/>

</copy><!-- Build the product from the temp directory --><zip zipfile="${product_dir}/hello_v${product_version}.zip">

<fileset dir="${temp_dir}"/></zip></target></project>

Page 114: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

114Component-Based Development

Building with Apache Ant

To execute the Ant script, select the build.xml file in the navigator view, and then from the popup context menu, select Run Ant…

Page 115: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

115Component-Based Development

Building with Apache Ant

Once the Ant wizard appears, click the Run button to build the product

Page 116: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

116Component-Based Development

Installing and running the product

To install the Favorites plug-in, shutdown Eclipse, unzip the hello_v1.0.0.zip the Ant script generated, and restart Eclipse

Page 117: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

117Component-Based Development

PDE Views

The Plug-in Development Environment (PDE) provides several views for inspecting various aspects of plug-insTo open the various PDE views, select Window > Show View > Other…, and in the Show View dialog, expand both the PDE category and the PDE Runtime category

Page 118: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

118Component-Based Development

The Plug-in Registry view The Plug-in Registry view displays a tree view of all plug-ins discovered in the current workspaceExpanding the plug-in in the tree shows its components such as extension points, extensions, prerequisites, and runtime librariesRight-click and select Properties to display additional information about each element in the tree

Page 119: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

119Component-Based Development

The Plug-in view The Plug-ins view shows a tree list of external plug-ins and plug-in projects in the current workspace and provides a quick way to review plug-ins that already exist (see Figure 2-28)You can expand each external plug-in in the tree to browse the files located in the plug-in directorySimilar to the Plug-in Registry view, selecting an element in the tree displays additional information about that element in the Properties viewDouble-clicking on a file element opens that file in an editor for viewing

Page 120: Component-Based Developmentpro.unibz.it/staff/mscotto/CBD/CBD1Ex - Introduction.pdf · 2005-05-04 · Component-Based Development 33 Editors ¾Editors appear in workbench editor area

120Component-Based Development

The Plug-in Dependency viewThe Plug-in Dependencyview shows a hierarchy of which plug-ins are dependent upon which other plug-ins, which in turn are dependent upon other plug-ins, etc.When the view opens, first right-click and select Focus On…Double clicking on an element in the tree opens the plug-in manifest editor for the corresponding plug-in