Chinaunix首页 | 论坛 | 博客
  • 博客访问: 194226
  • 博文数量: 69
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 720
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-03 11:35
文章分类

全部博文(69)

文章存档

2011年(13)

2010年(46)

2009年(10)

我的朋友

分类: Java

2010-08-06 17:21:47

Eclipse Plug-in 简记 (1)

 

@ http://zcatt.cublog.cn

 

Hist:

20100806, draft

 

 

 

1.  Plug-in的配置设置(runtime preferences)

配置的范围(the scope of a preference)描述的是preference的作用范围. scope也决定了preference的存储位置.

1.       instance, 每个workspaceinstance有一份

2.       configuration, 一个安装就一份, 也就是说这个安装后, 所有的instance, workspace都将一样, 共同使用这个configuration.

3.       default, 默认值, 用户一般不能变动, default存于pluginfeature. 也就是说, 写死的固定值.

 

所以, 对于Instanceconfiguration, 都需要与作用的对象相关, 一般是plug-inid.

 

主要package, interfaceclass:

IPreferencesService,  Preferences

 

 

2. Runtime application model

eclipse按照 OSGi Application Admin service specification实现了app container. app container负责发现app, 并为每一个app注册一个ApplicationDescriptor.

 

default applicationeclipse启动后app container运行的默认app, 可配置.

 

主要package, interfaceclass:

org.osgi.service.application, org.eclipse.core.runtime.applications

 

3. Content types

Content type(内容类型)描述的是数据流如何解读, 例如使用的字符集(charset), 字节序(byte order), 以及其它定制的特性. IContentTypeManager提供了方法侦测数据流的content type. 如果提供文件名信息, 采用文件名后缀判定的方法, 是一个效率较好的方法.

 

定义一个content type的例子, 一个txt, 一个派生自txtxml, 一个alaise占位.

 

  

     

          

                 priority="high"

                 file-extensions="txt">

                               

                

                

          

             

                 base-type="org.eclipse.core.runtime.text"

                 priority="high"

                 file-extensions="xml">           

                

                

          

                        

          

                 base-type="org.eclipse.core.runtime.text"

                 alias-for="org.eclipse.jdt.core.javaProperties"

                 file-extensions="properties">

                

                       

          

 

 

主要package, interfaceclass:

IContentTypeManager, IContentType, IContentDescription

 

主要的extension point:

org.eclipse.core.runtime.contentTypes

 

 

4. Concurrency infrastructure

 

eclipse中的job相当于javathread, job family相当与javathread group.

Jobeclipse中可以异步工作的最小单位, plugin 创建job, job被放到eclipse platform管理的job queue中进行调度, 完成生命周期.

状态图 state machine 如下:

 

state NONE    1. ----ableToRun----->  state RUN ;  2. ---------scheduled------> state WAITING

state RUN      1. ------done-------> state NONE;   2. ------scheduled-----> state WAITING

state WAITING  1.-----done------>state WAITING;  2. -------ableToRun---->state RUNNING; 3. -------sleeping------> state SLEEPING

state SLEEPING  1. -----awake------> state WAITING

 

Jobs的集中管理可以借助job manager, IJobManager.

 

   IJobManager jobMan = Platform.getJobManager();

 

 

主要package,interfaceclass:

org.eclipse.core.runtime.jobs

IJobChangeListener, IJobManager, IJobStatus, Job

 

主要extension point:  n/a

 

REF

1.       Eclipse Platform plug-in Developer Guide

2.       Eclipse Plug-in Development Environment Guide
Locations of visitors to this page

阅读(1623) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~