Getting Started with RCP (Rich Client Platform) (2)

xiaoxiao2021-03-06  110

2, RCP Getting Started

(1) Steps to implement RCP applications

l Logo extension point

l Define the Plugin list file

l Implementation

l Definition perspective

l Define the WorkbenChadvisor class

l Defining the Application class

l Export application

(2) Creating a project

l File> New> Plug-in Project

l Enter the project name Google, keep other default values, click Next

l Type com.xqtu.google.googleplugin in the Class Name field

l Click Finish to complete the project creation

(3) Understand plug-in list

l Eclipse generates an item, there will be a lot of related files, where the most important thing is plugin list file plugin.xml

l Plugin.xml is located on the root directory of the project, which is responsible for defining the resource, dependency and extension of the Eclipse runtime environment.

l Eclipse provides a plug-in list editor, and each tab at the bottom provides an easy way to access and operate the plugin.xml specific part.

l The source file of Plugin.xml is displayed, the content of the plug-in list of the wizard initially generated is as follows

ID = "Google"

Name = "Google Plug-in"

Version = "1.0.0"

Provider-name = "Nelson_tu"

Class = "com.xqtu.google.googleplugin">

l Tag Description The basic content of the plugin has the following five attributes:

l id: Insert unique identifier; in order to reduce naming conflicts, it should be obtained from the plug-in author's Internet domain name, and its naming agreement and Java naming agreement are consistent, such as class package.

l Name: Plugin General Name

l Version - Plug-in version, format is Major.minor.Service

l Provider-name: Plugin author

l Class - Plug-in full path; although the plugin class is defined, the RCP application does not use this class when executed.

l section You can set the L tag for the genernal information section of the OverView page Define the run library required by the plugin; use the tag to list each runtime; tag is specified to export the entire library ( Use *), or under the specific package (listed with multiple tags)

l section can be set in the Runtime page

l Tag Defines the dependency of other plugins; lists each plugin using the tag

l section can be set in the DependenCies page

(4) Understanding expansion

l Eclipse platform provides high scalability using relatively small operating environment and its exquisite plug-in architecture

l Add new features to the running environment by using plugins

l Each plugin can contain any number of expansions using extended points

L, the plugin can also define your own set of extensions so that other developers can use in their plug-in or RCP applications.

l In this example, we have to define two extensions.

ID = "Google"

Name = "Google Plug-in"

Version = "1.0.0"

Provider-name = "Nelson_tu"

Class = "com.xqtu.google.googleplugin">

ID = "GoogleApplication"

Point = "org.eclipse.core.runtime.Applications">

Point = "Org.eclipse.ui.Perspectives">

Class = "com.xqtu.google.googlePerspective"

Name = "Google"

ID = "com.xqtu.google.googlePerspective" />

l Define the first extension through org.eclixse.core.runtime.Applications, declare the entry point for the RCP application; ID attribute identifies the application

l Tag Specifies the full path to the RCP application startup class

l Define the second extension through org.eclipse.ui.Perspectives, which defines a perspective of the RCP to the General Table

l tag Defines a perspective graphic full path (Class property), perspective name (Name property) and unique identifier (ID attribute)

l section can be set in the extensions page

转载请注明原文地址:https://www.9cbs.com/read-125375.html

New Post(0)