aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android
Commit message (Collapse)AuthorAgeFilesLines
* Update Eclipse plugin to handle new LocaleQualifier APITor Norbye2015-02-043-115/+168
| | | | Change-Id: I1d5eaec7e6f61a21b07cf790166d9b6ea8f041db
* Track lint API changes in the Eclipse lint integrationTor Norbye2014-09-151-3/+5
| | | | Change-Id: If9c6843f0b9231a2b629e61ab7b8c3a401485f1f
* Update ADT to match DeviceManager API change.Raphael Moll2014-02-201-2/+3
| | | | Change-Id: I4f68d23ca86bfdcb8055f54dec5546ef021aa777
* Pass credentials to render sandboxTor Norbye2013-11-271-5/+5
| | | | Change-Id: I330c944ab6712b36cc62c046e955c6a00f0496a4
* Use the new ResourceUrl API in sdk-commonTor Norbye2013-09-201-21/+24
| | | | Change-Id: I50154323e4db659d0d29753076bae805c7fc6c7d
* Use LocaleManager from sdk-common rather than local ADT copyTor Norbye2013-06-131-75/+3
| | | | Change-Id: Iae8bc5c4bc06643691b82242162a93f22c06d868
* Add "Draw 9-patch editor" to ADT.Keiji Ariyama2013-04-1320-0/+1227
| | | | Change-Id: I1a60ac1e683887dc4cecf8b18bdcf9def48f19a4
* Update GravityHelper to handle start|end gravititiesTor Norbye2013-04-111-1/+43
| | | | Change-Id: Id3628f87569cab8df14f885274137a332a074550
* Use the SDK common XmlPrettyPrinterTor Norbye2013-03-123-14/+17
| | | | | | | | | | | | | | The XML pretty printer was moved up from the Eclipse plugin into common (such that for example the resource merger can use it). This CL removes the old XML pretty printer and replaces it by a subclass which customizes the formatter slightly (in particular, taking advantage of the Eclipse DOM's ability to remember whether an XML tag was an empty tag such at <this/> rather than <this></this>.) Change-Id: Ie0865c3c35f1340fa4dcaf42253599f278ce4997
* 39612: Question Mark causes Eclipse Graphical Layout Editor to Freak OutTor Norbye2013-01-141-57/+0
| | | | | | | | | | | | | | Handle string values starting with ? and @ even if they do not correspond to actual theme or resource URLs. Also fix the code which handles processing strings read from XML files; apply unescaping rules (for unicode, newlines and tabs, removing quotes, etc). Also make the style warning include the full resource URI (it was only logging the stripped URI). Change-Id: I9b9a87ac4841faeacd1d94a43fa091702e60f4d8
* Fix attribute validationTor Norbye2013-01-041-4/+8
| | | | | | | This is used when incrementally validating XML attributes when a file is saved in the IDE. Change-Id: I37d37ab8ac64aec72455c3bfbabc7bbd65595a94
* Refactoring fixesTor Norbye2012-12-103-21/+64
| | | | | | | | | | | | | | | | This CL contains a couple of tweaks to the refactoring support. First, update <declare-styleable> declarations for renamed custom views. Second, update XML in downstream projects from library projects. Third, allow invoking the rename refactoring from XML files from class attributes and custom view tags as well (until now it applied only to resource names.) Finally, update unit test golden file format to include whether each change is enabled, and tweak the code to disable R class changes to handle some additional scenarios. Change-Id: I74ccbe1b0f15ec10429f8dda7674f51f9a6f83cd
* Support layout aliases properlyTor Norbye2012-12-061-16/+0
| | | | Change-Id: I3c1dac7809a225118b69f1557a42051e96011198
* Code completion improvements for custom views and themesTor Norbye2012-12-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds custom view completion to the content assist. Code completion for elements (e.g. from text context or inside a <) should now include custom views found in the project, and prefix typing should work as well. Similarly, code completing inside a <fragment> name attribute or a <view> class attribute should complete fragment and view classes. It will display javadocs for these classes, if available. It also hooks up class completion in manifest files, so completing <activity>, <application>, <receiver> etc android:name attributes should show matching classes corresponding to the tag being edited. The completion will also always complete theme references (?) even when there is no known metadata for the tag, such as for an arbitrary custom view. Also fix descriptor metadata such that <view> and <requestFocus> show up in code completion, works properly for layout editor palette drag (with a class selection popup) and with a suitable outline icon. Also tweak refactoring such that it handles both class= and android:name usage for <fragment> elements. Finally, for the LinearLayout automatically added inside new ScrollViews, set the vertical attribute since that's usually what you want. Change-Id: Ifc98c19607ddc4e69d7645f2720120ce72d0cd95
* Fix rename type, rename package and move type refactoringsTor Norbye2012-12-032-24/+83
| | | | | | | | | | | | | | | | | | | | | | This CL updates the various refactorings to properly handle layout refactoring such that it not only updates custom views, but also updates fragment references, tool:context references etc. It also fixes missing manifest updates (such as replacing the parentActivityName attributes). Most importantly, it also fixes bugs where the wrong elements in the manifest could get updated. There are a lot of diffs in this CL because I basically replaced the old refactoring code (which had a lot of custom text change and document manipulation code) with code based on the new resource refactoring, where there is a single iteration of the XML documents. This also improves the emitted refactoring elements such that it only lists each file once. Also updated the unit tests to check additional scenarios; adding a second activity with the same prefix as the first is what revealed the broken document handling in the old code. Change-Id: I7c5959ca6b046ce3dab566663988cdd0389b0e5b
* Fix rename package refactoringTor Norbye2012-11-282-0/+230
| | | | | | | | | | | This changeset fixes a couple of bugs in the package rename refactoring code, including 34466: Android refactoring participant gives NPE It also fixes a bug in the move type refactoring, and adds unit tests for package rename, move type, and rename type. Change-Id: I4f43aabbcf1aeddc6c27011bfcffbe5a49c42372
* Merge "Use unicode escapes in LocaleManager"Tor Norbye2012-11-281-0/+42
|\
| * Use unicode escapes in LocaleManagerTor Norbye2012-11-161-0/+42
| | | | | | | | | | | | | | | | This ensures that when the plugin is built outside of Eclipse (where the source file is marked as being in UTF-8 encoding), the special characters are handled correctly. Change-Id: I94d70bd3fb9d8a6bbf37e83eb30f161a2fc24016
* | Add resource renaming supportTor Norbye2012-11-262-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for renaming resources. There are several new hooks for initiating a resource rename: (1) You can use the same keybinding as in Java files from XML files to initiate refactoring; for example, place the caret somewhere in @+id/foo or @string/bar and hit the refactoring keybinding, and a rename resource refactoring dialog shows up. (2) Invoking Quick Assistant in an XML file (Ctrl/Cmd 1) will offer to rename the resource, if the caret is over a resource name. (3) Renaming an XML or bitmap resource file, such as res/drawable-hdpi/foo.png, will now initiate the same XML resource naming machinery as above to update all resource references, plus it will also update all the other versions of the same file (e.g. in res/drawable-mdpi, res/drawable-xhdpi, etc.). Assuming an R field exists (e.g. the project has been built), it will also optionally update all Java field references. (4) Invoking renaming in the layout editor (via the rename keybinding, or via the context menu, or via the property sheet's "..." button) will also initiate id resource refactoring. Editing the id directly in the inline editor for the id will pop up a dialog asking whether to update references as well, along with a "Do not ask again" checkbox. (5) Finally, there is a renaming participant registered which will discover whether an R field is renamed, so if you go and rename R.layout.foo from Java, this will also kick in all of the above machinery - renaming layout files, updating resource references, etc. If the renamed resource is in a library project, the refactoring will also look at all the including projects and offer to update references there as well. Finally, this CL goes and fixes a few bugs in the existing refactoring operations; in particular, making sure that they not only look at files in layout/ but in all folder configurations containing layout files. It also adds refactoring unit tests. Change-Id: Ie88511a571b414fdc5be048e781fe29a34063cbf
* | Fix refresh issue in the AVD Manager.Raphael Moll2012-11-261-4/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | In tools 21.0.0, hitting refrehs in the AVD Manager will create the list display to blink rapidly several times in a row. Same happens when a new AVD is created from a device. The issue is that the DeviceManager reparses and rebuilds its internal lists from scratch for every single call to getDevices() and getDeviceStatus(). Each time it notifies the listeners, and consequently the AVD Manager rebuilds its table. 2 fixes for that: - First use a boolean guard to prevent recursive refreshes of the avd manager table in AvdSelector. - Second fix DeviceManager to not rebuilt its lists all the time. This also changes DeviceManager so that callers create one instance that contains all the lists and there no static data shared between the instances. This is more deterministic. It shifts the responsibility to the callers to pass around the same instance if they want the data to remain consistent. Change-Id: Ia0c104395fe599071892e24bc234f8cffde9f635
* Improve double click handling in the XML editorsTor Norbye2012-11-051-0/+71
| | | | | | | | | | | When you double click on the name portion of a resource url, it selects just the name. Similarly when you double click on just the class portion of a fully qualified class name, it selects just the class. Finally, when you click on an attribute name consisting of a namespace prefix and a local name, it selects only the local name if you click within the local name region. Change-Id: I050eb1493e570fd94719679e3eef2a40c92db2f8
* Merge "Update Layoutlib_api to use a class for h/w config."Xavier Ducrohet2012-10-172-5/+4
|\
| * Update Layoutlib_api to use a class for h/w config.Xavier Ducrohet2012-10-172-5/+4
| | | | | | | | Change-Id: Iead02d468590407ec274357f1a1c57ed8d5cc24c
* | 32849: Fix CRLF line ending handling in the partial formatterTor Norbye2012-10-171-0/+331
|/ | | | | | | | | | | | | | | | | | Fix the handling of \r characters in the code which applies formatting deltas into existing documents. It could end up inserting the formatted portion in the middle of a \r\n pair, which made Eclipse extremely confused (https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421) This fixes 32849: Eclipse android adt xml editing artifacting (unsynced) lines of text when changes are made in the graphical interface It also adds a lint check to identify *existing* files that already have these mangled line endings, along with a quickfix to make the correction. Change-Id: I1e7024f2786e4cb0233c2c6b98c3d3f942703ea0
* Improvements to the multi-configuration layoutTor Norbye2012-10-121-1/+30
| | | | | | | | | | | | | | | | | | This adds a new layout algorithm which tries to do a more optimal fit if all the configuration previews can fit on the current screen without scrolling. (However, it still doesn't scale up these previews to fit all available space, that's coming in a later CL). It also delays rendering previews and performing layout until the layout is actually painted, and improves the error rendering a bit. It's also more deliberate in how preview renderings are scheduled, performing them in visual order etc. There's a new brief animation when you switch to a preview. Finally, there are some preview zoom controls now. Change-Id: Iea503a3fd57dfcaea7656e47b946bfcfea3eecb1
* Lazy loading (and reloading) of project resources.Xavier Ducrohet2012-10-103-6/+38
| | | | Change-Id: I4a725d523ae14ba8b487076e230fe9d622d5d281
* Multi-Configuration Layout EditingTor Norbye2012-10-033-1/+108
| | | | | | | | This changeset adds support for previewing other configurations (as well as including contexts) for a layout, with live updates. Change-Id: Iff3523d6f5749b3287716e563330fb18c8576611
* Merge "Move some utility functions from AdtUtils to common"Siva Velusamy2012-09-211-65/+2
|\
| * Move some utility functions from AdtUtils to commonSiva Velusamy2012-09-201-65/+2
| | | | | | | | Change-Id: Ia6f5c55e07c7f60712472c8e850b7c4595c46671
* | Merge "Validate user edits in XML files"Tor Norbye2012-09-205-4/+397
|\ \
| * | Validate user edits in XML filesTor Norbye2012-09-205-4/+397
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Around ADT 15 or so we introduced a bunch of optimizations to run AAPT much less frequently, since with large projects it can take a long time, and end up blocking the UI if you try to save twice. Unfortunately, one side effect of this change is that if you edit only the *value* of an attribute, we will not re-run aapt, which means that if you set the value to a bogus value, you will get no error message until the next time AAPT runs (usually when you try to run). This changeset fixes this. We already have the attribute metadata which aapt uses, so now, when an XML file is changed and saved, we process it with an XML pull parser, and validate all the Android namespace attributes. If any are found to not be correct, then we request a full AAPT process, which will then display errors as appropriate. Change-Id: I374c19648e29c27c6d82616b3ee602cb2343cd3a
* | 37497: Templates should escape string literals in resource filesTor Norbye2012-09-184-0/+208
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | If the user enters an activity title like "Android's Tools" in the new template wizard, an invalid strings.xml file is generated, since the apostrophe is not properly escaped. To fix this, there's a new string conversion method in the template engine, "escapeXmlString", which will perform all the necessary conversions. It also adds two other XML escaping functions: one to escape text to be suitable for XML attribute values, and one to be suitable for XML text values. Finally, when verifying this, I discovered that if I inserted ampersands in the MasterDetail template, I ended up with errors in various places there a filename was derived from the input string. To help make this work better, there's also a new "extractLetters" method which pulls all the characters out of a string (effectively stripping whitespace and punctuation). In addition to the above 4 new string conversion methods, the templates have been updated to use them, and the template format documentation updated. Change-Id: I4d4e854ab78d63bc86b8eb0fb9d92246534615e7
* 37546: Graphical layout in Eclipse does not render unicode charactersTor Norbye2012-09-181-0/+13
| | | | Change-Id: I1fd07245e68b39af16a38bcec8a711867e87e5c6
* Merge "Manifest Editor: class selector for <application backupAgent>."Raphael Moll2012-09-171-0/+4
|\
| * Manifest Editor: class selector for <application backupAgent>.Raphael Moll2012-09-171-0/+4
| | | | | | | | | | | | | | <application android:backupAgent> needs a class selector that accepts classes deriving from BackupAgent. Change-Id: Id2e72e85967bc31a67d1eff2c342bcf7acc2cb3c
* | Support separate layout editors for a single layout resourceTor Norbye2012-09-172-0/+160
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset changes the "reuse" behavior of the layout editor to no longer reuse the same layout editor when you are switching between alternate layout files for the same layout resource, such as layout/foo.xml and layout-land/foo.xml. This lets you more quickly switch back and forth and inspect differences between the layouts, etc. There is also an option in the Android > Editors panel to turn on single editor sharing again. The biggest part of the changeset, by far, is a cleanup of the ConfigurationComposite class and associated code. This was necessary not just to support the above feature (where we need to "back out" UI changes when you've made a configuration edit which results in a different file getting opened), but it's also an important preparation for multi configuration editing, where we need to be able to switch configuration settings in and out of a single configuration editor, etc. The configuration data itself is now in a separate Configuration class; the UI is in ConfigurationChooser, and the configuration matching code is in ConfigurationMatcher. There's also a new Locale class to track language/region pairs instead of using 2-element ResourceQualifier arrays. The various menu listeners are also in separate UI classes now. While there are new classes, most of the configuration matching algorithm is unchanged, just moved to a new class and the UI syncing and configuration data lookup replaced. Bitmasks are used to handle configuration changes, such that updating multiple related attributes (e.g. a rendering target change also causes a theme change if say Holo isn't available) can now be processed just once with a single change call. (Various other cleanup too.) Change-Id: I04ac969f46824321be3db0c487ef077c03cc6012
* Constants refactoring.Tor Norbye2012-09-1312-32/+32
| | | | | | | | | | | | | | | | 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
* Add class to resource name conversion for templatesTor Norbye2012-09-126-0/+336
| | | | | | This is to support a template name update in issue 36890. Change-Id: I47458c094c8dd601e086da0cb1c6fafb7680b58c
* Default action for view rules.Tor Norbye2012-09-041-0/+11
| | | | | | | | For now, text-oriented widgets declare their default action to be to set the text attribute. Also hook up the default rename keybinding to setting the id. Change-Id: I14e8e06d0842759b1ac05e7e9494deb30b3cc40f
* Fix property sheet value completionTor Norbye2012-08-271-0/+151
| | | | | | | | | | | | | | | This changeset fixes the value completion such that you can add custom values into properties that also have enum fields. Rather than have separate completion routines for properties based on whether they contain an enum, a flag, a reference, etc., have a single completer which considers all the various formats and combines the results. In addition to combining results, this now also offers completion on dimensions, and offers theme attribute values for references as well. Change-Id: Idbc1799a34b3a3f14ea567654953925bf12afb8f
* Unify all loggers in the sdk tools.Xavier Ducrohet2012-08-171-2/+8
| | | | | | | | | | Removed ILogger from ide_common Removed ISdkLog (and implementations) from sdklib Moved all existing code to com.android.utils.ILogger which is located in common. Change-Id: Icd674d4b8d10f6ae8b60a83acb43cc53c7a52137
* More refactoring.Xavier Ducrohet2012-08-133-3/+3
| | | | | | | Move stuff out of sdklib into common and ide_common. Remove androidprefs and move the one class into common. Change-Id: I71d126a13cf2ba413692e29616f4968a37d7b33a
* Improvements to relative layout move and delete operationsTor Norbye2012-08-082-1/+491
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset improves the way the RelativeLayout editing support in the layout editor handles deletions and moves. First, during a move, if the move is simply within the same layout, then the layout constraints are left alone such that if you for example have A v B < C < D and you move B up to be next to A, you end up with A < B < C < D (It will however remove cycles if the move would result in them.) Second, it now handles deletion better where deleting a view will cause all references to any deleted views to be replaced by transitive constraints. For example, if you hve A < B < C < D and you delete B and C, you end up with A < D Change-Id: Icb9d3552e60aee20192f7941fe52be71ba52557f
* Refactor common.jarXavier Ducrohet2012-08-079-12/+12
| | | | | | | | | | | | | | | Move resources and com.android.util.Pair into layoutlib_api where they belong since layoutlib depends on them and we need to control the API. Made a copy of Pair to stay in common.jar but moved it to com.android.utils.Pair (the one in com.android.util.Pair is marked as deprecated to prevent usage where applicable). Also moved XmlUtil and PositionXmlParser to com.android.utils to match Pair. Change-Id: I21d7057d3f2ce604f86a3bb1fa3c130948c93b89
* Allow lint cli --sources to specify a path, and use from ant lintTor Norbye2012-08-061-28/+0
| | | | | | | | | | | | | | | First, this changeset allows the arguments passed to --sources and --classpath (renamed from --classes) to specify not just a directory, but to specify a path as well. This might make it easier to invoke lint from scripts if you have a path variable, so you don't have to split it into multiple arguments. Second, it makes the lint task in ant use these, such that any build.xml customizations to the source paths or class paths are automatically used rather than relying on lint's default structure check. Change-Id: Id8e4caf0010d7fd7245844b3099b5dc0607f0aba
* 26501: Handle padding between image and textTor Norbye2012-07-272-32/+32
| | | | | | | | | | The visual refactoring for converting a LinearLayout with a <TextView> and an <ImageView> adjacent into a single <TextView> using a compound drawable, needed to properly handle spacing between the two widgets. This changeset updates it to convert margins between the views into a single drawablePadding attribute. Change-Id: Idb077e3324c279d41fdc0baa68008fe862d8181a
* Add locale dataTor Norbye2012-07-161-0/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This checkin adds a new LocaleManager which provides data related to locales and regions, such as (1) The right flag icon to use for a given language and region combination (2) The full name of a language code (3) The full name of a region code Before this CL, the flag icons were determined by looking at the Locale instances installed on the machine, and matching up the language codes with the corresponding country codes. However, that only works for the locales you have installed -- and on a typical Linux installation I tried, there were no other locales, and on a Mac OSX install, many common locales (such as those referenced by standard Android apps) were not included. Instead, we now have a static map of bindings from language to region (though if the language matches the default locale on the system, it will use the associated country of that locale). The full names of the languages and regions are also provided. This allows us to display the corresponding name of a language in the locale menu, such that users don't for example confuse country codes and locales; "ca" isn't Canadian but Catalan, and so on. This checkin also adds all the known language codes into the Language dropdown for the configuration selector, and displays the corresponding language name next to the selection. Similarly, it also sets the relevant flag icon as the page icon for the value XML files. Change-Id: I2a3a6f037a745a6c56aedb38ecd71ba25324f6fb
* 28860: Default proguard.config invalid on WindowsTor Norbye2012-06-131-0/+29
| | | | | | | | Attempt to work with ambiguous ProGuard path definitions (e.g. where : is used both as a path separator and in paths like D:\foo\bar) Change-Id: I63c3488b59ebfeb44e92ab84ec302932947ab909
* Migrate Fragment and ListView metadata to the tools namespaceTor Norbye2012-06-121-0/+7
| | | | | | | | | | | | | | | | | | | | The persistent metadata storing AdapterView and Fragment bindings predates the new tools namespace handled by aapt, and uses XML comments. This changeset updates the code to using tools: attributes instead. Note that it doesn't migrate old settings; I could not find a way to do that performantly (and in some cases the code which reads a setting has no access to the document containing the metadata, only to parsed XML nodes, so it cannot mutate it on demand to the new format.) However, this shouldn't be a big deal; for fragments for example the fragment message states what needs to be done to set up a binding. This CL also fixes a couple of bugs around setting up these views which should make switching views faster (it used to do the work twice), and avoids a rare concurrent modification exception. Change-Id: Id6a8a9a1649c1b9f6f5fc6a9fbc3a6e5b0512dd6
* GridLayout support workTor Norbye2012-06-124-14/+1084
| | | | | | | | | | | Lots of miscellaneous fixes to the GridLayout support in ADT. The changes include using the GridLayout state (via reflection) to populate the model; caching the grid model for performance, and a bunch of fixes to the code which handles insertions and removals. There are also some new unit tests. This is not done, but is an improvement over the current state. Change-Id: I4851153d3e409630c2d2024c4894d1ad1535fb47