|
Re: Creating a query plugin with graphs [message #8536 is a reply to message #8505] |
Fri, 16 January 2009 08:43 |
Andreas Buchen Messages: 123 Registered: July 2009 |
Senior Member |
|
|
Hi Andrew,
you're right: the PieFactory could and should be made available to ease
create simple pie charts. For now has been restricted, because I created
it "on the go" and I am not quite sure if it is THE api that makes sense.
Why don't you go ahead, and use the PieFactory? Let me know if it works
for you and we will add it the the public API.
A query could look like this:
public class PieQuery implements IQuery
{
@Argument
public ISnapshot snapshot;
public IResult execute(IProgressListener listener) throws Exception
{
PieFactory f = new PieFactory(snapshot);
int[] topDominators = snapshot.getImmediateDominatedIds(-1);
for (int ii = 0; ii < 5 && ii < topDominators.length; ii++)
f.addSlice(topDominators[ii]);
return f.build();
}
}
This would be the change necessary:
Index: src/org/eclipse/mat/inspections/util/PieFactory.java
============================================================ =======
--- src/org/eclipse/mat/inspections/util/PieFactory.java (revision 194)
+++ src/org/eclipse/mat/inspections/util/PieFactory.java (working copy)
@@ -24,7 +24,9 @@
import org.eclipse.mat.util.HTMLUtils;
import org.eclipse.mat.util.Units;
-
+/**
+ * @since 0.7
+ */
public class PieFactory
{
private ISnapshot snapshot;
Index: META-INF/MANIFEST.MF
============================================================ =======
--- META-INF/MANIFEST.MF (revision 205)
+++ META-INF/MANIFEST.MF (working copy)
@@ -6,6 +6,7 @@
Bundle-Vendor: Eclipse.org
Export-Package:
org.eclipse.mat.inspections.osgi;x-friends:="org.eclipse.mat.ui ",
org.eclipse.mat.inspections.osgi.model;x-friends:="org.eclipse.mat.ui ",
+ org.eclipse.mat.inspections.util,
org.eclipse.mat.internal.snapshot;x-friends:="org.eclipse.mat.ui ",
org.eclipse.mat.snapshot,
org.eclipse.mat.snapshot.extension,
Cheers,
Andreas.
|
|
|
|
Powered by
FUDForum. Page generated in 0.07308 seconds