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 閱讀(468) 評論(0)  編輯  收藏 所屬分類: Eclipse開發

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 南京市| 唐海县| 庆元县| 海安县| 米易县| 靖江市| 松潘县| 凌海市| 新宁县| 辽中县| 华安县| 乐业县| 西充县| 南华县| 丰镇市| 尉氏县| 韶山市| 广州市| 南昌市| 涡阳县| 隆化县| 大同县| 逊克县| 修文县| 依安县| 玛纳斯县| 南澳县| 苍南县| 峨眉山市| 高邮市| 峨山| 汝南县| 精河县| 郎溪县| 汕尾市| 西青区| 乾安县| 岳西县| 太湖县| 泰顺县| 饶平县|