From fb349d615248bd796c3bd0c9070d1bfbdede67d3 Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Tue, 21 Feb 2012 16:25:27 -0500 Subject: Use getFullPath() instead of getLocation() when linking to source code. The call to getSourceElement may return an Object that has a file system path associated with it, but does not implement the IFile interface. If it implements IStorage, we can still link to the source code. --- .../linuxtools/internal/valgrind/massif/MassifPlugin.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'valgrind') diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifPlugin.java index 43ba0d7b7c..c82dc7f665 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifPlugin.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifPlugin.java @@ -10,7 +10,8 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.valgrind.massif; -import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IStorage; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; @@ -74,12 +75,14 @@ public class MassifPlugin extends AbstractUIPlugin { public void openEditorForNode(MassifHeapTreeNode element) { // do source lookup + String workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); ISourceLocator sourceLocator = MassifPlugin.getDefault().getSourceLocator(); if (sourceLocator instanceof ISourceLookupDirector) { Object obj = ((ISourceLookupDirector) sourceLocator).getSourceElement(element.getFilename()); - if (obj != null && obj instanceof IFile) { + if (obj != null && obj instanceof IStorage) { try { - ProfileUIUtils.openEditorAndSelect(((IFile) obj).getLocation().toOSString(), element.getLine()); + String fullFilePath = workspaceLocation + ((IStorage) obj).getFullPath().toOSString(); + ProfileUIUtils.openEditorAndSelect(fullFilePath, element.getLine()); } catch (PartInitException e) { e.printStackTrace(); } catch (BadLocationException e) { -- cgit v1.2.3