stamp

          2006年與我同在

           

          文本編輯器的輔助提示

              在進行文本編輯器的開發時候,經常會遇到對相關內容的提示,可以通過如下代碼實現SourceViewerConfiguration的
          public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
           {
               ContentAssistant assistant = new ContentAssistant();
               assistant.setContentAssistProcessor   (new   XMLCompletionProcessor (),  XMLPartitionScanner.XML_TAG);
               assistant.enableAutoActivation(true);
               assistant.setAutoActivationDelay(250);
               assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
               assistant.setProposalSelectorBackground(ColorManager.background);
               assistant.setProposalSelectorForeground(ColorManager.foreground);
               return assistant;
           }
          其中XMLCompletionProcessor 主要實現IContentAssistProcessor接口,內容輔助主要實現接口中的
          public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset)
           {
              for (int i = 0; i < 5;i++)
             {
                  result[i] = new CompletionProposal("bbb", documentOffset, 0, 3, null,     
                             "aaa",null, "");
             }  
             return result;
           }
          此時會在輔助框中出現5個aaa,當確定后,補充到文本編輯器的相應位置是bbb,具體參數的說明請見API說明。

          posted on 2005-09-23 20:57 stamp 閱讀(469) 評論(0)  編輯  收藏 所屬分類: Eclipse開發

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 富宁县| 谢通门县| 乌兰浩特市| 阿勒泰市| 沭阳县| 澜沧| 新化县| 怀安县| 丹江口市| 永吉县| 汪清县| 卢氏县| 安宁市| 肇庆市| 马山县| 都匀市| 新乡市| 岑溪市| 大埔县| 合肥市| 景谷| 安化县| 宁国市| 循化| 崇信县| 边坝县| 靖宇县| 加查县| 丹东市| 施秉县| 平定县| 瓮安县| 肃南| 宜兴市| 宁化县| 成都市| 余庆县| 永寿县| 沿河| 华阴市| 加查县|