<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>

      當前位置:首頁 > 網站舊欄目 > 學習園地 > 設計軟件教程 > TextEditor原理分析筆記

      TextEditor原理分析筆記
      2010-01-14 22:59:00  作者:  來源:

      Editor的語法著色原理:Eclipse使用damage ,repair和reconcile模型來實現語法著色功能,當用戶每次修改了document,Reconciler就會去計算文檔中哪些可視區域是無效的以及如何去repair之:這里的damage表示需要重新加以顯示的文本,repair則表示重新進行顯示的方式,而reconcile則是這個重新顯示的過程.為了定制damage和repair,需要給TextEditor配置自定義的SourceViewerConfigration,TextEditor中的主要組成部分叫SourceViewer,默認情況下SourceViewer不支持語法著色功能,而通過擴展SourceViewerConfiguration就可以對SourceViewer進行定制,通過復寫SourceViewerConfiguration的getPresentationReconciler()方法就可以定制我們自己的Reconciler,定制Reconciler主要是給其配置相關的Damager和Repairer,而這兩個東東又會跟RuleScanner關聯:

      java 代碼
       
      1. PresentationReconciler reconciler = new PresentationReconciler();   
      2. DefaultDamagerRepairer dr = new DefaultDamagerRepairer (getTagScanner());   
      3. reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);   
      4. reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);  


      RuleScanner定義了各種用于區分各種Token的規則以及相關的TextAttribute(顏色屬性就定義在里面)

      內容輔助功能的實現:需要改寫SourceViewerConfiguration.getContentAssistance()方法,而自動完成行為的設置通過定義不同的CompletionProcessor來實現, CompletionProcessor需要復寫getCompletionProposalAutoActivationCharacters()來告訴編輯器在輸入何種內容時給出自動提示的內容,同時還需要實現computeCompletionProposals()方法來告訴要顯示的提示內容(completion proposal)


      安徽新華電腦學校專業職業規劃師為你提供更多幫助【在線咨詢
      国产午夜福三级在线播放_亚洲精品成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>
        亚洲精品综合网在线影院 | 先锋影音最新在线资源网 | 亚洲一线免费观看 | 亚洲国产精品激情在线观看 | 亚洲人成电影在线天堂色 | 中文字幕不卡在线 |