-
Notifications
You must be signed in to change notification settings - Fork 8
/
ComparisonReport.java
49 lines (43 loc) · 1.98 KB
/
ComparisonReport.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
* Copyright (c) 2020 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Johnson (IBM Corporation) - initial API and implementation
*******************************************************************************/
package org.eclipse.mat.inspections;
import java.util.Collections;
import java.util.List;
import org.eclipse.mat.query.IQuery;
import org.eclipse.mat.query.IResult;
import org.eclipse.mat.query.annotations.Argument;
import org.eclipse.mat.query.annotations.CommandName;
import org.eclipse.mat.query.annotations.Argument.Advice;
import org.eclipse.mat.query.annotations.HelpUrl;
import org.eclipse.mat.query.annotations.Icon;
import org.eclipse.mat.snapshot.ISnapshot;
import org.eclipse.mat.snapshot.query.SnapshotQuery;
import org.eclipse.mat.util.IProgressListener;
@CommandName("comparison_report")
@Icon("/META-INF/icons/compare.gif")
@HelpUrl("/org.eclipse.mat.ui.help/tasks/comparingdata.html")
public class ComparisonReport implements IQuery
{
@Argument
public ISnapshot snapshot;
@Argument(advice = Advice.SECONDARY_SNAPSHOT)
public ISnapshot baseline;
@Argument(flag = Argument.UNFLAGGED)
public String report = "org.eclipse.mat.api:suspects2"; //$NON-NLS-1$
public IResult execute(IProgressListener listener) throws Exception
{
SnapshotQuery queryc = SnapshotQuery.parse("default_report "+report, snapshot); //$NON-NLS-1$
List<String> params = Collections.singletonList("baseline="+baseline.getSnapshotInfo().getPath()); //$NON-NLS-1$
queryc.setArgument("params", params); //$NON-NLS-1$
IResult ret = queryc.execute(listener);
return ret;
}
}