aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2010-11-30 09:05:11 -0800
committerTor Norbye <tnorbye@google.com>2010-11-30 11:34:08 -0800
commit668e2e80ca60a02afd98276aa1e989c0d939bdc5 (patch)
tree50cb5b8952f59c46636f3e05f2814caf53524686 /eclipse/plugins/com.android.ide.eclipse.adt/src/com
parent935ae86b44c66f0ec0bd80d94b27b2739ef0549a (diff)
downloadsdk-668e2e80ca60a02afd98276aa1e989c0d939bdc5.zip
sdk-668e2e80ca60a02afd98276aa1e989c0d939bdc5.tar.gz
sdk-668e2e80ca60a02afd98276aa1e989c0d939bdc5.tar.bz2
Replace reflection with Sdk.makeRelativeTo
Replace reflection-based invocation of IPath.makeRelativeTo (which is not available in Eclipse 3.4) with usage of Sdk.makeRelativeTo, our own copy of the equivalent code. Change-Id: If67d985b96b845d85cf7fc13d47e9adeee49e8a8
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java29
1 files changed, 2 insertions, 27 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
index ff5d3c4..430fd68 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
@@ -28,6 +28,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.gre.RulesEngine;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.layoutlib.api.LayoutScene;
import com.android.layoutlib.api.SceneResult;
import com.android.layoutlib.api.LayoutScene.IAnimationListener;
@@ -86,8 +87,6 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.w3c.dom.Node;
import java.awt.image.BufferedImage;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -726,31 +725,7 @@ class LayoutCanvas extends Canvas {
IPath workspacePath = workspace.getLocation();
IEditorSite editorSite = graphicalEditor.getEditorSite();
if (workspacePath.isPrefixOf(filePath)) {
- // 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;
- }
-
+ IPath relativePath = Sdk.makeRelativeTo(filePath, workspacePath);
IResource xmlFile = workspace.findMember(relativePath);
try {
EditorUtility.openInEditor(xmlFile, true);