<source id="4vppl"><ins id="4vppl"></ins></source>
<u id="4vppl"><sub id="4vppl"><label id="4vppl"></label></sub></u>
<object id="4vppl"></object>
  • <u id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></u>

    <object id="4vppl"></object>
    <b id="4vppl"><sub id="4vppl"><tr id="4vppl"></tr></sub></b>

      <i id="4vppl"><thead id="4vppl"></thead></i>

      <thead id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></thead>

      當(dāng)前位置:首頁 > 網(wǎng)站舊欄目 > 學(xué)習(xí)園地 > 設(shè)計軟件教程 > TextActionHandler的使用以及對EditingDomainActionBarContributor的定制

      TextActionHandler的使用以及對EditingDomainActionBarContributor的定制
      2010-01-14 22:54:48  作者:  來源:

      在使用Eclipse Forms Editor對EMF model進行編輯的時候,由于editor的contributor是繼承EditingDomainActionBarContributor,因此Cut, Copy,Paste都是使用EMF的Cut,Copy和Paste,這樣在Editor中進行的所有操作都將轉(zhuǎn)換為對EMF model的操作,對于Viewer上的節(jié)點來說當(dāng)然沒有什么問題,但是如果是使用Text來進行文本編輯的時候,我們希望執(zhí)行的是Text中文本的Cut,Copy和Paste,這里就需要將EMF的Action重定向到系統(tǒng)的Global Action,開始試了各種辦法,都沒有成功,后來google了一下,發(fā)現(xiàn)不僅我碰到了這個問題,還有很多人也碰到了同樣的問題:http://dev.eclipse.org/newslists/news.eclipse.platform/msg53441.html, 同時也找到了相關(guān)的解決辦法:http://www.eclipsezone.com/eclipse/forums/t62058.rhtml
      不過我按照這個上面的做法稍微調(diào)整了一下圓滿解決了我的問題。

      從上面的解決方法中我們發(fā)現(xiàn)了TextActionHandler這樣一個類,它就是用來將ActionBarContributor定義的各種action在遇到指定的text時重定向到系統(tǒng)的global action。用法分四部分:
      第一部分就是在初始化ActionBarContributor的時候創(chuàng)建該對象:

      java 代碼
       
      1. textActionHandler = new TextActionHandler(actionBars);  

       

      緊接著就是將ActionBarContributor中創(chuàng)建的各種action先保存在textActionHandler,這樣在由TextActionHandler的global action撤回的時候能找到對應(yīng)的各種action:

      java 代碼
      1. textActionHandler.setCopyAction(copyAction);   
      2. textActionHandler.setCutAction(cutAction);   
      3. textActionHandler.setDeleteAction(deleteAction);   
      4. textActionHandler.setPasteAction(pasteAction);   

      告訴TextActionHandler哪個Text的action需要進行重定向,即那個Text Widget獲得焦點的時候:
       

      java 代碼
      1. textActionHandler.addText(text);  


      告訴TextActionHandler哪個Text的action需要撤回,即那個Text Widget失去焦點的時候:

      java 代碼
      1. textActionHandler.removeText(text);   

      安徽新華電腦學(xué)校專業(yè)職業(yè)規(guī)劃師為你提供更多幫助【在線咨詢
      国产午夜福三级在线播放_亚洲精品成a人片在线观看_亚洲自慰一区二区三区_久久棈精品久久久久久噜噜
      <source id="4vppl"><ins id="4vppl"></ins></source>
      <u id="4vppl"><sub id="4vppl"><label id="4vppl"></label></sub></u>
      <object id="4vppl"></object>
    1. <u id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></u>

      <object id="4vppl"></object>
      <b id="4vppl"><sub id="4vppl"><tr id="4vppl"></tr></sub></b>

        <i id="4vppl"><thead id="4vppl"></thead></i>

        <thead id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></thead>
        婷婷开心深爱五月天播播 | 日韩精品色婷婷免费视频 | 亚洲精品A区在线 | 日本一区二区三区三州在线观看视频 | 色依依国内精品中文字幕 | 欧美亚洲日韩另类中文字幕20 |