aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-07-26 17:43:22 -0700
committerTor Norbye <tnorbye@google.com>2011-07-26 17:43:22 -0700
commit8853ecca4ab4ecc22254d1ddee92aa95b90c590e (patch)
tree47d6550ac3d9e6907d4cb02090b218af1d57fc59 /eclipse/plugins
parent4acb7dd9a09af790eb019922f6e4bc8555c39cd6 (diff)
downloadsdk-8853ecca4ab4ecc22254d1ddee92aa95b90c590e.zip
sdk-8853ecca4ab4ecc22254d1ddee92aa95b90c590e.tar.gz
sdk-8853ecca4ab4ecc22254d1ddee92aa95b90c590e.tar.bz2
Fix code completion handling for text selection
This CL fixes 18607: ADT 12 problems with xml files The bug is that if there is a text selection and you invoke code completion and select an alternative, the wrong number of characters is deleted as part of the replacement. The fix is simple: remove the code which adds in the selection count from the replacement string, since the complete replacement count is now already computed properly without regard for the selection (we should -always- replace the complete value token, not just the selection). Most of the diffs actually pertain to new unit tests for this because the testing infrastructure needed some changes to handle references to selection ranges rather than just caret offsets. There are also a couple of updates to some test goldenfiles unrelated to this fix, which updates the golden files to reflect recent changes like the package name of GestureOverlayViews and the @attr resource type in completion. Change-Id: Ie4f680f201930414457a79846f722db6efc89f93
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java28
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java39
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java69
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-completion65.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion9-expected-completion64.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion66.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion67.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion68.txt3
17 files changed, 152 insertions, 36 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java
index 38ab6d8..3f5a318 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssist.java
@@ -45,14 +45,12 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.w3c.dom.NamedNodeMap;
@@ -195,7 +193,6 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
return;
}
- int selectionLength = getSelectionLength(viewer);
int replaceLength = parent.length() - wordPrefix.length();
boolean isNew = replaceLength == 0 && nextNonspaceChar(viewer, offset) == '<';
// Special case: if we are right before the beginning of a new
@@ -214,21 +211,10 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
addMatchingProposals(proposals, choices, offset,
parentNode != null ? parentNode : null, wordPrefix, needTag,
false /* isAttribute */, isNew, false /*isComplete*/,
- selectionLength + replaceLength);
+ replaceLength);
}
}
- private int getSelectionLength(ITextViewer viewer) {
- // get the selection length
- int selectionLength = 0;
- ISelection selection = viewer.getSelectionProvider().getSelection();
- if (selection instanceof TextSelection) {
- TextSelection textSelection = (TextSelection) selection;
- selectionLength = textSelection.getLength();
- }
- return selectionLength;
- }
-
private void computeAttributeProposals(List<ICompletionProposal> proposals, ITextViewer viewer,
int offset, String wordPrefix, UiElementNode currentUiNode, Node parentNode,
Node currentNode, String parent, AttribInfo info, char nextChar) {
@@ -247,7 +233,6 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
return;
}
- int selectionLength = getSelectionLength(viewer);
int replaceLength = info.replaceLength;
if (info.correctedPrefix != null) {
wordPrefix = info.correctedPrefix;
@@ -259,7 +244,7 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
addMatchingProposals(proposals, choices, offset, parentNode != null ? parentNode : null,
wordPrefix, needTag, true /* isAttribute */, isNew, info.skipEndTag,
- selectionLength + replaceLength);
+ replaceLength);
}
private char computeElementNeedTag(ITextViewer viewer, int offset, String wordPrefix) {
@@ -541,20 +526,13 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
ISourceViewer viewer = mEditor.getStructuredSourceViewer();
char needTag = computeElementNeedTag(viewer, offset, wordPrefix);
- // get the selection length
- int selectionLength = 0;
- ISelection selection = viewer.getSelectionProvider().getSelection();
- if (selection instanceof TextSelection) {
- TextSelection textSelection = (TextSelection) selection;
- selectionLength = textSelection.getLength();
- }
int replaceLength = 0;
addMatchingProposals(proposals, choices,
offset, parentNode, wordPrefix, needTag,
false /* isAttribute */,
false /*isNew*/,
false /*isComplete*/,
- selectionLength + replaceLength);
+ replaceLength);
}
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java
index ae41f84..ace5093 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java
@@ -350,7 +350,6 @@ public class PreviewIconFactory {
}
AdtPlugin.log(IStatus.WARNING, "Failed to render set of icons for %1$s",
sb.toString());
- System.out.println(sb.toString());
if (session.getResult().getException() != null) {
AdtPlugin.log(session.getResult().getException(),
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 7608d2a..4eb54cd 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
@@ -432,6 +432,24 @@ public class AndroidContentAssistTest extends AdtProjectTest {
checkLayoutCompletion("completion9.xml", "^<Button");
}
+ public void testCompletion65() throws Exception {
+ // Test completion replacement when there is a selection
+ // (see issue http://code.google.com/p/android/issues/detail?id=18607 )
+ checkLayoutCompletion("completion10.xml", "\"[^wrap_content]\"");
+ }
+
+ public void testCompletion66() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "17[^sp]");
+ }
+
+ public void testCompletion67() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "17[^sp]");
+ }
+
+ public void testCompletion68() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "[^false]");
+ }
+
// ---- Test *applying* code completion ----
@@ -704,6 +722,21 @@ public class AndroidContentAssistTest extends AdtProjectTest {
"android:layout_marginRight");
}
+ public void testApplyCompletion42() throws Exception {
+ // Test completion replacement when there is a selection
+ // (see issue http://code.google.com/p/android/issues/detail?id=18607 )
+ checkApplyLayoutCompletion("completion10.xml", "\"[^wrap_content]\"", "fill_parent");
+ }
+
+ public void testApplyCompletion43() throws Exception {
+ // Same as testApplyCompletion42 but with a smaller selection range
+ checkApplyLayoutCompletion("completion10.xml", "\"[^wrap_c]ontent\"", "fill_parent");
+ }
+
+ public void testApplyCompletion44() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "[^false]", "true");
+ }
+
// --- Code Completion test infrastructure ----
private void checkLayoutCompletion(String name, String caretLocation) throws Exception {
@@ -768,9 +801,6 @@ public class AndroidContentAssistTest extends AdtProjectTest {
private ICompletionProposal[] complete(IFile file, String caretLocation,
AndroidContentAssist assist) throws Exception {
- // Determine the offset
- int offset = getCaretOffset(file, caretLocation);
-
// Open file
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
assertNotNull(page);
@@ -779,6 +809,9 @@ public class AndroidContentAssistTest extends AdtProjectTest {
AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+ // Determine the offset, and possibly make text range selections as well
+ int offset = updateCaret(viewer, caretLocation);
+
// Run code completion
ICompletionProposal[] proposals = assist.computeCompletionProposals(viewer, offset);
if (proposals == null) {
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 4baa0e7..013a6a0 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
@@ -43,6 +43,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.graphics.Point;
@@ -274,18 +275,78 @@ public class AdtProjectTest extends SdkTestCase {
}
protected int getCaretOffset(String fileContent, String caretLocation) {
- assertTrue(caretLocation, caretLocation.contains("^"));
+ assertTrue(caretLocation, caretLocation.contains("^")); //$NON-NLS-1$
- int caretDelta = caretLocation.indexOf("^");
+ int caretDelta = caretLocation.indexOf("^"); //$NON-NLS-1$
assertTrue(caretLocation, caretDelta != -1);
- String caretContext = caretLocation.substring(0, caretDelta)
- + caretLocation.substring(caretDelta + 1); // +1: skip "^"
+
+ // 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
+ *
+ * @param viewer the viewer to contain the selection
+ * @param caretLocation the location string
+ */
+ protected int updateCaret(ISourceViewer viewer, String caretLocation) {
+ assertTrue(caretLocation, caretLocation.contains("^")); //$NON-NLS-1$
+
+ int caretDelta = caretLocation.indexOf("^"); //$NON-NLS-1$
+ assertTrue(caretLocation, caretDelta != -1);
+ String text = viewer.getTextWidget().getText();
+
+ int length = 0;
+
+ // 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);
+ length = caretRangeEnd - caretDelta - 2;
+ assertTrue(length > 0);
+ 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 = text.indexOf(caretContext);
+
+ assertTrue("Caret content " + caretContext + " not found in file",
+ caretContextIndex != -1);
+
+ int offset = caretContextIndex + caretDelta;
+ viewer.setSelectedRange(offset, length);
+
+ return offset;
+ }
+
protected String addSelection(String newFileContents, Point selectedRange) {
int selectionBegin = selectedRange.x;
int selectionEnd = selectionBegin + selectedRange.y;
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt
index 96e8408..9b7d001 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt
@@ -1,4 +1,5 @@
Code completion in broken2.xml for style=^:
+"@style/"
"@android:"
"@drawable/"
"@layout/"
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 099a779..701c608 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
@@ -15,7 +15,6 @@ Code completion in completion1.xml for ^<TextView:
<ExpandableListView ></ExpandableListView>
<FrameLayout ></FrameLayout>
<Gallery />
-<GestureOverlayView /> : GestureOverlayView specific attributes.
<GridView ></GridView>
<HorizontalScrollView ></HorizontalScrollView>
<ImageButton />
@@ -57,5 +56,6 @@ Code completion in completion1.xml for ^<TextView:
<WebView />
<ZoomButton />
<ZoomControls />
+<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.
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 6d20513..9bf7169 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
@@ -15,7 +15,6 @@ Code completion in completion1.xml for btn_default">^</FrameLayout>:
<ExpandableListView ></ExpandableListView>
<FrameLayout ></FrameLayout>
<Gallery />
-<GestureOverlayView /> : GestureOverlayView specific attributes.
<GridView ></GridView>
<HorizontalScrollView ></HorizontalScrollView>
<ImageButton />
@@ -57,5 +56,6 @@ Code completion in completion1.xml for btn_default">^</FrameLayout>:
<WebView />
<ZoomButton />
<ZoomControls />
+<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.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt
index 0853a83..99f92b8 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt
@@ -3,6 +3,7 @@ Code completion in completion1.xml for style="@android:^style/Widget.Button":
@android:anim/
@android:animator/
@android:array/
+@android:attr/
@android:bool/
@android:color/
@android:declare-styleable/
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
new file mode 100644
index 0000000..dcd7f71
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion42.diff
@@ -0,0 +1,4 @@
+Code completion in completion10.xml for "[^wrap_content]" selecting fill_parent:
+< 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
new file mode 100644
index 0000000..a8d2d43
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-applyCompletion43.diff
@@ -0,0 +1,4 @@
+Code completion in completion10.xml for "[^wrap_c]ontent" selecting fill_parent:
+< 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-completion65.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-completion65.txt
new file mode 100644
index 0000000..69fae0d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10-expected-completion65.txt
@@ -0,0 +1,4 @@
+Code completion in completion10.xml for "[^wrap_content]":
+fill_parent
+match_parent
+wrap_content
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10.xml
new file mode 100644
index 0000000..57b38ee
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion10.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical">
+<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/gallery"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+</RelativeLayout>
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 8fc4636..e889a29 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
@@ -15,7 +15,6 @@ Code completion in completion9.xml for ^<Button:
<ExpandableListView ></ExpandableListView>
<FrameLayout ></FrameLayout>
<Gallery />
-<GestureOverlayView /> : GestureOverlayView specific attributes.
<GridView ></GridView>
<HorizontalScrollView ></HorizontalScrollView>
<ImageButton />
@@ -57,6 +56,7 @@ Code completion in completion9.xml for ^<Button:
<WebView />
<ZoomButton />
<ZoomControls />
+<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.
<merge ></merge> : A root tag useful for XML layouts inflated using a ViewStub.
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
new file mode 100644
index 0000000..7a845b3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion44.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for [^false] selecting true:
+< <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-completion66.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion66.txt
new file mode 100644
index 0000000..4f29a8b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion66.txt
@@ -0,0 +1,7 @@
+Code completion in completionvalues1.xml for 17[^sp]:
+17dp : <b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen.
+17sp : <b>Scale-independent Pixels</b> - this is like the dp unit, but it is also scaled by the user's font size preference.
+17pt : <b>Points</b> - 1/72 of an inch based on the physical size of the screen.
+17mm : <b>Millimeters</b> - based on the physical size of the screen.
+17in : <b>Inches</b> - based on the physical size of the screen.
+17px : <b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion67.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion67.txt
new file mode 100644
index 0000000..4f29a8b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion67.txt
@@ -0,0 +1,7 @@
+Code completion in completionvalues1.xml for 17[^sp]:
+17dp : <b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen.
+17sp : <b>Scale-independent Pixels</b> - this is like the dp unit, but it is also scaled by the user's font size preference.
+17pt : <b>Points</b> - 1/72 of an inch based on the physical size of the screen.
+17mm : <b>Millimeters</b> - based on the physical size of the screen.
+17in : <b>Inches</b> - based on the physical size of the screen.
+17px : <b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion68.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion68.txt
new file mode 100644
index 0000000..5aa1d43
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion68.txt
@@ -0,0 +1,3 @@
+Code completion in completionvalues1.xml for [^false]:
+true
+false