<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    精彩的人生

    好好工作,好好生活

    BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
      147 Posts :: 0 Stories :: 250 Comments :: 0 Trackbacks
    其實(shí)很多人都問到了這個(gè)問題。目前插件的安裝是需要重啟的,但是很多情況下是有不重啟而安裝插件的需求。我找到的一點(diǎn)資料,應(yīng)該會(huì)有幫助



    FAQ How do I make my plug-in dynamic aware?

    From Eclipsepedia




    Dynamic awareness requires extra steps that were not required prior to the introduction of dynamic plug-ins. Dynamic awareness requires that you remove all references to classes defined in other plug-ins when those plug-ins are removed from the system. In particular, if your plug-in defines extension points that load classes from other plug-ins—executable extensions—you need to discard those references when other plug-ins are dynamically removed. The extension registry allows you to add a listener that notifies you when extensions are being added or removed from the system. If your plug-in maintains its own cache of extensions that are installed on your extension point, your listener should update this cache for each added or removed extension.



    The following is an example of a simple class that maintains its own cache of the set of extensions installed for a given extension point. This example is a bit contrived as simply caching the extension objects has no value. Typically, your plug-in will process the extensions to extract useful information and possibly load one or more classes associated with that extension. The basic structure of this cache example is as follows:

       public class ExtCache implements IRegistryChangeListener {
          private static final String PID = "my.plugin";
          private static final String PT_ID = 
             PID + "." + "extension.point";
          private final HashSet extensions = new HashSet();
          ...
       }
    

    The extensions field stores the set of installed extensions for a particular extension point.



    The cache has a startup method that loads the initial set of extensions and then adds an extension registry listener in order to be notified of future changes:

       public void startup() {
          IExtensionRegistry reg = Platform.getExtensionRegistry();
          IExtensionPoint pt = reg.getExtensionPoint(PT_ID);
          IExtension[] ext = pt.getExtensions();
          for (int i = 0; i < ext.length; i++)
             extensions.add(ext[i]);
          reg.addRegistryChangeListener(this);
       }
    

    The class implements the IRegistryChangeListener interface, which has a single method that is called whenever the registry changes:

       public void registryChanged(IRegistryChangeEvent event) {
          IExtensionDelta[] deltas = 
                              event.getExtensionDeltas(PID, PT_ID);
          for (int i = 0; i < deltas.length; i++) {
             if (deltas[i].getKind() == IExtensionDelta.ADDED)
                extensions.add(deltas[i].getExtension());
             else
                extensions.remove(deltas[i].getExtension());
          }
       }
    

    This class is now dynamic aware but is not yet dynamic enabled; that is, the class does not yet support itself being dynamically removed. The final step is to implement a shutdown method that clears all values from the cache and removes the listener from the extension registry:

       public void shutdown() {
          extensions.clear();
          IExtensionRegistry reg = Platform.getExtensionRegistry();
          reg.removeRegistryChangeListener(this);
       }
    

    This shutdown method must be called from the shutdown method of the plug-in that defines the cache. For the complete source code of this example, see the ExtCache class in the FAQ Examples plug-in.



    Note that not only extensions points acquire and maintain references to classes defined in other plug-ins. You need to be especially aware of static fields and caches that contain references to objects whose class is defined in other plug-ins.

    If you hold onto classes defined in other plug-ins through different mechanisms, you also need to discard those references when those other plug-ins are removed.


    原文地址:http://wiki.eclipse.org/index.php/FAQ_How_do_I_make_my_plug-in_dynamic_aware%3F

    posted on 2006-03-23 11:16 hopeshared 閱讀(2580) 評論(0)  編輯  收藏 所屬分類: Eclipse
    主站蜘蛛池模板: a国产成人免费视频| 无码乱肉视频免费大全合集| 婷婷久久久亚洲欧洲日产国码AV| 久久久久国色av免费看| 亚洲一区二区三区成人网站| 在线亚洲高清揄拍自拍一品区| 成人免费午夜视频| 91视频免费观看| 亚洲色偷偷色噜噜狠狠99| 国产午夜亚洲精品午夜鲁丝片| 麻豆一区二区免费播放网站| 一级一看免费完整版毛片| 无码欧精品亚洲日韩一区夜夜嗨 | 国产美女做a免费视频软件| 特级做A爰片毛片免费看无码| 亚洲人成www在线播放| 国产成人亚洲综合无码精品| 免费观看毛片视频| 国产白丝无码免费视频| 亚洲综合在线成人一区| 亚洲成?Ⅴ人在线观看无码| 久视频精品免费观看99| eeuss影院免费直达入口| 精品日韩99亚洲的在线发布| 久久亚洲国产午夜精品理论片| 成人男女网18免费视频| 久久一本岛在免费线观看2020| 日韩在线视频播放免费视频完整版| 国产亚洲精品a在线观看| 国产美女在线精品免费观看| 亚洲av日韩av永久在线观看| 亚洲性日韩精品一区二区三区 | 69堂人成无码免费视频果冻传媒| 亚洲精品偷拍视频免费观看| 亚洲高清一区二区三区电影| 亚洲高清资源在线观看| 亚洲精品无码久久一线| 男人的好免费观看在线视频| 男人进去女人爽免费视频国产| 黄色免费在线观看网址| 91情国产l精品国产亚洲区 |