org.eclipse.jface.text.information.InformationPresenter#install ( )源码实例Demo

下面列出了org.eclipse.jface.text.information.InformationPresenter#install ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: xtext-eclipse   文件: QuickTypeHierarchyHandler.java
@Override
protected void openPresentation(final XtextEditor editor, final IJavaElement javaElement,
		final EObject selectedElement) {
	final ISourceViewer sourceViewer = editor.getInternalSourceViewer();
	ITextRegion significantTextRegion = locationInFileProvider.getSignificantTextRegion(selectedElement);
	InformationPresenter presenter = new HierarchyInformationPresenter(sourceViewer, javaElement, new Region(significantTextRegion.getOffset(),significantTextRegion.getLength()));
	presenter.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING);
	presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
	IInformationProvider provider = new JavaElementProvider(editor, false);
	presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
	presenter.setInformationProvider(provider, IJavaPartitions.JAVA_DOC);
	presenter.setInformationProvider(provider, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
	presenter.setInformationProvider(provider, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
	presenter.setInformationProvider(provider, IJavaPartitions.JAVA_STRING);
	presenter.setInformationProvider(provider, IJavaPartitions.JAVA_CHARACTER);
	presenter.setSizeConstraints(50, 20, true, false);
	presenter.install(sourceViewer);
	presenter.showInformation();
}
 
源代码2 项目: uima-uimaj   文件: AnnotationEditor.java
/**
 * Initializes a new instance.
 */
ShowAnnotationContextEditAction() {
  mPresenter = new InformationPresenter(new AnnotationEditingControlCreator());

  mPresenter.setInformationProvider(new AnnotationInformationProvider(AnnotationEditor.this),
          org.eclipse.jface.text.IDocument.DEFAULT_CONTENT_TYPE);
  mPresenter.setDocumentPartitioning(org.eclipse.jface.text.IDocument.DEFAULT_CONTENT_TYPE);
  mPresenter.install(getSourceViewer());
}
 
public void installOutlinePresenter(final LangSourceViewer sourceViewer) {
	
	InformationPresenter presenter = new InformationPresenter(getOutlinePresenterControlCreator(sourceViewer));
	
	presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
	presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
	
	IInformationProvider provider = new StructureElementInformationProvider(sourceBuffer); 
	
	for(String contentType : getConfiguredContentTypes(sourceViewer)) {
		presenter.setInformationProvider(provider, contentType);
	}
	
	presenter.setSizeConstraints(50, 20, true, false);
	
	presenter.install(sourceViewer);
	sourceViewer.setOutlinePresenter(presenter);
}