18
Eclipse Plug-ins and RCP Training Course RCP and Industrialization October 2013 Copyright © 2013 Luca D’Onofrio – RCP Solutions 1

Eclipse Training - RCP & Industrialization

Embed Size (px)

DESCRIPTION

Eclipse Training - RCP & Industrialization Example code available at: https://code.google.com/p/eclipse-training-course/

Citation preview

Page 1: Eclipse Training - RCP & Industrialization

Eclipse Plug-ins and RCP

Training CourseRCP and Industrialization

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions1

Page 2: Eclipse Training - RCP & Industrialization

1. Internationalization (I18N)2. Building RCPs

a) RCP startup classesb) Product Configuration and Brandingc) Features and Brandingd) Update Sitee) Building a Productf) Target Platform and Delta Packsg) P2 Repository

Agenda

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions2

Page 3: Eclipse Training - RCP & Industrialization

Eclipse and the underlying JRE (Java Runtime Environment) provide APIs for separating language and UI human readable strings from code.

By isolating those strings an application can be «localized»

Main Concepts: Property files containing the strings collected by

language APIs or tools create/access string properties

Internationalization (I18N)(1/2)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions3

Page 4: Eclipse Training - RCP & Industrialization

Internationalize plug-in manifest: PDE Tools Internationalize/Externalize Strings Extract strings and create fragments for each selected language

(see ISO 639, ISO 3166)bundle_<language>_<country>.properties

Externalize plugin-in strings: SourceExternalize Strings A property(ies) file(s) contains the set strings An accessor class(es) extending org.eclipse.osgi.util.NLS provides

mechanisms to load and access property file according to environment locale

<basename>_<language>_<country>.propertiesTIP: factor any common values and create a common key.TIP: use in your code «Name»+ «:» instead of «Name:»

Internationalization (I18N)(2/2)

Copyright © 2013 Luca D’Onofrio – RCP Solutions4

October 2013

Page 5: Eclipse Training - RCP & Industrialization

Define the application which you would like to run using the platform runtime.

Declared applications can be run directly from the main platform launcher by specifying the application argument where the parameter is the id of an extension supplied to the applications extension point.

This application is instantiated and run by the platform. An IApplication represent executable entry points.

Building RCPsExtension points and APIs

(1/2)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions5

Purpose Define the application entry point.

Package org.eclipse.core.runtime

Extension Point org.eclipse.core.runtime.applications

Interface(s) org.eclipse.equinox.app.IApplication

Page 6: Eclipse Training - RCP & Industrialization

IApplication Start/stop

WorkbenchAdvisor Initialize Performs arbitrary actions just

before the first workbench window is opened (or restored) / closed

WorkbenchWindowAdvisor Performs arbitrary actions before

the window is opened/closed ActionBarAdvisor

Configure menu, action bar, status bar, …

Building RCPsExtension points and APIs

(2/2)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions6

class rcp

ActionBarAdvisor

ApplicationActionBarAdv isor

WorkbenchAdvisor

ApplicationWorkbenchAdv isor

WorkbenchWindowAdvisor

ApplicationWorkbenchWindowAdv isor

IApplication

TrainingApplication Enry Point

Configure the Workbench

Configure action bar and menu of a workcench window.

Configure the workbench window.

Page 7: Eclipse Training - RCP & Industrialization

Products are the Eclipse unit of branding. A Product defines the default application to run when running

the product. There are two possible forms of product extension

Static product extensions directly contain all relevant information about the product.

Dynamic product extensions identify a class (an IProductProvider) which is capable of defining one or more products when queried.

Product Configuration and Branding (1/3)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions7

Purpose Define the product application to launch and its branding.

Package org.eclipse.core.runtime

Extension Point org.eclipse.core.runtime.products

Page 8: Eclipse Training - RCP & Industrialization

An Eclipse based product is a stand-alone program built with the Eclipse platform.

A product may optionally be packaged and delivered as one or more features, which are simply groupings of plug-ins that are managed as a single entity by the Eclipse update mechanisms.

Products include all the code and plug-ins needed to run them. This includes a Java runtime environment (JRE) and the Eclipse platform code.

Once installed, the user launches the product and is presented with an Eclipse workbench configured specifically for the purpose supported by the product.

The platform makes it easy to configure labels, about dialogs, graphics, and splash screens.

PDE provides a product configuration file and associated editor to make it easy to create products in the correct format.

Product Configuration and Branding (2/3)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions8

Page 9: Eclipse Training - RCP & Industrialization

Product Configuration and Branding (3/3)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions9

Product Branding: Splash screen About dialog image and text Windows Images (and icons associated to the launcher)

Page 10: Eclipse Training - RCP & Industrialization

A Feature groups together one or more plug-ins

A Feature can be deployed as an installation unit.

A Feature specifies: Category (optional) Branding plugin (optional) Feature update site URL (optional) Licence, copyright, … information Dependencies

Features and Branding(1/3)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions10

Page 11: Eclipse Training - RCP & Industrialization

Features and Branding(2/3)

Copyright © 2013 Luca D’Onofrio – RCP Solutions11

October 2013

Page 12: Eclipse Training - RCP & Industrialization

Contains: about.ini

aboutText: short multi-line description of the feature

featureImage: 32x32 pixel image used in the product About dialog

Features and BrandingBranding Plugin (3/3)

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions12

Page 13: Eclipse Training - RCP & Industrialization

More features can be collected in an update site described by a site.xml file.

An update site contains: Features categories Features Web page(s) (optional)

Feature/Update site exported packages can be installed using Eclipse installation wizard

Installed Features can be uninstalled using the Eclipse About dialog

Update Site

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions13

Page 14: Eclipse Training - RCP & Industrialization

Package those elements to be delivered to the customer in a form suitable for the installation. Automated build using PDE Customized build using ANT script file

Building a Product

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions14

Page 15: Eclipse Training - RCP & Industrialization

Target Platform

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions15

The Target Platform refers to the plug-ins which your workspace will be built and run against. It describes the platform that you are developing for.

The Target Definition Editor is used to edit target definition files in the workspace, which should end with the extension ".target".

Target definition files can be created using the New Target Definition Wizard or by moving them to the workspace on the Target Platform Preference Page.

Page 16: Eclipse Training - RCP & Industrialization

Eclipse package containing all the needed plugins to export your RCP product to different platforms (Windows, Linux, Mac, …) without having to use a platform’s native Eclipse installation.

The archives contains all the platform specific fragments from the Eclipse SDK.

Delta pack can be installed using:WindowPreferencesPlug-in DevelopmentTarget

Platform

Delta Packs

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions16

Page 17: Eclipse Training - RCP & Industrialization

The p2 project is a sub-project of Equinox (OSGI services) that focuses on provisioning technology for OSGi-based applications.

It provides Eclipse with installation facilities. In order to use P2 you need to add

org.eclipse.equinox.p2.* packages in your installation unit.

An installable unit can be augmented at generation time by writing a p2 advice file (p2.inf). The format of this file is java properties file containing key=value pairs.

P2 Repository

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions17

Page 18: Eclipse Training - RCP & Industrialization

www.eclipse.org help.eclipse.org wiki.eclipse.org Eclipse SDK update site

http://download.eclipse.org/eclipse/updates/4.3

www.eclipse.org/equinox/ http://wiki.eclipse.org/Equinox_Provisioning

References

October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions18