import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.w3c.dom.Node;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
IPath workspacePath = workspace.getLocation();
IEditorSite editorSite = graphicalEditor.getEditorSite();
if (workspacePath.isPrefixOf(filePath)) {
- IPath relativePath = filePath.makeRelativeTo(workspacePath);
+ // This apparently doesn't work in 3.4:
+ // IPath relativePath = filePath.makeRelativeTo(workspacePath);
+ // Use reflection as a build hotfix.
+ // FIXME: This won't work on 3.4 but we're talking about dropping 3.4 support
+ // shortly since most Eclipse users have migrated to 3.5 + 3.6.
+ IPath relativePath = null;
+ try {
+ Method method = IPath.class.getDeclaredMethod("makeRelativeTo", //$NON-NLS-1$
+ new Class<?>[] {
+ IPath.class
+ });
+ relativePath = (IPath) method.invoke(filePath, new Object[] {
+ workspacePath
+ });
+ } catch (SecurityException e) {
+ } catch (NoSuchMethodException e) {
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+
+ if (relativePath == null) {
+ return;
+ }
+
IResource xmlFile = workspace.findMember(relativePath);
try {
EditorUtility.openInEditor(xmlFile, true);