diff options
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests/src/com/android')
126 files changed, 3882 insertions, 1340 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java index e2f7049..700e68b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java @@ -27,11 +27,15 @@ import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.internal.editors.animator.AnimationContentAssist; import com.android.ide.eclipse.adt.internal.editors.color.ColorContentAssist; import com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor; +import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor; +import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.adt.internal.editors.drawable.DrawableContentAssist; import com.android.ide.eclipse.adt.internal.editors.layout.LayoutContentAssist; +import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor; import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest; import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestContentAssist; import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestEditor; +import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode; import com.android.ide.eclipse.adt.internal.editors.values.ValuesContentAssist; import org.eclipse.core.resources.IFile; @@ -487,6 +491,38 @@ public class AndroidContentAssistTest extends AdtProjectTest { checkLayoutCompletion("completion11.xml", "?and^roid:attr/Textapp"); } + public void testCompletion75() throws Exception { + // Test <include> attributes + checkLayoutCompletion("completion12.xml", "<include ^/>"); + } + + public void testComplation76() throws Exception { + // Test theme completion with implicit attr + checkLayoutCompletion("navigation1.xml", "?android:a^ttr/alertDialogStyle"); + } + + public void testComplation77() throws Exception { + // Test <fragment class="^" completion + checkLayoutCompletion("fragmentlayout.xml", "android:name=\"^com"); + } + + public void testComplation78() throws Exception { + // Test <fragment android:name="^" completion + checkLayoutCompletion("fragmentlayout.xml", "class=\"^com"); + } + + public void testComplation79() throws Exception { + // Test tools context completion + checkLayoutCompletion("completion11.xml", "tools:context=\"^.MainActivity\""); + } + + public void testComplation80() throws Exception { + // Test manifest class completion + checkManifestCompletion("manifest.xml", "<activity android:name=\"^."); + } + + // TODO: Test <view completion! + // ---- Test *applying* code completion ---- // The following tests check -applying- a specific code completion @@ -782,6 +818,12 @@ public class AndroidContentAssistTest extends AdtProjectTest { "?android:attr/Textapp^", "?android:attr/textAppearanceLargeInverse"); } + public void testApplyCompletion47() throws Exception { + // Test applying <fragment android:name="^" completion + checkApplyLayoutCompletion("fragmentlayout.xml", "class=\"^com", + "android.app.ListFragment"); + } + // --- Code Completion test infrastructure ---- private void checkLayoutCompletion(String name, String caretLocation) throws Exception { @@ -852,8 +894,17 @@ public class AndroidContentAssistTest extends AdtProjectTest { assertNotNull(page); IEditorPart editor = IDE.openEditor(page, file); assertTrue(editor instanceof AndroidXmlEditor); - AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor; - ISourceViewer viewer = layoutEditor.getStructuredSourceViewer(); + AndroidXmlEditor xmlEditor = (AndroidXmlEditor) editor; + + UiElementNode root = xmlEditor.getUiRootNode(); + ElementDescriptor descriptor = root.getDescriptor(); + if (descriptor instanceof ViewElementDescriptor) { + ViewElementDescriptor vd = (ViewElementDescriptor) descriptor; + AttributeDescriptor[] attributes = vd.getAttributes(); + assertTrue(Integer.toString(attributes.length), attributes.length > 0); + } + + ISourceViewer viewer = xmlEditor.getStructuredSourceViewer(); // Determine the offset, and possibly make text range selections as well int offset = updateCaret(viewer, caretLocation); @@ -921,11 +972,16 @@ public class AndroidContentAssistTest extends AdtProjectTest { sb.append("Code completion in " + basename + " for " + caretLocation + ":\n"); for (ICompletionProposal proposal : proposals) { // TODO: assertNotNull(proposal.getImage()); + int length = sb.length(); sb.append(proposal.getDisplayString().trim()); String help = proposal.getAdditionalProposalInfo(); if (help != null && help.trim().length() > 0) { sb.append(" : "); sb.append(help.replace('\n', ' ').trim()); + if (sb.length() > length + 300) { + sb.setLength(length + 300 - "...".length()); + sb.append("..."); + } } sb.append('\n'); } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/HyperlinksTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/HyperlinksTest.java index 7dcf661..cb83947 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/HyperlinksTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/HyperlinksTest.java @@ -44,7 +44,9 @@ import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; import java.lang.reflect.Field; import java.lang.reflect.Method; -@SuppressWarnings("restriction") +@SuppressWarnings({ + "restriction", "javadoc" +}) public class HyperlinksTest extends AdtProjectTest { @Override protected boolean testCaseNeedsUniqueProject() { @@ -184,6 +186,12 @@ public class HyperlinksTest extends AdtProjectTest { "?android:attr/alert^DialogStyle"); } + public void testNavigate16() throws Exception { + // Check navigating to a theme resource + checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml", + "?android:alert^DialogStyle"); + } + // Left to test: // onClick handling // class attributes diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/XmlPrettyPrinterTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java index 731621c..ac5fd01 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/XmlPrettyPrinterTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java @@ -15,6 +15,7 @@ */ package com.android.ide.eclipse.adt.internal.editors.formatting; +import com.android.ide.common.xml.XmlFormatStyle; import com.android.ide.eclipse.adt.internal.editors.layout.gle2.DomUtilities; import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; @@ -28,9 +29,9 @@ import org.w3c.dom.NodeList; import junit.framework.TestCase; @SuppressWarnings({ - "javadoc", "restriction" + "javadoc", "restriction" }) -public class XmlPrettyPrinterTest extends TestCase { +public class EclipseXmlPrettyPrinterTest extends TestCase { @Override protected void setUp() throws Exception { super.setUp(); @@ -39,11 +40,11 @@ public class XmlPrettyPrinterTest extends TestCase { AdtPrefs prefs = AdtPrefs.getPrefs(); prefs.initializeStoreWithDefaults(store); prefs.loadValues(null); - XmlFormatPreferences formatPrefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences formatPrefs = EclipseXmlFormatPreferences.create(); assertTrue(formatPrefs.oneAttributeOnFirstLine); } - private void checkFormat(XmlFormatPreferences prefs, String baseLocation, + private void checkFormat(EclipseXmlFormatPreferences prefs, String baseLocation, String xml, String expected, String delimiter, String startNodeName, boolean openTagOnly, String endNodeName) throws Exception { @@ -61,7 +62,8 @@ public class XmlPrettyPrinterTest extends TestCase { } XmlFormatStyle style = AndroidXmlFormattingStrategy.guessStyle(model, document); - XmlPrettyPrinter printer = new XmlPrettyPrinter(prefs, style, delimiter); + EclipseXmlPrettyPrinter printer = new EclipseXmlPrettyPrinter(prefs, style, delimiter); + printer.setEndWithNewline(xml.endsWith("\n")); StringBuilder sb = new StringBuilder(1000); Node startNode = document; @@ -110,18 +112,18 @@ public class XmlPrettyPrinterTest extends TestCase { return caretContextIndex + caretDelta; } - private void checkFormat(XmlFormatPreferences prefs, String baseLocation, String xml, + private void checkFormat(EclipseXmlFormatPreferences prefs, String baseLocation, String xml, String expected, String delimiter) throws Exception { checkFormat(prefs, baseLocation, xml, expected, delimiter, null, false, null); } - private void checkFormat(XmlFormatPreferences prefs, String baseLocation, String xml, + private void checkFormat(EclipseXmlFormatPreferences prefs, String baseLocation, String xml, String expected) throws Exception { checkFormat(prefs, baseLocation, xml, expected, "\n"); //$NON-NLS-1$ } private void checkFormat(String baseLocation, String xml, String expected) throws Exception { - XmlFormatPreferences prefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences prefs = EclipseXmlFormatPreferences.create(); checkFormat(prefs, baseLocation, xml, expected); } @@ -152,7 +154,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testLayout3() throws Exception { - XmlFormatPreferences prefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences prefs = EclipseXmlFormatPreferences.create(); prefs.oneAttributeOnFirstLine = true; checkFormat( prefs, "res/layout-land/layout3.xml", @@ -179,7 +181,7 @@ public class XmlPrettyPrinterTest extends TestCase { " <item name=\"title_container\" type=\"id\"/>\n" + " <item name=\"title_logo\" type=\"id\"/>\n" + "\n" + - "</resources>"); + "</resources>\n"); } public void testResources() throws Exception { @@ -252,7 +254,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testWindowsDelimiters() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", + EclipseXmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", "<LinearLayout><Button foo=\"bar\"></Button></LinearLayout>", "<LinearLayout>\r\n" + @@ -265,7 +267,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testRemoveBlanklines() throws Exception { - XmlFormatPreferences prefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences prefs = EclipseXmlFormatPreferences.create(); prefs.removeEmptyLines = true; checkFormat( prefs, "res/layout-xlarge/layout.xml", @@ -289,7 +291,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testRange() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", + EclipseXmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", "<LinearLayout><Button foo=\"bar\"></Button><CheckBox/></LinearLayout>", "\n" + " <Button foo=\"bar\" >\n" + @@ -302,7 +304,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testOpenTagOnly() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", + EclipseXmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", "<LinearLayout><Button foo=\"bar\"></Button><CheckBox/></LinearLayout>", "\n" + " <Button foo=\"bar\" >\n" + @@ -313,7 +315,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testRange2() throws Exception { - XmlFormatPreferences prefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences prefs = EclipseXmlFormatPreferences.create(); prefs.removeEmptyLines = true; checkFormat( prefs, "res/layout-xlarge/layout.xml", @@ -329,7 +331,6 @@ public class XmlPrettyPrinterTest extends TestCase { " <bar3>\n" + " <baz12>\n" + " </baz12>\n", - "\n", "baz1", false, "baz12"); } @@ -480,6 +481,7 @@ public class XmlPrettyPrinterTest extends TestCase { " <dimen name=\"text_size_large\">22sp</dimen>\n" + "\n" + "</resources>", + "<resources>\n" + "\n" + " <dimen name=\"colorstrip_height\">6dip</dimen>\n" + @@ -499,7 +501,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testCommentHandling() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/layout/layout1.xml", + EclipseXmlFormatPreferences.create(), "res/layout/layout1.xml", "<foo >\n" + "\n" + " <!-- abc\n" + @@ -543,7 +545,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testCommentHandling2() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", + EclipseXmlFormatPreferences.create(), "res/layout-xlarge/layout.xml", "<foo >\n" + " <!-- multi -->\n" + "\n" + @@ -561,7 +563,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testMenus1() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/menu/menu1.xml", + EclipseXmlFormatPreferences.create(), "res/menu/menu1.xml", // http://code.google.com/p/android/issues/detail?id=21383 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n" + @@ -614,7 +616,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testMenus2() throws Exception { - XmlFormatPreferences prefs = XmlFormatPreferences.create(); + EclipseXmlFormatPreferences prefs = EclipseXmlFormatPreferences.create(); prefs.removeEmptyLines = true; checkFormat( prefs, "res/drawable-hdpi/layerlist.xml", @@ -640,6 +642,7 @@ public class XmlPrettyPrinterTest extends TestCase { " </shape>\n" + " </item>\n" + "</layer-list>", + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n" + " <item>\n" + @@ -665,7 +668,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testMenus3() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/menu/menu1.xml", + EclipseXmlFormatPreferences.create(), "res/menu/menu1.xml", // http://code.google.com/p/android/issues/detail?id=21227 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n" + @@ -703,7 +706,7 @@ public class XmlPrettyPrinterTest extends TestCase { public void testColors1() throws Exception { checkFormat( - XmlFormatPreferences.create(), "res/values/colors.xml", + EclipseXmlFormatPreferences.create(), "res/values/colors.xml", "<resources>\n" + " <color name=\"enrollment_error\">#99e21f14</color>\n" + "\n" + @@ -719,7 +722,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testEclipseFormatStyle1() throws Exception { - XmlFormatPreferences prefs = new XmlFormatPreferences() { + EclipseXmlFormatPreferences prefs = new EclipseXmlFormatPreferences() { @Override public String getOneIndentUnit() { return "\t"; @@ -747,7 +750,7 @@ public class XmlPrettyPrinterTest extends TestCase { } public void testEclipseFormatStyle2() throws Exception { - XmlFormatPreferences prefs = new XmlFormatPreferences() { + EclipseXmlFormatPreferences prefs = new EclipseXmlFormatPreferences() { @Override public String getOneIndentUnit() { return " "; @@ -874,7 +877,7 @@ public class XmlPrettyPrinterTest extends TestCase { " <string name=\"untitled2\"><untitled2></string>\n" + " <string name=\"untitled3\">'untitled3"</string>\n" + "\n" + - "</resources>"); + "</resources>\n"); } public void testCData1() throws Exception { @@ -937,4 +940,39 @@ public class XmlPrettyPrinterTest extends TestCase { "</resources>"); } + public void test52887() throws Exception { + // https://code.google.com/p/android/issues/detail?id=52887 + checkFormat( + "res/layout/relative.xml", + + "<!--Comment-->\n" + + "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"match_parent\"/>\n", + + "<!-- Comment -->\n" + + "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"match_parent\" />\n"); + } + + public void testPreserveLastNewline() throws Exception { + checkFormat( + "res/values/strings.xml", + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<resources>\n" + + "<string name=\"progress_completed_export_all\">The database has " + + "<b>successfully</b> been exported into: <br /><br /><font size=\"14\">" + + "\\\"<i>%s</i>\\\"</font></string>" + + "</resources>\n", + + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<resources>\n" + + "\n" + + " <string name=\"progress_completed_export_all\">The database has " + + "<b>successfully</b> been exported into: <br /><br /><font size=\"14\">" + + "\\\"<i>%s</i>\\\"</font></string>\n" + + "\n" + + "</resources>\n"); + } } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java index a75fc96..c71064e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java @@ -45,111 +45,6 @@ import org.w3c.dom.Node; @SuppressWarnings({"restriction", "javadoc", "deprecation"}) // XML DOM model public class LayoutMetadataTest extends AdtProjectTest { - public void testOldMetadata1() throws Exception { - Pair<IDocument, UiElementNode> pair = getNode("metadata.xml", "listView1"); - IDocument document = pair.getFirst(); - UiElementNode uiNode = pair.getSecond(); - Node node = uiNode.getXmlNode(); - - assertNull(LayoutMetadata.getProperty(document, node, "foo")); - String before = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " </ListView>"; - assertEquals(before, getText(document, node)); - - // Set the property - LayoutMetadata.setProperty(document, node, - "listitem", "@android:layout/simple_list_item_checked"); - String after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " <!-- Preview: listitem=@android:layout/simple_list_item_checked -->\n" + - " </ListView>"; - assertEquals(after, getText(document, node)); - - // Set a second property - LayoutMetadata.setProperty(document, node, - "listheader", "@android:layout/browser_link_context_header"); - after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " <!-- Preview: \n" + - " listheader=@android:layout/browser_link_context_header\n" + - " listitem=@android:layout/simple_list_item_checked\n" + - " -->\n" + - " </ListView>"; - assertEquals(after, getText(document, node)); - - // Set list item to a different layout - LayoutMetadata.setProperty(document, node, - "listitem", "@android:layout/simple_list_item_single_choice"); - after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " <!-- Preview: \n" + - " listheader=@android:layout/browser_link_context_header\n" + - " listitem=@android:layout/simple_list_item_single_choice\n" + - " -->\n" + - " </ListView>"; - assertEquals(after, getText(document, node)); - - // Set header to a different layout - LayoutMetadata.setProperty(document, node, - "listheader", "@layout/foo"); - after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " <!-- Preview: \n" + - " listheader=@layout/foo\n" + - " listitem=@android:layout/simple_list_item_single_choice\n" + - " -->\n" + - " </ListView>"; - assertEquals(after, getText(document, node)); - - // Clear out list item - LayoutMetadata.setProperty(document, node, - "listitem", null); - after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\">\n" + - " <!-- Preview: listheader=@layout/foo -->\n" + - " </ListView>"; - assertEquals(after, getText(document, node)); - - // Clear out list header - LayoutMetadata.setProperty(document, node, - "listheader", null); - after = - "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" + - " android:layout_height=\"wrap_content\"></ListView>"; - assertEquals(after, getText(document, node)); - - // Check node expansion on the button which doesn't have an end tag: - before = "<Button android:text=\"Button\" android:id=\"@+id/button1\"/>"; - } - - public void testMetadata2() throws Exception { - Pair<IDocument, UiElementNode> pair = getNode("metadata.xml", "button1"); - IDocument document = pair.getFirst(); - UiElementNode uiNode = pair.getSecond(); - Node node = uiNode.getXmlNode(); - - assertNull(LayoutMetadata.getProperty(document, node, "foo")); - String before = - "<Button android:text=\"Button\" android:id=\"@+id/button1\"/>"; - assertEquals(before, getText(document, node)); - - // Set the property - LayoutMetadata.setProperty(document, node, - "listitem", "@android:layout/simple_list_item_checked"); - String after = - "<Button android:text=\"Button\" android:id=\"@+id/button1\">\n" + - " <!-- Preview: listitem=@android:layout/simple_list_item_checked -->\n" + - " </Button>"; - assertEquals(after, getText(document, node)); - } - public void testMetadata1() throws Exception { Pair<IDocument, UiElementNode> pair = getNode("metadata.xml", "listView1"); UiElementNode uiNode = pair.getSecond(); @@ -158,11 +53,11 @@ public class LayoutMetadataTest extends AdtProjectTest { assertNull(LayoutMetadata.getProperty(node, "foo")); Element element = (Element) node; - String prefix = XmlUtils.lookupNamespacePrefix(element, TOOLS_URI, null); + String prefix = XmlUtils.lookupNamespacePrefix(element, TOOLS_URI, null, false); if (prefix == null) { // Add in new prefix... prefix = XmlUtils.lookupNamespacePrefix(element, - TOOLS_URI, TOOLS_PREFIX); + TOOLS_URI, TOOLS_PREFIX, true); } element.setAttribute(prefix + ':' + "foo", "bar"); } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java index 3d0c3f5..8dd83d7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java @@ -19,20 +19,25 @@ import static com.android.SdkConstants.FD_RES; import static com.android.SdkConstants.FD_RES_LAYOUT; import static com.android.SdkConstants.FD_RES_VALUES; -import com.android.SdkConstants; +import com.android.ide.common.sdk.LoadStatus; import com.android.ide.eclipse.adt.AdtPlugin; +import com.android.ide.eclipse.adt.AdtUtils; import com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor; import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate; +import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors; import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor; import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode; import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode; import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; +import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper; +import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; +import com.android.ide.eclipse.adt.internal.sdk.Sdk; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState.Mode; -import com.android.ide.eclipse.tests.SdkTestCase; +import com.android.ide.eclipse.tests.SdkLoadingTestCase; import com.android.sdklib.IAndroidTarget; import org.eclipse.core.resources.IContainer; @@ -42,6 +47,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.text.source.ISourceViewer; @@ -51,31 +57,20 @@ import org.eclipse.wst.sse.core.internal.provisional.IModelManager; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; -import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import java.util.Calendar; import java.util.HashMap; +import java.util.List; import java.util.Map; @SuppressWarnings({"restriction", "javadoc"}) -public class AdtProjectTest extends SdkTestCase { - private static final int TARGET_API_LEVEL = 12; +public abstract class AdtProjectTest extends SdkLoadingTestCase { + private static final int TARGET_API_LEVEL = 16; public static final String TEST_PROJECT_PACKAGE = "com.android.eclipse.tests"; //$NON-NLS-1$ - - /** Update golden files if different from the actual results */ - private static final boolean UPDATE_DIFFERENT_FILES = false; - /** Create golden files if missing */ - private static final boolean UPDATE_MISSING_FILES = true; - private static final String TEST_DATA_REL_PATH = - "eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/" - + "internal/editors/layout/refactoring/testdata"; - private static final String PROJECTNAME_PREFIX = "testproject-"; private static final long TESTS_START_TIME = System.currentTimeMillis(); - private static File sTempDir = null; + private static final String PROJECTNAME_PREFIX = "testproject-"; /** * We don't stash the project used by each test case as a field such that test cases @@ -85,6 +80,23 @@ public class AdtProjectTest extends SdkTestCase { private static Map<String, IProject> sProjectMap = new HashMap<String, IProject>(); @Override + protected String getTestDataRelPath() { + return "eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/" + + "internal/editors/layout/refactoring/testdata"; + } + + @Override + protected InputStream getTestResource(String relativePath, boolean expectExists) { + String path = "testdata" + File.separator + relativePath; //$NON-NLS-1$ + InputStream stream = + AdtProjectTest.class.getResourceAsStream(path); + if (!expectExists && stream == null) { + return null; + } + return stream; + } + + @Override protected void setUp() throws Exception { super.setUp(); @@ -95,6 +107,40 @@ public class AdtProjectTest extends SdkTestCase { AdtPrefs.getPrefs().setPaletteModes("ICON_TEXT"); //$NON-NLS-1$ getProject(); + + Sdk current = Sdk.getCurrent(); + assertNotNull(current); + LoadStatus sdkStatus = AdtPlugin.getDefault().getSdkLoadStatus(); + assertSame(LoadStatus.LOADED, sdkStatus); + IAndroidTarget target = current.getTarget(getProject()); + IJavaProject javaProject = BaseProjectHelper.getJavaProject(getProject()); + assertNotNull(javaProject); + int iterations = 0; + while (true) { + if (iterations == 100) { + fail("Couldn't load target; ran out of time"); + } + LoadStatus status = current.checkAndLoadTargetData(target, javaProject); + if (status == LoadStatus.FAILED) { + fail("Couldn't load target " + target); + } + if (status != LoadStatus.LOADING) { + break; + } + Thread.sleep(250); + iterations++; + } + AndroidTargetData targetData = current.getTargetData(target); + assertNotNull(targetData); + LayoutDescriptors layoutDescriptors = targetData.getLayoutDescriptors(); + assertNotNull(layoutDescriptors); + List<ViewElementDescriptor> viewDescriptors = layoutDescriptors.getViewDescriptors(); + assertNotNull(viewDescriptors); + assertTrue(viewDescriptors.size() > 0); + List<ViewElementDescriptor> layoutParamDescriptors = + layoutDescriptors.getLayoutDescriptors(); + assertNotNull(layoutParamDescriptors); + assertTrue(layoutParamDescriptors.size() > 0); } /** Set to true if the subclass test case should use a per-instance project rather @@ -147,7 +193,10 @@ public class AdtProjectTest extends SdkTestCase { assertNotNull(project); sProjectMap.put(projectName, project); } - + if (!testCaseNeedsUniqueProject() && !testNeedsUniqueProject()) { + addCleanupDir(AdtUtils.getAbsolutePath(project).toFile()); + } + addCleanupDir(project.getFullPath().toFile()); return project; } @@ -217,6 +266,9 @@ public class AdtProjectTest extends SdkTestCase { IAndroidTarget[] targets = getSdk().getTargets(); for (IAndroidTarget t : targets) { + if (!t.isPlatform()) { + continue; + } if (t.getVersion().getApiLevel() >= TARGET_API_LEVEL) { target = t; break; @@ -224,7 +276,6 @@ public class AdtProjectTest extends SdkTestCase { } assertNotNull(target); - IRunnableContext context = new IRunnableContext() { @Override public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) @@ -240,12 +291,19 @@ public class AdtProjectTest extends SdkTestCase { state.applicationName = name; state.createActivity = false; state.useDefaultLocation = true; + if (getMinSdk() != -1) { + state.minSdk = Integer.toString(getMinSdk()); + } NewProjectCreator creator = new NewProjectCreator(state, context); creator.createAndroidProjects(); return validateProjectExists(name); } + protected int getMinSdk() { + return -1; + } + public void createTestProject() { IAndroidTarget target = null; @@ -267,8 +325,7 @@ public class AdtProjectTest extends SdkTestCase { } private static IProject getProject(String name) { - IProject iproject = ResourcesPlugin.getWorkspace().getRoot() - .getProject(name); + IProject iproject = ResourcesPlugin.getWorkspace().getRoot().getProject(name); return iproject; } @@ -279,33 +336,6 @@ public class AdtProjectTest extends SdkTestCase { return getCaretOffset(fileContent, caretLocation); } - protected int getCaretOffset(String fileContent, String caretLocation) { - assertTrue(caretLocation, caretLocation.contains("^")); //$NON-NLS-1$ - - int caretDelta = caretLocation.indexOf("^"); //$NON-NLS-1$ - assertTrue(caretLocation, caretDelta != -1); - - // String around caret/range without the range and caret marker characters - String caretContext; - if (caretLocation.contains("[^")) { //$NON-NLS-1$ - caretDelta--; - assertTrue(caretLocation, caretLocation.startsWith("[^", caretDelta)); //$NON-NLS-1$ - int caretRangeEnd = caretLocation.indexOf(']', caretDelta + 2); - assertTrue(caretLocation, caretRangeEnd != -1); - caretContext = caretLocation.substring(0, caretDelta) - + caretLocation.substring(caretDelta + 2, caretRangeEnd) - + caretLocation.substring(caretRangeEnd + 1); - } else { - caretContext = caretLocation.substring(0, caretDelta) - + caretLocation.substring(caretDelta + 1); // +1: skip "^" - } - - int caretContextIndex = fileContent.indexOf(caretContext); - assertTrue("Caret content " + caretContext + " not found in file", - caretContextIndex != -1); - return caretContextIndex + caretDelta; - } - /** * If the given caret location string contains a selection range, select that range in * the given viewer @@ -358,107 +388,9 @@ public class AdtProjectTest extends SdkTestCase { return addSelection(newFileContents, selectionBegin, selectionEnd); } - protected String addSelection(String newFileContents, int selectionBegin, int selectionEnd) { - // Insert selection markers -- [ ] for the selection range, ^ for the caret - String newFileWithCaret; - if (selectionBegin < selectionEnd) { - newFileWithCaret = newFileContents.substring(0, selectionBegin) + "[^" - + newFileContents.substring(selectionBegin, selectionEnd) + "]" - + newFileContents.substring(selectionEnd); - } else { - // Selected range - newFileWithCaret = newFileContents.substring(0, selectionBegin) + "^" - + newFileContents.substring(selectionBegin); - } - - return newFileWithCaret; - } - - protected String getCaretContext(String file, int offset) { - int windowSize = 20; - int begin = Math.max(0, offset - windowSize / 2); - int end = Math.min(file.length(), offset + windowSize / 2); - - return "..." + file.substring(begin, offset) + "^" + file.substring(offset, end) + "..."; - } - - /** - * Very primitive line differ, intended for files where there are very minor changes - * (such as code completion apply-tests) - */ - protected String getDiff(String before, String after) { - // Do line by line analysis - String[] beforeLines = before.split("\n"); - String[] afterLines = after.split("\n"); - - int firstDelta = 0; - for (; firstDelta < Math.min(beforeLines.length, afterLines.length); firstDelta++) { - if (!beforeLines[firstDelta].equals(afterLines[firstDelta])) { - break; - } - } - - if (firstDelta == beforeLines.length && firstDelta == afterLines.length) { - return ""; - } - - // Counts from the end of both arrays - int lastDelta = 0; - for (; lastDelta < Math.min(beforeLines.length, afterLines.length); lastDelta++) { - if (!beforeLines[beforeLines.length - 1 - lastDelta].equals( - afterLines[afterLines.length - 1 - lastDelta])) { - break; - } - } - - boolean showBeforeWindow = firstDelta >= beforeLines.length - lastDelta; - boolean showAfterWindow = firstDelta >= afterLines.length - lastDelta; - - StringBuilder sb = new StringBuilder(); - if (showAfterWindow && firstDelta > 0) { - sb.append(" "); - sb.append(afterLines[firstDelta - 1]); - sb.append('\n'); - } - for (int i = firstDelta; i < beforeLines.length - lastDelta; i++) { - sb.append("<"); - if (beforeLines[i].length() > 0) { - sb.append(" "); - } - sb.append(beforeLines[i]); - sb.append('\n'); - } - if (showAfterWindow && lastDelta < afterLines.length - 1) { - sb.append(" "); - sb.append(afterLines[afterLines.length - (lastDelta -1)]); - sb.append('\n'); - } - - sb.append("---\n"); - - if (showBeforeWindow && firstDelta > 0) { - sb.append(" "); - sb.append(beforeLines[firstDelta - 1]); - sb.append('\n'); - } - for (int i = firstDelta; i < afterLines.length - lastDelta; i++) { - sb.append(">"); - if (afterLines[i].length() > 0) { - sb.append(" "); - } - sb.append(afterLines[i]); - sb.append('\n'); - } - if (showBeforeWindow && lastDelta < beforeLines.length - 1) { - sb.append(" "); - sb.append(beforeLines[beforeLines.length - (lastDelta -1)]); - sb.append('\n'); - } - - return sb.toString(); - } - + @Override protected String removeSessionData(String data) { + data = super.removeSessionData(data); if (getProject() != null) { data = data.replace(getProject().getName(), "PROJECTNAME"); } @@ -490,122 +422,6 @@ public class AdtProjectTest extends SdkTestCase { return createNode(null, fqn, hasChildren); } - protected String readTestFile(String relativePath, boolean expectExists) { - String path = "testdata" + File.separator + relativePath; //$NON-NLS-1$ - InputStream stream = - AdtProjectTest.class.getResourceAsStream(path); - if (!expectExists && stream == null) { - return null; - } - - assertNotNull(relativePath + " does not exist", stream); - - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - String xml = AdtPlugin.readFile(reader); - assertNotNull(xml); - assertTrue(xml.length() > 0); - - // Remove any references to the project name such that we are isolated from - // that in golden file. - // Appears in strings.xml etc. - xml = removeSessionData(xml); - - return xml; - } - - protected void assertEqualsGolden(String basename, String actual) { - assertEqualsGolden(basename, actual, basename.substring(basename.lastIndexOf('.') + 1)); - } - - protected void assertEqualsGolden(String basename, String actual, String newExtension) { - String testName = getName(); - if (testName.startsWith("test")) { - testName = testName.substring(4); - if (Character.isUpperCase(testName.charAt(0))) { - testName = Character.toLowerCase(testName.charAt(0)) + testName.substring(1); - } - } - String expectedName; - String extension = basename.substring(basename.lastIndexOf('.') + 1); - if (newExtension == null) { - newExtension = extension; - } - expectedName = basename.substring(0, basename.indexOf('.')) - + "-expected-" + testName + '.' + newExtension; - String expected = readTestFile(expectedName, false); - if (expected == null) { - File expectedPath = new File( - UPDATE_MISSING_FILES ? getTargetDir() : getTempDir(), expectedName); - AdtPlugin.writeFile(expectedPath, actual); - System.out.println("Expected - written to " + expectedPath + ":\n"); - System.out.println(actual); - fail("Did not find golden file (" + expectedName + "): Wrote contents as " - + expectedPath); - } else { - if (!expected.replaceAll("\r\n", "\n").equals(actual.replaceAll("\r\n", "\n"))) { - File expectedPath = new File(getTempDir(), expectedName); - File actualPath = new File(getTempDir(), - expectedName.replace("expected", "actual")); - AdtPlugin.writeFile(expectedPath, expected); - AdtPlugin.writeFile(actualPath, actual); - // Also update data dir with the current value - if (UPDATE_DIFFERENT_FILES) { - AdtPlugin.writeFile( new File(getTargetDir(), expectedName), actual); - } - System.out.println("The files differ: diff " + expectedPath + " " - + actualPath); - assertEquals("The files differ - see " + expectedPath + " versus " + actualPath, - expected, actual); - } - } - } - - /** Get the location to write missing golden files to */ - protected File getTargetDir() { - // Set $ADT_SDK_SOURCE_PATH to point to your git "sdk" directory; if done, then - // if you run a unit test which refers to a golden file which does not exist, it - // will be created directly into the test data directory and you can rerun the - // test - // and it should pass (after you verify that the golden file contains the correct - // result of course). - String sdk = System.getenv("ADT_SDK_SOURCE_PATH"); - if (sdk != null) { - File sdkPath = new File(sdk); - if (sdkPath.exists()) { - File testData = new File(sdkPath, TEST_DATA_REL_PATH.replace('/', - File.separatorChar)); - if (testData.exists()) { - return testData; - } - } - } - return getTempDir(); - } - - protected File getTempDir() { - if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) { - return new File("/tmp"); //$NON-NLS-1$ - } - - if (sTempDir == null) { - // On Windows, we don't want to pollute the temp folder (which is generally - // already incredibly busy). So let's create a temp folder for the results. - - File base = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ - - Calendar c = Calendar.getInstance(); - String name = String.format("adtTests_%1$tF_%1$tT", c).replace(':', '-'); //$NON-NLS-1$ - File tmpDir = new File(base, name); - if (!tmpDir.exists() && tmpDir.mkdir()) { - sTempDir = tmpDir; - } else { - sTempDir = base; - } - } - - return sTempDir; - } - /** Special editor context set on the model to be rendered */ protected static class TestLayoutEditorDelegate extends LayoutEditorDelegate { diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java index 4c55323..a716a75 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java @@ -107,6 +107,11 @@ public class ChangeLayoutRefactoringTest extends RefactoringTest { checkRefactoring(newLayoutType, basename, flatten, null); } + @Override + protected int getMinSdk() { + return 14; + } + private void checkRefactoring(String newLayoutType, String basename, boolean flatten, String initialAttributes) throws Exception { IFile file = getLayoutFile(getProject(), basename); diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java index 48dc6ae..b227179 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java @@ -48,8 +48,7 @@ public class RefactoringAssistantTest extends AdtProjectTest { } public void testAssistant4() throws Exception { - // Negative test: ensure that we don't offer extract string on a value that is - // already a resource (should list all but extract string) + // Check for resource rename refactoring (and don't offer extract string) checkFixes("sample1a.xml", "android:id=\"@+id/Linea^rLayout2\""); } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java index 86fc8a7..9565183 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java @@ -116,6 +116,9 @@ public class RefactoringTest extends AdtProjectTest { if (change instanceof TextFileChange) { TextFileChange tf = (TextFileChange) change; TextEdit edit = tf.getEdit(); + IFile file = tf.getFile(); + String contents = AdtPlugin.readFile(file); + assertEquals(contents, xml); if (edit instanceof MultiTextEdit) { MultiTextEdit edits = (MultiTextEdit) edit; edits.apply(document); @@ -138,12 +141,13 @@ public class RefactoringTest extends AdtProjectTest { } protected void checkEdits(List<Change> changes, - Map<IPath, String> fileToGoldenName) throws BadLocationException { + Map<IPath, String> fileToGoldenName) throws BadLocationException, IOException { checkEdits(changes, fileToGoldenName, false); } protected void checkEdits(List<Change> changes, - Map<IPath, String> fileToGoldenName, boolean createDiffs) throws BadLocationException { + Map<IPath, String> fileToGoldenName, boolean createDiffs) + throws BadLocationException, IOException { for (Change change : changes) { if (change instanceof TextFileChange) { TextFileChange tf = (TextFileChange) change; @@ -214,7 +218,7 @@ public class RefactoringTest extends AdtProjectTest { * <p> * Each file can be generated by the dump method in the ViewHierarchy. */ - protected ViewInfo createInfos(UiElementNode model, String relativePath) { + protected ViewInfo createInfos(UiElementNode model, String relativePath) throws IOException { String basename = relativePath.substring(0, relativePath.lastIndexOf('.') + 1); String relative = basename + "info"; //$NON-NLS-1$ String info = readTestFile(relative, true); diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/UseCompoundDrawableRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/UseCompoundDrawableRefactoringTest.java index e946327..01a0e1e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/UseCompoundDrawableRefactoringTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/UseCompoundDrawableRefactoringTest.java @@ -17,9 +17,12 @@ package com.android.ide.eclipse.adt.internal.editors.layout.refactoring; import static com.android.ide.eclipse.adt.internal.editors.layout.refactoring.UseCompoundDrawableRefactoring.combine; +import com.android.ide.eclipse.adt.AdtUtils; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.CompositeChange; import org.w3c.dom.Element; import java.util.List; @@ -90,7 +93,8 @@ public class UseCompoundDrawableRefactoringTest extends RefactoringTest { checkRefactoring("refactoring/usecompound/compound7.xml", "@+id/layout1"); } - private void checkRefactoring(String basename, String id) throws Exception { + private void checkRefactoring(String basename, String id) + throws Exception { IFile file = getLayoutFile(getProject(), basename); TestContext info = setupTestContext(file, basename); TestLayoutEditorDelegate layoutEditor = info.mLayoutEditorDelegate; @@ -99,6 +103,12 @@ public class UseCompoundDrawableRefactoringTest extends RefactoringTest { UseCompoundDrawableRefactoring refactoring = new UseCompoundDrawableRefactoring( selectedElements, layoutEditor); List<Change> changes = refactoring.computeChanges(new NullProgressMonitor()); + + CompositeChange cc = new CompositeChange("Combined from unit test", + changes.toArray(new Change[changes.size()])); + cc.markAsSynthetic(); + addCleanupDir(AdtUtils.getAbsolutePath(getProject()).toFile()); + checkEdits(basename, changes); } } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff index 51a2cc9..4ce3540 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff @@ -1,4 +1,4 @@ Code completion in broken1.xml for android:textColorHigh^ selecting android:textColorHighlight: -< android:textColorHigh^ ---- -> android:textColorHighlight="^" +@@ -8 +8 +- android:textColorHigh^ ++ android:textColorHighlight="^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff index 21437b9..3337ad2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff @@ -1,4 +1,4 @@ Code completion in broken2.xml for style=^ selecting "@android:": -< style=^ ---- -> style="@android:^" +@@ -9 +9 +- style=^ ++ style="@android:^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff index 3e60eb9..2787380 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff @@ -1,4 +1,4 @@ Code completion in broken3.xml for <EditT^ selecting EditText />: -< <EditT^ ---- -> <EditText ^/> +@@ -6 +6 +- <EditT^ ++ <EditText ^/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt index 99ae870..def6d13 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt @@ -16,4 +16,5 @@ android:state_accelerated : State value for StateListDrawable, indicating that t android:state_hovered : State value for StateListDrawable, set when a pointer is hovering over the view. [boolean] android:state_drag_can_accept : State for StateListDrawable indicating that the Drawable is in a view that is capable of accepting a drop of the content currently being manipulated in a drag-and-drop operation. [boolean] android:state_drag_hovered : State for StateListDrawable indicating that a drag operation (for which the Drawable's view is a valid recipient) is currently positioned over the Drawable. [boolean] +android:state_accessibility_focused : State for StateListDrawable indicating that a View has accessibility focus. [boolean] android:color : Hexadeximal color. Required. The color is specified with an RGB value and optional alpha channel. The value always begins with a pound (#) character and then followed by the Alpha-Red-Green-Blue information in one of the following formats: * RGB * ARGB * RRGGBB * AARRGGBB diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff index d656509..6b05566 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for layout_w^idth="fill_parent" selecting android:layout_weight: -< android:layout_w^idth="fill_parent" ---- -> android:layout_weight^="fill_parent" +@@ -8 +8 +- android:layout_w^idth="fill_parent" ++ android:layout_weight^="fill_parent" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff index 824fa25..7b448c2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for <T^extView selecting TableLayout: -< <T^extView ---- -> <TableLayout^ +@@ -7 +7 +- <T^extView ++ <TableLayout^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff index 7f4ec86..1a5f24d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for ^<TextView selecting <RadioGroup ></RadioGroup>: -< ^<TextView ---- -> <RadioGroup ^></RadioGroup><TextView +@@ -7 +7 +- ^<TextView ++ <RadioGroup ^></RadioGroup><TextView diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff index 384c4a9..9010bf6 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for ^<TextView selecting <CheckBox />: -< ^<TextView ---- -> <CheckBox ^/><TextView +@@ -7 +7 +- ^<TextView ++ <CheckBox ^/><TextView diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff index a4b7231..a7a4638 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for btn_default">^</FrameLayout> selecting <FrameLayout ></FrameLayout>: -< <FrameLayout android:foreground="@android:drawable/btn_default">^</FrameLayout> ---- -> <FrameLayout android:foreground="@android:drawable/btn_default"><FrameLayout ^></FrameLayout></FrameLayout> +@@ -18 +18 +- <FrameLayout android:foreground="@android:drawable/btn_default">^</FrameLayout> ++ <FrameLayout android:foreground="@android:drawable/btn_default"><FrameLayout ^></FrameLayout></FrameLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff index a410606..7776131 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for layout_width="^fill_parent" selecting match_parent: -< android:layout_width="^fill_parent" ---- -> android:layout_width="match_parent"^ +@@ -8 +8 +- android:layout_width="^fill_parent" ++ android:layout_width="match_parent"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff index 578f8ea..e67a336 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for layout_width="fi^ll_parent" selecting fill_parent: -< android:layout_width="fi^ll_parent" ---- -> android:layout_width="fill_parent"^ +@@ -8 +8 +- android:layout_width="fi^ll_parent" ++ android:layout_width="fill_parent"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff index 577089b..fe63acd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for marginBottom="50"^ selecting android:maxEms: -< android:layout_marginBottom="50"^ ---- -> android:layout_marginBottom="50" android:maxEms="^" +@@ -12 +12 +- android:layout_marginBottom="50"^ ++ android:layout_marginBottom="50" android:maxEms="^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff index ebbba89..2d229f3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for marginBottom="50^" selecting 50mm: -< android:layout_marginBottom="50^" ---- -> android:layout_marginBottom="50mm"^ +@@ -12 +12 +- android:layout_marginBottom="50^" ++ android:layout_marginBottom="50mm"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff index ba7cb0b..5a2b413 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for layout_marginLeft="50d^p" selecting 50dp: -< android:layout_marginLeft="50d^p" ---- -> android:layout_marginLeft="50dp"^ +@@ -11 +11 +- android:layout_marginLeft="50d^p" ++ android:layout_marginLeft="50dp"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff index f1e6465..d3a8c11 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for style="@android:^style/Widget.Button" selecting @android:drawable/: -< style="@android:^style/Widget.Button" ---- -> style="@android:drawable/^" +@@ -14 +14 +- style="@android:^style/Widget.Button" ++ style="@android:drawable/^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff index 1a577db..afd7e21 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for android:gravity="l^eft|bottom" selecting left: -< android:gravity="l^eft|bottom" ---- -> android:gravity="left^" +@@ -15 +15 +- android:gravity="l^eft|bottom" ++ android:gravity="left^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff index 2560011..73f2bd4 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for android:gravity="left|b^ottom" selecting bottom: -< android:gravity="left|b^ottom" ---- -> android:gravity="left|bottom^" +@@ -15 +15 +- android:gravity="left|b^ottom" ++ android:gravity="left|bottom^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff index 05656fb..1b4198e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff @@ -1,4 +1,4 @@ Code completion in completion1.xml for layout_width=^"fill_parent" selecting "wrap_content": -< android:layout_width=^"fill_parent" ---- -> android:layout_width="wrap_content"^ +@@ -8 +8 +- android:layout_width=^"fill_parent" ++ android:layout_width="wrap_content"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt index 8d25f95..20dad3a 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt @@ -63,3 +63,5 @@ Code completion in completion1.xml for ^<TextView: <android.gesture.GestureOverlayView ></android.gesture.GestureOverlayView> : GestureOverlayView specific attributes. <fragment /> : A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity <include /> : Lets you statically include XML layouts inside other XML layouts. +<requestFocus /> : Requests focus for the parent element or one of its descendants +<view /> : A view tag whose class attribute names the class to be instantiated diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt index a5fe067..8da18db 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt @@ -63,3 +63,5 @@ Code completion in completion1.xml for btn_default">^</FrameLayout>: <android.gesture.GestureOverlayView ></android.gesture.GestureOverlayView> : GestureOverlayView specific attributes. <fragment /> : A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity <include /> : Lets you statically include XML layouts inside other XML layouts. +<requestFocus /> : Requests focus for the parent element or one of its descendants +<view /> : A view tag whose class attribute names the class to be instantiated diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt index 0f940c2..2ac2d31 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt @@ -11,6 +11,7 @@ android:textSize : Size of the text. [dimension] android:textScaleX : Sets the horizontal scaling factor for the text. [float] android:typeface : Typeface (normal, sans, serif, monospace) for the text. [enum] android:textStyle : Style (bold, italic, bolditalic) for the text. [flag] +android:fontFamily : Font family (named by string) for the text. [string] android:textColorLink : Text color for links. [color, reference] android:cursorVisible : Makes the cursor visible (the default) or invisible. [boolean] android:maxLines : Makes the TextView be at most this many lines tall. [integer] @@ -28,9 +29,9 @@ android:minWidth : Makes the TextView be at least this many pixels wide. [dimen android:gravity : Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. [flag] android:scrollHorizontally : Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). [boolean] android:password : Whether the characters of the field are displayed as password dots instead of themselves. * Deprecated: Use inputType instead. [boolean] -android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean] -android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean] -android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean] +android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated. Use "maxLines" instead to change the layo... +android:enabled : Specifies whether the widget is enabled. [boolean] +android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus. [boolean] android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean] android:maxLength : Set an input filter to constrain the text length to the specified number. [integer] android:shadowColor : Place a shadow of the specified color behind the text. [color] @@ -104,7 +105,7 @@ android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawab android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference] android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean] android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean] -android:fadingEdge : . * Deprecated: This attribute is deprecated and will be ignored as of API level {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH. [flag] +android:fadingEdge : This attribute is deprecated and will be ignored as of API level 14 (ICE_CREAM_SANDWICH). [flag] android:requiresFadingEdge : Defines which edges should be faded on scrolling. [flag] android:fadingEdgeLength : Defines the length of the fading edges. [dimension] android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference] @@ -140,6 +141,8 @@ android:verticalScrollbarPosition : Determines which side the vertical scroll ba android:layerType : Specifies the type of layer backing this view. [enum] android:layoutDirection : Defines the direction of layout drawing. [enum] android:textDirection : Direction of the text. [integer, enum] +android:textAlignment : Alignment of the text. [integer, enum] +android:importantForAccessibility : Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. [integer, enum] android:layout_width : Specifies the basic width of the view. [dimension, enum] android:layout_height : Specifies the basic height of the view. [dimension, enum] android:layout_weight : [float] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff index dcd7f71..af28a13 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff @@ -1,4 +1,4 @@ Code completion in completion10.xml for "[^wrap_content]" selecting fill_parent: -< android:layout_height="^wrap_content"/> ---- -> android:layout_height="fill_parent"^/> +@@ -9 +9 +- android:layout_height="^wrap_content"/> ++ android:layout_height="fill_parent"^/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff index a8d2d43..0a4d338 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff @@ -1,4 +1,4 @@ Code completion in completion10.xml for "[^wrap_c]ontent" selecting fill_parent: -< android:layout_height="^wrap_content"/> ---- -> android:layout_height="fill_parent"^/> +@@ -9 +9 +- android:layout_height="^wrap_content"/> ++ android:layout_height="fill_parent"^/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-applyCompletion46.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-applyCompletion46.diff index 981a931..321deaa 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-applyCompletion46.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-applyCompletion46.diff @@ -1,4 +1,4 @@ Code completion in completion11.xml for ?android:attr/Textapp^ selecting ?android:attr/textAppearanceLargeInverse: -< style="?android:attr/Textapp^" ---- -> style="?android:attr/textAppearanceLargeInverse^" +@@ -7 +7 +- style="?android:attr/Textapp^" ++ style="?android:attr/textAppearanceLargeInverse^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-complation79.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-complation79.txt new file mode 100644 index 0000000..3748c77 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion11-expected-complation79.txt @@ -0,0 +1,10 @@ +Code completion in completion11.xml for tools:context="^.MainActivity": +android.accounts.AccountAuthenticatorActivity : <p>See <code><a href="/reference/android/app/SearchManager.html">android.app.SearchManager</a></code> for more details.</td> </tr> <tr class=" api apilevel-1" > <td class="jd-typecol">int</td> <td class="jd-linkcol"... +android.app.ActivityGroup : <p> <p class="caution"> <strong>This class was deprecated in API level 13</strong>.<br/> Use the new <code><a href="/reference/android/app/Fragment.html">Fragment</a></code> and <code><a href="/reference/android/app/FragmentManager.html">FragmentManager</... +android.app.AliasActivity : <p>See <code><a href="/reference/android/app/SearchManager.html">android.app.SearchManager</a></code> for more details.</td> </tr> <tr class=" api apilevel-1" > <td class="jd-typecol">int</td> <td class="jd-linkcol"><a href="/reference... +android.app.ExpandableListActivity : <p> ExpandableListActivity hosts a <code><a href="/reference/android/widget/ExpandableListView.html">ExpandableListView</a></code> object that can be bound to different data sources that provide a two-levels of data (the top-level is group, and below each ... +android.app.LauncherActivity : <div id="jd-header"> public abstract class <h1 itemprop="name">LauncherActivity</h1> extends <a href="/reference/android/app/ListActivity.html">ListActivity</a><br/> ... +android.app.ListActivity : <p> ListActivity hosts a <code><a href="/reference/android/widget/ListView.html">ListView</a></code> object that can be bound to different data sources, typically either an array or a Cursor holding query results. Binding, screen layout, and row layout are discussed ... +android.app.NativeActivity : <p>A typical manifest would look like: <pre><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.native_activity" android:versionCode="1" android:versionName="1.0"> <!-- This is the platform ... +android.app.TabActivity : <p> <p class="caution"> <strong>This class was deprecated in API level 13</strong>.<br/> New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the F... +android.preference.PreferenceActivity : <p>This activity shows one or more headers of preferences, each of which is associated with a <code><a href="/reference/android/preference/PreferenceFragment.html">PreferenceFragment</a></code> to display the preferences of that header. The actual layout... diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12-expected-completion75.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12-expected-completion75.txt new file mode 100644 index 0000000..5ad38e6 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12-expected-completion75.txt @@ -0,0 +1,96 @@ +Code completion in completion12.xml for <include ^/>: +layout : [reference]. * Required. +style : A reference to a custom style [reference] +android:id : Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById(). [reference] +android:tag : Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag() . [string] +android:scrollX : The initial horizontal scroll offset, in pixels. [dimension] +android:scrollY : The initial vertical scroll offset, in pixels. [dimension] +android:background : A drawable to use as the background. [color, reference] +android:padding : Sets the padding, in pixels, of all four edges. [dimension] +android:paddingLeft : Sets the padding, in pixels, of the left edge; see padding. [dimension] +android:paddingTop : Sets the padding, in pixels, of the top edge; see padding. [dimension] +android:paddingRight : Sets the padding, in pixels, of the right edge; see padding. [dimension] +android:paddingBottom : Sets the padding, in pixels, of the bottom edge; see padding. [dimension] +android:paddingStart : Sets the padding, in pixels, of the start edge; see padding. [dimension] +android:paddingEnd : Sets the padding, in pixels, of the end edge; see padding. [dimension] +android:focusable : Boolean that controls whether a view can take focus. [boolean] +android:focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode. [boolean] +android:visibility : Controls the initial visibility of the view. [enum] +android:fitsSystemWindows : Boolean internal attribute to adjust view layout based on system windows such as the status bar. [boolean] +android:scrollbars : Defines which scrollbars should be displayed on scrolling or not. [flag] +android:scrollbarStyle : Controls the scrollbar style and position. [enum] +android:isScrollContainer : Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. [boolean] +android:fadeScrollbars : Defines whether to fade out scrollbars when they are not in use. [boolean] +android:scrollbarFadeDuration : Defines the delay in milliseconds that a scrollbar takes to fade out. [integer] +android:scrollbarDefaultDelayBeforeFade : Defines the delay in milliseconds that a scrollbar waits before fade out. [integer] +android:scrollbarSize : Sets the width of vertical scrollbars and height of horizontal scrollbars. [dimension] +android:scrollbarThumbHorizontal : Defines the horizontal scrollbar thumb drawable. [reference] +android:scrollbarThumbVertical : Defines the vertical scrollbar thumb drawable. [reference] +android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawable. [reference] +android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference] +android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean] +android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean] +android:fadingEdge : This attribute is deprecated and will be ignored as of API level 14 (ICE_CREAM_SANDWICH). [flag] +android:requiresFadingEdge : Defines which edges should be faded on scrolling. [flag] +android:fadingEdgeLength : Defines the length of the fading edges. [dimension] +android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference] +android:nextFocusRight : Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference] +android:nextFocusUp : Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference] +android:nextFocusDown : Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference] +android:nextFocusForward : Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference] +android:clickable : Defines whether this view reacts to click events. [boolean] +android:longClickable : Defines whether this view reacts to long click events. [boolean] +android:saveEnabled : If unset, no state will be saved for this view when it is being frozen. [boolean] +android:filterTouchesWhenObscured : Specifies whether to filter touches when the view's window is obscured by another visible window. [boolean] +android:drawingCacheQuality : Defines the quality of translucent drawing caches. [enum] +android:keepScreenOn : Controls whether the view's window should keep the screen on while visible. [boolean] +android:duplicateParentState : When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. [boolean] +android:minHeight : Defines the minimum height of the view. +android:minWidth : Defines the minimum width of the view. +android:soundEffectsEnabled : Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. [boolean] +android:hapticFeedbackEnabled : Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. [boolean] +android:contentDescription : Defines text that briefly describes content of the view. [string] +android:onClick : Name of the method in this View's context to invoke when the view is clicked. [string] +android:overScrollMode : Defines over-scrolling behavior. [enum] +android:alpha : alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). [float] +android:translationX : translation in x of the view. [dimension] +android:translationY : translation in y of the view. [dimension] +android:transformPivotX : x location of the pivot point around which the view will rotate and scale. [dimension] +android:transformPivotY : y location of the pivot point around which the view will rotate and scale. [dimension] +android:rotation : rotation of the view, in degrees. [float] +android:rotationX : rotation of the view around the x axis, in degrees. [float] +android:rotationY : rotation of the view around the y axis, in degrees. [float] +android:scaleX : scale of the view in the x direction. [float] +android:scaleY : scale of the view in the y direction. [float] +android:verticalScrollbarPosition : Determines which side the vertical scroll bar should be placed on. [enum] +android:layerType : Specifies the type of layer backing this view. [enum] +android:layoutDirection : Defines the direction of layout drawing. [enum] +android:textDirection : Direction of the text. [integer, enum] +android:textAlignment : Alignment of the text. [integer, enum] +android:importantForAccessibility : Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. [integer, enum] +android:layout_toLeftOf : Positions the right edge of this view to the left of the given anchor view ID. [reference] +android:layout_toRightOf : Positions the left edge of this view to the right of the given anchor view ID. [reference] +android:layout_above : Positions the bottom edge of this view above the given anchor view ID. [reference] +android:layout_below : Positions the top edge of this view below the given anchor view ID. [reference] +android:layout_alignBaseline : Positions the baseline of this view on the baseline of the given anchor view ID. [reference] +android:layout_alignLeft : Makes the left edge of this view match the left edge of the given anchor view ID. [reference] +android:layout_alignTop : Makes the top edge of this view match the top edge of the given anchor view ID. [reference] +android:layout_alignRight : Makes the right edge of this view match the right edge of the given anchor view ID. [reference] +android:layout_alignBottom : Makes the bottom edge of this view match the bottom edge of the given anchor view ID. [reference] +android:layout_alignParentLeft : If true, makes the left edge of this view match the left edge of the parent. [boolean] +android:layout_alignParentTop : If true, makes the top edge of this view match the top edge of the parent. [boolean] +android:layout_alignParentRight : If true, makes the right edge of this view match the right edge of the parent. [boolean] +android:layout_alignParentBottom : If true, makes the bottom edge of this view match the bottom edge of the parent. [boolean] +android:layout_centerInParent : If true, centers this child horizontally and vertically within its parent. [boolean] +android:layout_centerHorizontal : If true, centers this child horizontally within its parent. [boolean] +android:layout_centerVertical : If true, centers this child vertically within its parent. [boolean] +android:layout_alignWithParentIfMissing : If set to true, the parent will be used as the anchor when the anchor cannot be be found for layout_toLeftOf, layout_toRightOf, etc. [boolean] +android:layout_width : Specifies the basic width of the view. [dimension, enum] +android:layout_height : Specifies the basic height of the view. [dimension, enum] +android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension] +android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension] +android:layout_marginTop : Specifies extra space on the top side of this view. [dimension] +android:layout_marginRight : Specifies extra space on the right side of this view. [dimension] +android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension] +android:layout_marginStart : Specifies extra space on the start side of this view. [dimension] +android:layout_marginEnd : Specifies extra space on the end side of this view. [dimension] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12.xml new file mode 100644 index 0000000..946a232 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion12.xml @@ -0,0 +1,7 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <include /> + +</RelativeLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff index 13e224e..b365736 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff @@ -1,4 +1,4 @@ Code completion in completion2.xml for gravity="left|bottom|^cen selecting fill_vertical: -< <TextView android:gravity="left|bottom|^cen"></TextView> ---- -> <TextView android:gravity="left|bottom|fill_vertical^"></TextView> +@@ -4 +4 +- <TextView android:gravity="left|bottom|^cen"></TextView> ++ <TextView android:gravity="left|bottom|fill_vertical^"></TextView> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff index 5d1b39e..46268af 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff @@ -1,4 +1,4 @@ Code completion in completion2.xml for gravity="left|bottom|cen^ selecting center_horizontal: -< <TextView android:gravity="left|bottom|cen^"></TextView> ---- -> <TextView android:gravity="left|bottom|center_horizontal^"></TextView> +@@ -4 +4 +- <TextView android:gravity="left|bottom|cen^"></TextView> ++ <TextView android:gravity="left|bottom|center_horizontal^"></TextView> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff index 0c7e564..bcac56d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff @@ -1,4 +1,4 @@ Code completion in completion2.xml for gravity="left|bottom^|cen selecting bottom|fill_horizontal: -< <TextView android:gravity="left|bottom^|cen"></TextView> ---- -> <TextView android:gravity="left|bottom|fill_horizontal^"></TextView> +@@ -4 +4 +- <TextView android:gravity="left|bottom^|cen"></TextView> ++ <TextView android:gravity="left|bottom|fill_horizontal^"></TextView> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff index 14bb9ac..ef070b2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff @@ -1,4 +1,4 @@ Code completion in completion3.xml for <EditText ^/> selecting android:textColorHighlight: -< <EditText ^/> ---- -> <EditText android:textColorHighlight="^"/> +@@ -3 +3 +- <EditText ^/> ++ <EditText android:textColorHighlight="^"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff index a751a3e..283636b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff @@ -1,4 +1,4 @@ Code completion in completion3.xml for <Button ^></Button> selecting android:paddingRight: -< <Button ^></Button> ---- -> <Button android:paddingRight="^"></Button> +@@ -4 +4 +- <Button ^></Button> ++ <Button android:paddingRight="^"></Button> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff index 16f42b2..3f78663 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff @@ -1,4 +1,4 @@ Code completion in completion5.xml for android:orientation='^' selecting horizontal: -< android:orientation='^' ---- -> android:orientation='horizontal'^ +@@ -5 +5 +- android:orientation='^' ++ android:orientation='horizontal'^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff index dd48af1..4933d13 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff @@ -1,4 +1,4 @@ Code completion in completion5.xml for android:layout_marginTop='50^dp' selecting 50pt: -< android:layout_marginTop='50^dp' ---- -> android:layout_marginTop='50pt'^ +@@ -10 +10 +- android:layout_marginTop='50^dp' ++ android:layout_marginTop='50pt'^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff index 40e5bb1..a4c88d7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff @@ -1,4 +1,4 @@ Code completion in completion5.xml for android:layout_width='^wrap_content' selecting match_parent: -< android:layout_width='^wrap_content' ---- -> android:layout_width='match_parent'^ +@@ -11 +11 +- android:layout_width='^wrap_content' ++ android:layout_width='match_parent'^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff index 00ffd0a..705f865 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff @@ -1,4 +1,4 @@ Code completion in completion5.xml for android:id='@+id/button2'^ selecting android:maxWidth: -< android:id='@+id/button2'^ ---- -> android:id='@+id/button2' android:maxWidth="^" +@@ -15 +15 +- android:id='@+id/button2'^ ++ android:id='@+id/button2' android:maxWidth="^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt index 300494e..a4cf0fa 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt @@ -11,6 +11,7 @@ android:textSize : Size of the text. [dimension] android:textScaleX : Sets the horizontal scaling factor for the text. [float] android:typeface : Typeface (normal, sans, serif, monospace) for the text. [enum] android:textStyle : Style (bold, italic, bolditalic) for the text. [flag] +android:fontFamily : Font family (named by string) for the text. [string] android:textColorLink : Text color for links. [color, reference] android:cursorVisible : Makes the cursor visible (the default) or invisible. [boolean] android:maxLines : Makes the TextView be at most this many lines tall. [integer] @@ -28,9 +29,9 @@ android:minWidth : Makes the TextView be at least this many pixels wide. [dimen android:gravity : Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. [flag] android:scrollHorizontally : Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). [boolean] android:password : Whether the characters of the field are displayed as password dots instead of themselves. * Deprecated: Use inputType instead. [boolean] -android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean] -android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean] -android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean] +android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated. Use "maxLines" instead to change the layo... +android:enabled : Specifies whether the widget is enabled. [boolean] +android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus. [boolean] android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean] android:maxLength : Set an input filter to constrain the text length to the specified number. [integer] android:shadowColor : Place a shadow of the specified color behind the text. [color] @@ -104,7 +105,7 @@ android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawab android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference] android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean] android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean] -android:fadingEdge : . * Deprecated: This attribute is deprecated and will be ignored as of API level {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH. [flag] +android:fadingEdge : This attribute is deprecated and will be ignored as of API level 14 (ICE_CREAM_SANDWICH). [flag] android:requiresFadingEdge : Defines which edges should be faded on scrolling. [flag] android:fadingEdgeLength : Defines the length of the fading edges. [dimension] android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference] @@ -140,6 +141,8 @@ android:verticalScrollbarPosition : Determines which side the vertical scroll ba android:layerType : Specifies the type of layer backing this view. [enum] android:layoutDirection : Defines the direction of layout drawing. [enum] android:textDirection : Direction of the text. [integer, enum] +android:textAlignment : Alignment of the text. [integer, enum] +android:importantForAccessibility : Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. [integer, enum] android:layout_width : Specifies the basic width of the view. [dimension, enum] android:layout_height : Specifies the basic height of the view. [dimension, enum] android:layout_weight : [float] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff index 8ea8837..92cd2f2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff @@ -1,4 +1,4 @@ Code completion in completion6.xml for android:orientation="^" selecting horizontal: -< android:orientation="^" ---- -> android:orientation="horizontal"^ +@@ -5 +5 +- android:orientation="^" ++ android:orientation="horizontal"^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff index d874fc1..1aaadc2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff @@ -1,4 +1,4 @@ Code completion in completion7.xml for android:orientation="^ selecting horizontal: -< android:orientation="^ ---- -> android:orientation="horizontal^ +@@ -5 +5 +- android:orientation="^ ++ android:orientation="horizontal^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff index 9a1b962..7678740 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff @@ -1,4 +1,4 @@ Code completion in completion8.xml for android:mar^="50dp" selecting android:layout_marginRight: -< android:mar^="50dp" ---- -> android:layout_marginRight^="50dp" +@@ -6 +6 +- android:mar^="50dp" ++ android:layout_marginRight^="50dp" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt index c8d699f..0c2e215 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt @@ -1,5 +1,4 @@ Code completion in completion8.xml for android:mar^="50dp": -android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum] android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension] android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension] android:layout_marginTop : Specifies extra space on the top side of this view. [dimension] @@ -7,3 +6,4 @@ android:layout_marginRight : Specifies extra space on the right side of this vie android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension] android:layout_marginStart : Specifies extra space on the start side of this view. [dimension] android:layout_marginEnd : Specifies extra space on the end side of this view. [dimension] +android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt index c8be83f..f5b0720 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt @@ -1,4 +1,4 @@ Code completion in completion8.xml for android:w^i="100": -android:width : Makes the TextView be exactly this many pixels wide. [dimension] android:layout_width : Specifies the basic width of the view. [dimension, enum] android:layout_weight : [float] +android:width : Makes the TextView be exactly this many pixels wide. [dimension] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt index 041f826..50f13d1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt @@ -1,5 +1,4 @@ Code completion in completion8.xml for mar^="60dp": -android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum] android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension] android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension] android:layout_marginTop : Specifies extra space on the top side of this view. [dimension] @@ -7,3 +6,4 @@ android:layout_marginRight : Specifies extra space on the right side of this vie android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension] android:layout_marginStart : Specifies extra space on the start side of this view. [dimension] android:layout_marginEnd : Specifies extra space on the end side of this view. [dimension] +android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt index 9dbe81e..3578145 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt @@ -1,5 +1,4 @@ Code completion in completion8.xml for android:layo^ut_width="fill_parent": -android:layoutDirection : Defines the direction of layout drawing. [enum] android:layout_width : Specifies the basic width of the view. [dimension, enum] android:layout_height : Specifies the basic height of the view. [dimension, enum] android:layout_weight : [float] @@ -11,3 +10,4 @@ android:layout_marginRight : Specifies extra space on the right side of this vie android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension] android:layout_marginStart : Specifies extra space on the start side of this view. [dimension] android:layout_marginEnd : Specifies extra space on the end side of this view. [dimension] +android:layoutDirection : Defines the direction of layout drawing. [enum] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion9-expected-completion64.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion9-expected-completion64.txt index be2096b..2085e96 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion9-expected-completion64.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion9-expected-completion64.txt @@ -65,3 +65,4 @@ Code completion in completion9.xml for ^<Button: <include /> : Lets you statically include XML layouts inside other XML layouts. <merge ></merge> : A root tag useful for XML layouts inflated using a ViewStub. <requestFocus /> : Requests focus for the parent element or one of its descendants +<view /> : A view tag whose class attribute names the class to be instantiated diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff index 4b88448..d323219 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for android:textS^ize selecting android:textSelectHandleLeft: -< <item name="android:textS^ize">17sp</item> ---- -> <item name="android:textSelectHandleLeft"^>17sp</item> +@@ -4 +4 +- <item name="android:textS^ize">17sp</item> ++ <item name="android:textSelectHandleLeft"^>17sp</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff index acfd3ab..ac71df7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for 17^sp selecting 17mm: -< <item name="android:textSize">17^sp</item> ---- -> <item name="android:textSize">17mm^</item> +@@ -4 +4 +- <item name="android:textSize">17^sp</item> ++ <item name="android:textSize">17mm^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff index ba7a1f2..df6fceb 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for textColor">^@color/title_color</item> selecting @android:: -< <item name="android:textColor">^@color/title_color</item> ---- -> <item name="android:textColor">@android:^</item> +@@ -5 +5 +- <item name="android:textColor">^@color/title_color</item> ++ <item name="android:textColor">@android:^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff index 491363b..36fce8b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:shadowColor">@an^</item> selecting @android:: -< <item name="android:shadowColor">@an^</item> ---- -> <item name="android:shadowColor">@android:^</item> +@@ -6 +6 +- <item name="android:shadowColor">@an^</item> ++ <item name="android:shadowColor">@android:^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff index 1c999c7..6315fc4 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:gravity">^ </item> selecting center_vertical: -< <item name="android:gravity">^ </item> ---- -> <item name="android:gravity">center_vertical^</item> +@@ -7 +7 +- <item name="android:gravity">^ </item> ++ <item name="android:gravity">center_vertical^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff index fbfa7a8..1db9773 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:gravity"> ^</item> selecting left: -< <item name="android:gravity"> ^</item> ---- -> <item name="android:gravity"> left^</item> +@@ -7 +7 +- <item name="android:gravity"> ^</item> ++ <item name="android:gravity"> left^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff index 3e2cf0d..6307646 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="gr^"> selecting android:gravity: -< <item name="gr^">@color/title_color</item> ---- -> <item name="android:gravity"^>@color/title_color</item> +@@ -8 +8 +- <item name="gr^">@color/title_color</item> ++ <item name="android:gravity"^>@color/title_color</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff index 5f79eaf..c8a119f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="an^"> selecting android:animateOnClick: -< <item name="an^">@color/title_color</item> ---- -> <item name="android:animateOnClick"^>@color/title_color</item> +@@ -9 +9 +- <item name="an^">@color/title_color</item> ++ <item name="android:animateOnClick"^>@color/title_color</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff index 8f83183..9b37438 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item ^></item> selecting name: -< <item ^></item> ---- -> <item name="^"></item> +@@ -10 +10 +- <item ^></item> ++ <item name="^"></item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff index 1a68f13..b34a8ec 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="^"></item> selecting android:background: -< <item name="^"></item> ---- -> <item name="android:background"^></item> +@@ -11 +11 +- <item name="^"></item> ++ <item name="android:background"^></item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff index 1a61da3..b78adee 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:allowSingleTap">^</item> selecting true: -< <item name="android:allowSingleTap">^</item> ---- -> <item name="android:allowSingleTap">true^</item> +@@ -12 +12 +- <item name="android:allowSingleTap">^</item> ++ <item name="android:allowSingleTap">true^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff index da4d30f..5af6c92 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache">^ false </item> selecting true: -< <item name="android:alwaysDrawnWithCache">^ false </item> ---- -> <item name="android:alwaysDrawnWithCache">true^</item> +@@ -13 +13 +- <item name="android:alwaysDrawnWithCache">^ false </item> ++ <item name="android:alwaysDrawnWithCache">true^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff index 4334c9f..f48f101 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> ^false </item> selecting true: -< <item name="android:alwaysDrawnWithCache"> ^false </item> ---- -> <item name="android:alwaysDrawnWithCache"> true^</item> +@@ -13 +13 +- <item name="android:alwaysDrawnWithCache"> ^false </item> ++ <item name="android:alwaysDrawnWithCache"> true^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff index 2c9f547..8c246a8 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> f^alse </item> selecting false: -< <item name="android:alwaysDrawnWithCache"> f^alse </item> ---- -> <item name="android:alwaysDrawnWithCache"> false^</item> +@@ -13 +13 +- <item name="android:alwaysDrawnWithCache"> f^alse </item> ++ <item name="android:alwaysDrawnWithCache"> false^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff index 195e159..082f2b2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for <item name="android:orientation">h^</item> selecting horizontal: -< <item name="android:orientation">h^</item> ---- -> <item name="android:orientation">horizontal^</item> +@@ -14 +14 +- <item name="android:orientation">h^</item> ++ <item name="android:orientation">horizontal^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff index 0e81810..47580e1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for c^ selecting center: -< c^ ---- -> center^ +@@ -16 +16 +- c^ ++ center^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff index 7a845b3..57fe472 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff @@ -1,4 +1,4 @@ Code completion in completionvalues1.xml for [^false] selecting true: -< <item name="android:alwaysDrawnWithCache"> ^false </item> ---- -> <item name="android:alwaysDrawnWithCache"> true^</item> +@@ -13 +13 +- <item name="android:alwaysDrawnWithCache"> ^false </item> ++ <item name="android:alwaysDrawnWithCache"> true^</item> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt index 4b87a0c..efee2bc 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt @@ -5,4 +5,4 @@ android:animateLayoutChanges : Defines whether changes in layout (caused by addi android:animateOnClick : Indicates whether the drawer should be opened/closed with an animation when the user clicks the handle. [boolean] android:animationCache : Defines whether layout animations should create a drawing cache for their children. [boolean] android:animationDuration : Sets how long a transition animation should run (in milliseconds) when layout has changed. [integer] -android:animationResolution : Timeout between frames of animation in milliseconds [integer] +android:animationResolution : Timeout between frames of animation in milliseconds * Deprecated: Not used by the framework. [integer] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt index 43cf419..57684d7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt @@ -11,7 +11,7 @@ android:animateLayoutChanges : Defines whether changes in layout (caused by addi android:animateOnClick : Indicates whether the drawer should be opened/closed with an animation when the user clicks the handle. [boolean] android:animationCache : Defines whether layout animations should create a drawing cache for their children. [boolean] android:animationDuration : Sets how long a transition animation should run (in milliseconds) when layout has changed. [integer] -android:animationResolution : Timeout between frames of animation in milliseconds [integer] +android:animationResolution : Timeout between frames of animation in milliseconds * Deprecated: Not used by the framework. [integer] android:autoLink : Controls whether links such as urls and email addresses are automatically found and converted to clickable links. [flag] android:autoStart : When true, automatically start animating [boolean] android:autoText : If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. * Deprecated: Use inputType instead. [boolean] @@ -34,7 +34,7 @@ android:childIndicator : Indicator shown beside the child View. [reference] android:childIndicatorLeft : The left bound for a child's indicator. [dimension] android:childIndicatorRight : The right bound for a child's indicator. [dimension] android:choiceMode : Defines the choice behavior for the view. [enum] -class : Supply the name of the fragment class to instantiate +class : Supply the name of the view class to instantiate android:clickColor : Color of the outline of click feedback. [color] android:clickable : Defines whether this view reacts to click events. [boolean] android:clipChildren : Defines whether a child is limited to draw inside of its bounds or not. [boolean] @@ -79,15 +79,15 @@ android:editable : If set, specifies that this TextView has an input method. * D android:editorExtras : Reference to an "input-extras" XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. [reference] android:ellipsize : If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. [enum] android:ems : Makes the TextView be exactly this many ems wide. [integer] -android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean] -android:endYear : The last year (inclusive), for example "2010". [integer] +android:enabled : Specifies whether the widget is enabled. [boolean] +android:endYear : The last year (inclusive), for example "2010". * Deprecated: Use maxDate instead. [integer] android:entries : Reference to an array resource that will populate the Spinner. [reference] android:eventsInterceptionEnabled : Defines whether the overlay should intercept the motion events when a gesture is recognized. [boolean] android:fadeDuration : Duration, in milliseconds, of the fade out effect after the user is done drawing a gesture. [integer] android:fadeEnabled : Defines whether the gesture will automatically fade out after being recognized. [boolean] android:fadeOffset : Time, in milliseconds, to wait before the gesture fades out after the user is done drawing it. [integer] android:fadeScrollbars : Defines whether to fade out scrollbars when they are not in use. [boolean] -android:fadingEdge : . * Deprecated: This attribute is deprecated and will be ignored as of API level {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH. [flag] +android:fadingEdge : This attribute is deprecated and will be ignored as of API level 14 (ICE_CREAM_SANDWICH). [flag] android:fadingEdgeLength : Defines the length of the fading edges. [dimension] android:fastScrollAlwaysVisible : When set to true, the list will always show the fast scroll interface. [boolean] android:fastScrollEnabled : Enables the fast scroll thumb that can be dragged to quickly scroll through the list. [boolean] @@ -98,7 +98,8 @@ android:fitsSystemWindows : Boolean internal attribute to adjust view layout bas android:flipInterval : [integer] android:focusable : Boolean that controls whether a view can take focus. [boolean] android:focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode. [boolean] -android:focusedMonthDateColor : The color for the dates of the selected month. [color, reference] +android:focusedMonthDateColor : The color for the dates of the focused month. [color, reference] +android:fontFamily : Font family (named by string) for the text. [string] android:footerDividersEnabled : When set to false, the ListView will not draw the divider before each footer view. [boolean] android:foreground : Defines the drawable to draw over the content. [color, reference] android:foregroundGravity : Defines the gravity to apply to the foreground drawable. [flag] @@ -127,6 +128,7 @@ android:ignoreGravity : Indicates what view should not be affected by gravity. android:imeActionId : Supply a value for EditorInfo.actionId used when an input method is connected to the text view. [integer] android:imeActionLabel : Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. [string] android:imeOptions : Additional features you can enable in an IME associated with an editor to improve the integration with your application. [flag] +android:importantForAccessibility : Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. [integer, enum] android:inAnimation : Identifier for the animation to use when a view is shown. [reference] android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean] android:indeterminate : Allows to enable the indeterminate mode. [boolean] @@ -231,8 +233,8 @@ android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. android:scrollbars : Defines which scrollbars should be displayed on scrolling or not. [flag] android:scrollingCache : When set to true, the list uses a drawing cache during scrolling. [boolean] android:secondaryProgress : Defines the secondary progress value, between 0 and max. [integer] -android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean] -android:selectedDateVerticalBar : Drawable for the vertical bar shown at the beggining and at the end of a selected date. [reference] +android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus. [boolean] +android:selectedDateVerticalBar : Drawable for the vertical bar shown at the beginning and at the end of the selected date. [reference] android:selectedWeekBackgroundColor : The background color for the selected week. [color, reference] android:shadowColor : Place a shadow of the specified color behind the text. [color] android:shadowDx : Horizontal offset of the shadow. [float] @@ -242,7 +244,7 @@ android:showDividers : Setting for which dividers to show. [flag] android:showWeekNumber : Whether do show week numbers. [boolean] android:shownWeekCount : The number of weeks to be shown. [integer] android:shrinkColumns : The zero-based index of the columns to shrink. [string] -android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean] +android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated. Use "maxLines" instead to change the layo... android:smoothScrollbar : When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. [boolean] android:soundEffectsEnabled : Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. [boolean] android:spacing : [dimension] @@ -251,7 +253,7 @@ android:spinnersShown : Whether the spinners are shown. [boolean] android:splitMotionEvents : Sets whether this ViewGroup should split MotionEvents to separate child views during touch event dispatch. [boolean] android:src : Sets a drawable as the content of this ImageView. [color, reference] android:stackFromBottom : Used by ListView and GridView to stack their content from the bottom. [boolean] -android:startYear : The first year (inclusive), for example "1940". [integer] +android:startYear : The first year (inclusive), for example "1940". * Deprecated: Use minDate instead. [integer] android:stepSize : The step size of the rating. [float] android:stretchColumns : The zero-based index of the columns to stretch. [string] android:stretchMode : Defines how columns should stretch to fill the available empty space, if any. [enum] @@ -265,6 +267,7 @@ android:tabStripLeft : Drawable used to draw the left part of the strip undernea android:tabStripRight : Drawable used to draw the right part of the strip underneath the tabs. [reference] android:tag : Supply a tag for the top-level view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag() . [string] android:text : Text to display. [string] +android:textAlignment : Alignment of the text. [integer, enum] android:textAllCaps : Present the text in ALL CAPS. [boolean] android:textAppearance : Base text color, typeface, size, and style. [reference] android:textColor : Text color. [color, reference] @@ -309,6 +312,6 @@ android:verticalSpacing : Defines the default vertical spacing between rows. [d android:visibility : Controls the initial visibility of the view. [enum] android:weekDayTextAppearance : The text appearance for the week day abbreviation of the calendar header. [reference] android:weekNumberColor : The color for the week numbers. [color, reference] -android:weekSeparatorLineColor : The color for the sepatator line between weeks. [color, reference] +android:weekSeparatorLineColor : The color for the separator line between weeks. [color, reference] android:weightSum : Defines the maximum weight sum. [float] android:width : Makes the TextView be exactly this many pixels wide. [dimension] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff index 95d078c..e21c594 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff @@ -1,34 +1,34 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF00FF" -> android:textSize="20pt" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF00FF" ++ android:textSize="20pt" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff index 3c3d47f..8c12b7c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff @@ -1,31 +1,31 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff index 33ff9db..c819b09 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff @@ -1,32 +1,32 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff index 33ff9db..c819b09 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff @@ -1,32 +1,32 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff index e4d3412..36186b8 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff @@ -1,32 +1,32 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF00FF" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF00FF" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff index 9094011..83837f5 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff @@ -1,33 +1,33 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textSize="20pt" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textSize="20pt" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff index c7cdba6..55d658d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff @@ -1,33 +1,33 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> style="@style/newstyle" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF00FF" -> android:textSize="20pt" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ style="@style/newstyle" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF00FF" ++ android:textSize="20pt" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff index 3c3d47f..8c12b7c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff @@ -1,31 +1,31 @@ -< android:layout_width="wrap_content" android:layout_height="match_parent"> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="wrap_content" -< android:textColor="#FF0000" android:textSize="20pt" -< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> -< <Button android:text="Button" -< android:layout_width="wrap_content" android:layout_height="fill_parent" -< android:textColor="#FF00FF" android:textSize="20pt" -< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ---- -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_alignParentBottom="true" -> android:text="Button" -> android:textColor="#FF0000" -> android:textSize="20pt" > -> </Button> -> -> <Button -> android:id="@+id/button2" -> android:layout_width="wrap_content" -> android:layout_height="fill_parent" -> android:layout_alignParentBottom="true" -> android:text="Button" > -> </Button> -> +@@ -2 +2 +- android:layout_width="wrap_content" android:layout_height="match_parent"> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="wrap_content" +- android:textColor="#FF0000" android:textSize="20pt" +- android:id="@+id/button1" android:layout_alignParentBottom="true"></Button> +- <Button android:text="Button" +- android:layout_width="wrap_content" android:layout_height="fill_parent" +- android:textColor="#FF00FF" android:textSize="20pt" +- android:id="@+id/button2" android:layout_alignParentBottom="true"></Button> ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_alignParentBottom="true" ++ android:text="Button" ++ android:textColor="#FF0000" ++ android:textSize="20pt" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button2" ++ android:layout_width="wrap_content" ++ android:layout_height="fill_parent" ++ android:layout_alignParentBottom="true" ++ android:text="Button" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff index a4dd387..bb2960e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff @@ -1,33 +1,33 @@ -< foo:layout_width="wrap_content" foo:layout_height="match_parent" foo:orientation="vertical"> -< <Button foo:text="Button" -< foo:layout_width="wrap_content" foo:layout_height="wrap_content" -< foo:textColor="#FF0000" foo:textSize="20pt" -< foo:id="@+id/button1" foo:layout_alignParentBottom="true"></Button> -< <Button foo:text="Button" -< foo:layout_width="wrap_content" foo:layout_height="fill_parent" -< foo:textColor="#00FF00" foo:textSize="20pt" -< foo:id="@+id/button2" foo:layout_alignParentBottom="true"></Button> ---- -> foo:layout_width="wrap_content" -> foo:layout_height="match_parent" -> foo:orientation="vertical" > -> -> <Button -> foo:id="@+id/button1" -> style="@style/newstyle" -> foo:layout_width="wrap_content" -> foo:layout_height="wrap_content" -> foo:layout_alignParentBottom="true" -> foo:text="Button" -> foo:textColor="#FF0000" > -> </Button> -> -> <Button -> foo:id="@+id/button2" -> style="@style/newstyle" -> foo:layout_width="wrap_content" -> foo:layout_height="fill_parent" -> foo:layout_alignParentBottom="true" -> foo:text="Button" > -> </Button> -> +@@ -2 +2 +- foo:layout_width="wrap_content" foo:layout_height="match_parent" foo:orientation="vertical"> +- <Button foo:text="Button" +- foo:layout_width="wrap_content" foo:layout_height="wrap_content" +- foo:textColor="#FF0000" foo:textSize="20pt" +- foo:id="@+id/button1" foo:layout_alignParentBottom="true"></Button> +- <Button foo:text="Button" +- foo:layout_width="wrap_content" foo:layout_height="fill_parent" +- foo:textColor="#00FF00" foo:textSize="20pt" +- foo:id="@+id/button2" foo:layout_alignParentBottom="true"></Button> ++ foo:layout_width="wrap_content" ++ foo:layout_height="match_parent" ++ foo:orientation="vertical" > ++ ++ <Button ++ foo:id="@+id/button1" ++ style="@style/newstyle" ++ foo:layout_width="wrap_content" ++ foo:layout_height="wrap_content" ++ foo:layout_alignParentBottom="true" ++ foo:text="Button" ++ foo:textColor="#FF0000" > ++ </Button> ++ ++ <Button ++ foo:id="@+id/button2" ++ style="@style/newstyle" ++ foo:layout_width="wrap_content" ++ foo:layout_height="fill_parent" ++ foo:layout_alignParentBottom="true" ++ foo:text="Button" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-applyCompletion47.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-applyCompletion47.diff new file mode 100644 index 0000000..3ed60f1 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-applyCompletion47.diff @@ -0,0 +1,4 @@ +Code completion in fragmentlayout.xml for class="^com selecting android.app.ListFragment: +@@ -16 +16 +- <fragment class="^com.android.eclipse.tests.TestFragment" ++ <fragment class="android.app.ListFragment^" diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation77.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation77.txt new file mode 100644 index 0000000..6e8687f --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation77.txt @@ -0,0 +1,5 @@ +Code completion in fragmentlayout.xml for android:name="^com: +android.app.DialogFragment : <p>Implementations should override this class and implement <code><a href="/reference/android/app/Fragment.html#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)">onCreateView(LayoutInflater, ViewGroup, Bundle)</a></code> to supply ... +android.app.ListFragment : <p> ListFragment hosts a <code><a href="/reference/android/widget/ListView.html">ListView</a></code> object that can be bound to different data sources, typically either an array or a Cursor holding query results. Binding, screen layout, and row layout are discussed ... +android.preference.PreferenceFragment : <p> Furthermore, the preferences shown will follow the visual style of system preferences. It is easy to create a hierarchy of preferences (that can be shown on multiple screens) via XML. For these reasons, it is recommended to use this fragment (as a s... +android.webkit.WebViewFragment : <p> The WebView is automically paused or resumed when the Fragment is paused or resumed. </p> </div><!-- jd-descr --> <div class="jd-descr"> <h2>Summary</h2> <!-- =========== ENUM CONSTANT SUMMARY =========== --> <table id="... diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation78.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation78.txt new file mode 100644 index 0000000..e02637c --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/fragmentlayout-expected-complation78.txt @@ -0,0 +1,5 @@ +Code completion in fragmentlayout.xml for class="^com: +android.app.DialogFragment : <p>Implementations should override this class and implement <code><a href="/reference/android/app/Fragment.html#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)">onCreateView(LayoutInflater, ViewGroup, Bundle)</a></code> to supply ... +android.app.ListFragment : <p> ListFragment hosts a <code><a href="/reference/android/widget/ListView.html">ListView</a></code> object that can be bound to different data sources, typically either an array or a Cursor holding query results. Binding, screen layout, and row layout are discussed ... +android.preference.PreferenceFragment : <p> Furthermore, the preferences shown will follow the visual style of system preferences. It is easy to create a hierarchy of preferences (that can be shown on multiple screens) via XML. For these reasons, it is recommended to use this fragment (as a s... +android.webkit.WebViewFragment : <p> The WebView is automically paused or resumed when the Fragment is paused or resumed. </p> </div><!-- jd-descr --> <div class="jd-descr"> <h2>Summary</h2> <!-- =========== ENUM CONSTANT SUMMARY =========== --> <table id="... diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-complation80.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-complation80.txt new file mode 100644 index 0000000..cb1d0ce --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-complation80.txt @@ -0,0 +1,8 @@ +Code completion in manifest.xml for <activity android:name="^.: +android.accounts.AccountAuthenticatorActivity +android.app.ActivityGroup +android.app.AliasActivity +android.app.ExpandableListActivity +android.app.ListActivity +android.app.NativeActivity +android.app.TabActivity diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt index 39de60c..1215244 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt @@ -26,3 +26,4 @@ android:windowSoftInputMode : Specify the default soft-input mode for the main w android:immersive : Flag declaring this activity to be 'immersive'; immersive activities should not be interrupted with other activities or notifications. [boolean] android:hardwareAccelerated : <p>Flag indicating whether the application's rendering should be hardware accelerated if possible. [boolean] android:uiOptions : Extra options for an activity's UI. [flag] +android:parentActivityName : The name of the logical parent of the activity as it appears in the manifest. [string] diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion69.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion69.txt index 0cc2abe..cf7e0f4 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion69.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion69.txt @@ -1,4 +1,5 @@ Code completion in manifest.xml for <uses-sdk android:minSdkVersion="^11" />: +17 : API 17: Android 4.2 (Jelly Bean) 16 : API 16: Android 4.1 (Jelly Bean) 15 : API 15: Android 4.0.3 (IceCreamSandwich) 14 : API 14: Android 4.0 (IceCreamSandwich) @@ -15,13 +16,3 @@ Code completion in manifest.xml for <uses-sdk android:minSdkVersion="^11" />: 3 : API 3: Android 1.5 (Cupcake) 2 : API 2: Android 1.1 1 : API 1: Android 1.0 -@string/ -@android: -@+id/ -@anim/ -@animator/ -@color/ -@drawable/ -@id/ -@layout/ -@style/ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt new file mode 100644 index 0000000..6b9cf5b --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt @@ -0,0 +1,76 @@ +Code completion in navigation1.xml for ?android:a^ttr/alertDialogStyle: +?android:attr/ +?android:allowClearUserData +?android:authorities +?android:action +?android:alertDialogStyle +?android:absListViewStyle +?android:autoCompleteTextViewStyle +?android:autoLink +?android:activityOpenEnterAnimation +?android:activityOpenExitAnimation +?android:activityCloseEnterAnimation +?android:activityCloseExitAnimation +?android:animationCache +?android:alwaysDrawnWithCache +?android:addStatesFromChildren +?android:animationDuration +?android:antialias +?android:adjustViewBounds +?android:autoText +?android:angle +?android:animation +?android:animationOrder +?android:alphabeticShortcut +?android:alwaysRetainTaskState +?android:allowTaskReparenting +?android:apiKey +?android:allowSingleTap +?android:animateOnClick +?android:anyDensity +?android:allowBackup +?android:autoUrlDetect +?android:accountType +?android:accountPreferences +?android:author +?android:autoStart +?android:allContactsName +?android:actionBarStyle +?android:animateFirstView +?android:actionDropDownStyle +?android:actionButtonStyle +?android:actionModeBackground +?android:actionModeCloseDrawable +?android:actionBarSize +?android:animateLayoutChanges +?android:actionBarTabStyle +?android:actionBarTabBarStyle +?android:actionBarTabTextStyle +?android:actionOverflowButtonStyle +?android:actionModeCloseButtonStyle +?android:actionLayout +?android:actionViewClass +?android:activatedBackgroundIndicator +?android:alertDialogTheme +?android:autoAdvanceViewId +?android:actionModeCutDrawable +?android:actionModeCopyDrawable +?android:actionModePasteDrawable +?android:animationResolution +?android:alpha +?android:allowParallelSyncs +?android:alertDialogIcon +?android:actionMenuTextAppearance +?android:actionMenuTextColor +?android:alignmentMode +?android:actionModeSelectAllDrawable +?android:accessibilityEventTypes +?android:accessibilityFeedbackType +?android:accessibilityFlags +?android:actionBarSplitStyle +?android:actionProviderClass +?android:actionModeStyle +?android:actionBarWidgetTheme +?android:actionBarDivider +?android:actionBarItemBackground +?android:actionModeSplitBackground diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate16.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate16.txt new file mode 100644 index 0000000..b6f6cb2 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate16.txt @@ -0,0 +1,7 @@ +Go To Declaration in navigation1.xml for ?android:alert^DialogStyle: +Open Declaration in values/attrs.xml : [?android:alertDialogStyle] + data/res/values/attrs.xml + + +After open, the selected text is: + <attr name="alertDialogStyle" format="reference" />^ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml index e7ac4bc..c5b292e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml @@ -14,4 +14,5 @@ android:text="@android:string/ok" </EditText> <EditText android:text="?android:attr/alertDialogStyle" /> + <EditText android:text="?android:alertDialogStyle" /> </LinearLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff index 141180b..8890f79 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff @@ -1,6 +1,5 @@ ---- - </style> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> - </resources> +@@ -28 +28 ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff index 1958ae5..6772a8f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff @@ -1,11 +1,12 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> -> <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> -> <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> -> <!-- Comment --> -> <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -> </LinearLayout> -> </LinearLayout> -> </LinearLayout> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> ++ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> ++ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> ++ <!-- Comment --> ++ <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> ++ </LinearLayout> ++ </LinearLayout> ++ </LinearLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract7.diff index 871a14d..d0fdc92 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract7.diff @@ -1,30 +1,29 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -> android:id="@+id/linearLayout4" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <LinearLayout -> android:id="@+id/linearLayout5" -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <LinearLayout -> android:id="@+id/linearLayout6" -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <!-- Comment --> -> -> <Button -> android:id="@+id/button6" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="Button" > -> </Button> -> </LinearLayout> -> </LinearLayout> -> -> </LinearLayout> +@@ -1 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ++ android:id="@+id/linearLayout4" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > +@@ -2 +7 ++ <LinearLayout ++ android:id="@+id/linearLayout5" ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <LinearLayout ++ android:id="@+id/linearLayout6" ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <!-- Comment --> ++ ++ <Button ++ android:id="@+id/button6" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="Button" > ++ </Button> ++ </LinearLayout> ++ </LinearLayout> ++ ++ </LinearLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff index 7f076e7..0949fbd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff index 7f076e7..0949fbd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff index 7f076e7..0949fbd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff index 01d0697..e8b553e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle" parent="android:Widget.Button"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle" parent="android:Widget.Button"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff index 7f076e7..0949fbd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff index 8f2e543..88a94e7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF0000</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF0000</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff index 3013eb5..49043b9 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff @@ -1,8 +1,9 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#FF00FF</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#FF00FF</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff index 7980fae..49ab2c3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff @@ -1,8 +1,9 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff index 9e4ee25..6bcd6ff 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff @@ -1,9 +1,10 @@ -< ---- -> <?xml version="1.0" encoding="utf-8"?> -> <resources xmlns:android="http://schemas.android.com/apk/res/android"> -> <style name="newstyle"> -> <item name="android:textColor">#00FF00</item> -> <item name="android:textSize">20pt</item> -> </style> -> </resources> +@@ -1 +1 +- +@@ -2 +1 ++ <?xml version="1.0" encoding="utf-8"?> ++ <resources xmlns:android="http://schemas.android.com/apk/res/android"> ++ <style name="newstyle"> ++ <item name="android:textColor">#00FF00</item> ++ <item name="android:textSize">20pt</item> ++ </style> ++ </resources> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml index 2ef716b..a51abf4 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="hello">Hello World!</string> + <string name="app_name">PROJECTNAME</string> <string name="firststring">[^TODO]</string> -</resources> + +</resources>
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml index 8773027..900c420 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > ^ -</LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml index 025fa0a..7b638c6 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml @@ -1,3 +1,4 @@ -< <color android:color="#0000000"/> ---- -> <color android:color="#0000000" xmlns:android="http://schemas.android.com/apk/res/android"/> +@@ -5 +5 +- <color android:color="#0000000"/> +@@ -6 +5 ++ <color android:color="#0000000" xmlns:android="http://schemas.android.com/apk/res/android"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-convertFromGrid.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-convertFromGrid.xml index faa95d7..98e1f36 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-convertFromGrid.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-convertFromGrid.xml @@ -3,6 +3,7 @@ android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" + android:columnCount="2" android:orientation="horizontal" > <Button @@ -15,6 +16,8 @@ android:id="@+id/radioButton1" android:layout_width="150dp" android:layout_height="wrap_content" + android:layout_column="0" + android:layout_row="1" android:text="RadioButton" /> <RadioButton diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-initialAttributes.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-initialAttributes.xml index 8f19186..aa8ecda 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-initialAttributes.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample10-expected-initialAttributes.xml @@ -3,6 +3,7 @@ android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" + android:columnCount="2" android:orientation="vertical" > <Button @@ -15,6 +16,8 @@ android:id="@+id/radioButton1" android:layout_width="150dp" android:layout_height="wrap_content" + android:layout_column="0" + android:layout_row="1" android:text="RadioButton" /> <RadioButton diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt index be08a13..30bb00b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt @@ -1,2 +1,3 @@ Quick assistant in sample1a.xml for android:id="@+id/Linea^rLayout2": +Rename Android Resource : Initiates the "Rename Android Resource" refactoring Extract Style : Initiates the "Extract Style" refactoring diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff index c0ebd59..1ae5748 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff @@ -1,9 +1,9 @@ -< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> -< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> ---- -> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> +@@ -13 +13 +- <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> +- <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> +- </LinearLayout> ++ <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract7.diff index 0a0b809..6d18aab 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract7.diff @@ -1,86 +1,84 @@ -< <LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> -< <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="wrap_content"> -< <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button> -< <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button> -< <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox> -< </LinearLayout> -< <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button> -< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout3" android:layout_width="match_parent"> -< <Button android:layout_gravity="right" android:id="@+id/button5" android:text="FifthButton" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button> -< </LinearLayout> -< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> -< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> ---- -> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -> android:id="@+id/LinearLayout2" -> android:layout_width="match_parent" -> android:layout_height="match_parent" -> android:orientation="vertical" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="FirstButton" > -> </Button> -> -> <LinearLayout -> android:id="@+id/linearLayout1" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <Button -> android:id="@+id/button2" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="SecondButton" > -> </Button> -> -> <Button -> android:id="@+id/button3" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="ThirdButton" > -> </Button> -> -> <CheckBox -> android:id="@+id/checkBox1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="CheckBox" > -> </CheckBox> -> </LinearLayout> -> -> <Button -> android:id="@+id/button4" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" -> android:text="FourthButton" > -> </Button> -> -> <LinearLayout -> android:id="@+id/linearLayout3" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <Button -> android:id="@+id/button5" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:layout_gravity="right" -> android:text="FifthButton" > -> </Button> -> </LinearLayout> -> -> <include -> android:id="@+id/linearLayout4_ref" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" -> layout="@layout/newlayout6" /> -> +@@ -2 +2 +- <LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> +- <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="wrap_content"> +- <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button> +- <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button> +- <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox> +- </LinearLayout> +- <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button> +- <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout3" android:layout_width="match_parent"> +- <Button android:layout_gravity="right" android:id="@+id/button5" android:text="FifthButton" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button> ++ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ++ android:id="@+id/LinearLayout2" ++ android:layout_width="match_parent" ++ android:layout_height="match_parent" ++ android:orientation="vertical" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="FirstButton" > ++ </Button> ++ ++ <LinearLayout ++ android:id="@+id/linearLayout1" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <Button ++ android:id="@+id/button2" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="SecondButton" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button3" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="ThirdButton" > ++ </Button> ++ ++ <CheckBox ++ android:id="@+id/checkBox1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="CheckBox" > ++ </CheckBox> +@@ -13 +41 +- <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> +- <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> ++ ++ <Button ++ android:id="@+id/button4" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" ++ android:text="FourthButton" > ++ </Button> ++ ++ <LinearLayout ++ android:id="@+id/linearLayout3" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <Button ++ android:id="@+id/button5" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:layout_gravity="right" ++ android:text="FifthButton" > ++ </Button> +@@ -20 +62 ++ ++ <include ++ android:id="@+id/linearLayout4_ref" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" ++ layout="@layout/newlayout6" /> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml index 5a55498..366c8df 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml @@ -3,10 +3,10 @@ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <RelativeLayout android:layout_height="match_parent" android:id="@+id/relativeLayout1" android:layout_width="match_parent"> <Button android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/button2" android:layout_height="wrap_content" android:text="Button"></Button> - <ImageButton android:layout_width="wrap_content" android:id="@+id/ImageButton1" android:layout_below="@+id/button2" android:layout_height="wrap_content" android:layout_toRightOf="@+id/button2"></ImageButton> + <ImageButton android:layout_width="wrap_content" android:id="@+id/ImageButton1" android:layout_below="@+id/button2" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button2"></ImageButton> <Button android:layout_width="wrap_content" android:id="@+id/button4" android:layout_below="@+id/ImageButton1" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/ImageButton1"></Button> <CheckBox android:layout_width="wrap_content" android:layout_below="@+id/button4" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:text="CheckBox" android:layout_toLeftOf="@+id/button4"></CheckBox> - <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ImageButton2" android:layout_alignParentRight="true"></ImageButton> + <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/ImageButton2" android:layout_alignParentRight="true"></ImageButton> </RelativeLayout> </LinearLayout> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff index 636e301..8a01599 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff @@ -1,10 +1,10 @@ -< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> -< <!-- Comment --> -< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> ---- -> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> +@@ -4 +4 +- <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> +- <!-- Comment --> +- <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> +- </LinearLayout> ++ <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract7.diff index 96e6dfb..3de135d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract7.diff @@ -1,70 +1,69 @@ -< <LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> -< <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> -< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> -< <!-- Comment --> -< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> -< <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout9" android:layout_height="wrap_content"> -< <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button> -< <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button> -< <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox> -< </LinearLayout> -< <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button> ---- -> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -> android:id="@+id/LinearLayout2" -> android:layout_width="match_parent" -> android:layout_height="match_parent" -> android:orientation="vertical" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="FirstButton" > -> </Button> -> -> <include -> android:id="@+id/linearLayout4_ref" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" -> layout="@layout/newlayout6" /> -> -> <LinearLayout -> android:id="@+id/linearLayout9" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <Button -> android:id="@+id/button2" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="SecondButton" > -> </Button> -> -> <Button -> android:id="@+id/button3" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="ThirdButton" > -> </Button> -> -> <CheckBox -> android:id="@+id/checkBox1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="CheckBox" > -> </CheckBox> -> </LinearLayout> -> -> <Button -> android:id="@+id/button4" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" -> android:text="FourthButton" > -> </Button> -> +@@ -2 +2 +- <LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> +- <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content"> +- <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content"> +- <!-- Comment --> +- <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> +- </LinearLayout> +- <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout9" android:layout_height="wrap_content"> +- <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button> +- <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button> +- <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox> ++ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ++ android:id="@+id/LinearLayout2" ++ android:layout_width="match_parent" ++ android:layout_height="match_parent" ++ android:orientation="vertical" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="FirstButton" > ++ </Button> ++ ++ <include ++ android:id="@+id/linearLayout4_ref" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" ++ layout="@layout/newlayout6" /> ++ ++ <LinearLayout ++ android:id="@+id/linearLayout9" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <Button ++ android:id="@+id/button2" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="SecondButton" > ++ </Button> ++ ++ <Button ++ android:id="@+id/button3" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="ThirdButton" > ++ </Button> ++ ++ <CheckBox ++ android:id="@+id/checkBox1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="CheckBox" > ++ </CheckBox> +@@ -17 +47 +- <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button> ++ ++ <Button ++ android:id="@+id/button4" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" ++ android:text="FourthButton" > ++ </Button> ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff index 024141a..ea3afc2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff @@ -1,15 +1,15 @@ -< <LinearLayout android:layout_height="wrap_content" -< android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" -< android:layout_width="wrap_content" android:id="@+id/linearLayout5"> -< <LinearLayout android:layout_height="match_parent" -< android:id="@+id/linearLayout6" -< android:layout_width="wrap_content"> -< <Button android:text="Button" android:id="@+id/button6" -< android:layout_width="wrap_content" -< android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> ---- -> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> +@@ -10 +10 +- <LinearLayout android:layout_height="wrap_content" +- android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" +- android:layout_width="wrap_content" android:id="@+id/linearLayout5"> +- <LinearLayout android:layout_height="match_parent" +- android:id="@+id/linearLayout6" +- android:layout_width="wrap_content"> +- <Button android:text="Button" android:id="@+id/button6" +- android:layout_width="wrap_content" +- android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> +- </LinearLayout> ++ <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract7.diff index 1774968..8228b59 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract7.diff +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract7.diff @@ -1,95 +1,85 @@ -< <LinearLayout android:id="@+id/LinearLayout2" -< xmlns:android="http://schemas.android.com/apk/res/android" -< android:layout_width="match_parent" android:layout_height="match_parent" -< android:orientation="vertical"> -< <Button android:text="FirstButton" android:id="@+id/button1" -< android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -< <FrameLayout android:id="@+id/outer" -< android:layout_width="match_parent" android:layout_height="wrap_content"> -< <LinearLayout android:layout_height="wrap_content" -< android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" -< android:layout_width="wrap_content" android:id="@+id/linearLayout5"> -< <LinearLayout android:layout_height="match_parent" -< android:id="@+id/linearLayout6" -< android:layout_width="wrap_content"> -< <Button android:text="Button" android:id="@+id/button6" -< android:layout_width="wrap_content" -< android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> -< </FrameLayout> -< <FrameLayout android:id="@+id/outer" -< android:layout_width="match_parent" android:layout_height="wrap_content"> -< <LinearLayout android:layout_height="wrap_content" -< android:id="@+id/linearLayout4" android:layout_width="match_parent"> -< <LinearLayout android:layout_height="match_parent" -< android:layout_width="wrap_content" android:id="@+id/linearLayout5"> -< <LinearLayout android:layout_height="match_parent" -< android:id="@+id/linearLayout6" -< android:layout_width="wrap_content"> -< <Button android:text="Button" android:id="@+id/button6" -< android:layout_width="wrap_content" -< android:layout_height="wrap_content"></Button> -< </LinearLayout> -< </LinearLayout> -< </LinearLayout> -< </FrameLayout> ---- -> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -> android:id="@+id/LinearLayout2" -> android:layout_width="match_parent" -> android:layout_height="match_parent" -> android:orientation="vertical" > -> -> <Button -> android:id="@+id/button1" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="FirstButton" > -> </Button> -> -> <FrameLayout -> android:id="@+id/outer" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <include -> android:id="@+id/linearLayout4_ref" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" -> layout="@layout/newlayout6" /> -> </FrameLayout> -> -> <FrameLayout -> android:id="@+id/outer" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <LinearLayout -> android:id="@+id/linearLayout4" -> android:layout_width="match_parent" -> android:layout_height="wrap_content" > -> -> <LinearLayout -> android:id="@+id/linearLayout5" -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <LinearLayout -> android:id="@+id/linearLayout6" -> android:layout_width="wrap_content" -> android:layout_height="match_parent" > -> -> <Button -> android:id="@+id/button6" -> android:layout_width="wrap_content" -> android:layout_height="wrap_content" -> android:text="Button" > -> </Button> -> </LinearLayout> -> </LinearLayout> -> </LinearLayout> -> </FrameLayout> -> +@@ -2 +2 +- <LinearLayout android:id="@+id/LinearLayout2" +- xmlns:android="http://schemas.android.com/apk/res/android" +- android:layout_width="match_parent" android:layout_height="match_parent" +- android:orientation="vertical"> +- <Button android:text="FirstButton" android:id="@+id/button1" +- android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> +- <FrameLayout android:id="@+id/outer" +- android:layout_width="match_parent" android:layout_height="wrap_content"> +- <LinearLayout android:layout_height="wrap_content" +- android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" +- android:layout_width="wrap_content" android:id="@+id/linearLayout5"> +- <LinearLayout android:layout_height="match_parent" +- android:id="@+id/linearLayout6" +- android:layout_width="wrap_content"> +- <Button android:text="Button" android:id="@+id/button6" +- android:layout_width="wrap_content" +- android:layout_height="wrap_content"></Button> +- </LinearLayout> +- </LinearLayout> +- </LinearLayout> ++ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ++ android:id="@+id/LinearLayout2" ++ android:layout_width="match_parent" ++ android:layout_height="match_parent" ++ android:orientation="vertical" > ++ ++ <Button ++ android:id="@+id/button1" ++ android:layout_width="wrap_content" ++ android:layout_height="wrap_content" ++ android:text="FirstButton" > ++ </Button> ++ ++ <FrameLayout ++ android:id="@+id/outer" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <include ++ android:id="@+id/linearLayout4_ref" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" ++ layout="@layout/newlayout6" /> +@@ -24 +26 +- <FrameLayout android:id="@+id/outer" +- android:layout_width="match_parent" android:layout_height="wrap_content"> +- <LinearLayout android:layout_height="wrap_content" +- android:id="@+id/linearLayout4" android:layout_width="match_parent"> +- <LinearLayout android:layout_height="match_parent" +- android:layout_width="wrap_content" android:id="@+id/linearLayout5"> +- <LinearLayout android:layout_height="match_parent" ++ ++ <FrameLayout ++ android:id="@+id/outer" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <LinearLayout ++ android:id="@+id/linearLayout4" ++ android:layout_width="match_parent" ++ android:layout_height="wrap_content" > ++ ++ <LinearLayout ++ android:id="@+id/linearLayout5" ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <LinearLayout +@@ -32 +44 +- android:layout_width="wrap_content"> +- <Button android:text="Button" android:id="@+id/button6" ++ android:layout_width="wrap_content" ++ android:layout_height="match_parent" > ++ ++ <Button ++ android:id="@+id/button6" +@@ -35 +50 +- android:layout_height="wrap_content"></Button> ++ android:layout_height="wrap_content" ++ android:text="Button" > ++ </Button> +@@ -40 +57 ++ diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java index faf8ada..f4b8cee 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java @@ -30,6 +30,8 @@ import org.eclipse.core.runtime.NullProgressMonitor; import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import java.util.Map; @SuppressWarnings("javadoc") @@ -396,5 +398,10 @@ public class ManifestInfoTest extends AdtProjectTest { public String getShortClasspathName() { return null; } + + @Override + public List<String> getBootClasspath() { + return new ArrayList<String>(); + } } } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java index 9f0783f..088ece7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java @@ -33,7 +33,6 @@ import com.android.tools.lint.detector.api.Severity; import org.eclipse.core.resources.IProject; import java.io.File; -import java.util.Calendar; @SuppressWarnings("javadoc") public class ProjectLintConfigurationTest extends AdtProjectTest { @@ -181,31 +180,11 @@ public class ProjectLintConfigurationTest extends AdtProjectTest { assertSame(config1, config2); } - private static File sTempDir = null; - @Override - protected File getTempDir() { - if (sTempDir == null) { - File base = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ - String os = System.getProperty("os.name"); //$NON-NLS-1$ - if (os.startsWith("Mac OS")) { //$NON-NLS-1$ - base = new File("/tmp"); - } - Calendar c = Calendar.getInstance(); - String name = String.format("lintTests/%1$tF_%1$tT", c).replace(':', '-'); //$NON-NLS-1$ - File tmpDir = new File(base, name); - if (!tmpDir.exists() && tmpDir.mkdirs()) { - sTempDir = tmpDir; - } else { - sTempDir = base; - } - } - - return sTempDir; - } - @Override protected File getTargetDir() { - return new File(getTempDir(), getClass().getSimpleName() + "_" + getName()); + File targetDir = new File(getTempDir(), getClass().getSimpleName() + "_" + getName()); + addCleanupDir(targetDir); + return targetDir; } private static class TestClient extends LintClient { diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidPackageRenameParticipantTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidPackageRenameParticipantTest.java new file mode 100644 index 0000000..1df0b0c --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidPackageRenameParticipantTest.java @@ -0,0 +1,293 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ide.eclipse.adt.internal.refactorings.core; + +import com.android.annotations.NonNull; +import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestInfo; +import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; +import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring; + +/** + * TODO: Test renaming a DIFFERENT package than the application package! + */ +@SuppressWarnings({"javadoc", "restriction"}) +public class AndroidPackageRenameParticipantTest extends RefactoringTestBase { + public void testRefactor1() throws Exception { + renamePackage( + TEST_PROJECT, + false /*renameSubpackages*/, + true /*updateReferences*/, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename package 'com.example.refactoringtest' to 'my.pkg.name'\n" + + "\n" + + "[x] MainActivity.java - /testRefactor1/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -3 +3\n" + + " + import com.example.refactoringtest.R;\n" + + " +\n" + + "\n" + + "\n" + + "[x] activity_main.xml - /testRefactor1/res/layout/activity_main.xml\n" + + " @@ -33 +33\n" + + " - <fragment android:name=\"com.example.refactoringtest.MyFragment\"/>\n" + + " + <fragment android:name=\"my.pkg.name.MyFragment\"/>\n" + + "\n" + + "\n" + + "[x] AndroidManifest.xml - /testRefactor1/AndroidManifest.xml\n" + + " @@ -16 +16\n" + + " - android:name=\"com.example.refactoringtest.MainActivity\"\n" + + " + android:name=\"my.pkg.name.MainActivity\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"my.pkg.name.MainActivity2\"", + true); + } + + public void testRefactor1_noreferences() throws Exception { + renamePackage( + TEST_PROJECT, + false /*renameSubpackages*/, + false /*updateReferences*/, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename package 'com.example.refactoringtest' to 'my.pkg.name'", + false); + } + + public void testRefactor2() throws Exception { + // Tests custom view handling + renamePackage( + TEST_PROJECT2, + false /*renameSubpackages*/, + true /*updateReferences*/, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename package 'com.example.refactoringtest' to 'my.pkg.name'\n" + + "\n" + + "[x] MainActivity.java - /testRefactor2/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -3 +3\n" + + " + import com.example.refactoringtest.R;\n" + + " +\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2/res/layout/customviews.xml\n" + + " @@ -9 +9\n" + + " - <com.example.refactoringtest.CustomView1\n" + + " + <my.pkg.name.CustomView1\n" + + "\n" + + "\n" + + "[x] activity_main.xml - /testRefactor2/res/layout/activity_main.xml\n" + + " @@ -33 +33\n" + + " - <fragment android:name=\"com.example.refactoringtest.MyFragment\"/>\n" + + " + <fragment android:name=\"my.pkg.name.MyFragment\"/>\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2/res/layout-land/customviews.xml\n" + + " @@ -9 +9\n" + + " - <com.example.refactoringtest.CustomView1\n" + + " + <my.pkg.name.CustomView1\n" + + "\n" + + "\n" + + "[x] AndroidManifest.xml - /testRefactor2/AndroidManifest.xml\n" + + " @@ -16 +16\n" + + " - android:name=\"com.example.refactoringtest.MainActivity\"\n" + + " + android:name=\"my.pkg.name.MainActivity\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"my.pkg.name.MainActivity2\"", + true); + } + + public void testRefactor2_renamesub() throws Exception { + // Tests custom view handling + renamePackage( + TEST_PROJECT2, + true /*renameSubpackages*/, + true /*updateReferences*/, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename package 'com.example.refactoringtest' and subpackages to 'my.pkg.name'\n" + + "\n" + + "[x] MainActivity.java - /testRefactor2_renamesub/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -3 +3\n" + + " + import com.example.refactoringtest.R;\n" + + " +\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2_renamesub/res/layout/customviews.xml\n" + + " @@ -9 +9\n" + + " - <com.example.refactoringtest.CustomView1\n" + + " + <my.pkg.name.CustomView1\n" + + "\n" + + "\n" + + "[x] activity_main.xml - /testRefactor2_renamesub/res/layout/activity_main.xml\n" + + " @@ -33 +33\n" + + " - <fragment android:name=\"com.example.refactoringtest.MyFragment\"/>\n" + + " + <fragment android:name=\"my.pkg.name.MyFragment\"/>\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2_renamesub/res/layout-land/customviews.xml\n" + + " @@ -9 +9\n" + + " - <com.example.refactoringtest.CustomView1\n" + + " + <my.pkg.name.CustomView1\n" + + "\n" + + "\n" + + "[x] AndroidManifest.xml - /testRefactor2_renamesub/AndroidManifest.xml\n" + + " @@ -16 +16\n" + + " - android:name=\"com.example.refactoringtest.MainActivity\"\n" + + " + android:name=\"my.pkg.name.MainActivity\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"my.pkg.name.MainActivity2\"\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2_renamesub/res/layout/customviews.xml\n" + + " @@ -15 +15\n" + + " - <com.example.refactoringtest.subpackage.CustomView2\n" + + " + <my.pkg.name.subpackage.CustomView2\n" + + "\n" + + "\n" + + "[x] customviews.xml - /testRefactor2_renamesub/res/layout-land/customviews.xml\n" + + " @@ -15 +15\n" + + " - <com.example.refactoringtest.subpackage.CustomView2\n" + + " + <my.pkg.name.subpackage.CustomView2", + true); + } + + public void testRefactor2_renamesub_norefs() throws Exception { + // Tests custom view handling + renamePackage( + TEST_PROJECT2, + true /*renameSubpackages*/, + false /*updateReferences*/, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename package 'com.example.refactoringtest' and subpackages to 'my.pkg.name'", + false); + } + + + // ---- Test infrastructure ---- + + protected void renamePackage( + @NonNull Object[] testData, + boolean renameSubpackages, + boolean updateReferences, + @NonNull String newName, + @NonNull String expected, + boolean expectedAppPackageRenameWarning) throws Exception { + IProject project = createProject(testData); + String expectedWarnings = expectedAppPackageRenameWarning ? + EXPECTED_WARNINGS_TEMPLATE.replace("PROJECTNAME", project.getName()) : null; + renamePackage(project, renameSubpackages, updateReferences, newName, expected, + expectedWarnings); + } + + protected void renamePackage( + @NonNull IProject project, + boolean renameSubpackages, + boolean updateReferences, + @NonNull String newName, + @NonNull String expected, + @NonNull String expectedWarnings) throws Exception { + ManifestInfo info = ManifestInfo.get(project); + String currentPackage = info.getPackage(); + assertNotNull(currentPackage); + + IPackageFragment pkgFragment = getPackageFragment(project, currentPackage); + RenamePackageProcessor processor = new RenamePackageProcessor(pkgFragment); + processor.setNewElementName(newName); + processor.setRenameSubpackages(renameSubpackages); + processor.setUpdateReferences(updateReferences); + assertNotNull(processor); + + RenameRefactoring refactoring = new RenameRefactoring(processor); + checkRefactoring(refactoring, expected, expectedWarnings); + } + + private static IPackageFragment getPackageFragment(IProject project, String pkg) + throws CoreException, JavaModelException { + IPackageFragment pkgFragment = null; + IJavaProject javaProject = BaseProjectHelper.getJavaProject(project); + assertNotNull(javaProject); + IPackageFragment[] fragments = javaProject.getPackageFragments(); + for (IPackageFragment fragment : fragments) { + String name = fragment.getElementName(); + if (pkg.equals(name)) { + pkgFragment = fragment; + break; + } + } + return pkgFragment; + } + + private static String EXPECTED_WARNINGS_TEMPLATE = + "<INFO\n" + + "\t\n" + + "INFO: You are refactoring the same package as your application's package (specified in the manifest).\n" + + "\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: Note that this refactoring does NOT also update your application package.\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: The application package defines your application's identity.\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: If you change it, then it is considered to be a different application.\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: (Users of the previous version cannot update to the new version.)\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: The application package, and the package containing the code, can differ.\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + "\t\n" + + "INFO: To really change application package, choose \"Android Tools\" > \"Rename Application Package.\" from the project context menu.\n" + + "Context: L/PROJECTNAME/AndroidManifest.xml\n" + + "code: none\n" + + "Data: null\n" + + ">"; +} diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java new file mode 100644 index 0000000..41838e2 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java @@ -0,0 +1,757 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ide.eclipse.adt.internal.refactorings.core; + +import com.android.annotations.NonNull; +import com.android.annotations.Nullable; +import com.android.ide.eclipse.adt.AdtUtils; +import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest; +import com.google.common.base.Charsets; +import com.google.common.base.Splitter; +import com.google.common.io.ByteStreams; +import com.google.common.io.Files; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange; +import org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.CompositeChange; +import org.eclipse.ltk.core.refactoring.Refactoring; +import org.eclipse.ltk.core.refactoring.RefactoringStatus; +import org.eclipse.ltk.core.refactoring.TextChange; +import org.eclipse.ltk.core.refactoring.TextFileChange; +import org.eclipse.ltk.core.refactoring.resource.MoveResourceChange; +import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; +import org.eclipse.text.edits.TextEdit; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +@SuppressWarnings({"javadoc","restriction"}) +public abstract class RefactoringTestBase extends AdtProjectTest { + protected void checkRefactoring(Refactoring refactoring, String expected) throws Exception { + checkRefactoring(refactoring, expected, null); + } + + @Override + protected void setUp() throws Exception { + // Not calling super.setUp + } + + protected void checkRefactoring(Refactoring refactoring, String expected, + @Nullable String expectedWarnings) throws Exception { + RefactoringStatus status = refactoring.checkAllConditions(new NullProgressMonitor()); + assertNotNull(status); + if (expectedWarnings == null) { + expectedWarnings = "<OK\n>"; + } + if (status.toString().trim().startsWith( + "<WARNING\n" + + "\t\n" + + "WARNING: Code modification may not be accurate as affected resource '")) { + // Test instability, probably a timing issue with getting the new project + // compiled (to recognize Android classpath entries) + // Just continue to ensure that the refactoring list matches. + } else { + assertEquals(status.toString().trim(), expectedWarnings.trim()); + } + if (!status.isOK()) { + return; + } + assertTrue(status.toString(), status.isOK()); + Change change = refactoring.createChange(new NullProgressMonitor()); + assertNotNull(change); + String explanation = "CHANGES:\n-------\n" + describe(change); + if (!expected.trim().equals(explanation.trim())) { // allow trimming endlines in expected + assertEquals(expected, explanation); + } + } + + private IProject mProject; + + @Override + protected IProject getProject() { + return mProject; + } + + protected IProject createProject(Object[] testData) throws Exception { + String name = getName(); + IProject project = createProject(name); + mProject = project; + File projectDir = AdtUtils.getAbsolutePath(project).toFile(); + assertNotNull(projectDir); + assertTrue(projectDir.getPath(), projectDir.exists()); + createTestDataDir(projectDir, testData); + project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + + for (int i = 0; i < testData.length; i+= 2) { + assertTrue(testData[i].toString(), testData[i] instanceof String); + String relative = (String) testData[i]; + IResource member = project.findMember(relative); + assertNotNull(relative, member); + assertTrue(member.getClass().getSimpleName(), member instanceof IFile); + } + + return project; + } + + public static String describe(Change change) throws Exception { + StringBuilder sb = new StringBuilder(1000); + describe(sb, change, 0); + + // Trim trailing space + for (int i = sb.length() - 1; i >= 0; i--) { + if (!Character.isWhitespace(sb.charAt(i))) { + sb.setLength(i + 1); + break; + } + } + + return sb.toString(); + } + + protected static void describe(StringBuilder sb, Change change, int indent) throws Exception { + if (change instanceof CompositeChange + && ((CompositeChange) change).isSynthetic()) { + // Don't display information about synthetic changes + } else { + String changeName = change.getName(); + + if (changeName.contains("MoreUnit")) { + // If MoreUnit plugin is installed, don't include in unit test results + return; + } + + // Describe this change + indent(sb, indent); + if (change.isEnabled()) { + sb.append("[x] "); + } else { + sb.append("[ ] "); + } + sb.append(changeName); + + IFile file = getFile(change); + if (file != null) { + sb.append(" - "); + sb.append(file.getFullPath()); + sb.append('\n'); + } else { + sb.append('\n'); + } + + if (change instanceof TextFileChange) { + assertNotNull(file); + if (file != null) { + TextChange tc = (TextChange) change; + TextEdit edit = tc.getEdit(); + byte[] bytes = ByteStreams.toByteArray(file.getContents()); + String before = new String(bytes, Charsets.UTF_8); + IDocument document = new Document(); + document.replace(0, 0, before); + // Make a copy: edits are sometimes destructive when run repeatedly! + edit.copy().apply(document); + String after = document.get(); + + String diff = getDiff(before, after); + for (String line : Splitter.on('\n').split(diff)) { + if (!line.trim().isEmpty()) { + indent(sb, indent + 1); + sb.append(line); + } + sb.append('\n'); + } + } + } else if (change instanceof RenameCompilationUnitChange) { + // Change name, appended above, is adequate + } else if (change instanceof RenameResourceChange) { + // Change name, appended above, is adequate + } else if (change instanceof RenamePackageChange) { + // Change name, appended above, is adequate + } else if (change instanceof MoveResourceChange) { + // Change name, appended above, is adequate + } else if (change instanceof CompositeChange) { + // Don't print details about children here; they'll be nested below + } else { + indent(sb, indent); + sb.append("<UNKNOWN CHANGE TYPE " + change.getClass().getName() + ">"); + } + sb.append('\n'); + } + + if (change instanceof CompositeChange) { + CompositeChange composite = (CompositeChange) change; + Change[] children = composite.getChildren(); + List<Change> sorted = Arrays.asList(children); + // Process children in a fixed (output-alphabetical) order to ensure stable output + Collections.sort(sorted, new Comparator<Change>() { + @Override + public int compare(Change change1, Change change2) { + try { + IFile file1 = getFile(change1); + IFile file2 = getFile(change2); + if (file1 != null && file2 != null) { + // Sort in decreasing order. This places the most interesting + // files first: res > src > gen + int fileDelta = file2.getFullPath().toOSString().compareToIgnoreCase( + file1.getFullPath().toOSString()); + if (fileDelta != 0) { + return fileDelta; + } + } + + int nameDelta = change2.getName().compareTo(change1.getName()); + if (nameDelta != 0) { + return nameDelta; + } + + // This is pretty inefficient but ensures stable output + return describe(change2).compareTo(describe(change1)); + } catch (Exception e) { + fail(e.getLocalizedMessage()); + return 0; + } + } + + }); + for (Change child : sorted) { + describe(sb, child, indent + (composite.isSynthetic() ? 0 : 1)); + } + } + } + + @Nullable + private static IFile getFile(@NonNull Change change) { + if (change instanceof TextFileChange) { + TextFileChange tfc = (TextFileChange) change; + return tfc.getFile(); + } + + return null; + } + + protected static void indent(StringBuilder sb, int indent) { + for (int i = 0; i < indent; i++) { + sb.append(" "); + } + } + + protected void createTestDataDir(File dir, Object[] data) throws IOException { + for (int i = 0, n = data.length; i < n; i += 2) { + assertTrue("Must be a path: " + data[i], data[i] instanceof String); + String relativePath = ((String) data[i]).replace('/', File.separatorChar); + File to = new File(dir, relativePath); + File parent = to.getParentFile(); + if (!parent.exists()) { + boolean mkdirs = parent.mkdirs(); + assertTrue(to.getPath(), mkdirs); + } + + Object o = data[i + 1]; + if (o instanceof String) { + String contents = (String) o; + Files.write(contents, to, Charsets.UTF_8); + } else if (o instanceof byte[]) { + Files.write((byte[]) o, to); + } else { + fail("Data must be a String or a byte[] for " + to); + } + } + } + + // Test sources + + protected static final String SAMPLE_MANIFEST = + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " package=\"com.example.refactoringtest\"\n" + + " android:versionCode=\"1\"\n" + + " android:versionName=\"1.0\" >\n" + + "\n" + + " <uses-sdk\n" + + " android:minSdkVersion=\"8\"\n" + + " android:targetSdkVersion=\"17\" />\n" + + "\n" + + " <application\n" + + " android:icon=\"@drawable/ic_launcher\"\n" + + " android:label=\"@string/app_name\"\n" + + " android:theme=\"@style/AppTheme\" >\n" + + " <activity\n" + + " android:name=\"com.example.refactoringtest.MainActivity\"\n" + + " android:label=\"@string/app_name\" >\n" + + " <intent-filter>\n" + + " <action android:name=\"android.intent.action.MAIN\" />\n" + + "\n" + + " <category android:name=\"android.intent.category.LAUNCHER\" />\n" + + " </intent-filter>\n" + + " </activity>\n" + + " <activity\n" + + " android:name=\".MainActivity2\"\n" + + " android:label=\"@string/app_name2\" >\n" + + " </activity>\n" + + " </application>\n" + + "\n" + + "</manifest>"; + + protected static final String SAMPLE_MAIN_ACTIVITY = + "package com.example.refactoringtest;\n" + + "\n" + + "import android.os.Bundle;\n" + + "import android.app.Activity;\n" + + "import android.view.Menu;\n" + + "import android.view.View;\n" + + "\n" + + "public class MainActivity extends Activity {\n" + + "\n" + + " @Override\n" + + " protected void onCreate(Bundle savedInstanceState) {\n" + + " super.onCreate(savedInstanceState);\n" + + " setContentView(R.layout.activity_main);\n" + + " View view1 = findViewById(R.id.textView1);\n" + + " }\n" + + "\n" + + " @Override\n" + + " public boolean onCreateOptionsMenu(Menu menu) {\n" + + " // Inflate the menu; this adds items to the action bar if it is present.\n" + + " getMenuInflater().inflate(R.menu.activity_main, menu);\n" + + " return true;\n" + + " }\n" + + "\n" + + "}\n"; + + protected static final String SAMPLE_MAIN_ACTIVITY2 = + "package com.example.refactoringtest;\n" + + "\n" + + "import android.os.Bundle;\n" + + "import android.app.Activity;\n" + + "import android.view.Menu;\n" + + "import android.view.View;\n" + + "\n" + + "public class MainActivity2 extends Activity {\n" + + "\n" + + " @Override\n" + + " protected void onCreate(Bundle savedInstanceState) {\n" + + " super.onCreate(savedInstanceState);\n" + + " }\n" + + "\n" + + "}\n"; + + protected static final String MY_FRAGMENT = + "package com.example.refactoringtest;\n" + + "import android.support.v4.app.ListFragment;\n" + + "\n" + + "public class MyFragment extends ListFragment {\n" + + "\n" + + "}\n"; + + protected static final String SAMPLE_LAYOUT = + "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " xmlns:tools=\"http://schemas.android.com/tools\"\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"match_parent\"\n" + + " tools:context=\".MainActivity\" >\n" + + "\n" + + " <TextView\n" + + " android:id=\"@+id/textView1\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " android:layout_centerVertical=\"true\"\n" + + " android:layout_toRightOf=\"@+id/button2\"\n" + + " android:text=\"@string/hello_world\" />\n" + + "\n" + + " <Button\n" + + " android:id=\"@+id/button1\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " android:layout_alignLeft=\"@+id/textView1\"\n" + + " android:layout_below=\"@+id/textView1\"\n" + + " android:layout_marginLeft=\"22dp\"\n" + + " android:layout_marginTop=\"24dp\"\n" + + " android:text=\"Button\" />\n" + + "\n" + + " <Button\n" + + " android:id=\"@+id/button2\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " android:layout_alignParentLeft=\"true\"\n" + + " android:layout_alignParentTop=\"true\"\n" + + " android:text=\"Button\" />\n" + + "\n" + + " <fragment android:name=\"com.example.refactoringtest.MyFragment\"/>" + + "\n" + + "</RelativeLayout>"; + + protected static final String SAMPLE_LAYOUT_2 = + "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " xmlns:tools=\"http://schemas.android.com/tools\"\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"match_parent\"\n" + + " tools:context=\".MainActivity\" >\n" + + "\n" + + " <ListView\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " tools:listitem=\"@layout/preview\" >\n" + + " </ListView>\n" + + "\n" + + " <fragment\n" + + " android:name=\"android.support.v4.app.ListFragment\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " tools:layout=\"@layout/preview\" />\n" + + "\n" + + "\n" + + "</RelativeLayout>"; + + + protected static final String SAMPLE_MENU = + "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n" + + "\n" + + " <item\n" + + " android:id=\"@+id/menu_settings\"\n" + + " android:orderInCategory=\"100\"\n" + + " android:showAsAction=\"never\"\n" + + " android:title=\"@string/menu_settings\"/>\n" + + "\n" + + "</menu>"; + + protected static final String SAMPLE_STRINGS = + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<resources>\n" + + "\n" + + " <string name=\"app_name\">RefactoringTest</string>\n" + + " <string name=\"hello_world\">Hello world!</string>\n" + + " <string name=\"menu_settings\">Settings</string>\n" + + "\n" + + "</resources>"; + + protected static final String SAMPLE_STYLES = + "<resources>\n" + + "\n" + + " <!--\n" + + " Base application theme, dependent on API level. This theme is replaced\n" + + " by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n" + + " -->\n" + + " <style name=\"AppBaseTheme\" parent=\"android:Theme.Light\">\n" + + " <!--\n" + + " Theme customizations available in newer API levels can go in\n" + + " res/values-vXX/styles.xml, while customizations related to\n" + + " backward-compatibility can go here.\n" + + " -->\n" + + " </style>\n" + + "\n" + + " <!-- Application theme. -->\n" + + " <style name=\"AppTheme\" parent=\"AppBaseTheme\">\n" + + " <!-- All customizations that are NOT specific to a particular API-level can go here. -->\n" + + " </style>\n" + + "\n" + + "</resources>"; + + protected static final String SAMPLE_R = + "/* AUTO-GENERATED FILE. DO NOT MODIFY.\n" + + " *\n" + + " * This class was automatically generated by the\n" + + " * aapt tool from the resource data it found. It\n" + + " * should not be modified by hand.\n" + + " */\n" + + "\n" + + "package com.example.refactoringtest;\n" + + "\n" + + "public final class R {\n" + + " public static final class attr {\n" + + " }\n" + + " public static final class drawable {\n" + + " public static final int ic_launcher=0x7f020000;\n" + + " }\n" + + " public static final class id {\n" + + " public static final int button1=0x7f070002;\n" + + " public static final int button2=0x7f070001;\n" + + " public static final int menu_settings=0x7f070003;\n" + + " public static final int textView1=0x7f070000;\n" + + " }\n" + + " public static final class layout {\n" + + " public static final int activity_main=0x7f030000;\n" + + " }\n" + + " public static final class menu {\n" + + " public static final int activity_main=0x7f060000;\n" + + " }\n" + + " public static final class string {\n" + + " public static final int app_name=0x7f040000;\n" + + " public static final int hello_world=0x7f040001;\n" + + " public static final int menu_settings=0x7f040002;\n" + + " }\n" + + " public static final class style {\n" + + " /** \n" + + " Base application theme, dependent on API level. This theme is replaced\n" + + " by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n" + + " \n" + + "\n" + + " Theme customizations available in newer API levels can go in\n" + + " res/values-vXX/styles.xml, while customizations related to\n" + + " backward-compatibility can go here.\n" + + " \n" + + "\n" + + " Base application theme for API 11+. This theme completely replaces\n" + + " AppBaseTheme from res/values/styles.xml on API 11+ devices.\n" + + " \n" + + " API 11 theme customizations can go here. \n" + + "\n" + + " Base application theme for API 14+. This theme completely replaces\n" + + " AppBaseTheme from BOTH res/values/styles.xml and\n" + + " res/values-v11/styles.xml on API 14+ devices.\n" + + " \n" + + " API 14 theme customizations can go here. \n" + + " */\n" + + " public static final int AppBaseTheme=0x7f050000;\n" + + " /** Application theme. \n" + + " All customizations that are NOT specific to a particular API-level can go here. \n" + + " */\n" + + " public static final int AppTheme=0x7f050001;\n" + + " }\n" + + "}\n"; + + protected static final Object[] TEST_PROJECT = new Object[] { + "AndroidManifest.xml", + SAMPLE_MANIFEST, + + "src/com/example/refactoringtest/MainActivity.java", + SAMPLE_MAIN_ACTIVITY, + + "src/com/example/refactoringtest/MainActivity2.java", + SAMPLE_MAIN_ACTIVITY2, + + "gen/com/example/refactoringtest/R.java", + SAMPLE_R, + + "res/drawable-xhdpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-hdpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-ldpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-mdpi/ic_launcher.png", + new byte[] { 0 }, + + "res/layout/activity_main.xml", + SAMPLE_LAYOUT, + + "res/layout-land/activity_main.xml", + SAMPLE_LAYOUT_2, + + "res/menu/activity_main.xml", + SAMPLE_MENU, + + "res/values/strings.xml", // file 3 + SAMPLE_STRINGS, + + "res/values/styles.xml", // file 3 + SAMPLE_STYLES, + }; + + // More test data + + protected static final String CUSTOM_VIEW_1 = + "package com.example.refactoringtest;\n" + + "\n" + + "import android.content.Context;\n" + + "import android.widget.Button;\n" + + "\n" + + "public class CustomView1 extends Button {\n" + + " public CustomView1(Context context) {\n" + + " super(context);\n" + + " }\n" + + "}\n"; + + protected static final String CUSTOM_VIEW_1_STYLES = + "<resources>\n" + + "\n" + + " <!-- Aattributes for the custom view -->\n" + + " <declare-styleable name=\"CustomView1\">\n" + + " <attr name=\"exampleString\" format=\"string\" />\n" + + " <attr name=\"exampleDimension\" format=\"dimension\" />\n" + + " <attr name=\"exampleColor\" format=\"color\" />\n" + + " <attr name=\"exampleDrawable\" format=\"color|reference\" />\n" + + " </declare-styleable>\n" + + "\n" + + "</resources>"; + + protected static final String CUSTOM_VIEW_2 = + "package com.example.refactoringtest.subpackage;\n" + + "\n" + + "import android.content.Context;\n" + + "import android.widget.Button;\n" + + "\n" + + "public class CustomView2 extends Button {\n" + + " public CustomView2(Context context) {\n" + + " super(context);\n" + + " }\n" + + "}\n"; + + protected static final String CUSTOM_VIEW_LAYOUT = + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + + " xmlns:tools=\"http://schemas.android.com/tools\"\n" + + " android:layout_width=\"match_parent\"\n" + + " android:layout_height=\"match_parent\"\n" + + " android:orientation=\"vertical\"\n" + + " tools:ignore=\"HardcodedText\" >\n" + + "\n" + + " <com.example.refactoringtest.CustomView1\n" + + " android:id=\"@+id/customView1\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " android:text=\"CustomView1\" />\n" + + "\n" + + " <com.example.refactoringtest.subpackage.CustomView2\n" + + " android:id=\"@+id/customView2\"\n" + + " android:layout_width=\"wrap_content\"\n" + + " android:layout_height=\"wrap_content\"\n" + + " android:text=\"CustomView2\" />\n" + + "\n" + + "</LinearLayout>"; + + protected static final Object[] TEST_PROJECT2 = new Object[] { + "AndroidManifest.xml", + SAMPLE_MANIFEST, + + "src/com/example/refactoringtest/MainActivity.java", + SAMPLE_MAIN_ACTIVITY, + + "src/com/example/refactoringtest/CustomView1.java", + CUSTOM_VIEW_1, + + "res/values/attrs_custom_view.xml", + CUSTOM_VIEW_1_STYLES, + + "src/com/example/refactoringtest/subpackage/CustomView2.java", + CUSTOM_VIEW_2, + + "src/com/example/refactoringtest/MyFragment.java", + MY_FRAGMENT, + + "gen/com/example/refactoringtest/R.java", + SAMPLE_R, + + "res/drawable-xhdpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-hdpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-ldpi/ic_launcher.png", + new byte[] { 0 }, + "res/drawable-mdpi/ic_launcher.png", + new byte[] { 0 }, + + "res/layout/activity_main.xml", + SAMPLE_LAYOUT, + + "res/layout-land/activity_main.xml", + SAMPLE_LAYOUT_2, + + "res/layout/customviews.xml", + CUSTOM_VIEW_LAYOUT, + + "res/layout-land/customviews.xml", + CUSTOM_VIEW_LAYOUT, + + "res/menu/activity_main.xml", + SAMPLE_MENU, + + "res/values/strings.xml", // file 3 + SAMPLE_STRINGS, + + "res/values/styles.xml", // file 3 + SAMPLE_STYLES, + + // Just a gen file, should not be refactored + "bin/AndroidManifest.xml", + SAMPLE_MANIFEST, + + }; + + + protected static final String MANIFEST = + "/* AUTO-GENERATED FILE. DO NOT MODIFY.\n" + + " *\n" + + " * This class was automatically generated by the\n" + + " * aapt tool from the resource data it found. It\n" + + " * should not be modified by hand.\n" + + " */\n" + + "\n" + + "package com.example.refactoringtest;\n" + + "\n" + + "public final class Manifest {\n" + + " public static final class permission {\n" + + " public static final String WRITE_SCHEDULE=\"com.example.refactoringtest.permission.WRITE_SCHEDULE\";\n" + + " }\n" + + "}"; + + protected static final String BUILD_CONFIG = + "/** Automatically generated file. DO NOT MODIFY */\n" + + "package com.example.refactoringtest;\n" + + "\n" + + "public final class BuildConfig {\n" + + " public final static boolean DEBUG = true;\n" + + "}"; + + protected static final String MORE_CODE_JAVA = + "package com.example.refactoringtest.subpkg;\n" + + "\n" + + "import android.os.Bundle;\n" + + "import android.app.Activity;\n" + + "import android.view.Menu;\n" + + "import android.view.View;\n" + + "import com.example.refactoringtest.BuildConfig;\n" + + "import com.example.refactoringtest.Manifest;\n" + + "import com.example.refactoringtest.R;\n" + + "\n" + + "public class MoreCode extends Activity {\n" + + "\n" + + " protected void code() {\n" + + " if (BuildConfig.DEBUG) {\n" + + " System.out.println(Manifest.permission);\n" + + " }" + + " System.out.println(com.example.refactoringtest.BuildConfig.DEBUG);\n" + + " }\n" + + "\n" + + "}\n"; + + /** Project which includes references to BuildConfig, Manifest, and R */ + protected static final Object[] TEST_PROJECT3; + static { + Object[] additional = new Object[] { + "src/com/example/refactoringtest/subpkg/MoreCode.java", + MORE_CODE_JAVA, + + "gen/com/example/refactoringtest/BuildConfig.java", + BUILD_CONFIG, + + "gen/com/example/refactoringtest/Manifest.java", + MANIFEST, + }; + TEST_PROJECT3 = new Object[TEST_PROJECT2.length + additional.length]; + System.arraycopy(TEST_PROJECT2, 0, TEST_PROJECT3, 0, TEST_PROJECT2.length); + System.arraycopy(additional, 0, TEST_PROJECT3, TEST_PROJECT2.length, additional.length); + }; +} diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RenameResourceParticipantTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RenameResourceParticipantTest.java new file mode 100644 index 0000000..ccf6e4f --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RenameResourceParticipantTest.java @@ -0,0 +1,401 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ide.eclipse.adt.internal.refactorings.core; + +import com.android.annotations.NonNull; +import com.android.ide.common.resources.ResourceRepository; +import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper; +import com.android.resources.ResourceType; +import com.android.utils.Pair; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.jdt.core.IField; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor; +import org.eclipse.ltk.core.refactoring.participants.RenameProcessor; +import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring; + +@SuppressWarnings({"javadoc", "restriction"}) +public class RenameResourceParticipantTest extends RefactoringTestBase { + public void testRefactor1() throws Exception { + renameResource( + TEST_PROJECT, + "@string/app_name", + true /*updateReferences*/, + "myname", + + "CHANGES:\n" + + "-------\n" + + "[x] strings.xml - /testRefactor1/res/values/strings.xml\n" + + " @@ -4 +4\n" + + " - <string name=\"app_name\">RefactoringTest</string>\n" + + " + <string name=\"myname\">RefactoringTest</string>\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor1/gen/com/example/refactoringtest/R.java\n" + + " @@ -29 +29\n" + + " - public static final int app_name=0x7f040000;\n" + + " + public static final int myname=0x7f040000;\n" + + "\n" + + "\n" + + "[x] AndroidManifest.xml - /testRefactor1/AndroidManifest.xml\n" + + " @@ -13 +13\n" + + " - android:label=\"@string/app_name\"\n" + + " + android:label=\"@string/myname\"\n" + + " @@ -17 +17\n" + + " - android:label=\"@string/app_name\" >\n" + + " + android:label=\"@string/myname\" >"); + } + + public void testRefactor2() throws Exception { + renameResource( + TEST_PROJECT, + "@+id/menu_settings", + true /*updateReferences*/, + "new_id_for_the_action_bar", + + "CHANGES:\n" + + "-------\n" + + "[x] activity_main.xml - /testRefactor2/res/menu/activity_main.xml\n" + + " @@ -4 +4\n" + + " - android:id=\"@+id/menu_settings\"\n" + + " + android:id=\"@+id/new_id_for_the_action_bar\"\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor2/gen/com/example/refactoringtest/R.java\n" + + " @@ -19 +19\n" + + " - public static final int menu_settings=0x7f070003;\n" + + " + public static final int new_id_for_the_action_bar=0x7f070003;"); + } + + public void testRefactor3() throws Exception { + renameResource( + TEST_PROJECT, + "@+id/textView1", + true /*updateReferences*/, + "output", + + "CHANGES:\n" + + "-------\n" + + "[x] activity_main.xml - /testRefactor3/res/layout/activity_main.xml\n" + + " @@ -8 +8\n" + + " - android:id=\"@+id/textView1\"\n" + + " + android:id=\"@+id/output\"\n" + + " @@ -19 +19\n" + + " - android:layout_alignLeft=\"@+id/textView1\"\n" + + " - android:layout_below=\"@+id/textView1\"\n" + + " + android:layout_alignLeft=\"@+id/output\"\n" + + " + android:layout_below=\"@+id/output\"\n" + + "\n" + + "\n" + + "[x] MainActivity.java - /testRefactor3/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -14 +14\n" + + " - View view1 = findViewById(R.id.textView1);\n" + + " + View view1 = findViewById(R.id.output);\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor3/gen/com/example/refactoringtest/R.java\n" + + " @@ -20 +20\n" + + " - public static final int textView1=0x7f070000;\n" + + " + public static final int output=0x7f070000;"); + } + + public void testRefactor4() throws Exception { + renameResource( + TEST_PROJECT, + // same as testRefactor3, but use @id rather than @+id even though @+id is in file + "@id/textView1", + true /*updateReferences*/, + "output", + + "CHANGES:\n" + + "-------\n" + + "[x] activity_main.xml - /testRefactor4/res/layout/activity_main.xml\n" + + " @@ -8 +8\n" + + " - android:id=\"@+id/textView1\"\n" + + " + android:id=\"@+id/output\"\n" + + " @@ -19 +19\n" + + " - android:layout_alignLeft=\"@+id/textView1\"\n" + + " - android:layout_below=\"@+id/textView1\"\n" + + " + android:layout_alignLeft=\"@+id/output\"\n" + + " + android:layout_below=\"@+id/output\"\n" + + "\n" + + "\n" + + "[x] MainActivity.java - /testRefactor4/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -14 +14\n" + + " - View view1 = findViewById(R.id.textView1);\n" + + " + View view1 = findViewById(R.id.output);\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor4/gen/com/example/refactoringtest/R.java\n" + + " @@ -20 +20\n" + + " - public static final int textView1=0x7f070000;\n" + + " + public static final int output=0x7f070000;"); + } + + public void testRefactor5() throws Exception { + renameResource( + TEST_PROJECT, + "@layout/activity_main", + true /*updateReferences*/, + "newlayout", + + "CHANGES:\n" + + "-------\n" + + "[x] MainActivity.java - /testRefactor5/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -13 +13\n" + + " - setContentView(R.layout.activity_main);\n" + + " + setContentView(R.layout.newlayout);\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor5/gen/com/example/refactoringtest/R.java\n" + + " @@ -23 +23\n" + + " - public static final int activity_main=0x7f030000;\n" + + " + public static final int newlayout=0x7f030000;\n" + + "\n" + + "\n" + + "[x] Rename 'testRefactor5/res/layout/activity_main.xml' to 'newlayout.xml'\n" + + "\n" + + "[x] Rename 'testRefactor5/res/layout-land/activity_main.xml' to 'newlayout.xml'"); + } + + public void testRefactor6() throws Exception { + renameResource( + TEST_PROJECT, + "@drawable/ic_launcher", + true /*updateReferences*/, + "newlauncher", + + "CHANGES:\n" + + "-------\n" + + "[ ] R.java - /testRefactor6/gen/com/example/refactoringtest/R.java\n" + + " @@ -14 +14\n" + + " - public static final int ic_launcher=0x7f020000;\n" + + " + public static final int newlauncher=0x7f020000;\n" + + "\n" + + "\n" + + "[x] Rename 'testRefactor6/res/drawable-xhdpi/ic_launcher.png' to 'newlauncher.png'\n" + + "\n" + + "[x] Rename 'testRefactor6/res/drawable-mdpi/ic_launcher.png' to 'newlauncher.png'\n" + + "\n" + + "[x] Rename 'testRefactor6/res/drawable-ldpi/ic_launcher.png' to 'newlauncher.png'\n" + + "\n" + + "[x] Rename 'testRefactor6/res/drawable-hdpi/ic_launcher.png' to 'newlauncher.png'\n" + + "\n" + + "[x] AndroidManifest.xml - /testRefactor6/AndroidManifest.xml\n" + + " @@ -12 +12\n" + + " - android:icon=\"@drawable/ic_launcher\"\n" + + " + android:icon=\"@drawable/newlauncher\""); + } + + public void testRefactor7() throws Exception { + // Test refactoring initiated on a file rename + IProject project = createProject(TEST_PROJECT); + IFile file = project.getFile("res/layout/activity_main.xml"); + renameResource( + project, + file, + true /*updateReferences*/, + "newlayout", + + "CHANGES:\n" + + "-------\n" + + "[x] MainActivity.java - /testRefactor7/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -13 +13\n" + + " - setContentView(R.layout.activity_main);\n" + + " + setContentView(R.layout.newlayout);\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor7/gen/com/example/refactoringtest/R.java\n" + + " @@ -23 +23\n" + + " - public static final int activity_main=0x7f030000;\n" + + " + public static final int newlayout=0x7f030000;\n" + + "\n" + + "\n" + + "[x] Rename 'testRefactor7/res/layout-land/activity_main.xml' to 'newlayout.xml'\n" + + "\n" + + "[x] Rename 'testRefactor7/res/layout/activity_main.xml' to 'newlayout.xml'", + null); + } + + public void testRefactor8() throws Exception { + // Test refactoring initiated on a Java field rename + IProject project = createProject(TEST_PROJECT); + IJavaProject javaProject = BaseProjectHelper.getJavaProject(project); + assertNotNull(javaProject); + IType type = javaProject.findType("com.example.refactoringtest.R.layout"); + if (type == null || !type.exists()) { + type = javaProject.findType("com.example.refactoringtest.R$layout"); + System.out.println("Had to switch to $ notation"); + } + assertNotNull(type); + assertTrue(type.exists()); + IField field = type.getField("activity_main"); + assertNotNull(field); + assertTrue(field.exists()); + + renameResource( + project, + field, + true /*updateReferences*/, + "newlauncher", + + "CHANGES:\n" + + "-------\n" + + "[x] Rename 'testRefactor8/res/layout/activity_main.xml' to 'newlauncher.xml'\n" + + "\n" + + "[x] Rename 'testRefactor8/res/layout-land/activity_main.xml' to 'newlauncher.xml'\n" + + "\n" + + "[x] MainActivity.java - /testRefactor8/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -13 +13\n" + + " - setContentView(R.layout.activity_main);\n" + + " + setContentView(R.layout.newlauncher);\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor8/gen/com/example/refactoringtest/R.java\n" + + " @@ -23 +23\n" + + " - public static final int activity_main=0x7f030000;\n" + + " + public static final int newlauncher=0x7f030000;", + null); + } + + public void testInvalidName() throws Exception { + renameResource( + TEST_PROJECT, + "@drawable/ic_launcher", + true /*updateReferences*/, + "Newlauncher", + + "", + "<ERROR\n" + + "\t\n" + + "ERROR: File-based resource names must start with a lowercase letter.\n" + + "Context: <Unspecified context>\n" + + "code: none\n" + + "Data: null\n" + + ">"); + } + + public void testRefactor9() throws Exception { + // same as testRefactor4, but not updating references + renameResource( + TEST_PROJECT, + "@id/textView1", + false /*updateReferences*/, + "output", + + "CHANGES:\n" + + "-------\n" + + "[x] activity_main.xml - /testRefactor9/res/layout/activity_main.xml\n" + + " @@ -8 +8\n" + + " - android:id=\"@+id/textView1\"\n" + + " + android:id=\"@+id/output\"\n" + + "\n" + + "\n" + + "[ ] R.java - /testRefactor9/gen/com/example/refactoringtest/R.java\n" + + " @@ -20 +20\n" + + " - public static final int textView1=0x7f070000;\n" + + " + public static final int output=0x7f070000;"); + } + + public void testRefactor10() throws Exception { + // Check updating tools: attributes + renameResource( + TEST_PROJECT, + "@layout/preview", + true /*updateReferences*/, + "newlayout", + + "CHANGES:\n" + + "-------\n" + + "[x] activity_main.xml - /testRefactor10/res/layout-land/activity_main.xml\n" + + " @@ -10 +10\n" + + " - tools:listitem=\"@layout/preview\" >\n" + + " + tools:listitem=\"@layout/newlayout\" >\n" + + " @@ -17 +17\n" + + " - tools:layout=\"@layout/preview\" />\n" + + " + tools:layout=\"@layout/newlayout\" />"); + } + + // ---- Test infrastructure ---- + + protected void renameResource( + @NonNull Object[] testData, + @NonNull Object resource, + boolean updateReferences, + @NonNull String newName, + @NonNull String expected) throws Exception { + renameResource(testData, resource, updateReferences, newName, expected, null); + } + + protected void renameResource( + @NonNull Object[] testData, + @NonNull Object resource, + boolean updateReferences, + @NonNull String newName, + @NonNull String expected, + @NonNull String expectedWarnings) throws Exception { + IProject project = createProject(testData); + renameResource(project, resource, updateReferences, newName, expected, expectedWarnings); + } + + protected void renameResource( + @NonNull IProject project, + @NonNull Object resource, + boolean updateReferences, + @NonNull String newName, + @NonNull String expected, + @NonNull String expectedWarnings) throws Exception { + RenameProcessor processor = null; + if (resource instanceof String) { + String url = (String) resource; + assert url.startsWith("@") : resource; + Pair<ResourceType, String> pair = ResourceRepository.parseResource(url); + assertNotNull(url, pair); + ResourceType type = pair.getFirst(); + String currentName = pair.getSecond(); + RenameResourceProcessor p; + p = new RenameResourceProcessor(project, type, currentName, newName); + p.setUpdateReferences(updateReferences); + processor = p; + } else if (resource instanceof IResource) { + IResource r = (IResource) resource; + org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceProcessor p; + p = new org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceProcessor(r); + String fileName = r.getName(); + int dot = fileName.indexOf('.'); + String extension = (dot != -1) ? fileName.substring(dot) : ""; + p.setNewResourceName(newName + extension); + p.setUpdateReferences(updateReferences); + processor = p; + } else if (resource instanceof IField) { + RenameFieldProcessor p = new RenameFieldProcessor((IField) resource); + p.setNewElementName(newName); + p.setUpdateReferences(updateReferences); + processor = p; + } else { + fail("Unsupported resource element in tests: " + resource); + } + + assertNotNull(processor); + + RenameRefactoring refactoring = new RenameRefactoring(processor); + checkRefactoring(refactoring, expected, expectedWarnings); + } +}
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/ApplicationPackageNameRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/ApplicationPackageNameRefactoringTest.java new file mode 100644 index 0000000..0ac0344 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/ApplicationPackageNameRefactoringTest.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ide.eclipse.adt.internal.refactorings.renamepackage; + +import com.android.annotations.NonNull; +import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestInfo; +import com.android.ide.eclipse.adt.internal.refactorings.core.RefactoringTestBase; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jdt.core.dom.AST; +import org.eclipse.jdt.core.dom.Name; + +@SuppressWarnings("javadoc") +public class ApplicationPackageNameRefactoringTest extends RefactoringTestBase { + public void testRefactor1() throws Exception { + renamePackage( + TEST_PROJECT, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] MainActivity.java - /testRefactor1/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -7 +7\n" + + " + import my.pkg.name.R;\n" + + "\n" + + "\n" + + "[x] Make Manifest edits - /testRefactor1/AndroidManifest.xml\n" + + " @@ -3 +3\n" + + " - package=\"com.example.refactoringtest\"\n" + + " + package=\"my.pkg.name\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"com.example.refactoringtest.MainActivity2\""); + } + + public void testRefactor2() throws Exception { + // Tests custom view handling + renamePackage( + TEST_PROJECT2, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] MainActivity.java - /testRefactor2/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -7 +7\n" + + " + import my.pkg.name.R;\n" + + "\n" + + "\n" + + "[x] Make Manifest edits - /testRefactor2/AndroidManifest.xml\n" + + " @@ -3 +3\n" + + " - package=\"com.example.refactoringtest\"\n" + + " + package=\"my.pkg.name\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"com.example.refactoringtest.MainActivity2\""); + } + + public void testRefactor3() throws Exception { + // Tests BuildConfig imports and updates + renamePackage( + TEST_PROJECT3, + "my.pkg.name", + + "CHANGES:\n" + + "-------\n" + + "[x] MoreCode.java - /testRefactor3/src/com/example/refactoringtest/subpkg/MoreCode.java\n" + + " @@ -7 +7\n" + + " - import com.example.refactoringtest.BuildConfig;\n" + + " - import com.example.refactoringtest.Manifest;\n" + + " - import com.example.refactoringtest.R;\n" + + " + import my.pkg.name.BuildConfig;\n" + + " + import my.pkg.name.Manifest;\n" + + " + import my.pkg.name.R;\n" + + "\n" + + "\n" + + "[x] MainActivity.java - /testRefactor3/src/com/example/refactoringtest/MainActivity.java\n" + + " @@ -7 +7\n" + + " + import my.pkg.name.R;\n" + + "\n" + + "\n" + + "[x] Make Manifest edits - /testRefactor3/AndroidManifest.xml\n" + + " @@ -3 +3\n" + + " - package=\"com.example.refactoringtest\"\n" + + " + package=\"my.pkg.name\"\n" + + " @@ -25 +25\n" + + " - android:name=\".MainActivity2\"\n" + + " + android:name=\"com.example.refactoringtest.MainActivity2\""); + } + + // ---- Test infrastructure ---- + + protected void renamePackage( + @NonNull Object[] testData, + @NonNull String newName, + @NonNull String expected) throws Exception { + IProject project = createProject(testData); + renamePackage(project, newName, expected); + } + + protected void renamePackage( + @NonNull IProject project, + @NonNull String newName, + @NonNull String expected) throws Exception { + ManifestInfo info = ManifestInfo.get(project); + String currentPackage = info.getPackage(); + assertNotNull(currentPackage); + + final AST astValidator = AST.newAST(AST.JLS3); + Name oldPackageName = astValidator.newName(currentPackage); + Name newPackageName = astValidator.newName(newName); + ApplicationPackageNameRefactoring refactoring = + new ApplicationPackageNameRefactoring(project, oldPackageName, newPackageName); + checkRefactoring(refactoring, expected); + } +} diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandlerTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandlerTest.java new file mode 100644 index 0000000..48681d0 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandlerTest.java @@ -0,0 +1,903 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ide.eclipse.adt.internal.wizards.templates; + +import static com.android.SdkConstants.CURRENT_PLATFORM; +import static com.android.SdkConstants.FD_TOOLS; +import static com.android.SdkConstants.PLATFORM_WINDOWS; +import static com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.ATTR_MIN_API; +import static com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.ATTR_MIN_BUILD_API; +import static com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.ATTR_ID; + +import com.android.annotations.NonNull; +import com.android.annotations.Nullable; +import com.android.ide.common.sdk.SdkVersionInfo; +import com.android.ide.eclipse.adt.AdtPlugin; +import com.android.ide.eclipse.adt.AdtUtils; +import com.android.ide.eclipse.adt.internal.lint.EclipseLintClient; +import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; +import com.android.ide.eclipse.adt.internal.sdk.Sdk; +import com.android.ide.eclipse.tests.SdkLoadingTestCase; +import com.android.sdklib.IAndroidTarget; +import com.android.sdklib.util.GrabProcessOutput; +import com.android.sdklib.util.GrabProcessOutput.IProcessOutput; +import com.android.sdklib.util.GrabProcessOutput.Wait; +import com.android.tools.lint.checks.BuiltinIssueRegistry; +import com.android.tools.lint.checks.ManifestOrderDetector; +import com.android.tools.lint.checks.SecurityDetector; +import com.android.tools.lint.client.api.Configuration; +import com.android.tools.lint.client.api.DefaultConfiguration; +import com.android.tools.lint.client.api.IDomParser; +import com.android.tools.lint.client.api.IJavaParser; +import com.android.tools.lint.client.api.LintClient; +import com.android.tools.lint.client.api.LintDriver; +import com.android.tools.lint.detector.api.Category; +import com.android.tools.lint.detector.api.Context; +import com.android.tools.lint.detector.api.Issue; +import com.android.tools.lint.detector.api.Location; +import com.android.tools.lint.detector.api.Project; +import com.android.tools.lint.detector.api.Scope; +import com.android.tools.lint.detector.api.Severity; +import com.google.common.base.Charsets; +import com.google.common.base.Stopwatch; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import com.google.common.io.Files; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.CompositeChange; +import org.w3c.dom.Element; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +/** + * Unit tests for template instantiation. + * <p> + * Note: This test can take multiple hours to run! + * + * <p> + * TODO: Test all permutations of variables (it currently just varies one at a time with the + * rest of the defaults) + * TODO: Test trying to change strings arguments (currently just varies enums and booleans) + * TODO: Test adding multiple instances of the templates (to look for resource conflicts) + */ +@SuppressWarnings("javadoc") +public class TemplateHandlerTest extends SdkLoadingTestCase { + /** + * Flag used to quickly check each template once (for one version), to get + * quicker feedback on whether something is broken instead of waiting for + * all the versions for each template first + */ + private static final boolean TEST_FEWER_API_VERSIONS = true; + private static final boolean TEST_JUST_ONE_MIN_SDK = false; + private static final boolean TEST_JUST_ONE_BUILD_TARGET = true; + private static final boolean TEST_JUST_ONE_TARGET_SDK_VERSION = true; + private QualifiedName ERROR_KEY = new QualifiedName(AdtPlugin.PLUGIN_ID, "JobErrorKey"); + private static int sCount = 0; + /** + * If true, check this template with all the interesting ( + * {@link #isInterestingApiLevel(int)}) api versions + */ + private boolean mApiSensitiveTemplate; + /** + * Set of templates already tested with separate unit test; remainder is + * checked in {@link #testCreateRemainingProjects()} + */ + private static final Set<File> sProjectTestedSeparately = Sets.newHashSet(); + /** + * Set of templates already tested with separate unit test; remainder is + * checked in {@link #testCreateRemainingTemplates()} + */ + private static final Set<File> sTemplateTestedSeparately = Sets.newHashSet(); + + @Override + protected void setUp() throws Exception { + super.setUp(); + mApiSensitiveTemplate = true; + } + + /** + * Is the given api level interesting for testing purposes? This is used to + * skip gaps, such that we for example only check say api 8, 9, 11, 14, etc + * -- versions where the <b>templates</b> are doing conditional changes. To + * be EXTRA comprehensive, occasionally try returning true unconditionally + * here to test absolutely everything. + */ + private boolean isInterestingApiLevel(int api) { + // For templates that aren't API sensitive, only test with API = 16 + if (!mApiSensitiveTemplate) { + return api == 16; + } + + switch (api) { + case 1: + case 8: + return true; + case 11: + return true; + case 14: + return true; + case 9: + case 16: + return !TEST_FEWER_API_VERSIONS; + default: + return false; + } + } + + public void testNewBlankProject() throws Exception { + Stopwatch stopwatch = new Stopwatch(); + stopwatch.start(); + checkProjectWithActivity(null); + stopwatch.stop(); + System.out.println("Checked blank project successfully in " + + stopwatch.toString()); + } + + public void testNewBlankActivity() throws Exception { + checkCreateTemplate("activities", "BlankActivity"); + } + + public void testBlankActivityInProject() throws Exception { + checkCreateActivityInProject("BlankActivity"); + } + + public void testNewMasterDetailFlow() throws Exception { + checkCreateTemplate("activities", "MasterDetailFlow"); + } + + public void testMasterDetailFlowInProject() throws Exception { + checkCreateActivityInProject("MasterDetailFlow"); + } + + public void testNewFullscreen() throws Exception { + checkCreateTemplate("activities", "FullscreenActivity"); + } + + public void testFullscreenInProject() throws Exception { + checkCreateActivityInProject("FullscreenActivity"); + } + + public void testNewLoginActivity() throws Exception { + checkCreateTemplate("activities", "LoginActivity"); + } + + public void testLoginActivityInProject() throws Exception { + checkCreateActivityInProject("MasterDetailFlow"); + } + + public void testNewSettingsActivity() throws Exception { + checkCreateTemplate("activities", "SettingsActivity"); + } + + public void testSettingsActivityInProject() throws Exception { + checkCreateActivityInProject("SettingsActivity"); + } + + public void testNewBroadcastReceiver() throws Exception { + // No need to try this template with multiple platforms, one is adequate + mApiSensitiveTemplate = false; + checkCreateTemplate("other", "BroadcastReceiver"); + } + + public void testNewContentProvider() throws Exception { + mApiSensitiveTemplate = false; + checkCreateTemplate("other", "ContentProvider"); + } + + public void testNewCustomView() throws Exception { + mApiSensitiveTemplate = false; + checkCreateTemplate("other", "CustomView"); + } + + public void testNewService() throws Exception { + mApiSensitiveTemplate = false; + checkCreateTemplate("other", "Service"); + } + + public void testCreateRemainingTemplates() throws Exception { + sCount = 0; + long begin = System.currentTimeMillis(); + TemplateManager manager = new TemplateManager(); + List<File> other = manager.getTemplates("other"); + for (File templateFile : other) { + if (sTemplateTestedSeparately.contains(templateFile)) { + continue; + } + checkTemplate(templateFile); + } + // Also try creating templates, not as part of creating a project + List<File> activities = manager.getTemplates("activities"); + for (File templateFile : activities) { + if (sTemplateTestedSeparately.contains(templateFile)) { + continue; + } + checkTemplate(templateFile); + } + long end = System.currentTimeMillis(); + System.out.println("Successfully checked " + sCount + " template permutations in " + + ((end - begin) / (1000 * 60)) + " minutes"); + } + + public void testCreateRemainingProjects() throws Exception { + sCount = 0; + long begin = System.currentTimeMillis(); + TemplateManager manager = new TemplateManager(); + List<File> templates = manager.getTemplates("activities"); + for (File activityFile : templates) { + if (sTemplateTestedSeparately.contains(activityFile)) { + continue; + } + checkProjectWithActivity(activityFile.getName()); + } + long end = System.currentTimeMillis(); + System.out.println("Successfully checked " + sCount + " project permutations in " + + ((end - begin) / (1000 * 60)) + " minutes"); + } + + // ---- Test support code below ---- + + private void checkCreateActivityInProject(String activityName) throws Exception { + Stopwatch stopwatch = new Stopwatch(); + stopwatch.start(); + File templateFile = findTemplate("activities", activityName); + sProjectTestedSeparately.add(templateFile); + checkProjectWithActivity(templateFile.getName()); + stopwatch.stop(); + System.out.println("Checked " + templateFile.getName() + " successfully in " + + stopwatch.toString()); + } + + private void checkCreateTemplate(String category, String name) throws Exception { + Stopwatch stopwatch = new Stopwatch(); + stopwatch.start(); + File templateFile = findTemplate(category, name); + assertNotNull(templateFile); + sTemplateTestedSeparately.add(templateFile); + checkTemplate(templateFile); + stopwatch.stop(); + System.out.println("Checked " + templateFile.getName() + " successfully in " + + stopwatch.toString()); + } + + private static File findTemplate(String category, String name) { + File templateRootFolder = TemplateManager.getTemplateRootFolder(); + assertNotNull(templateRootFolder); + File file = new File(templateRootFolder, category + File.separator + name); + assertTrue(file.getPath(), file.exists()); + return file; + } + + private void checkTemplate(File templateFile) throws Exception { + NewProjectWizardState values = new NewProjectWizardState(); + values.applicationName = "My Application"; + values.packageName = "my.pkg2"; + + values.isLibrary = false; + values.createIcon = false; + values.useDefaultLocation = true; + values.createActivity = false; + + String projectNameBase = "MyTemplateProject_" + templateFile.getName(); + values.projectName = projectNameBase; + values.createActivity = false; + + // Create the new template + + NewTemplateWizardState state = new NewTemplateWizardState(); + state.setTemplateLocation(templateFile); + state.minSdkLevel = values.minSdkLevel; + + // Iterate over all (valid) combinations of build target, minSdk and targetSdk + IAndroidTarget[] targets = Sdk.getCurrent().getTargets(); + for (int i = targets.length - 1; i >= 0; i--) { + IAndroidTarget target = targets[i]; + if (!target.isPlatform()) { + continue; + } + if (!isInterestingApiLevel(target.getVersion().getApiLevel())) { + continue; + } + + for (int minSdk = 1; + minSdk <= SdkVersionInfo.HIGHEST_KNOWN_API; + minSdk++) { + // Don't bother checking *every* single minSdk, just pick some interesting ones + if (!isInterestingApiLevel(minSdk)) { + continue; + } + + for (int targetSdk = minSdk; + targetSdk <= SdkVersionInfo.HIGHEST_KNOWN_API; + targetSdk++) { + if (!isInterestingApiLevel(targetSdk)) { + continue; + } + + // Make sure this template is supported with these versions + IStatus status = values.template.validateTemplate( + minSdk, target.getVersion().getApiLevel()); + if (status != null && !status.isOK()) { + continue; + } + + // Also make sure activity is enabled for these versions + status = state.getTemplateHandler().validateTemplate( + minSdk, target.getVersion().getApiLevel()); + if (status != null && !status.isOK()) { + continue; + } + + // Iterate over all new new project templates + + // should I try all options of theme with all platforms? + // or just try all platforms, with one setting for each? + // doesn't seem like I need to multiply + // just pick the best setting that applies instead for each platform + List<Parameter> parameters = values.template.getTemplate().getParameters(); + projectParameters: + for (Parameter parameter : parameters) { + List<Element> options = parameter.getOptions(); + if (parameter.type == Parameter.Type.ENUM) { + for (Element element : options) { + Option option = Option.get(element); + String optionId = option.id; + int optionMinSdk = option.minSdk; + int optionMinBuildApi = option.minBuild; + if (optionMinSdk <= minSdk && + optionMinBuildApi <= target.getVersion().getApiLevel()) { + values.parameters.put(parameter.id, optionId); + if (parameter.id.equals("baseTheme")) { + String base = projectNameBase + "_min_" + minSdk + + "_target_" + targetSdk + + "_build_" + target.getVersion().getApiLevel() + + "_theme_" + optionId; + System.out.println("checking base " + base); + + checkApiTarget(minSdk, targetSdk, target, values, base, + state); + break projectParameters; + } + } + } + } + } + + if (TEST_JUST_ONE_TARGET_SDK_VERSION) { + break; + } + } + + if (TEST_JUST_ONE_MIN_SDK) { + break; + } + } + + if (TEST_JUST_ONE_BUILD_TARGET) { + break; + } + } + } + + private void checkProjectWithActivity(String activity) throws Exception { + NewProjectWizardState values = new NewProjectWizardState(); + values.applicationName = "My Application"; + values.packageName = "my.pkg"; + + values.isLibrary = false; + values.createIcon = false; + values.useDefaultLocation = true; + + // These are basically unused; passed as defaults + values.activityName = activity == null ? "Blank" : activity; + values.activityTitle = "My Activity Title"; + + String projectNameBase = "MyProject_" + values.activityName; + values.projectName = projectNameBase; + + values.createActivity = activity != null; + NewTemplateWizardState activityValues = values.activityValues; + assertNotNull(activityValues); + activityValues.minSdkLevel = values.minSdkLevel; + + + // Iterate over all (valid) combinations of build target, minSdk and targetSdk + IAndroidTarget[] targets = Sdk.getCurrent().getTargets(); + for (int i = targets.length - 1; i >= 0; i--) { + IAndroidTarget target = targets[i]; + if (!target.isPlatform()) { + continue; + } + if (!isInterestingApiLevel(target.getVersion().getApiLevel())) { + continue; + } + + for (int minSdk = 1; + minSdk <= SdkVersionInfo.HIGHEST_KNOWN_API; + minSdk++) { + // Don't bother checking *every* single minSdk, just pick some interesting ones + if (!isInterestingApiLevel(minSdk)) { + continue; + } + + for (int targetSdk = minSdk; + targetSdk <= SdkVersionInfo.HIGHEST_KNOWN_API; + targetSdk++) { + if (!isInterestingApiLevel(targetSdk)) { + continue; + } + + // Make sure this template is supported with these versions + IStatus status = values.template.validateTemplate( + values.minSdkLevel, values.getBuildApi()); + if (status != null && !status.isOK()) { + continue; + } + + // Also make sure activity is enabled for these versions + status = values.activityValues.getTemplateHandler().validateTemplate( + values.minSdkLevel, values.getBuildApi()); + if (status != null && !status.isOK()) { + continue; + } + + // Iterate over all new new project templates + + // should I try all options of theme with all platforms? + // or just try all platforms, with one setting for each? + // doesn't seem like I need to multiply + // just pick the best setting that applies instead for each platform + List<Parameter> parameters = values.template.getTemplate().getParameters(); + for (Parameter parameter : parameters) { + List<Element> options = parameter.getOptions(); + if (parameter.type == Parameter.Type.ENUM) { + for (Element element : options) { + Option option = Option.get(element); + String optionId = option.id; + int optionMinSdk = option.minSdk; + int optionMinBuildApi = option.minBuild; + if (optionMinSdk <= minSdk && + optionMinBuildApi <= target.getVersion().getApiLevel()) { + values.parameters.put(parameter.id, optionId); + if (parameter.id.equals("baseTheme")) { + String base = projectNameBase + "_min_" + minSdk + + "_target_" + targetSdk + + "_build_" + target.getVersion().getApiLevel() + + "_theme_" + optionId; + System.out.println("checking base " + base); + + checkApiTarget(minSdk, targetSdk, target, values, base, + null); + + } + } + } + } + } + + if (TEST_JUST_ONE_TARGET_SDK_VERSION) { + break; + } + } + + if (TEST_JUST_ONE_MIN_SDK) { + break; + } + } + + if (TEST_JUST_ONE_BUILD_TARGET) { + break; + } + } + } + + private void checkApiTarget( + int minSdk, + int targetSdk, + @NonNull IAndroidTarget target, + @NonNull NewProjectWizardState projectValues, + @NonNull String projectNameBase, + @Nullable NewTemplateWizardState templateValues) + throws Exception { + NewTemplateWizardState values = + projectValues.createActivity ? projectValues.activityValues : templateValues; + + projectValues.minSdk = Integer.toString(minSdk); + projectValues.minSdkLevel = minSdk; + projectValues.targetSdkLevel = targetSdk; + projectValues.target = target; + + if (values == null) { + checkProject(projectValues, templateValues); + return; + } + + // Next check all other parameters, cycling through booleans and enums. + TemplateHandler templateHandler = values.getTemplateHandler(); + TemplateMetadata template = templateHandler.getTemplate(); + assertNotNull(template); + List<Parameter> parameters = template.getParameters(); + + if (!projectValues.createActivity) { + for (Parameter parameter : parameters) { + values.parameters.put(parameter.id, parameter.value); + } + } + + for (Parameter parameter : parameters) { + if (parameter.type == Parameter.Type.SEPARATOR + || parameter.type == Parameter.Type.STRING) { + // TODO: Consider whether we should attempt some strings here + continue; + } + + // The initial (default value); revert to this one after cycling, + Object initial = values.parameters.get(parameter.id); + + if (parameter.type == Parameter.Type.ENUM) { + List<Element> options = parameter.getOptions(); + for (Element element : options) { + Option option = Option.get(element); + String optionId = option.id; + int optionMinSdk = option.minSdk; + int optionMinBuildApi = option.minBuild; + if (projectValues.minSdkLevel >= optionMinSdk && + projectValues.getBuildApi() >= optionMinBuildApi) { + values.parameters.put(parameter.id, optionId); + projectValues.projectName = projectNameBase + "_" + parameter.id + + "_" + optionId; + checkProject(projectValues, templateValues); + } + } + } else { + assert parameter.type == Parameter.Type.BOOLEAN; + if (parameter.id.equals("isLauncher") && projectValues.createActivity) { + // Skipping this one: always true when launched from new project + continue; + } + boolean value = false; + values.parameters.put(parameter.id, value); + projectValues.projectName = projectNameBase + "_" + parameter.id + + "_" + value; + checkProject(projectValues, templateValues); + + value = true; + values.parameters.put(parameter.id, value); + projectValues.projectName = projectNameBase + "_" + parameter.id + + "_" + value; + checkProject(projectValues, templateValues); + } + + values.parameters.put(parameter.id, initial); + } + } + + private final class OutputGrabber implements IProcessOutput { + private final List<String> output = Lists.newArrayList(); + private final List<String> error = Lists.newArrayList(); + + @Override + public void out(@Nullable String line) { + if (line != null) { + output.add(line); + } + } + + @Override + public void err(@Nullable String line) { + if (line != null) { + error.add(line); + } + } + + @NonNull + private List<String> getOutput() { + return output; + } + + @NonNull + private List<String> getError() { + return error; + } + } + + private static class Option { + private String id; + private int minSdk; + private int minBuild; + + public Option(String id, int minSdk, int minBuild) { + this.id = id; + this.minSdk = minSdk; + this.minBuild = minBuild; + } + + private static Option get(Element option) { + String optionId = option.getAttribute(ATTR_ID); + String minApiString = option.getAttribute(ATTR_MIN_API); + int optionMinSdk = 1; + if (minApiString != null && !minApiString.isEmpty()) { + try { + optionMinSdk = Integer.parseInt(minApiString); + } catch (NumberFormatException nufe) { + // Templates aren't allowed to contain codenames, should + // always be an integer + AdtPlugin.log(nufe, null); + optionMinSdk = 1; + } + } + String minBuildApiString = option.getAttribute(ATTR_MIN_BUILD_API); + int optionMinBuildApi = 1; + if (minBuildApiString != null && !minBuildApiString.isEmpty()) { + try { + optionMinBuildApi = Integer.parseInt(minBuildApiString); + } catch (NumberFormatException nufe) { + // Templates aren't allowed to contain codenames, should + // always be an integer + AdtPlugin.log(nufe, null); + optionMinBuildApi = 1; + } + } + + + return new Option(optionId, optionMinSdk, optionMinBuildApi); + } + } + + private void checkProject( + @NonNull NewProjectWizardState projectValues, + @Nullable NewTemplateWizardState templateValues) throws Exception { + NewTemplateWizardState values = + projectValues.createActivity ? projectValues.activityValues : templateValues; + if (values != null) { // if not, creating blank project + // Validate that a template is only being used in a context it is compatible with! + IStatus status = values.getTemplateHandler().validateTemplate( + projectValues.minSdkLevel, projectValues.getBuildApi()); + if (status != null && !status.isOK()) { + fail(status.toString()); + } + } + + assertNotNull(projectValues.projectName); + projectValues.projectName = AdtUtils.getUniqueProjectName(projectValues.projectName, ""); + IPath workspace = Platform.getLocation(); + String projectLocation = workspace.append(projectValues.projectName).toOSString(); + projectValues.projectLocation = projectLocation; + + // Create project with the given parameter map + final IProject project = createProject(projectValues); + assertNotNull(project); + + if (templateValues != null) { + templateValues.project = project; + List<Change> changes = templateValues.computeChanges(); + if (!changes.isEmpty()) { + try { + CompositeChange composite = new CompositeChange("", + changes.toArray(new Change[changes.size()])); + composite.perform(new NullProgressMonitor()); + } catch (CoreException e) { + fail(e.getLocalizedMessage()); + } + } + } + + // Project creation has some async hooks so don't attempt to build it *right* away + Job job = new Job("Validate project") { + @Override + protected IStatus run(IProgressMonitor monitor) { + try { + ensureValidProject(this, project); + return Status.OK_STATUS; + } catch (Exception e) { + fail(e.toString()); + } + return null; + } + }; + job.schedule(1000); + job.join(); + Object property = job.getProperty(ERROR_KEY); + assertNull(property); + } + + private IProject createProject(NewProjectWizardState values) throws InvocationTargetException { + NewProjectWizard wizard = new NewProjectWizard(); + wizard.setValues(values); + wizard.performFinish(new NullProgressMonitor()); + + if (TemplateHandler.sMostRecentException != null) { + fail(values.projectName + ": " + TemplateHandler.sMostRecentException.toString()); + } + + IProject project = wizard.getProject(); + assertNotNull(project); + assertTrue(project.exists()); + System.out.println("Created project " + project + " : " + AdtUtils.getAbsolutePath(project)); + return project; + } + + private void ensureValidProject(@NonNull Job job, @NonNull IProject project) throws Exception { + System.out.println("Begin build error check"); + ensureNoBuildErrors(job, project); + System.out.println("Finished build error check"); + + System.out.println("Begin lint check"); + ensureNoLintWarnings(job, project); + System.out.println("Finished lint check"); + + sCount++; + } + + private void ensureNoLintWarnings(final Job job, IProject project) { + System.setProperty("com.android.tools.lint.bindir", AdtPrefs.getPrefs().getOsSdkFolder() + + File.separator + FD_TOOLS); + + LintDriver driver = new LintDriver(new BuiltinIssueRegistry(), new LintClient() { + @Override + public void report(@NonNull Context context, + @NonNull Issue issue, @NonNull Severity severity, + @Nullable Location location, @NonNull String message, @Nullable Object data) { + String s = "Found lint error: " + issue.getId() + ": " + message + " at " + location; + job.setProperty(ERROR_KEY, s); + fail(s); + } + + @Override + public Configuration getConfiguration(@NonNull Project p) { + return new DefaultConfiguration(this, p, null, new File("dummy.xml")) { + @Override + public boolean isEnabled(@NonNull Issue issue) { + // Doesn't work: hangs in unit test context, something about + // loading native libs. + if (issue.getCategory() == Category.ICONS){ + return false; + } + + if (issue == ManifestOrderDetector.TARGET_NEWER) { + // Don't complain about targetSdk < latest: we're deliberately + // testing that (to make sure templates compile etc in compat + // mode) + return false; + } + + if (issue == SecurityDetector.EXPORTED_SERVICE + || issue == SecurityDetector.EXPORTED_PROVIDER + || issue == SecurityDetector.EXPORTED_RECEIVER) { + // Don't complain about missing permissions when exporting: the + // unit test is deliberately turning on exported + return false; + } + + return true; + } + }; + } + + @Override + @NonNull + public String readFile(@NonNull File file) { + try { + return Files.toString(file, Charsets.UTF_8); + } catch (IOException e) { + fail(e.toString() + " for " + file.getPath()); + return ""; + } + } + + @Override + public void log(@NonNull Severity severity, @Nullable Throwable exception, + @Nullable String format, @Nullable Object... args) { + if (exception != null) { + exception.printStackTrace(); + } + if (format != null) { + if (args != null) { + System.err.println("Log: " + String.format(format, args)); + } else { + System.err.println("Unexpected log message " + format); + } + } + } + + @Override + @Nullable + public IJavaParser getJavaParser() { + return new EclipseLintClient(null, null, null, false).getJavaParser(); + } + + @Override + @Nullable + public IDomParser getDomParser() { + //return new LintCliXmlParser(); + return new EclipseLintClient(null, null, null, false).getDomParser(); + } + }); + File projectDir = AdtUtils.getAbsolutePath(project).toFile(); + assertNotNull(projectDir); + assertTrue(projectDir.getPath(), projectDir.isDirectory()); + driver.analyze(Collections.singletonList(projectDir), Scope.ALL); + } + + // Wait for test build support. + // This is copied from {@link SampleProjectTest} + + private void ensureNoBuildErrors(final Job job, final IProject project) throws Exception { + File projectDir = AdtUtils.getAbsolutePath(project).toFile(); + + // Checking the build in Eclipse doesn't work well, because of asynchronous issues + // (it looks like not all necessary changes are applied, and even adding waits works + // unpredictably.) + // + // So instead we do it via the command line. + // First add ant support: + // $ android update project -p . + // Then we run ant and look at the exit code to make sure it worked. + + List<String> command = new ArrayList<String>(); + command.add(AdtPlugin.getOsSdkToolsFolder() + "android" + + (CURRENT_PLATFORM == PLATFORM_WINDOWS ? ".bat" : "")); + command.add("update"); + command.add("project"); + command.add("-p"); + command.add(projectDir.getPath()); + + // launch the command line process + Process process = Runtime.getRuntime().exec(command.toArray(new String[command.size()])); + + + OutputGrabber processOutput = new OutputGrabber(); + int status = GrabProcessOutput.grabProcessOutput( + process, + Wait.WAIT_FOR_READERS, // we really want to make sure we get all the output! + processOutput); + if (status != 0) { + fail(processOutput.getOutput().toString() + processOutput.getError().toString()); + } + assertEquals(0, status); + + // Run ant + String antCmd = "ant" + (CURRENT_PLATFORM == PLATFORM_WINDOWS ? ".bat" : ""); + String antTarget = "debug"; + process = Runtime.getRuntime().exec(antCmd + " " + antTarget, null, projectDir); + processOutput = new OutputGrabber(); + status = GrabProcessOutput.grabProcessOutput( + process, + Wait.WAIT_FOR_READERS, // we really want to make sure we get all the output! + processOutput); + if (status != 0) { + fail(processOutput.getOutput().toString() + processOutput.getError().toString()); + } + assertEquals(0, status); + System.out.println("Ant succeeded (code=" + status + ")"); + } +} diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkLoadingTestCase.java index 84c238e..65ce8e1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkLoadingTestCase.java @@ -21,20 +21,19 @@ import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser; import com.android.ide.eclipse.adt.internal.sdk.Sdk; import com.android.sdklib.IAndroidTarget; +import com.android.testutils.SdkTestCase; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; -import junit.framework.TestCase; - /** * A test case which uses the SDK loaded by the ADT plugin. */ -public abstract class SdkTestCase extends TestCase { +public abstract class SdkLoadingTestCase extends SdkTestCase { private Sdk mSdk; - protected SdkTestCase() { + protected SdkLoadingTestCase() { } /** @@ -107,10 +106,12 @@ public abstract class SdkTestCase extends TestCase { if (!validateSdk(target)) { continue; } + if (false) { // This takes forEVER IStatus status = new AndroidTargetParser(target).run(new NullProgressMonitor()); if (status.getCode() != IStatus.OK) { fail("Failed to parse targets data"); } + } } } } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java index 5cb5647..8b46f87 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java @@ -19,6 +19,7 @@ package com.android.ide.eclipse.tests.functests.layoutRendering; import com.android.SdkConstants; import com.android.ide.common.rendering.LayoutLibrary; import com.android.ide.common.rendering.api.AdapterBinding; +import com.android.ide.common.rendering.api.HardwareConfig; import com.android.ide.common.rendering.api.ILayoutPullParser; import com.android.ide.common.rendering.api.IProjectCallback; import com.android.ide.common.rendering.api.RenderSession; @@ -26,6 +27,7 @@ import com.android.ide.common.rendering.api.ResourceReference; import com.android.ide.common.rendering.api.ResourceValue; import com.android.ide.common.rendering.api.SessionParams; import com.android.ide.common.rendering.api.SessionParams.RenderingMode; +import com.android.ide.common.resources.ResourceItem; import com.android.ide.common.resources.ResourceRepository; import com.android.ide.common.resources.ResourceResolver; import com.android.ide.common.resources.configuration.DensityQualifier; @@ -43,10 +45,9 @@ import com.android.ide.common.resources.configuration.SmallestScreenWidthQualifi import com.android.ide.common.resources.configuration.TextInputMethodQualifier; import com.android.ide.common.resources.configuration.TouchScreenQualifier; import com.android.ide.common.sdk.LoadStatus; -import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources; import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager; import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; -import com.android.ide.eclipse.tests.SdkTestCase; +import com.android.ide.eclipse.tests.SdkLoadingTestCase; import com.android.io.FolderWrapper; import com.android.resources.Density; import com.android.resources.Keyboard; @@ -73,7 +74,7 @@ import java.util.Map; import javax.imageio.ImageIO; -public class ApiDemosRenderingTest extends SdkTestCase { +public class ApiDemosRenderingTest extends SdkLoadingTestCase { /** * Custom parser that implements {@link ILayoutPullParser} (which itself extends @@ -215,8 +216,13 @@ public class ApiDemosRenderingTest extends SdkTestCase { ResourceRepository framework = ResourceManager.getInstance().loadFrameworkResources(target); // now load the project resources - ProjectResources project = new ProjectResources(null /*project*/); - project.loadResources(resFolder); + ResourceRepository project = new ResourceRepository(resFolder, false) { + @Override + protected ResourceItem createResourceItem(String name) { + return new ResourceItem(name); + } + + }; // Create a folder configuration that will be used for the rendering: FolderConfiguration config = getConfiguration(); @@ -245,15 +251,21 @@ public class ApiDemosRenderingTest extends SdkTestCase { configuredProject, configuredFramework, "Theme", false /*isProjectTheme*/); - RenderSession session = layoutLib.createSession(new SessionParams( - parser, - RenderingMode.NORMAL, - null /*projectKey*/, + HardwareConfig hardwareConfig = new HardwareConfig( 320, 480, Density.MEDIUM, 160, //xdpi 160, // ydpi + ScreenSize.NORMAL, + ScreenOrientation.PORTRAIT, + false /*software buttons */); + + RenderSession session = layoutLib.createSession(new SessionParams( + parser, + RenderingMode.NORMAL, + null /*projectKey*/, + hardwareConfig, resolver, projectCallBack, 1, // minSdkVersion diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java index 656e8e8..3fb705d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java @@ -20,7 +20,7 @@ import com.android.ide.eclipse.adt.AdtUtils; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState.Mode; -import com.android.ide.eclipse.tests.SdkTestCase; +import com.android.ide.eclipse.tests.SdkLoadingTestCase; import com.android.sdklib.IAndroidTarget; import org.eclipse.core.resources.IMarker; @@ -50,7 +50,7 @@ import java.util.logging.Logger; * execution there * */ -public class SampleProjectTest extends SdkTestCase { +public class SampleProjectTest extends SdkLoadingTestCase { private static final Logger sLogger = Logger.getLogger(SampleProjectTest.class.getName()); |