eclipse training - main eclipse ecosystem classes

15
Eclipse Plug-ins and RCP Training Course Main Eclipse ecosystem classes October 2013 Copyright © 2013 Luca D’Onofrio – RCP Solutions 1

Upload: luca-donofrio

Post on 25-May-2015

224 views

Category:

Technology


4 download

DESCRIPTION

Eclipse Training - Main eclipse ecosystem classes

TRANSCRIPT

Page 1: Eclipse Training - Main eclipse ecosystem classes

Eclipse Plug-ins and RCP

Training CourseMain Eclipse ecosystem

classes

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

Page 2: Eclipse Training - Main eclipse ecosystem classes

1. Runtime Platform Core & Runtimea) Plugin & Bundle classesb) Platform User Interfacec) Logging

2. Resource Management3. Jobs

a) Progress monitoringb) Workspace operations

Agenda

2October 2013Copyright © 2013 Luca D’Onofrio – RCP Solutions

Page 3: Eclipse Training - Main eclipse ecosystem classes

The core component provides basic platform infrastructure that does not involve any UI. Main plug-ins:

org.eclipse.core.contenttype - Support for defining and managing file content types org.eclipse.core.expressions - A generic XML-based expression language used in

the markup of various extension points. org.eclipse.core.filesystem - A generic file system API org.eclipse.core.jobs - Infrastructure for concurrent programming in Eclipse org.eclipse.core.resources - Management of resources - projects, folders, and files org.eclipse.core.runtime - Formerly the foundation of the platform, this plug-in has

largely been supplanted by the Equinox runtime Each plug-in provides a basic set of services, and API and extension points for managing

and interacting with those services. The contents of resources are never examined in any domain-specific way and the Core

can run equally well with and without a UI. Much of the function previously provided by core now falls under the Equinox OSGi

project

Platform Core & Runtime

Copyright © 2013 Luca D’Onofrio – RCP Solutions3

October 2013

Page 4: Eclipse Training - Main eclipse ecosystem classes

The central class of the Eclipse Platform Runtime. This class cannot be instantiated or subclassed by clients; all functionality is provided by static methods.

The Platform defines the set of frameworks and common services that collectively make up infrastructure required to support the use of Eclipse as a component model, as a Rich Client Platform (RCP) and as a comprehensive tool integration platform.

Features include: the platform registry of installed plug-ins the platform adapter manager the platform log the authorization info management

Platform core

Copyright © 2013 Luca D’Onofrio – RCP Solutions4

class Platform

runtime::Platform{leaf}

+ addAuthorizationInfo(URL, String, String, Map) : void+ getAdapterManager() : IAdapterManager+ getAuthorizationInfo(URL, String, String) : Map+ getCommandLineArgs() : String[]+ getDebugOption(String) : String+ getLocation() : IPath+ getPlugin(String) : Plugin+ getPluginRegistry() : IPluginRegistry+ resolve(URL) : URL+ getJobManager() : IJobManager+ getExtensionRegistry() : IExtensionRegistry+ find(Bundle, IPath) : URL+ find(Bundle, IPath, Map<String,String>) : URL+ getLog(Bundle) : ILog+ getOSArch() : String+ getNL() : String+ getNLExtensions() : String+ getOS() : String+ getWS() : String+ getApplicationArgs() : String[]+ getPlatformAdmin() : PlatformAdmin+ getPreferencesService() : IPreferencesService+ getProduct() : IProduct+ getConfigurationLocation() : Location+ getUserLocation() : Location+ getInstallLocation() : Location+ isFragment(Bundle) : boolean+ getFragments(Bundle) : Bundle[]+ getBundle(String) : Bundle+ getBundles(String, String) : Bundle[]+ isRunning() : boolean+ inDebugMode() : boolean

October 2013

Page 5: Eclipse Training - Main eclipse ecosystem classes

class PluginBundle

runtime::Plugin

+ Plugin()+ Plugin(IPluginDescriptor)+ find(IPath) : URL+ find(IPath, Map) : URL+ getDescriptor() : IPluginDescriptor+ getLog() : ILog+ getStateLocation() : IPath+ getPluginPreferences() : Preferences+ savePluginPreferences() : void+ internalInitializeDefaultPluginPreferences() : void+ isDebugging() : boolean+ openStream(IPath) : InputStream+ openStream(IPath, boolean) : InputStream+ setDebugging(boolean) : void+ shutdown() : void+ startup() : void+ start(BundleContext) : void+ stop(BundleContext) : void+ getBundle() : Bundle

Comparable

«interface»framework::Bundle

+ UNINSTALLED: int = 0x00000001+ INSTALLED: int = 0x00000002+ RESOLVED: int = 0x00000004+ STARTING: int = 0x00000008+ STOPPING: int = 0x00000010+ ACTIVE: int = 0x00000020+ START_TRANSIENT: int = 0x00000001+ START_ACTIVATION_POLICY: int = 0x00000002+ STOP_TRANSIENT: int = 0x00000001+ SIGNERS_ALL: int = 1+ SIGNERS_TRUSTED: int = 2

+ getState() : int+ start(int) : void+ start() : void+ stop(int) : void+ stop() : void+ update(InputStream) : void+ update() : void+ uninstall() : void+ getHeaders() : Dictionary<String, String>+ getBundleId() : long+ getLocation() : String+ getRegisteredServices() : ServiceReference<?>[]+ getServicesInUse() : ServiceReference<?>[]+ hasPermission(Object) : boolean+ getResource(String) : URL+ getHeaders(String) : Dictionary<String, String>+ getSymbolicName() : String+ loadClass(String) : Class<?>+ getResources(String) : Enumeration<URL>+ getEntryPaths(String) : Enumeration<String>+ getEntry(String) : URL+ getLastModified() : long+ findEntries(String, String, boolean) : Enumeration<URL>+ getBundleContext() : BundleContext+ getSignerCertificates(int) : Map<X509Certificate, List<X509Certificate>>+ getVersion() : Version+ adapt(Class<A>) : A+ getDataFile(String) : File

