org.eclipse.jface.text.hyperlink.IHyperlinkPresenter Java Examples

The following examples show how to use org.eclipse.jface.text.hyperlink.IHyperlinkPresenter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtextSourceViewerConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer) {
	IHyperlinkPresenter base = super.getHyperlinkPresenter(sourceViewer);
	try {
		SingleHoverShowingHyperlinkPresenter wrapper = new SingleHoverShowingHyperlinkPresenter((MultipleHyperlinkPresenter) base);
		Set<Class<?>> interfaces = Sets.newHashSet();
		Class<?> c = base.getClass();
		while(c != null) {
			Collections.addAll(interfaces, c.getInterfaces());
			c = c.getSuperclass();
		}
		IHyperlinkPresenter result = (IHyperlinkPresenter) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces.toArray(new Class[0]), wrapper);	
		return result;
	} catch(Exception e) {
		return base;
	}
}
 
Example #2
Source File: CalciteSourceViewerConfiguration.java    From mat-calcite-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer) {
	/* When using default implementation, the following exception appears:
  java.lang.IllegalStateException
at org.eclipse.jface.text.TextViewer.setHyperlinkPresenter(TextViewer.java:5712)
at org.eclipse.jface.text.source.SourceViewer.configure(SourceViewer.java:491)
at CalcitePane.createPartControl(CalcitePane.java:84)
at org.eclipse.mat.ui.editor.MultiPaneEditor.addPage(MultiPaneEditor.java:585)
at org.eclipse.mat.ui.editor.MultiPaneEditor.addPage(MultiPaneEditor.java:574)
at org.eclipse.mat.ui.editor.MultiPaneEditor.doAddNewPage(MultiPaneEditor.java:552)
at org.eclipse.mat.ui.editor.MultiPaneEditor.addNewPage(MultiPaneEditor.java:535)
at org.eclipse.mat.ui.editor.MultiPaneEditor.addNewPage(MultiPaneEditor.java:489)
at OpenCalciteAction.run(OpenCalciteAction.java:22)
	 */
	return null;
}
 
Example #3
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
{
	RGB rgb = getCurrentTheme().getForegroundAsRGB("hyperlink"); //$NON-NLS-1$
	return new MultipleHyperlinkPresenter(rgb);
}
 
Example #4
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public void setHyperlinkPresenter(IHyperlinkPresenter hyperlinkPresenter) throws IllegalStateException {
    viewer.setHyperlinkPresenter(hyperlinkPresenter);
}