diff options
author | Tor Norbye <tnorbye@google.com> | 2011-07-28 14:07:18 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2011-07-29 13:10:36 -0700 |
commit | 401e50139efc9333a689c2306ca66a7b2c840c40 (patch) | |
tree | 216dd7bb1bb77b4c0b1cf7f3296922d3f3f5b14e /eclipse/plugins/com.android.ide.eclipse.tests | |
parent | 5c7d53f8dcb78d9e4ba353ec768866e82479698e (diff) | |
download | sdk-401e50139efc9333a689c2306ca66a7b2c840c40.zip sdk-401e50139efc9333a689c2306ca66a7b2c840c40.tar.gz sdk-401e50139efc9333a689c2306ca66a7b2c840c40.tar.bz2 |
Add Java Quick Assistant for Extracting Strings
This changeset adds a Quick Assistant to Java files in Android
projects, which proposes "Extract String" when the caret is within a
String literal.
It also moves a couple of utility methods from the Hyperlinks class to
the AdtUtils class.
Change-Id: Ica5ff40e32e3e145481d6c895178109289ed1d9b
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests')
3 files changed, 7 insertions, 6 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java index 78f16a2..1380aea 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java @@ -22,9 +22,9 @@ import static com.android.sdklib.SdkConstants.FD_RES; import com.android.ide.eclipse.adt.AdtConstants; import com.android.ide.eclipse.adt.AdtPlugin; +import com.android.ide.eclipse.adt.AdtUtils; import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor; import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest; -import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; @@ -180,7 +180,7 @@ public class AaptQuickFixTest extends AdtProjectTest { assertNotNull(path.toPortableString(), newFile); // Ensure that the newly created file was opened - IEditorPart currentFile = Hyperlinks.getEditor(); + IEditorPart currentFile = AdtUtils.getActiveEditor(); assertEquals(newFile.getProjectRelativePath(), ((FileEditorInput) currentFile.getEditorInput()).getFile().getProjectRelativePath()); @@ -267,7 +267,7 @@ public class AaptQuickFixTest extends AdtProjectTest { // Open the file to ensure we can get an XML model with getExistingModelForEdit: AdtPlugin.openFile(file, null); - IEditorPart newEditor = Hyperlinks.getEditor(); + IEditorPart newEditor = AdtUtils.getActiveEditor(); assertTrue(newEditor instanceof AndroidXmlEditor); AndroidXmlEditor xmlEditor = (AndroidXmlEditor) newEditor; 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 7dc3f2d..7a2c387 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 @@ -21,10 +21,10 @@ import static com.android.ide.common.layout.LayoutConstants.NEW_ID_PREFIX; import com.android.ide.common.layout.BaseLayoutRule; import com.android.ide.eclipse.adt.AdtPlugin; +import com.android.ide.eclipse.adt.AdtUtils; import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor; import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest; import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode; -import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks; import com.android.util.Pair; import org.eclipse.core.resources.IFile; @@ -158,7 +158,7 @@ public class LayoutMetadataTest extends AdtProjectTest { throws Exception, PartInitException { IFile file = getLayoutFile(getProject(), filename); AdtPlugin.openFile(file, null); - IEditorPart newEditor = Hyperlinks.getEditor(); + IEditorPart newEditor = AdtUtils.getActiveEditor(); assertTrue(newEditor instanceof AndroidXmlEditor); AndroidXmlEditor xmlEditor = (AndroidXmlEditor) newEditor; IStructuredDocument document = xmlEditor.getStructuredDocument(); diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java index afe6f3b..ade4ab3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java @@ -18,6 +18,7 @@ package com.android.ide.eclipse.adt.internal.editors.xml; import static com.android.sdklib.SdkConstants.FD_SOURCES; import com.android.ide.common.resources.ResourceFile; +import com.android.ide.eclipse.adt.AdtUtils; import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor; import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest; import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks.ResourceLink; @@ -231,7 +232,7 @@ public class HyperlinksTest extends AdtProjectTest { // Open the first link IHyperlink link = links[0]; link.open(); - IEditorPart newEditor = Hyperlinks.getEditor(); + IEditorPart newEditor = AdtUtils.getActiveEditor(); // Ensure that this isn't an invalid file (e.g. opening the SDK platform files // with incorrect content binding could cause this) assertTrue(!(newEditor instanceof ErrorEditorPart)); |