aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-09-15 07:25:27 -0700
committerTor Norbye <tnorbye@google.com>2014-09-15 09:46:44 -0700
commitf24c9d3aa16f16725dfd8ef71552b679b70a7e2b (patch)
treec03ca85117e61b10dcfe5ffaef55f0c8cfefe4c2 /eclipse/plugins
parenta0bf2facc25c00e023f5cdd4e4c8479465cbea3e (diff)
downloadsdk-f24c9d3aa16f16725dfd8ef71552b679b70a7e2b.zip
sdk-f24c9d3aa16f16725dfd8ef71552b679b70a7e2b.tar.gz
sdk-f24c9d3aa16f16725dfd8ef71552b679b70a7e2b.tar.bz2
Track lint API changes in the Eclipse lint integration
Change-Id: If9c6843f0b9231a2b629e61ab7b8c3a401485f1f
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/GlobalLintConfiguration.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFix.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/TypoFix.java9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/LintPreferencePage.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandlerTest.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationTest.java8
10 files changed, 34 insertions, 26 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
index 54222e3..c916616 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
@@ -49,6 +49,7 @@ import com.android.tools.lint.detector.api.Location.Handle;
import com.android.tools.lint.detector.api.Position;
import com.android.tools.lint.detector.api.Project;
import com.android.tools.lint.detector.api.Severity;
+import com.android.tools.lint.detector.api.TextFormat;
import com.android.tools.lint.detector.api.XmlContext;
import com.android.utils.Pair;
import com.android.utils.SdkUtils;
@@ -379,7 +380,8 @@ public class EclipseLintClient extends LintClient {
@Override
public void report(@NonNull Context context, @NonNull Issue issue, @NonNull Severity s,
@Nullable Location location,
- @NonNull String message, @Nullable Object data) {
+ @NonNull String message, @NonNull TextFormat format) {
+ message = format.toText(message);
int severity = getMarkerSeverity(s);
IMarker marker = null;
if (location != null) {
@@ -666,8 +668,8 @@ public class EclipseLintClient extends LintClient {
return "";
}
- String summary = issue.getDescription(Issue.OutputFormat.TEXT);
- String explanation = issue.getExplanation(Issue.OutputFormat.TEXT);
+ String summary = issue.getBriefDescription(TextFormat.TEXT);
+ String explanation = issue.getExplanation(TextFormat.TEXT);
StringBuilder sb = new StringBuilder(summary.length() + explanation.length() + 20);
try {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/GlobalLintConfiguration.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/GlobalLintConfiguration.java
index 5870501..2f0261e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/GlobalLintConfiguration.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/GlobalLintConfiguration.java
@@ -96,8 +96,7 @@ class GlobalLintConfiguration extends Configuration {
@Override
public void ignore(@NonNull Context context, @NonNull Issue issue,
- @Nullable Location location, @NonNull String message,
- @Nullable Object data) {
+ @Nullable Location location, @NonNull String message) {
throw new UnsupportedOperationException(
"Can't ignore() in global configurations"); //$NON-NLS-1$
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFix.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFix.java
index 658e409..366e949 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFix.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFix.java
@@ -37,7 +37,7 @@ import com.android.tools.lint.checks.TypographyDetector;
import com.android.tools.lint.checks.UseCompoundDrawableDetector;
import com.android.tools.lint.checks.UselessViewDetector;
import com.android.tools.lint.detector.api.Issue;
-import com.android.tools.lint.detector.api.Issue.OutputFormat;
+import com.android.tools.lint.detector.api.TextFormat;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
@@ -110,7 +110,7 @@ abstract class LintFix implements ICompletionProposal {
public String getAdditionalProposalInfo() {
Issue issue = EclipseLintClient.getRegistry().getIssue(mId);
if (issue != null) {
- return issue.getExplanation(OutputFormat.HTML);
+ return issue.getExplanation(TextFormat.HTML);
}
return null;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
index ce5fd55..da10085 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
@@ -27,7 +27,7 @@ import com.android.tools.lint.client.api.Configuration;
import com.android.tools.lint.client.api.DefaultConfiguration;
import com.android.tools.lint.client.api.IssueRegistry;
import com.android.tools.lint.detector.api.Issue;
-import com.android.tools.lint.detector.api.Issue.OutputFormat;
+import com.android.tools.lint.detector.api.TextFormat;
import com.android.tools.lint.detector.api.Project;
import com.android.tools.lint.detector.api.Severity;
import com.android.utils.SdkUtils;
@@ -489,12 +489,12 @@ public class LintFixGenerator implements IMarkerResolutionGenerator2, IQuickAssi
sb.append('\n').append('\n');
sb.append("Issue Explanation:");
sb.append('\n');
- String explanation = issue.getExplanation(Issue.OutputFormat.TEXT);
+ String explanation = issue.getExplanation(TextFormat.TEXT);
if (explanation != null && !explanation.isEmpty()) {
sb.append('\n');
sb.append(explanation);
} else {
- sb.append(issue.getDescription(Issue.OutputFormat.TEXT));
+ sb.append(issue.getBriefDescription(TextFormat.TEXT));
}
if (issue.getMoreInfo() != null) {
@@ -546,7 +546,7 @@ public class LintFixGenerator implements IMarkerResolutionGenerator2, IQuickAssi
return "Provides more information about this issue."
+ "<br><br>" //$NON-NLS-1$
+ EclipseLintClient.getRegistry().getIssue(mId).getExplanation(
- OutputFormat.HTML);
+ TextFormat.HTML);
}
@Override
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/TypoFix.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/TypoFix.java
index 8a83364..7cc05d2 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/TypoFix.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/TypoFix.java
@@ -17,6 +17,7 @@ package com.android.ide.eclipse.adt.internal.lint;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.tools.lint.checks.TypoDetector;
+import com.android.tools.lint.detector.api.TextFormat;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
@@ -58,11 +59,11 @@ final class TypoFix extends DocumentFix {
protected void apply(IDocument document, IStructuredModel model, Node node,
int start, int end) {
String message = mMarker.getAttribute(IMarker.MESSAGE, "");
- String typo = TypoDetector.getTypo(message);
+ String typo = TypoDetector.getTypo(message, TextFormat.TEXT);
if (typo == null) {
return;
}
- List<String> replacements = TypoDetector.getSuggestions(message);
+ List<String> replacements = TypoDetector.getSuggestions(message, TextFormat.TEXT);
if (replacements == null || replacements.isEmpty()) {
return;
}
@@ -103,8 +104,8 @@ final class TypoFix extends DocumentFix {
@Override
protected List<LintFix> getAllFixes() {
String message = mMarker.getAttribute(IMarker.MESSAGE, "");
- String typo = TypoDetector.getTypo(message);
- List<String> replacements = TypoDetector.getSuggestions(message);
+ String typo = TypoDetector.getTypo(message, TextFormat.TEXT);
+ List<String> replacements = TypoDetector.getSuggestions(message, TextFormat.TEXT);
if (replacements != null && !replacements.isEmpty() && typo != null) {
List<LintFix> allFixes = new ArrayList<LintFix>(replacements.size());
for (String replacement : replacements) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/LintPreferencePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/LintPreferencePage.java
index 02af2fd..5cb94ba 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/LintPreferencePage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/LintPreferencePage.java
@@ -15,8 +15,8 @@
*/
package com.android.ide.eclipse.adt.internal.preferences;
-import static com.android.tools.lint.detector.api.Issue.OutputFormat.RAW;
-import static com.android.tools.lint.detector.api.Issue.OutputFormat.TEXT;
+import static com.android.tools.lint.detector.api.TextFormat.RAW;
+import static com.android.tools.lint.detector.api.TextFormat.TEXT;
import com.android.annotations.NonNull;
import com.android.ide.eclipse.adt.AdtPlugin;
@@ -30,6 +30,7 @@ import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.Project;
import com.android.tools.lint.detector.api.Severity;
+import com.android.tools.lint.detector.api.TextFormat;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
@@ -451,8 +452,8 @@ public class LintPreferencePage extends PropertyPage implements IWorkbenchPrefer
Object data = item != null ? item.getData() : null;
if (data instanceof Issue) {
Issue issue = (Issue) data;
- String summary = issue.getDescription(Issue.OutputFormat.TEXT);
- String explanation = issue.getExplanation(Issue.OutputFormat.TEXT);
+ String summary = issue.getBriefDescription(TextFormat.TEXT);
+ String explanation = issue.getExplanation(TextFormat.TEXT);
StringBuilder sb = new StringBuilder(summary.length() + explanation.length() + 20);
sb.append(summary);
@@ -571,7 +572,7 @@ public class LintPreferencePage extends PropertyPage implements IWorkbenchPrefer
|| issue.getCategory().getName().toLowerCase(Locale.US).startsWith(filter)
|| issue.getCategory().getFullName().toLowerCase(Locale.US).startsWith(filter)
|| issue.getId().toLowerCase(Locale.US).contains(filter)
- || issue.getDescription(RAW).toLowerCase(Locale.US).contains(filter);
+ || issue.getBriefDescription(RAW).toLowerCase(Locale.US).contains(filter);
}
private class ContentProvider extends TreeNodeContentProvider {
@@ -715,7 +716,7 @@ public class LintPreferencePage extends PropertyPage implements IWorkbenchPrefer
case 0:
return issue.getId();
case 1:
- return issue.getDescription(TEXT);
+ return issue.getBriefDescription(TEXT);
}
return null;
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
index b4741aa..1b29ac8 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
@@ -13,3 +13,4 @@ Bundle-ClassPath: .,
libs/lint-api.jar,
libs/lint-checks.jar,
libs/easymock.jar
+Import-Package: com.android.tools.lint.detector.api
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 7fd042e..f8ea8c4 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
@@ -29,6 +29,7 @@ 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.Severity;
+import com.android.tools.lint.detector.api.TextFormat;
import org.eclipse.core.resources.IProject;
@@ -191,7 +192,7 @@ public class ProjectLintConfigurationTest extends AdtProjectTest {
@Override
public void report(@NonNull Context context, @NonNull Issue issue,
@NonNull Severity severity, @Nullable Location location,
- @NonNull String message, @Nullable Object data) {
+ @NonNull String message, @NonNull TextFormat format) {
}
@Override
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
index 09f4592..a93bc3e 100644
--- 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
@@ -51,6 +51,7 @@ 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.android.tools.lint.detector.api.TextFormat;
import com.google.common.base.Charsets;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
@@ -766,7 +767,7 @@ public class TemplateHandlerTest extends SdkLoadingTestCase {
@Override
public void report(@NonNull Context context,
@NonNull Issue issue, @NonNull Severity severity,
- @Nullable Location location, @NonNull String message, @Nullable Object data) {
+ @Nullable Location location, @NonNull String message, @NonNull TextFormat format) {
String s = "Found lint error: " + issue.getId() + ": " + message + " at " + location;
job.setProperty(ERROR_KEY, s);
fail(s);
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationTest.java
index 2e02509..a9e39fb 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationTest.java
@@ -25,8 +25,10 @@ import com.android.sdklib.devices.Device;
import com.android.sdklib.devices.DeviceManager;
import com.android.sdklib.devices.Screen;
import com.android.utils.StdLogger;
+import com.google.common.collect.Lists;
import java.lang.reflect.Constructor;
+import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
@@ -53,10 +55,10 @@ public class ConfigurationTest extends TestCase {
DeviceManager deviceManager = DeviceManager.createInstance(
null /*osSdkPath*/,
new StdLogger(StdLogger.Level.VERBOSE));
- List<Device> devices = deviceManager.getDevices(DeviceManager.DeviceFilter.DEFAULT);
+ Collection<Device> devices = deviceManager.getDevices(DeviceManager.DeviceFilter.DEFAULT);
assertNotNull(devices);
assertTrue(devices.size() > 0);
- configuration.setDevice(devices.get(0), false);
+ configuration.setDevice(devices.iterator().next(), false);
// Check syncing
FolderConfiguration folderConfig = configuration.getFullConfig();
@@ -113,7 +115,7 @@ public class ConfigurationTest extends TestCase {
DeviceManager deviceManager = DeviceManager.createInstance(
null /*osSdkPath*/,
new StdLogger(StdLogger.Level.VERBOSE));
- List<Device> devices = deviceManager.getDevices(DeviceManager.DeviceFilter.DEFAULT);
+ List<Device> devices = Lists.newArrayList(deviceManager.getDevices(DeviceManager.DeviceFilter.DEFAULT));
assertNotNull(devices);
assertTrue(devices.size() > 0);
configuration.setDevice(devices.get(0), false);