Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to create a FileLink for an external library resource
icon5.gif  How to create a FileLink for an external library resource [message #1153988] Fri, 25 October 2013 00:38
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi everyone,

I am trying to create a FileLink (similar to what Eclipse Console does for exception traces) for exception traces programmatically.

So far, through my Console IPatternMatchListener, I was able to retrieve the filename:linenumber pattern correctly, and using this pattern I was able to get the absolute path for the corresponding type (java file or class) using SearchEngine.searchAllTypeNames(..).

Everything works perfectly for files that already exist in my Eclipse workspace, the hyperlinks I create correctly open them. However for file that are referenced by the dependent projects, I keep getting an internal Eclipse exception.

Example: (or just Assert for SearchEngine)
resolves to absolute path
<home directory>\Eclipses\eclipse_4.3_dev\plugins\org.junit_4.11.0.v201303080030\junit.jar|org/junit/Assert.class

I create an IFile from this by
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

which creates the following IFile (when printed):

However, if I click on the hyperlink that I generate, I get the following error:
!ENTRY org.eclipse.ui 4 0 2013-10-24 17:32:43.192
!MESSAGE Unhandled event loop exception
	at org.eclipse.ui.part.FileEditorInput.getPath(
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(
	at org.eclipse.ui.internal.WorkbenchPage.access$21(
	at org.eclipse.ui.internal.WorkbenchPage$
	at org.eclipse.swt.custom.BusyIndicator.showWhile(
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(
	at org.eclipse.debug.ui.console.FileLink.linkActivated(
	at org.eclipse.ui.console.TextConsoleViewer$2.handleEvent(
	at org.eclipse.swt.widgets.EventTable.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Display.runDeferredEvents(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(
	at org.eclipse.ui.internal.Workbench$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(

I suspect that the absolute path I am giving to IFile is incorrect (since it has the path for the .jar file and then the fully qualified path for the class), but I do not know the correct format.

Can someone know how to resolve the problem and make hyperlinks for external resources work? Alternative transform the path I get from SearchEngine to an IFile that can be used with FileLink?

Thanks in advance, best regards,
Previous Topic:Contributing to eclipse.ini (from plugin?)
Next Topic:How to set Network Connections programatically
Goto Forum:

Current Time: Wed May 23 17:04:19 GMT 2018

Powered by FUDForum. Page generated in 0.01901 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top