题记:
最近在上课,花了4500闷,有段时间没写博客了。因为马上要开启人生中重要的新职业生涯,也来充充电。
Technical Overview:
When people speak of Eclipse, they very often mean the Eclipse Software Development Kit (SDK)
which is both the leading Java™ integrated development environment (IDE) and the single best tool
available for building products based on the Eclipse Platform.
The Eclipse SDK, a critical piece of the Eclipse tapestry, is a combination of the efforts of several Eclipse projects, including Platform [http://eclipse.org/platform], Java Development Tools (JDT [http://eclipse.org/jdt]), and the Plug-in Development Environment (PDE [http://eclipse.org/pde]).
the Eclipse Platform is itself a composition of components; by using a subset of these components, it is possible to build arbitrary applications.
it is a foundation for building arbitrary tools and applications.As the name "rich client" implies, clipse RCP is an excellent platform for building applications that work in conjunction with application servers, databases,and other backend resources to deliver a rich user experience on the desktop.
Integration extends into the rich client space as well. An organization can split up the development of application components across development teams and then integrate the results using the Eclipse Rich Client Platform. This doesn't trivialize the process of developing large scale applications, but it does make the integration easier.
The Eclipse Platform is built on a mechanism for discovering, integrating, and running modules called plug-ins, which are in turn represented as bundles based on the OSGi [http://osgi.org] specification. A tool provider writes a tool as a separate plug-in that operates on files in the workspace and surfaces its tool-specific UI in the workbench. When the Platform is launched, the user is presented with an integrated development environment (IDE) composed of the set of available plug-ins. The quality of the user experience depends significantly on how well the tools integrate with the Platform and how well the various tools work with each other.
functions:
A plug-in is the smallest unit of Eclipse Platform function that can be developed and delivered separately. Usually a small tool is written as a single plug-in, whereas a complex tool has its
functionality split across several plug-ins. Except for a small kernel known as the Platform Runtime, all of the Eclipse Platform's functionality is located in plug-ins.Plug-ins are coded in Java. A typical plug-in consists of Java code in a Java Archive (JAR) library, some read-only files, and other resources such as images, web templates, message catalogs, native code libraries, etc. Some plug-ins do not contain code at all.
Extension:
A plug-in’s extension points can be extended by other plug-ins. For example, the workbench plug-in declares an extension point for user preferences. Any plug-in can contribute its own user preferences by defining extensions to this extension point. An extension point may have a corresponding API interface. Other plug-ins contribute implementations of this interface via extensions to this extension point. Any plug-in is free to define new extension points and to provide new API for other plug-ins to use.
Manifest:
A plug-in's manifest is represented by a pair of files. The manifest.mf file is an OSGi bundle manifest describing the plug-ins runtime dependencies; the plugin.xml file is an XML-based description of the plug-in’s extensions and extension points. An extension point may declare additional specialized XML element types for use in the extensions. This allows the plug-in supplying the extension to communicate arbitrary information to the plug-in declaring the corresponding extension point. Moreover, extension and extension point information is available from the plug-in registry without activating the contributing plug-in or loading of any of its code. This property is key to supporting a large base of installed plug-ins only some of which are needed in any given user session. Until a plug-in's code is loaded, it has a negligible memory footprint and impact on start-up time. Using an XML-based plug-in manifest also makes it easier to write tools that support plug-in creation. The Plug-In Development Environment (PDE), which is included in the Eclipse SDK, is such a tool.
Activate:
A plug-in is activated when its code actually needs to be run. Once activated, a plug-in uses the plug-in registry to discover and access the extensions contributed to its extension points. For example, the plug-in declaring the user preference extension point can discover all contributed user preferences and access their display names to construct a preference dialog. This can be done using only the information from the registry, without having to activate any of the contributing plug-ins. The contributing plug-in will be activated when the user selects a preference from a list. Activating plug-ins in this manner does not happen automatically; there are a small number of API methods for explicitly activating plug-ins. Once activated, a plug-in remains active until it is explicitly deactivated or the Platform shuts down. Each plug-in is furnished with a subdirectory in which to store plug-in-specific data; this mechanism allows a plug-in to carry over important state between runs.
By determining the set of available plug-ins up front, and by supporting a significant exchange of information between plug-ins without having to activate any of them, the Platform can provide each plug-in with a rich source of pertinent information about the context in which it is operating. This context cannot change while the Platform is running, so there is no need for complex life cycle events to inform plug-ins when the context changes.
In one JVM:
The Eclipse Platform is run by a single invocation of a standard Java virtual machine. Each plug-in is assigned its own Java class loader that is solely responsible for loading its classes (and Java resource bundles). Each plug-in explicitly declares its dependence on other plug-ins from which it expects to directly access classes, and controls the visibility of the public classes and interfaces in its libraries. This information is declared in the plug-in manifest file; the visibility rules are enforced at runtime by the plug-in class loaders.
Creating a plugin
1,创建bundle。
plugin是eclipse平台最小的单位,几乎所有的东西都是plugins。eclipse平台的PDE给开发plugin提供了简化的图形界面操作,并提供了很多模版,比如创建SampleView,详细步骤见:http://www.ibm.com/developerworks/cn/lotus/notes-plugin-eclipse/ 。
于是我动手验证了下,果然比较简约,很快能制作出一个简单的plugin出来。
今天听了GUOYI的tranning才知道还要创建feature 和 update site。
2,创建feature
在eclipse中提供了直接创建feature的project,把刚才的bundle加入进来就可以了。
3,创建update site
和创建feature类似,很简单。
其实eclipse是一个平台,IDE是它提供最基本的内容,同时他就像操作系统一样,你可以在他之上扩展很多功能,包括现在很多产品都开发在它之上。bundle的灵活热拔插和扩展性提供了较友好的管理。