當前位置: 首頁>>代碼示例>>Java>>正文


Java IContentAssistant.getContentAssistProcessor方法代碼示例

本文整理匯總了Java中org.eclipse.jface.text.contentassist.IContentAssistant.getContentAssistProcessor方法的典型用法代碼示例。如果您正苦於以下問題:Java IContentAssistant.getContentAssistProcessor方法的具體用法?Java IContentAssistant.getContentAssistProcessor怎麽用?Java IContentAssistant.getContentAssistProcessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.text.contentassist.IContentAssistant的用法示例。


在下文中一共展示了IContentAssistant.getContentAssistProcessor方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLanguageElementAt

import org.eclipse.jface.text.contentassist.IContentAssistant; //導入方法依賴的package包/類
/**
 * Get language at given offset
 * 
 * @param offset
 * @param textViewer
 * @return language element or <code>null</code>
 */
protected HoverDataRegion getLanguageElementAt(int offset, ITextViewer textViewer) {
	IContentAssistant assist = gradleSourceViewerConfiguration.getContentAssistant(sourceViewer);
	if (assist == null) {
		return null;
	}
	IContentAssistProcessor processor = assist.getContentAssistProcessor(contentType);
	if (!(processor instanceof GradleContentAssistProcessor)) {
		return null;
	}
	GradleContentAssistProcessor gprocessor = (GradleContentAssistProcessor) processor;
	String allText = textViewer.getDocument().get();
	RelevantCodeCutter codeCutter = this.codeCutter;
	Model model = gprocessor.getModel();
	GradleFileType fileType = gradleSourceViewerConfiguration.getFileType();
	GradleLanguageElementEstimater estimator = gprocessor.getEstimator();

	HoverData data = hoverSupport.caclulateHoverData(allText, offset, codeCutter, model, fileType, estimator);
	if (data == null) {
		return null;
	}
	return new HoverDataRegion(data);
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:30,代碼來源:GradleTextHover.java

示例2: internalComputeCompletionProposals

import org.eclipse.jface.text.contentassist.IContentAssistant; //導入方法依賴的package包/類
/**
 * Internally compute completion proposals.
 *
 * @param cursorPosition
 *          the position of the cursor in the {@link IXtextDocument}
 * @param xtextDocument
 *          the {@link IXtextDocument}
 * @return a pair of {@link ICompletionProposal}[] and {@link BadLocationException}. If the tail argument is not {@code null}, an exception occurred in the UI
 *         thread.
 */
private Pair<ICompletionProposal[], BadLocationException> internalComputeCompletionProposals(final int cursorPosition, final IXtextDocument xtextDocument) {
  XtextSourceViewerConfiguration configuration = get(XtextSourceViewerConfiguration.class);
  Shell shell = new Shell();
  try {
    ISourceViewer sourceViewer = getSourceViewer(shell, xtextDocument, configuration);
    IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
    String contentType = xtextDocument.getContentType(cursorPosition);
    IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(contentType);
    if (processor != null) {
      return Tuples.create(processor.computeCompletionProposals(sourceViewer, cursorPosition), null);
    }
    return Tuples.create(new ICompletionProposal[0], null);
  } catch (BadLocationException e) {
    return Tuples.create(new ICompletionProposal[0], e);
  } finally {
    shell.dispose();
  }
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:29,代碼來源:AcfContentAssistProcessorTestBuilder.java

示例3: createCompletionProposalComputer

import org.eclipse.jface.text.contentassist.IContentAssistant; //導入方法依賴的package包/類
/**
 * Helper function to find the correct CompletionProposalComputer for the given offset.
 *
 * @param offset
 *          offset in test file
 * @return language and offset specific content assist proposal computer
 */
private CompletionProposalComputer createCompletionProposalComputer(final int offset) {
  XtextSourceViewerConfiguration configuration = getEditor().getXtextSourceViewerConfiguration();
  IContentAssistant contentAssistant = configuration.getContentAssistant(getViewer());
  IContentAssistProcessor contentAssistProcessor;
  try {
    contentAssistProcessor = contentAssistant.getContentAssistProcessor(getDocument().getContentType(offset));
  } catch (BadLocationException e) {
    contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
  }
  if (contentAssistProcessor == null) {
    contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
  }
  return new CompletionProposalComputer((State) contentAssistProcessor, (ITextViewer) getViewer(), offset);
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:22,代碼來源:AbstractContentAssistUiTest.java

示例4: requestProposals

import org.eclipse.jface.text.contentassist.IContentAssistant; //導入方法依賴的package包/類
/**
 * Requests proposals in the last location of the given editor.
 */
protected ICompletionProposal[] requestProposals(String mod1Contents, PyEdit editor) {
    editor.setSelection(mod1Contents.length(), 0);
    IContentAssistant contentAssistant = editor.getEditConfiguration().getContentAssistant(
            editor.getPySourceViewer());
    SimpleAssistProcessor processor = (SimpleAssistProcessor) contentAssistant
            .getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE);
    processor.doCycle(); //we want to show the default completions in this case (not the simple ones)
    ICompletionProposal[] props = processor.computeCompletionProposals(editor.getPySourceViewer(),
            mod1Contents.length());
    return props;
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:15,代碼來源:AbstractWorkbenchTestCase.java


注:本文中的org.eclipse.jface.text.contentassist.IContentAssistant.getContentAssistProcessor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。