Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Plug-in Development Environment (PDE) Guide. 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working.

Similar presentations


Presentation on theme: "1 Plug-in Development Environment (PDE) Guide. 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working."— Presentation transcript:

1 1 Plug-in Development Environment (PDE) Guide

2 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working inside the platform workbench. »provides a set of platform extension contributions (views, editors, perspectives, etc.) that collectively streamline the process of developing plug-ins inside the workbench. »based on the platform and the Java development tooling (JDT).

3 3 Conecpts l PDE identifies plug-in projects in the workspace by the existence of the special plugin.xml manifest file under the project. »also associate a special PDE nature with these projects to be able to attach special PDE builders l Host and run-time workbench instances »host instance: the workbench that you use to develop your plug-in. »run-time instance: the wrokbench that yu use to test/run your plug-in. »contains the same set of plug-ins as host instance and the additional developed plug-in.

4 4 External vs. workspace plug-ins l Run-time workbench instance contains two types of plug- ins: those from the host and those from the workspace. »External plug-ins are those from the original host and are considered read-only. »Workspace plug-ins are those plug-ins under development in your host workbench. l plug-ins are treated differently by PDE because of their location. »Ex: opening the plug-in manifest of a workspace plug- in will launch an editor on that manifest file in the workspace. The same operation for an external plug- in will launch an editor on an external URL.

5 5 Configuring PDE l PDE is part of the platform SDK, but it may or may not be present in your particular installation. l run-time instance configuration: »set the run-time workbench instance path. –This is the path of the workbench installation that will be used to run and debug your plug-ins. –default is the same as that of host workbench. »set the workspace of your run-time platform. –it is important to use different workspaces for your host and run-time platform »select external plug-ins used by the run-time instance.(preference > PDE > target Platform)

6 6 Setting up the workbench l using the default workbench PDE perspective »(window > open perspective > PDE ) l two new views: »error log »plug-in registry.

7 7 Eclipse Plug-Ins developer guide Simple Plug-in Example

8 8 l Eclipse platform = a core runtime engine + a set of additional features that are installed as platform plug-ins. l Plug-ins contribute functionality to the platform by contributing to pre-defined extension points. l The workbench UI is contributed by one such plug-in. »When you start up the workbench, you are not starting up a single Java program. You are activating a platform runtime which can dynamically discover registered plug-ins and start them as needed.

9 9 Make your code a plug-in l Decide how your plug-in will be integrated with the platform. l Identify the extension points that you need to contribute in order to integrate your plug-in. l Implement these extensions according to the specification for the extension points. l Provide a manifest file (plugin.xml) that describes »the extensions you are providing and »the packaging of your code.

10 10 The HelloWorld plug-in public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } l There are many ways to make this a plug-in. »Extend this plug-in as a view now.

11 11 Hello world view l extend org.eclipse.ui.part.ViewPart [which]implements l org.eclipse.ui.IViewPart l Standard Views often display some information about an object that the user has selected or is navigating. »Views update their contents based on actions that occur in the workbench. In our case, we are just saying hello, so our view is quite simple.

12 12 Using the tools to write our plug-in l can use any editors/tools to build your plug-in, but use Eclipse Java IDE in this example. l procedure to start: 1.create a project to do your work (use the new project wizard) –use org.eclipse.examples.helloworld as the name and id of your plug-in. –choose Create a blank plug-in project on the code generators page. 2.Create a package org.eclipse.examples.helloworld underneath the src directory for the project. 3.Create a new class called HelloWorldView in this package.

13 13 Writing the code package org.eclipse.examples.helloworld; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.SWT; import org.eclipse.ui.part.ViewPart; public class HelloWorldView extends ViewPart { Label label; public HelloWorldView() { } public void createPartControl(Composite parent) { label = new Label(parent, SWT.WRAP); label.setText("Hello World"); }

14 14 public void setFocus() { /* set focus to my widget. For a label, this doesn't make much sense, but for more complex sets of widgets, you would decide which one gets the focus. */ }


Download ppt "1 Plug-in Development Environment (PDE) Guide. 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working."

Similar presentations


Ads by Google