Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Grigorenko2019-08-13 12:29:29 -0400
committerKevin Grigorenko2019-08-15 13:44:41 -0400
commit13234932e4e70d98ba68b2883d2f0c0de16313a3 (patch)
treea084d650769404410dc20a38d07da4fa55c4673c
parent7d42d8ed3b8270a976ee965cc6ab4ee96484a76e (diff)
downloadorg.eclipse.mat-13234932e4e70d98ba68b2883d2f0c0de16313a3.tar.gz
org.eclipse.mat-13234932e4e70d98ba68b2883d2f0c0de16313a3.tar.xz
org.eclipse.mat-13234932e4e70d98ba68b2883d2f0c0de16313a3.zip
[550024] Update find_strings query to show detailed progress
-rw-r--r--plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/FindStringsQuery.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/FindStringsQuery.java b/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/FindStringsQuery.java
index c51cadca..8d9ed793 100644
--- a/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/FindStringsQuery.java
+++ b/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/FindStringsQuery.java
@@ -42,8 +42,6 @@ public class FindStringsQuery implements IQuery
public IResult execute(IProgressListener listener) throws Exception
{
- listener.subTask(Messages.FindStringsQuery_SearchingStrings);
-
ArrayInt result = new ArrayInt();
Collection<IClass> classes = snapshot.getClassesByName("java.lang.String", false); //$NON-NLS-1$
@@ -54,6 +52,8 @@ public class FindStringsQuery implements IQuery
{
int[] objectIds = clasz.getObjectIds();
+ listener.beginTask(Messages.FindStringsQuery_SearchingStrings, objectIds.length);
+
for (int id : objectIds)
{
if (listener.isCanceled())
@@ -62,7 +62,11 @@ public class FindStringsQuery implements IQuery
String value = snapshot.getObject(id).getClassSpecificName();
if (value != null && pattern.matcher(value).matches())
result.add(id);
+
+ listener.worked(1);
}
+
+ listener.done();
}
}
else
@@ -71,6 +75,14 @@ public class FindStringsQuery implements IQuery
{
IClass javaLangString = classes.iterator().next();
+ int totalWork = 0;
+ for (int[] objectIds : objects)
+ {
+ totalWork += objectIds.length;
+ }
+
+ listener.beginTask(Messages.FindStringsQuery_SearchingStrings, totalWork);
+
ObjectsLoop: for (int[] objectIds : objects)
{
for (int id : objectIds)
@@ -91,8 +103,12 @@ public class FindStringsQuery implements IQuery
{
result.add(id);
}
+
+ listener.worked(1);
}
}
+
+ listener.done();
}
}

Back to the top