OSDN Git Service

Accumulate rendering errors and ensure they are always shown
authorTor Norbye <tnorbye@google.com>
Fri, 7 Jan 2011 04:35:20 +0000 (20:35 -0800)
committerTor Norbye <tnorbye@google.com>
Fri, 7 Jan 2011 05:54:14 +0000 (21:54 -0800)
commit840daae58f5f6614242037f03ebf169d1b36b295
treee7727fe6686a7dccefa44bb1b0f8b4e4951f5eae
parentda7e08030089f1b72f388310f46292401fde5e90
Accumulate rendering errors and ensure they are always shown

There are some scenarios where rendering failures (such as an NPE in
the layout lib) will not appear in the error display, and it will not
appear in the Error Log.

In addition, we now get fidelity warnings from the layout library
(warning about Android code using graphics operations not supported by
the layout preview), and these should all be displayed to the user
with a proper explanation.

To solve these problems, this changeset replaces the layout logger
with a new logger which:

(1) Writes all exceptions to the AdtPlug.log(Throwable) method, which
results in the full exception being captured in the Error Log

(2) Accumulates all errors, warnings and fidelity warnings

(3) Provides a summary of ALL the problems at the end, such that they
are all displayed (in decreasing order of severity) for the user
rather than the last one clobbering them all.

The logger also records whether exceptions were logged, and if so, the
last line of the error display indicates that further details can be
found in Window > Show View > Error Log.

Finally, the old logger was a member of the GraphicalEditorPart, but
this is a lightweight object so there is no need to cache it, and in
fact we don't want other types of rendering (such as preview
rendering) popping open the error display area.

Change-Id: Ia00978a725cb7e7ec2dcfbf9e868df2a5136efc0
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderLogger.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderLoggerTest.java [new file with mode: 0644]