Search in sources :

Example 1 with JavaElementProvider

use of org.eclipse.jdt.internal.ui.text.JavaElementProvider in project xtext-eclipse by eclipse.

the class QuickTypeHierarchyHandler method openPresentation.

@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();
}
Also used : JavaElementProvider(org.eclipse.jdt.internal.ui.text.JavaElementProvider) ITextRegion(org.eclipse.xtext.util.ITextRegion) IInformationProvider(org.eclipse.jface.text.information.IInformationProvider) Region(org.eclipse.jface.text.Region) ITextRegion(org.eclipse.xtext.util.ITextRegion) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter)

Example 2 with JavaElementProvider

use of org.eclipse.jdt.internal.ui.text.JavaElementProvider in project xtext-eclipse by eclipse.

the class JvmImplementationOpener method openQuickHierarchy.

protected void openQuickHierarchy(ITextViewer textViewer, IJavaElement element, IRegion region) {
    HierarchyInformationPresenter presenter = new HierarchyInformationPresenter((ISourceViewer) textViewer, element, region);
    presenter.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING);
    presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
    IInformationProvider provider = new JavaElementProvider(null, 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(textViewer);
    presenter.showInformation();
}
Also used : JavaElementProvider(org.eclipse.jdt.internal.ui.text.JavaElementProvider) HierarchyInformationPresenter(org.eclipse.xtext.xbase.ui.hierarchy.HierarchyInformationPresenter) IInformationProvider(org.eclipse.jface.text.information.IInformationProvider)

Aggregations

JavaElementProvider (org.eclipse.jdt.internal.ui.text.JavaElementProvider)2 IInformationProvider (org.eclipse.jface.text.information.IInformationProvider)2 Region (org.eclipse.jface.text.Region)1 InformationPresenter (org.eclipse.jface.text.information.InformationPresenter)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 ITextRegion (org.eclipse.xtext.util.ITextRegion)1 HierarchyInformationPresenter (org.eclipse.xtext.xbase.ui.hierarchy.HierarchyInformationPresenter)1