aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Renamed some resource enum/qualifiers to be more consistent with the platform.Xavier Ducrohet2011-06-093-11/+17
| | | | Change-Id: I9c5ea5183e115582e0b805ca3ec75aad70e4a65c
* Fix various warningsTor Norbye2011-06-091-1/+8
| | | | | | | | | | | | | I ran the latest version of findbugs on our codebase and fixed some (not all!) of the warnings. I also ran with Eclipse 3.7 RC3 and updated our compiler warning settings for the new warnings that are available. I also fixed some DOS line endings in some files (formatted with CRLF instead of LF). Change-Id: I9a9d34a9b60f2cb609245793815d96a4587007b0
* Suggest similar class names or missing pkgs in the error consoleTor Norbye2011-06-081-0/+12
| | | | | | | | | | | | | | | | | | | If the layout XML file contains typos, the rendering will fail and the canvas will list the missing classes along with hyperlinks to create a new class, configure the build path etc. This changeset looks for "typos" in the view names and if it finds a similar real view class, either among the Android views or among the custom views in the current project, then it will add a hyperlink suggestion to fix the XML by editing the name to the correct spelling. It also handles the scenario where you have typed in a custom view class name correctly, but have forgotten to include its package. In a followup changeset this functionality will be available from the XML editing quick assistant as well. Change-Id: Iaefd3f503795e25e6eb38353c60c645061d4814e
* Code completion improvements inside custom viewsTor Norbye2011-06-085-0/+92
| | | | | | | | | | | This CL fixes several issues when using code completion inside a tag that is a custom view. In that case we don't have a valid descriptor which specifies the allowable children, which meant completing inside any of the children, even if they are standard Android widgets, would not locate names and attributes. This fixes that, along with handling dots in tag names which caused other code completion problems. Change-Id: If0f007322c6aa00363ab32baf6191a3d3ffb9883
* 17466: Strip Whitespace from Project Name to ActivityTor Norbye2011-06-082-9/+16
| | | | | | | | Also moved the capitalize() method from DescriptorsUtils to the AdtUtils method with the other general string utilities. Change-Id: Iffdbd906c5a4ecbd89c2f037d95f007e44733513
* Merge "Show previews of resources in the resource & reference choosers"Tor Norbye2011-06-062-0/+43
|\
| * Show previews of resources in the resource & reference choosersTor Norbye2011-06-062-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a first cut of previews in the Resource Chooser and the Reference Chooser. When the selected resource is a drawable or a color, then a tray is shown on the right hand side of the dialog with a preview of the given drawable or color. If the color is a state list, then the fallback color is shown. The previews only work for resource/reference choosers associated with a layout editor (because it looks up the associated rendering configuration from that editor). This should be made more generic such that it can work for example when bringing up the resource chooser from a manifest form editor. Change-Id: I9f2896cb7ce1468076a3ca83f820be7e9affcda6
* | BuildfixTor Norbye2011-06-061-0/+4
| | | | | | | | Change-Id: I532e666a585e4fd13e9ff965ce9a7a448bc9f8b7
* | Move tools to r12 and ADT to 12.0.0Xavier Ducrohet2011-06-061-2/+2
|/ | | | Change-Id: Ifcf5190547e9e37bdda766ad3d57a312c2dbb481
* Trim trailing whitespace in code completion test golden filesTor Norbye2011-06-0323-710/+710
| | | | | | There are no semantic changes. Change-Id: I43eddc9372c6e5194ba645bbe2d2bedfc438c25b
* Update unit test golden files to reflect recent changesTor Norbye2011-06-034-3/+7
| | | | Change-Id: I6c1eb0a0ab864f11cbc8cb9daddbf70189d03d11
* Resize & Guideline SupportTor Norbye2011-06-019-8/+62
| | | | | | | | | | | | | | | RelativeLayout now has both drop/move and resize guidelines, and existing constraints are visualized for the selection. LinearLayout resizing now uses weights to change the size of nodes rather than setting width/height. All resize operations offer guidelines to snap to their "wrap_content" size. Various bug fixes in related areas as well. Change-Id: I817e34c6e67ce61cfb137eb067076d91f69f99e9
* Fix ADT-testXavier Ducrohet2011-05-251-0/+4
| | | | Change-Id: Iebc29d774747ba64f1f895cd36970330145fd6b4
* Add support for addon providing their own layoutlib and/or res.Xavier Ducrohet2011-05-251-0/+4
| | | | | | | | | | | | | | | | | | During addon parsing, the SDK Manager will detect whether the addon has: - data/layoutlib.jar - data/res/ - data/fonts/ if the first one is present, then it is used during rendering. if *both* the 2nd and 3rd ones are present, then addon resources are used during rendering. On the GLE side, all that's needed is adding addons to the list of rendering targets if they have either library or resources (or both). Change-Id: Id16925eea2c98b9fbaaa884ac6fd8c1c1c444db2
* Basic fragment supportTor Norbye2011-05-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | This changeset adds preliminary support for fragments: * Add <fragment> to the palette, along with a drop handler which pops up a class chooser to pick the Fragment class; all project implementations of android.app.Fragment and android.support.v4.app.Fragment are listed. * Adds a fragment descriptor such that code completion works for <fragment> elements * Fix project callback such that it does not complain about a missing class "fragment". * Fix outline to display the name of the fragment rather than the fragment tag name. * This changeset also centers the label in MockViews since those are still used to render fragments Change-Id: I6e062970b335d9c95870f181ed408960978c423e
* Make Go To Declaration work for <fragment> names.Tor Norbye2011-05-136-1/+87
| | | | Change-Id: Ib2e8d8b93cdb52717719296dec0cbcf9780802ff
* Add code completion support for drawables, animations and colorsTor Norbye2011-04-2230-11/+470
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Custom listview layoutsTor Norbye2011-04-202-0/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for user-configured layouts in ListViews and ExpandableListViews. There is a new "Preview List Content" pullright menu when you right click on a ListView in the layout canvas. The menu contains links to configure - the layout to use for list view items - the layout to use as a header - the layout to use as a footer - as well as a number of pre-configured framework layouts for common arrangements like 2-item list, 1-item list, checked list, etc. The selected layout is persisted as an inline comment in the layout XML. (Current bug: When you drag elements around in the layout, comment nodes are not preserved, meaning you will lose your list view render type as well.) This changeset also adds "Clear" to the resource chooser, which makes it possible to clear a previously set value (until this, choosing nothing would simply abort the selection.) This makes it possible to remove a chosen header/footer. Change-Id: I611b00f627c5773f3fe2443a6e16c29388687b36
* Move getParser(name) into IProjectCallback.Xavier Ducrohet2011-04-201-0/+4
| | | | Change-Id: I316f03a9903e90eac0cb8059469c1de5b679dac5
* Cache resource resolver and manifest infoTor Norbye2011-04-182-0/+36
| | | | | | | | | | | This changeset adds caching of the ResourceResolver in the layout editor such that it can be reused for successive rendering requests as long as the configuration does not change. It also adds caching of the manifest icon and label; these are invalidated whenever the manifest file is updated and saved. Change-Id: Idbf77fd96fa60a4ac24e06bbecae882829a8b812
* Make Extract Include search in all filesTor Norbye2011-04-1515-14/+172
| | | | | | | | | | This changeset makes the "Extract Include" refactoring search not just the configuration-variations of the layout it was invoked on, but it will look for semantically identical XML fragments in all layouts in the same project, and will offer to replace each one of them with the new include. Change-Id: I03abf9e285d416e91b45eec7e01f518ea8d017d9
* Merge "Usability fix for the layout actions bar"Tor Norbye2011-04-111-0/+4
|\
| * Usability fix for the layout actions barTor Norbye2011-04-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The layout actions bar shows actions of two types: * Actions which edit attriubutes of the "current layout"; typically the parent of the currently selected views. For example, the "orientation" or "baseline" attributes of a LinearLayout. * Actions which edit the layout parameters of the selected views. For example, the "weight" attribute of children in a LinearLayout. One thing which was missing is adding in layout actions for views that are children. For example, the TableView now has an "Insert Row" action. If you select the table itself, rather than a child within the table, you would not see the Insert Row action. Similarly, if you drop a new LinearLayout, you cannot toggle its orientation attribute; it won't be shown, or if it is within another LinearLayout, you will see an orientation toggle but it controls the parent, not the newly selected LinearLayout. This changeset addresses this by adding a new section of actions on the right hand side of the actions bar, which contains the layout actions which apply to the selection, regardless of the parent type. For example, if you have a LinearLayout containing a TableLayout, and you have selected the TableLayout, you will first see the LinearLayout actions, then the LinearLayout layoutparams actions (which will be applied to the TableLayout), and finally the TableLayout layout actions (insert and remove row). This changeset also improves the TableLayout insert row action to insert the row before the current selected row (if any) rather than unconditionally appending it to the end. It also selects the table after creation to make it more obvious where it was added. The new ability to select nodes from layout rules is also used in a couple of other places. Change-Id: I7cd8f75e61fc916bc75ed5ad156440f0f8cbd786
* | Make theme selection take rendering target into accountTor Norbye2011-04-081-11/+150
|/ | | | | | | | If the current rendering target is less than API level 11, then don't use the Holo theme even if the project itself has >= 11 as an SDK target. Change-Id: I23c8a4865fa4af3c46fbfa34f0a83b18e7ed9b63
* Turn off palette previews during unit testsTor Norbye2011-04-081-0/+4
| | | | | | | | | | Set the default palette mode to icon+text rather than preview during unit test runs. Since each test run will create a blank workspace, the previews have to be recomputed each time, which adds a couple of seconds. Also, there are some problems on Windows when the previewing code runs under unit tests, which this will work around. Change-Id: Ic6a7bdaee731a219ff6042075977e12b0eeda111
* Sort elements alphabetically in code completionTor Norbye2011-04-063-63/+63
| | | | | | | | | Attributes were sorted, but not elements. Layout descriptors were mostly sorted already, but with all views before viewgroups. The manifest elements were in the order they must appear in the manifest files. Change-Id: I03e3fce032949f9df6ffc0ef96386b7458754270
* Merge "Move getViewParent/Index from RenderSession to Bridge."Xavier Ducrohet2011-04-062-4/+5
|\
| * Move getViewParent/Index from RenderSession to Bridge.Xavier Ducrohet2011-04-062-4/+5
| | | | | | | | | | | | Also update the IProjectCallback to handle expandableListView. Change-Id: I36ca8733182bbd9d169fee3e709ebc532fef7b1e
* | Fix hyperlinks plugin unit test on Windows.Raphael Moll2011-04-064-6/+6
|/ | | | Change-Id: I7c48ffe1beb511b0639ae90a26f1a8ee435fad47
* Fix crop tests on Windows (RGB endianess issue).Raphael Moll2011-04-051-20/+40
| | | | | | | | | Since endianess can change between an input and output image in SwtUtils, it's important to not test pixels as pure int values but instead use the correct RGB palette mapping. Change-Id: Icd3aad499a5cc069e8cc804af7511c95849a78a6
* Merge "Store plugin tests results in a tmp sub folder."Raphael Moll2011-04-051-1/+20
|\
| * Store plugin tests results in a tmp sub folder.Raphael Moll2011-04-041-1/+20
| | | | | | | | Change-Id: Ib52b2ae105225f3052cd46690d21a3f81be309d6
* | Merge "Fix AttrParser tests on Windows."Raphael Moll2011-04-051-3/+42
|\ \ | |/
| * Fix AttrParser tests on Windows.Raphael Moll2011-04-041-3/+42
| | | | | | | | Change-Id: I7c73b484db07aa06c6c4812672f88242b34c1e3e
* | Merge "Changed bundle versions in some manifests."Xavier Ducrohet2011-04-041-1/+1
|\ \
| * | Changed bundle versions in some manifests.Pierre Zurek2011-03-101-1/+1
| | | | | | | | | | | | Change-Id: I6a8dc3e5ef0a36dc071c54ff6c0d2abefe668ca8
* | | LayoutLib API: update adapter binding callbacks.Xavier Ducrohet2011-04-041-3/+5
| | | | | | | | | | | | Change-Id: I85be09fd7541da366c858ea04d7c2c4b53948475
* | | Pick layout themes from manifest registrations and target SDKTor Norbye2011-04-042-0/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset changes the way the layout editor picks themes when a layout is opened. It used to just pick the first available theme in the theme chooser. Now it performs the following checks, in order: * Does this layout have a persisted theme setting from a previous run of the tool? If yes, use it. * Can the activity for this layout be determined? If so, look at the manifest registration for the corresponding activity, and if it specifies a theme, use it. * If not, does the manifest specify a default theme for the project? If so, use it. * If not, is the target SDK version (or the minimum SDK version, if the target is not specified) at least API level 11 or higher? If so, the default theme is "Theme.Holo" * If not, the default theme is "Theme". * If the file to be opened is included from some other layout, use the no-decorations versions of the default layouts, e.g. Theme.NoTitleBar or Theme.Holo.NoActionBar. * At the end of this resolution, the computed theme is stored as the persisted theme setting for this layout, so the above algorithm will only be computed once. We might want to tweak this such that it distinguishes between a default computation of a theme and a manual user choice of a theme. * If the file is opened as "Show Included In" (e.g. rendered within an outer file) then the theme chosen is the one for the outer file. During startup, this information will be asked for each and every layout being reopened, so there is now a "ManifestInfo" class attached to the project which keeps manifest information around. It checks the timestamp of the AndroidManifest.xml file and refreshes its information lazily if necessary. All themes mentioned in the manifest are listed in a special section at the top of the theme chooser (below the entry for the default computed described above). The code to look up the associated Activity of a layout is using a simple heuristic: it looks for usages of the corresponding R.layout field, and prefers references from methods called onCreate or in classes whose superclass name ends with Activity. I tried a different approach where I searched for usages of Activity.setContentView(int) but this failed to identify a number of cases where the activity was doing some simple logic and didn't pass the layout id directly as a parameter in setContentView, so I went back to the basic approach. Change-Id: Ibd3c0f089fefe38e6e6c607d65524990699c86d3
* | | Make code completion skip the layout_ prefix if necessaryTor Norbye2011-04-047-0/+99
| |/ |/| | | | | | | | | | | | | | | | | | | The code completion prefix matcher already lets you skip the namespace, so you can type "width" and it will expand to "android:width". This changeset adds "layout_" to this scheme, so you can type "margin", and this will match "layout_margin" as well. Change-Id: I8bf71e91ac8ac71bd2cb0308c6f1d39a9dfaa66a
* | Update test to track layoutlib changeTor Norbye2011-04-011-3/+2
| | | | | | | | Change-Id: Ie4ccd0d05a85ebbb03fefb9ba1e31dfbde1a89be
* | Merge "Add a way to get the adapter binding through the project callback."Xavier Ducrohet2011-04-011-0/+5
|\ \
| * | Add a way to get the adapter binding through the project callback.Xavier Ducrohet2011-04-011-0/+5
| | | | | | | | | | | | Change-Id: I0de48e3519f38a63c3462f5eb0c7f6c2a29d0e6f
* | | Improve view cookie handlingTor Norbye2011-04-014-26/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The layout editor is passed a ViewInfo hierarchy by the layout library. For older versions of the layout library, it can be handed hierarchies where the view cookies (which point back to XML model objects corresponding to the rendered views) that are missing or ambiguous. For that reason, it has various algorithms to try to piece things back together, and for example handle <merge> scenarios as best it can. This isn't necessary with layout lib version 5 and higher, since as of version 5 these scenarios are handled on the layout lib side and the layout editor is passed back special cookies like the MergeCookie to properly handle the various scenarios. This fix makes the layout editor look up the layoutlib version, and if dealing with version 5 or higher, it takes a simpler path to build up the hierarchy. This is also necessary to deal with the latest version of layoutlib which passes a new type of view cookie which the older algorithm couldn't handle. Change-Id: I98c3ba5d17ad9d639eb118e4709c0b6bbf815b0a
* | | Extract Style RefactoringTor Norbye2011-03-3133-7/+480
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Add support for data binding in the layout editor."Xavier Ducrohet2011-03-291-0/+5
|\ \
| * | Add support for data binding in the layout editor.Xavier Ducrohet2011-03-291-0/+5
| | | | | | | | | | | | | | | | | | | | | The Layoutlib_api is changed to allow passing information regarding adapter content, and querying eclipse to fill the items. Change-Id: Ie5a047ab9cd0ed7677c13309d95663eae462c3e7
* | | Test infrastructure fixesTor Norbye2011-03-287-16/+66
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Code completion in style definitions & other improvementsTor Norbye2011-03-2566-43/+1038
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds code completion support to resource files where <style> elements are defined. In particular, you get two types of completion: - Completion on names: <style><item name="|" > Here you get offered ALL matching attribute names from any view descriptors. - Completion on values: <style><item name="android:gravity">|</item> Here you get offered all values that correspond to the attribute named as the value of the name attribute of the surrounding item element. Unrelated to styles, code completion will now also move the caret outside the attribute value quotes when you enter one of the value alternatives (unless the value is a flag type or a resource token). Also, run-on attributes are also handled more gracefully: if you complete properties with the caret immediately following another attribute, a separating space is added into the match as a prefix such that the new attribute is separated and the XML valid. There are a lot of diffs in this changeset. In order to allow the ResourcesContentAssist to extend code completion to add its style- specific logic, the content assist code had to be split up a bit. Doing completion in text nodes, or potential text nodes (e.g. if you have <item>|</item> you should get text completion at that caret offset even though there is no text node child of the item element until you insert actual text there) also required some changes. There are many new unit tests. I also changed the golden file format slightly to show the caret in the before-view such that it's more obvious how the caret was affected by inserting the new item. Change-Id: Ia985db7e848fea33e93ac8a70b2c3b4dbfd9056a
* | Handle AAPT ranges in value resource filesTor Norbye2011-03-2510-13/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Refactoring Quick Assistant"Tor Norbye2011-03-215-0/+138
|\ \