diff options
author | Xavier Ducrohet <xav@android.com> | 2011-01-13 10:11:53 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-01-13 10:11:53 -0800 |
commit | c090519e4e41c6c5716079e8f3ec45c0fd4daacc (patch) | |
tree | 6b65ffa9b8c0191935ad9a3c557650f18bcf1549 | |
parent | af9a91ecad2dc309ad84de47a97000cf5432f49b (diff) | |
parent | bdb83afd6e463e08c67ddf119eed878a479ad325 (diff) | |
download | sdk-c090519e4e41c6c5716079e8f3ec45c0fd4daacc.zip sdk-c090519e4e41c6c5716079e8f3ec45c0fd4daacc.tar.gz sdk-c090519e4e41c6c5716079e8f3ec45c0fd4daacc.tar.bz2 |
Merge "Misc fix in ProjectCallback." into tools_r9
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java index 3656e4d..8575a24 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java @@ -75,6 +75,7 @@ public final class ProjectCallback implements ILegacyCallback { public Object loadView(String className, Class[] constructorSignature, Object[] constructorParameters) throws ClassNotFoundException, Exception { + mUsed = true; // look for a cached version Class<?> clazz = mLoadedClasses.get(className); @@ -90,29 +91,27 @@ public final class ProjectCallback implements ILegacyCallback { } clazz = mLoader.loadClass(className); } catch (Exception e) { - // Log this error with the class name we're trying to load - AdtPlugin.log(e, "ProjectCallback.loadView failed to find class %1$s", //$NON-NLS-1$ - className); - // Add the missing class to the list so that the renderer can print them later. + // no need to log this. mMissingClasses.add(className); } try { if (clazz != null) { - mUsed = true; + // first try to instantiate it because adding it the list of loaded class so that + // we don't add broken classes. + Object view = instantiateClass(clazz, constructorSignature, constructorParameters); mLoadedClasses.put(className, clazz); - return instantiateClass(clazz, constructorSignature, constructorParameters); + + return view; } } catch (Throwable e) { - // Find root cause + // Find root cause to log it. while (e.getCause() != null) { e = e.getCause(); } - AdtPlugin.log(e, - "ProjectCallback.loadView failed to instantiate class %1$s", //$NON-NLS-1$ - className); + AdtPlugin.log(e, "%1$s failed to instantiate.", className); //$NON-NLS-1$ // Add the missing class to the list so that the renderer can print them later. mBrokenClasses.add(className); @@ -128,7 +127,6 @@ public final class ProjectCallback implements ILegacyCallback { Method m = view.getClass().getMethod("setText", new Class<?>[] { CharSequence.class }); m.invoke(view, getShortClassName(className)); - mUsed = true; return view; } catch (Exception e) { // We failed to create and return a mock view. |