Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 353341 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mat/inspections/threads/ThreadOverviewQuery.java (-5 / +24 lines)
Lines 34-39 Link Here
34
import org.eclipse.mat.query.annotations.Icon;
34
import org.eclipse.mat.query.annotations.Icon;
35
import org.eclipse.mat.snapshot.ISnapshot;
35
import org.eclipse.mat.snapshot.ISnapshot;
36
import org.eclipse.mat.snapshot.model.IClass;
36
import org.eclipse.mat.snapshot.model.IClass;
37
import org.eclipse.mat.snapshot.query.IHeapObjectArgument;
37
import org.eclipse.mat.snapshot.query.Icons;
38
import org.eclipse.mat.snapshot.query.Icons;
38
import org.eclipse.mat.snapshot.query.SnapshotQuery;
39
import org.eclipse.mat.snapshot.query.SnapshotQuery;
39
import org.eclipse.mat.util.IProgressListener;
40
import org.eclipse.mat.util.IProgressListener;
Lines 45-65 Link Here
45
    @Argument
46
    @Argument
46
    public ISnapshot snapshot;
47
    public ISnapshot snapshot;
47
48
49
    @Argument(isMandatory = false, flag = Argument.UNFLAGGED)
50
    public IHeapObjectArgument objects;
51
48
    public IResult execute(IProgressListener listener) throws Exception
52
    public IResult execute(IProgressListener listener) throws Exception
49
    {
53
    {
50
        listener.subTask(Messages.ThreadOverviewQuery_SearchingThreads);
54
        listener.subTask(Messages.ThreadOverviewQuery_SearchingThreads);
51
55
52
        List<ThreadInfoImpl> result = new ArrayList<ThreadInfoImpl>();
56
        List<ThreadInfoImpl> result = new ArrayList<ThreadInfoImpl>();
53
57
54
        Collection<IClass> classes = snapshot.getClassesByName("java.lang.Thread", true); //$NON-NLS-1$
58
        if (objects != null)
55
        if (classes != null)
59
        {
56
            for (IClass clasz : classes)
60
            for (int[] objectIds : objects)
61
            {
62
                for (int objectId : objectIds)
63
                {
64
                    result.add(ThreadInfoImpl.build(snapshot.getObject(objectId), false, listener));
65
                }
66
            }
67
        }
68
        else
69
        {
70
            Collection<IClass> classes = snapshot.getClassesByName("java.lang.Thread", true); //$NON-NLS-1$
71
            if (classes != null)
57
            {
72
            {
58
                for (int id : clasz.getObjectIds())
73
                for (IClass clasz : classes)
59
                {
74
                {
60
                    result.add(ThreadInfoImpl.build(snapshot.getObject(id), false, listener));
75
                    for (int id : clasz.getObjectIds())
76
                    {
77
                        result.add(ThreadInfoImpl.build(snapshot.getObject(id), false, listener));
78
                    }
61
                }
79
                }
62
            }
80
            }
81
        }
63
82
64
        Collections.sort(result, new Comparator<ThreadInfoImpl>()
83
        Collections.sort(result, new Comparator<ThreadInfoImpl>()
65
        {
84
        {

Return to bug 353341