introduction to eclipse plug-in development. who am i? scott kellicker java, c++, jni, eclipse....

28
Introduction to Eclipse Plug-in Development

Upload: alberta-lee

Post on 16-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Introduction to Eclipse Plug-in Development

Page 2: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Who am I?

Scott Kellicker Java, C++, JNI, Eclipse. [email protected]

Page 3: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Credits

Some slides are derivative, based on Eclipse presentations.

Copyright (c) 2002, 2003 IBM Corporation and others. All rights reserved. This content is made available to you by Eclipse.org under the terms and conditions of the Common Public License Version 1.0 ("CPL").

Page 4: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Agenda

Plug-in Architecture Eclipse Platform Example

Page 5: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

What is Eclipse?

Java VMStandard Java2Virtual Machine

PlatformEclipse Platform

Java development tools

JDT

PDEPlug-in developmentenvironment

A free Java IDE A tool integration platform Open, extensible architecture based on plug-ins

Page 6: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Eclipse Plug-in Architecture

Plug-in - smallest unit of Eclipse functionality Big example: HTML editor Small example: Action to backup files

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

Extension - a contribution Example: specific backup preferences

Page 7: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Eclipse Plug-in Architecture

Each plug-in Extends 1 or more extension points Depends on 1 or more plug-ins Lives in its own sub-directory May contain Java code or other files May export own Java APIs May declare its own extension points

Details spelled out in the plug-in manifest Manifest declares contributions Code implements contibutions and provides API

Page 8: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Plug-in Manifest

<plugin id = “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

plugin.xml

Page 9: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Eclipse Plug-in Architecture

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

plug-in A plug-in B

class Cinterface I

extensionpoint P

extension

Typical arrangement

contributes

creates, calls

implements

Page 10: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Plug-in Activation

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

Eclipse Platform Runtime handles start up Discovers plug-ins installed on disk

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

contributed items

Plug-ins are “lazy loaded” as needed Example: Plug-in activated only when user selects its menu

item

Page 11: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Plug-in Architecture - Summary

All functionality provided by plug-ins Includes all aspects of Eclipse Platform itself Load on demand by separating declaration from

implementation

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

Easy to install and manage plug-ins

Page 12: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Agenda

Plug-in Architecture Eclipse Platform Example

Page 13: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Eclipse Platform

Eclipse Platform is the common baseConsists of several key components

Platform Runtime

Eclipse Platform

Workspace

Workbench

SWTJFace

Team Help Debug

Ant“Core”

“UI”

Page 14: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Workspace Component

Resources: files, folders, projects

Projects map to directories in file system

Workspace holds 1 or more top-level projects

Tools read, create, modify, and delete resources in workspace

Tree of folders and files

Page 15: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Workbench Component

SWT – generic low-level graphics and widget set JFace – UI frameworks for common UI tasks Workbench – UI look and feel of Eclipse Platform

Workbench

SWTJFace

Page 16: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

SWT

SWT = Standard Widget Toolkit Generic graphics and GUI widget set

buttons, lists, text, menus, trees, styled text...

OS-independent API Uses native widgets where available Emulates widgets where unavailable

Workbench

SWTJFace

Page 17: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

JFace

JFace is higher level UI framework built on SWT Classes for handling common UI tasks API and implementation are window-system

independent Dialogs, preferences, wizards, tree, table, list widgets

Workbench

SWTJFace

Page 18: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Workbench Component

Workbench is UI personality of Eclipse Platform

UI paradigm centered around Editors Views Perspectives

Workbench

SWTJFace

Page 19: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Workbench Terminology

Tool bar

PerspectiveandFast Viewbar

ResourceNavigatorview

Stackedviews

Propertiesview

Tasksview

Outlineview

Bookmarksview

Menu bar

Messagearea

EditorStatusarea

Texteditor

Page 20: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Editors

Editors appear in workbench editor area Contribute actions to workbench menu and tool bars Open, edit, save, close lifecycle

Extension point for contributing new types of editors Example: JDT provides Java source file editor

Extensive text editor API and framework

Page 21: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Views

Views provide information on some object Views augment editors

Example: Outline view summarizes content

Views augment other views Example: Properties view describes selection

Extension point for new types of views Eclipse Platform includes many standard views

Resource Navigator, Outline, Properties, Tasks, Bookmarks, Search, …

Page 22: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Perspectives

Perspectives are arrangements of views and editors Different perspectives suited for different user tasks Extension point for new perspectives Eclipse Platform includes standard perspectives

Resource, Debug, …

Perspective API

Page 23: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Eclipse Platform - Summary

Eclipse Platform is the nucleus of IDE products Plug-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

Page 24: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Agenda

Plug-in Architecture Eclipse Platform Example

Page 25: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Plug-in example

Create a simple Backup Plug-in. Why? Eclipse has Export Functionality I use it often, don’t like typing, and want it tailored.

Page 26: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Requirements

Time stamp each backup Copy to a preset location Backup all open projects Backup all selected projects

Page 27: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Resources

www.eclipse.org Java Developer’s Guide To Eclipse, D’Anjou, et.al. www.planeteclipse.org IBM DeveloperWorks articles

C Judd: Building Eclipse plug-ins using Templates S Kellicker: Eclipse for Visual Studio Developers

[email protected]

Page 28: Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse. scott.kellicker@acm.org

Questions ?