aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-04-05 13:58:19 -0700
committerTor Norbye <tnorbye@google.com>2012-04-05 13:58:19 -0700
commitdbed8623e1cbbe767f9347f4e8a41b835793191e (patch)
tree485a7c02ae66fe4c3f7c0956b47c7030b78e9344
parent5e20417c0f11fe681dea9a8e0d71e755c9d6e3cb (diff)
downloadsdk-dbed8623e1cbbe767f9347f4e8a41b835793191e.zip
sdk-dbed8623e1cbbe767f9347f4e8a41b835793191e.tar.gz
sdk-dbed8623e1cbbe767f9347f4e8a41b835793191e.tar.bz2
Automatically safe files before refreshing lint.
Also fix bug where using the quickfix to add a suppress attribute would replace rather than append to the existing ignore attribute. Change-Id: Ia6933a59655e972c49f2e80ac14c6af15acd39d4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/AddSuppressAttribute.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintViewPart.java10
2 files changed, 8 insertions, 4 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/AddSuppressAttribute.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/AddSuppressAttribute.java
index 3297756..cd077ec 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/AddSuppressAttribute.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/AddSuppressAttribute.java
@@ -115,7 +115,7 @@ class AddSuppressAttribute implements ICompletionProposal {
// Use the non-namespace form of set attribute since we can't
// reference the namespace until the model has been reloaded
- mElement.setAttribute(prefix + ':' + ATTR_IGNORE, mId);
+ mElement.setAttribute(prefix + ':' + ATTR_IGNORE, ignore);
UiElementNode rootUiNode = mEditor.getUiRootNode();
if (rootUiNode != null) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintViewPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintViewPart.java
index 956ee9d..e9f94cc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintViewPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintViewPart.java
@@ -229,7 +229,7 @@ public class LintViewPart extends ViewPart implements SelectionListener, IJobCha
mRemoveAllAction = new LintViewAction("Remove All", ACTION_REMOVE_ALL,
sharedImages.getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL),
sharedImages.getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL_DISABLED));
- mRefreshAction = new LintViewAction("Refresh", ACTION_REFRESH,
+ mRefreshAction = new LintViewAction("Refresh (& Save Files)", ACTION_REFRESH,
iconFactory.getImageDescriptor(REFRESH_ICON), null);
mRemoveAllAction.setEnabled(true);
mCollapseAll = new LintViewAction("Collapse All", ACTION_COLLAPSE,
@@ -461,6 +461,11 @@ public class LintViewPart extends ViewPart implements SelectionListener, IJobCha
public void run() {
switch (mAction) {
case ACTION_REFRESH: {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench != null) {
+ workbench.saveAllEditors(false /*confirm*/);
+ }
+
Job[] jobs = EclipseLintRunner.getCurrentJobs();
if (jobs.length > 0) {
EclipseLintRunner.cancelCurrentJobs(false);
@@ -471,9 +476,8 @@ public class LintViewPart extends ViewPart implements SelectionListener, IJobCha
}
Job job = EclipseLintRunner.startLint(resources, null,
false /*fatalOnly*/, false /*show*/);
- if (job != null) {
+ if (job != null && workbench != null) {
job.addJobChangeListener(LintViewPart.this);
- IWorkbench workbench = PlatformUI.getWorkbench();
ISharedImages sharedImages = workbench.getSharedImages();
setImageDescriptor(sharedImages.getImageDescriptor(
ISharedImages.IMG_ELCL_STOP));