here - Mälardalens högskola

eyelashesnectarineSoftware and s/w Development

Nov 3, 2013 (3 years and 5 months ago)

64 views

Eclipse

Federico Ciccozzi

M
älardalens

Högskola, IDT

V
ästerås
,
Sweden

An

extensible Integrated Development Environment

Agenda

1.
Eclipse:
overview


2.
Eclipse Architecture


3.
Eclipse

in
Practice


4.
Eclipse

Plugin Development


5.
Assignment

What is Eclipse ?


Eclipse is an open source project


http://www.eclipse.org


Consortium of companies, including IBM


Launched in 2001


Designed to help developers with specific
development tasks



In this course we will use the Indigo distribution
(Eclipse 3.x)

Eclipse Platform Motivations


Support for application development tools construction


Independent tool vendors support


GUI and non
-
GUI application development support


Independent language but support for


Java, HTML, C, XML, ...


Easy integration of new “tools”


Use of Java language for implementation


Multiple operating systems support


Installation

Eclipse Architecture

Java
Virtual Machine

Eclipse Platform

Java Development Tools (JDT)

Plug
-
in Development Environment (PDE)

Eclipse Platform

Equinox (
OSGi

Platform*)

Core

SWT

JFace

Eclipse

Platform

Workbench

(*) Open
Services Gateway initiative framework

is a module system and

service

platform
for

Java


t
hat implements
a complete and dynamic component model

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



Workbench


Graphical part of Eclipse platform


View


Perspective


Editor


Workbench


Represents the desktop
development environment


It contains set of tools for
resource management


It provides common way of
navigating through the
resources



Multiple workbenches can
be opened at the same
time

Multiple Workbench Instances



Instance
of the workbench comes up when Eclipse
launched



It is possible to open another instance of the Workbench


Window


New Window


This opens up a new Workbench window


This is important when developing Eclipse plug
-
ins and you want
to test them within the
environment

Resources in a Workbench



When
working with Eclipse, you work with its
resources



Resources are organized as a file/directory structure in
the
Workbench



Files/directories correspond
to the actual
ones
in the
Workspace

Workspace


Represents users
data



It is a set of user defined
resources


Projects


Collections of files and
folders


Folders


Contain other folders or
files


Files


Contain arbitrary number
of
bytes

Workbench Components


Workbenches
contain perspectives


Perspectives
contain views and editors

views

editor

perspective

Perspectives


A perspective defines the
initial layout of the views in the
Workbench



They are task oriented, i.e. they contain specific views
for
given tasks
:


Java Perspective for manipulating Java code


Resource Perspective for manipulating resources


Debug Perspective for debugging
applications


Plug
-
in perspective for plug
-
ins development



One Workbench window contains many perspectives

Editors


An editor for a resource
is opened
when
double
-
clicking
on a resource


Editor type depends on a type of the resource, for example
.txt

files are open with the text editor


When an editor opens on a resource, it stays open across
different perspectives


When perspectives change editor stays open


Active editor contains menus and toolbars specific to that editor


When you change a resource, an asterisk on the editor’s title bar
indicates unsaved
changes


A set of different editors may be available for a file

Views


The main purpose of a view is:


To support editors


To provide alternative presentation and
navigation in the
Workbench



Views can have their own menus and
toolbars


Items available in menus and toolbars are
available only in
that particular
view

Stacked Views


Stacked views appear in a notebook form


Each view is a notebook page

Searching


Eclipse comes with an
extensive Search
mechanism


You can search for entities
such as files, text, and Java
classes


To start search:


Select
Search


Search…
from the menu


Choose search criteria


Click
Search


Plugin Install

A plug
-
in extends Eclipse platform for a specific purpose


Download and install

from menu

Help
-
> Install New Software...


Define plug
-
in update site

Select features

Plug
-
in Development Environment


Self
-
hosted development environment


New PDE project wizard creates directory structure and
populates


Templates for specific types of plug
-
in


Manifest editor for plugin.xml configuration file


Identify dependencies


Add extension points


Run and debug in a separate Eclipse window

Plug
-
in Architecture


Plug
-
in:
smallest unit of Eclipse function


It
i
s a bundle with a plugin.xml file


Example: HTML editor



Extension point:
named entity for collecting
“contributions”


Example: extension point for workbench preference UI



Extension:
a contribution


Example: specific HTML editor preferences


Plug
-
in Development Environment


Each plug
-
in


Contributes to 0 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 defined in the
plug
-
in manifests


plugin.xml file in root of plug
-
in project


Declares contributions


Code implements contributions and provides API


Manifest.mf

file in MANIFEST subdirectory


Define code dependencies


Manifest


plugin.xml and MANIFEST.MF
can

be

edited

by the
Plug
-
in
Manifest

Editor


Define

dependencies


Define

extensions


Define

extension
-
points

Manifest
-
Version: 1.0

Bundle
-
ManifestVersion
: 2

Bundle
-
Name:
MyApplication

Plug
-
in

Bundle
-
SymbolicName
:
MyApplication

Bundle
-
Version: 1.0.0

Bundle
-
Localization: plugin

Bundle
-
Activator:
myapp.Activator

Import
-
Package:


org.osgi.framework;version
="1.3.0“

Export
-
Package:
myapp


Plugin.xml

<
plugin>


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

the
plug
-
in
provides

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

plugin.xml

Assignment Instructions


Download the Eclipse Modeling Tools bundle
from:


http
://www.eclipse.org/downloads/packages/eclipse
-
modeling
-
tools/junor


Install it (just unzip the downloaded archive) on
the machines in the lab (U2
-
039)


Start looking at development of plugins:


http://
www.eclipse.org/articles/Article
-
Your%20First%20Plug
-
in/YourFirstPlugin.html


http://www.eclipsepluginsite.com/


Deadline: 10th September 2012