+bundle

Plugin & Bundle classes

Copyright © 2013 Luca D’Onofrio – RCP Solutions5

October 2013

Page 6: Eclipse Training - Main eclipse ecosystem classes

Platform UI consists of several components, which provide the basic building blocks for user interfaces built with Eclipse. (Some of these can be reused in arbitrary applications, while others are specific to the Eclipse IDE).

JFace and the Workbench can be used to build arbitrary applications, not just the Eclipse IDE. The Eclipse IDE is just one instance of an RCP application.

JFace is a UI toolkit with classes for handling many common UI programming tasks. JFace is window-system-independent in both its API and implementation, and is designed to work with SWT without hiding it. JFace includes the usual UI toolkit components of image and font registries, text, dialog, preference and wizard frameworks, and progress reporting for long running operations.

The Workbench provides the user interface structure for Eclipse. The purpose of the Workbench is to facilitate the seamless integration of tools. These tools contribute to extension points defined by the Workbench.

Platform User Interface (1/2)

Copyright © 2013 Luca D’Onofrio – RCP Solutions6

October 2013

Page 7: Eclipse Training - Main eclipse ecosystem classes

The central class for access to the Eclipse Platform User Interface. This class cannot be instantiated; all functionality is provided by static methods. Features provided:

Creation of the workbench. Access to the workbench.

Platform User Interface (2/2)

Copyright © 2013 Luca D’Onofrio – RCP Solutions7

October 2013

Page 8: Eclipse Training - Main eclipse ecosystem classes

Logging

Copyright © 2013 Luca D’Onofrio – RCP Solutions8

October 2013

Page 9: Eclipse Training - Main eclipse ecosystem classes

The Eclipse File System (EFS) is an abstract file system API. It is used in the Eclipse platform to abstract away implementation details about what file system is used to store data in the workspace.

EFS makes heavy use of Uniform Resource Identifiers, as defined by RFC 2396.

Implementations: Local file system for resource management Remote System Explorer (SSH, FTP, …) FTP, ZIP, CVS, …

Resource Management: EFS

Copyright © 2013 Luca D’Onofrio – RCP Solutions9

October 2013

Page 10: Eclipse Training - Main eclipse ecosystem classes

class resources

IAdaptable

«interface»IContainer

IEncodedStorageIAdaptable

«interface»IFile

IAdaptable

«interface»IFolder

IAdaptable

«interface»IMarker

IAdaptable

«interface»IProject

«interface»IProjectDescription

«interface»IProjectNature

IAdaptableISchedulingRule

«interface»IResource

IAdaptable

«interface»IWorkspace

IAdaptable

«interface»IWorkspaceRoot

0..*

0..*

1..*

Resources Hierarchy

Copyright © 2013 Luca D’Onofrio – RCP Solutions10

October 2013

Page 11: Eclipse Training - Main eclipse ecosystem classes

Copy / Move Create / Delete Exists Get Parent Get Location (IPath) Get Location (URI) Get Project Get Workspace Refresh Resource change listener management Markers management Persistent properties management Session properties management Find Marker

Resources operations

Copyright © 2013 Luca D’Onofrio – RCP Solutions11

Resource type attribute FILE FOLDER PROJECT ROOT DERIVED LINKED Synchronized Local Hidden Read Only

Refresh attributes DEPTH_ZERO, DEPTH_ONE,

DEPTH_INFINITEOctober 2013

Page 12: Eclipse Training - Main eclipse ecosystem classes

Long-running operations should be executed in the background so that the UI stays responsive. One solution is to fork a lower-priority thread to perform the operation rather than performing the operation in the UI thread.

Eclipse provides a Jobs API for creating, managing, and displaying background operations. Jobs: jobs are units of runnable work that can be scheduled to

be run with the job manager. UIJobs: the UIJob is a Job that runs within the UI Thread via an

asyncExec.

Jobs

Copyright © 2013 Luca D’Onofrio – RCP Solutions12

October 2013

Page 13: Eclipse Training - Main eclipse ecosystem classes

The IProgressMonitor object can be used to report progress. beginTask() specifies the total units of work. For an undefined

amount of work use IProgressMonitor .UNKNOWN worked() reports that a certain number of units of work have

been finished. isCancelled() checks if the user send a job cancel request done() all the work has been complete (successfully or not)

A monitor can have one ore more sub progress monitors. The run method of a Job provide returns a IStatus object to

the caller: Status.CANCEL_STATUS Status.OK_STATUS

Jobs: progress monitoring

Copyright © 2013 Luca D’Onofrio – RCP Solutions13

October 2013

Page 14: Eclipse Training - Main eclipse ecosystem classes

An operation which potentially makes changes to the workspace.

All resource modification should be performed using this operation.

The primary consequence of using this operation is that events which typically occur as a result of workspace changes are generally deferred until the outermost operation has successfully completed.

If a scheduling rule is provided, the operation will obtain that scheduling rule for the duration of its execute method. If no scheduling rule is provided, the operation will obtain a scheduling rule that locks the entire workspace for the duration of the operation.

Jobs: Workspace operations

Copyright © 2013 Luca D’Onofrio – RCP Solutions14

October 2013

Page 15: Eclipse Training - Main eclipse ecosystem classes

References

Copyright © 2013 Luca D’Onofrio – RCP Solutions15

www.eclipse.orghelp.eclipse.orgwiki.eclipse.orgEclipse SDK update site

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

October 2013