Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/actions
In directory usw-pr-cvs1:/tmp/cvs-serv16002
Modified Files:
Bundle.properties
Added Files:
ShowHistogram.java
Log Message:
Show Histogram
--- NEW FILE: ShowHistogram.java ---
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"); you may not use this file except
* in compliance with the License. A copy of the License is available
* at http://www.sun.com/
*
* The Original Code is the Java Profiler module. The Initial Developers
* of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner,
* Lukas Petru and Marek Przeczek.
*
* Portions created by Jan Stola are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Portions created by Pavel Vacha are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Portions created by Michal Pise are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Portions created by Petr Luner are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Portions created by Lukas Petru are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Portions created by Marek Przeczek are Copyright (C) 2000-2001.
* All Rights Reserved.
*
* Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner,
* Lukas Petru and Marek Przeczek.
*/
package net.sourceforge.javaprofiler.module.actions;
import org.openide.util.actions.NodeAction;
import org.openide.util.HelpCtx;
import org.openide.nodes.Node;
import org.openide.windows.TopComponent;
import java.awt.BorderLayout;
import java.awt.Dimension;
import net.sourceforge.javaprofiler.module.nodes.*;
import net.sourceforge.javaprofiler.module.views.*;
import net.sourceforge.javaprofiler.jpi.Snapshot;
import net.sourceforge.javaprofiler.jpi.Constants;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import java.util.ResourceBundle;
import org.openide.util.NbBundle;
public class ShowHistogram extends NodeAction {
private static ResourceBundle bundle=NbBundle.getBundle(ShowHistogram.class
);
protected boolean enable(Node[] activatedNodes) {
if (activatedNodes.length!=1 || !(activatedNodes[0] instanceof
PSelectorNode))
return false;
return (activatedNodes[0].getParentNode() instanceof SnapshotNode2);
}
protected void performAction(Node[] activatedNodes) {
if (activatedNodes.length!=1 || !(activatedNodes[0] instanceof
PSelectorNode))
return;
if (!(activatedNodes[0].getParentNode() instanceof SnapshotNode2))
return;
final Snapshot sn=((SnapshotNode2) activatedNodes[0].getParentNode())
.getSnapshot().getSnapshot();
class HistogramTopComponent extends TopComponent {
HistogramTopComponent() {
setName("Histogram");
setToolTipText("Histogram of Allocation");
setLayout(new BorderLayout());
//when you stop using model call model.dispose()
TableClickSorter sortedModel = new AllocTableClickSorter(
new AllocHistogramTableModel(sn.getTypes(), sn,
Constants.TYPE));
JTable table = new AllocHistogramTable( sortedModel );
sortedModel.addMouseListenerToHeaderInTable(table);
table.setPreferredScrollableViewportSize(new Dimension(400, 400)
);
JScrollPane scrollPane = new JScrollPane( table );
add( scrollPane, BorderLayout.CENTER);
}
}
TopComponent panel=new HistogramTopComponent();
panel.open();
}
public String getName() {
return bundle.getString("LBL_ShowHistogram");
}
public HelpCtx getHelpCtx() {
return new HelpCtx(getClass());
}
}
/*
* $Log: ShowHistogram.java,v $
* Revision 1.1 2002/09/03 17:50:46 petrul
* Show Histogram
*
*/
Index: Bundle.properties
===================================================================
RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/actions/Bundle.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Bundle.properties 31 Aug 2002 08:39:41 -0000 1.7
--- Bundle.properties 3 Sep 2002 17:50:46 -0000 1.8
***************
*** 61,65 ****
LBL_terminateAction=Terminate
HINT_terminateAction=Terminates listening for the connection from the profiled process.
! LBL_CTAction=Open Call Tree
! LBL_BTAction=Open Backtrace
! LBL_ShowTable=Show Table
\ No newline at end of file
--- 61,64 ----
LBL_terminateAction=Terminate
HINT_terminateAction=Terminates listening for the connection from the profiled process.
! LBL_ShowTable=Show Table
! LBL_ShowHistogram=Show Histogram
|