eclipse training - main eclipse ecosystem classes

Download Eclipse Training - Main eclipse ecosystem classes

Post on 25-May-2015




4 download

Embed Size (px)


Eclipse Training - Main eclipse ecosystem classes


  • 1. Eclipse Plug-ins and RCP Training Course Main Eclipse ecosystem classes October 2013Copyright 2013 Luca DOnofrio RCP Solutions 1

2. 1. Runtime Platform Core & Runtime a) Plugin & Bundle classes b) Platform User Interface c) Logging 2. Resource Management 3. Jobs a) Progress monitoring b) Workspace operations Agenda 2 October 2013Copyright 2013 Luca DOnofrio RCP Solutions 3. 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 - 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 DOnofrio RCP Solutions 3 October 2013 4. 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 DOnofrio RCP Solutions 4 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) : 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 5. 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 + getBundleId() : long + getLocation() : String + getRegisteredServices() : ServiceReference[] + getServicesInUse() : ServiceReference[] + hasPermission(Object) : boolean + getResource(String) : URL + getHeaders(String) : Dictionary + getSymbolicName() : String + loadClass(String) : Class + getResources(String) : Enumeration + getEntryPaths(String) : Enumeration + getEntry(String) : URL + getLastModified() : long + findEntries(String, String, boolean) : Enumeration + getBundleContext() : BundleContext + getSignerCertificates(int) : Map> + getVersion() : Version + adapt(Class) : A + getDataFile(String) : File +bundle Plugin & Bundle classes Copyright 2013 Luca DOnofrio RCP Solutions 5 October 2013 6. 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 DOnofrio RCP Solutions 6 October 2013 7. 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 DOnofrio RCP Solutions 7 October 2013 8. Logging Copyright 2013 Luca DOnofrio RCP Solutions 8 October 2013 9. 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 DOnofrio RCP Solutions 9 October 2013 10. class resources IAdaptable interface IContainer IEncodedStorage IAdaptable interface IFile IAdaptable interface IFolder IAdaptable interface IMarker IAdaptable interface IProject interface IProjectDescription interface IProjectNature IAdaptable ISchedulingRule interface IResource IAdaptable interface IWorkspace IAdaptable interface IWorkspaceRoot 0..* 0..* 1..* Resources Hierarchy Copyright 2013 Luca DOnofrio RCP Solutions 10 October 2013 11. 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 DOnofrio RCP Solutions 11 Resource type attribute FILE FOLDER PROJECT ROOT DERIVED LINKED Synchronized Local Hidden Read Only Refresh attributes DEPTH_ZERO, DEPTH_ONE, DEPTH_INFINITE October 2013 12. 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 DOnofrio RCP Solutions 12 October 2013 13. 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 DOnofrio RCP Solutions 13 October 2013 14. 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 DOnofrio RCP Solutions 14 October 2013 15. References Copyright 2013 Luca DOnofrio RCP Solutions