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 / +23 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
        for (int[] objectIds : objects)
55
        if (classes != null)
59
        {
56
            for (IClass clasz : classes)
60
            for (int objectId : objectIds)
57
            {
61
            {
58
                for (int id : clasz.getObjectIds())
62
                result.add(ThreadInfoImpl.build(snapshot.getObject(objectId), false, listener));
63
            }
64
        }
65
66
        // If no object specification was passed in, fall back
67
        if (result.size() == 0)
68
        {
69
            Collection<IClass> classes = snapshot.getClassesByName("java.lang.Thread", true); //$NON-NLS-1$
70
            if (classes != null)
71
            {
72
                for (IClass clasz : classes)
59
                {
73
                {
60
                    result.add(ThreadInfoImpl.build(snapshot.getObject(id), false, listener));
74
                    for (int id : clasz.getObjectIds())
75
                    {
76
                        result.add(ThreadInfoImpl.build(snapshot.getObject(id), false, listener));
77
                    }
61
                }
78
                }
62
            }
79
            }
80
        }
63
81
64
        Collections.sort(result, new Comparator<ThreadInfoImpl>()
82
        Collections.sort(result, new Comparator<ThreadInfoImpl>()
65
        {
83
        {

Return to bug 353341