History log of /sdk/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java
Revision Date Author Comments
12d4581faa6438941e65a9dc83213be34c6ca970 13-Sep-2012 Tor Norbye <tnorbye@google.com> Constants refactoring.

This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).

Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.

Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
81cefe2a26dd6db8a878e30874d12cdcbff0e83b 11-Aug-2012 Xavier Ducrohet <xav@android.com> More refactoring.

Move stuff out of sdklib into common and ide_common.
Remove androidprefs and move the one class into common.

Change-Id: I71d126a13cf2ba413692e29616f4968a37d7b33a
ab36f4e7488358dea4ab6b54ee2b7bef3da0232b 21-Dec-2011 Tor Norbye <tnorbye@google.com> Update SDK codebase to JDK 6

This changeset makes the SDK codebase compile with source=1.6 (which
means it also requires JDK 6). This means that methods implementing an
interface requires @Override's. It also means we can start using APIs
like the ArrayDeque class and methods like String#isEmpty().

This changeset looks big but the change is trivial: it's basically
adding @Override in all the places that need it, along with some other
automatic Eclipse cleanup in certain files (such as reordering imports
where they were incorrectly ordered (because older versions of Eclipse
didn't always handle inner classes right)), as well as cleaning up
trailing whitespace and removing some $NON-NLS-1$ markers on lines
where there aren't any string literals anymore.

This changeset also sets the source and target JDK level to 6 in the
Eclipse compiler .settings file, and synchronizes this file to all the
other Eclipse SDK projects.

Change-Id: I6a9585aa44c3dee9a5c00739ab22fbdbcb9f8275
401e50139efc9333a689c2306ca66a7b2c840c40 28-Jul-2011 Tor Norbye <tnorbye@google.com> Add Java Quick Assistant for Extracting Strings

This changeset adds a Quick Assistant to Java files in Android
projects, which proposes "Extract String" when the caret is within a
String literal.

It also moves a couple of utility methods from the Hyperlinks class to
the AdtUtils class.

Change-Id: Ica5ff40e32e3e145481d6c895178109289ed1d9b
3a0de834ccd2b4f89462fcb2d075823597c347ab 22-Apr-2011 Tor Norbye <tnorbye@google.com> Merge "Add code completion support for drawables, animations and colors"

This changeset adds in descriptor metadata and XML editors for:
- Drawables (res/drawable/)
- Animations (res/anim/)
- Animators (res/animator/)
- Colors (res/color)

These types have also been added to the New XML File wizard.

There is some specialized completion support for animators:
- Completing on the propertyName property of <objectAnimator> will
offer the various integer and float properties in views
- Completion for the interpolator property shows the framework
interpolators immediately and on top (instead of having to complete
the individual resource paths @android: and anim/ first

There is also a new quickfix and marker resolution for the AAPT error
which complains about an unbound prefix. This will insert a
xmlns:android="http://schemas.android.com/apk/res/android" attribute
declaration on the root element.

This CL also includes a fix to make the New XML File Wizard preselect
the current project in more scenarios.

NOTE: This changeset adds new XML editors for these resource types.
It does not attempt to update previous editor bindings for files of
the given type, so to test this you may need to use "Open With" in the
package explorer to pick the right file type.

A subsequent CL will try to migrate settings over to these editors,
but that work will tie into another effort: merging all these
different editors into a single editor class that does its own content
type switching and different viewparts for the other tabs.

(cherry picked from commit aaa917c9c5e6f974ca20b94adfd53d1bf01bb54e)

Change-Id: Iddc2405c4802d43126d9b2172f86869de80bef10
aaa917c9c5e6f974ca20b94adfd53d1bf01bb54e 22-Apr-2011 Tor Norbye <tnorbye@google.com> Add code completion support for drawables, animations and colors

This changeset adds in descriptor metadata and XML editors for:
- Drawables (res/drawable/)
- Animations (res/anim/)
- Animators (res/animator/)
- Colors (res/color)

These types have also been added to the New XML File wizard.

There is some specialized completion support for animators:
- Completing on the propertyName property of <objectAnimator> will
offer the various integer and float properties in views
- Completion for the interpolator property shows the framework
interpolators immediately and on top (instead of having to complete
the individual resource paths @android: and anim/ first

There is also a new quickfix and marker resolution for the AAPT error
which complains about an unbound prefix. This will insert a
xmlns:android="http://schemas.android.com/apk/res/android" attribute
declaration on the root element.

This CL also includes a fix to make the New XML File Wizard preselect
the current project in more scenarios.

NOTE: This changeset adds new XML editors for these resource types.
It does not attempt to update previous editor bindings for files of
the given type, so to test this you may need to use "Open With" in the
package explorer to pick the right file type.

A subsequent CL will try to migrate settings over to these editors,
but that work will tie into another effort: merging all these
different editors into a single editor class that does its own content
type switching and different viewparts for the other tabs.

Change-Id: I4b12bafd8fd068176c41bac1e345bb74ccdb8b6f
886436743d5f723318b56be9942a76b24ce14bc7 28-Mar-2011 Tor Norbye <tnorbye@google.com> Extract Style Refactoring

Adds a new refactoring, "Extract Style", which will show the user the
attributes for the current selected elements (or if invoked from an
editor context, the attributes overlapping the current caret or editor
selection). The user can select which attributes to extract, and these
are then added as a new style in the styles.xml file in the project
(which is created if necessary). The user can optionally replace the
attributes that were extracted, and the user can also optionally set
the style attribute on the elements to the new style. (Both are on by
default.) This is integrated with the refactoring quick assistant as
well.

Change-Id: I0504e86a824b00730482607150a879ff28233618
d3a3c261ef762dc3fb8f573b27625b0ebc81d5c8 23-Mar-2011 Tor Norbye <tnorbye@google.com> Test infrastructure fixes

Add methods which allow a test case to specify that it needs a unique
project for the testcase (or even for each individual test
method). This allows tests which modify the project (such as the
quickfix-resource-creation tests) to not cause side effects that
affect other tests (e.g. resources created by the quickfix could show
up in code completion results by the code completion tests, which
meant the goldenfiles would have to either include them or exclude
them, which meant the tests must always be run together or never run
together.

The changeset also adds an environment variable pointing to the git
working copy allowing tests with no golden file to create the golden
files directly. This makes it easy to add new test cases; just write
the test scenarios, run them, which will fail all the tests but also
write out the expected golden files. Verify them and check them in and
running the tests again should pass if the output is stable.

Change-Id: I2e2789c00c84a31a9fbc603851879d8d83342ad3
e2726b151fdb7b60fe603cc92b837b4c2b36258c 25-Mar-2011 Tor Norbye <tnorbye@google.com> Handle AAPT ranges in value resource files

The earlier fix to add editor column ranges for AAPT errors handled
the types of errors that occur in layout .xml files. In value
definition files there are several additional error messages that can
be parsed to infer the actual error range on the line. This changeset
adds handling for these additional cases, plus various unit tests.

It also fixes a couple of corner cases in layout files - in
particular, the case where a resource value is missing, and the case
where there are other -valid- uses of the same value earlier on the
same line where the first reference would be highlighted rather than
the one following the property in error.

Change-Id: I02906ada43a884d7518348924715892de9d33311
141d3be93d5d0840220cb3f92d87c67711a2bf7e 18-Mar-2011 Tor Norbye <tnorbye@google.com> Add go to declaration support for styles and embedded text

This changeset adds support to the Go To Declaration code for styles.
Style strings are a bit different from resource URLs - they can have
an @android: prefix, but they don't specify a resource type. For
example, go to declaration can now jump to the value in the parent
attribute:

<style name="BrowserTheme" parent="@android:Theme.Black">

This will show the Theme.Black style definition in the SDK's
styles.xml document.

In addition, the hyperlink resolver can now also link to fragments of
an attribute value. In particular, in the above, if you point anywhere
to the left of the ".", only the @android:Theme range will be
selected. This lets you go to parents, since styles inherit from other
styles by adding to them with dots.

Third, the hyperlink resolver can now link to resource urls that is in
the content part of XML documents (e.g. a text node, not an element
name or attribute value). As an example, you can now jump to the color
defined inside this style element:

<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:bg">@color/custom_theme_color</item>
</style>

Finally, this changeset adds unit/plugin tests for the hyperlink
resolver, which asserts the expected list of matches, and the expected
editor context when the default link is opened.

Change-Id: I73757ec78405f7c711e13387d0bb046f698799f1
c34b5f7721a486a9b88913d5d32bef02fead1d3c 18-Mar-2011 Tor Norbye <tnorbye@google.com> Fix AAPT error range

Turns out the AAPT errors always list a line number that corresponds
to the line where the element starts. If the error occurs in an
attribute that is on a subsequent line, the code to identify the
editor offset failed.

This changeset addresses that, by using a document forward search to
locate the attribute. The quickfix code was also checking for an exact
line number match, so that code is tweaked as well.

Change-Id: Ib648d2e2e7ad3ba082fd3c6a48e7f077b3aebc10
fafa79f3931bb8b396900e3a43ac4294195f83b4 15-Mar-2011 Tor Norbye <tnorbye@google.com> 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