OSDN Git Service

Add Quickfix and Quick Assistant for creating resources
authorTor Norbye <tnorbye@google.com>
Tue, 15 Mar 2011 04:15:57 +0000 (21:15 -0700)
committerTor Norbye <tnorbye@google.com>
Thu, 17 Mar 2011 20:30:26 +0000 (13:30 -0700)
commitfafa79f3931bb8b396900e3a43ac4294195f83b4
tree246ea51f7f091840d3e03cb7e3720ab195f32d7e
parent705dc5ca1d430be514fddcdb729d52fd7110f37a
Add Quickfix and Quick Assistant for creating resources

This changeset adds two related features:

- A "marker resolution" which adds a quickfix to aapt errors for
  nonexistent resources. This means that you can right click on the
  error in the Problems view to create the associated missing
  resource.

- A "quick assistant" which looks for a missing resource on the
  current line and if found adds a fix handler for it, similar to the
  quickfix above.

When a fix is invoked, it will create the new file or value, and open
it in the editor with the relevant value section selected.

The quick assistant can be invoked by the normal Ctrl-1 (Cmd-1). The
quickfix must be invoked from the Problems view; the Java editor seems
to add an extra level of integration with a lightbulb in the editor
margin but we don't get that in XML.

The quickfixes work for all value-based resources, as well as some
file-based ones (in particular, those supported by the New XML File
wizard, which it reuses.)

This changeset also adds unit tests for quickfixes along with a few
infrastructure changes to support it.

Change-Id: I962bcf6c98934685e4d74389469d0903115a75e3
15 files changed:
eclipse/dictionary.txt
eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFix.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/VisualRefactoring.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileWizard.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix2.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1.xml [new file with mode: 0644]