From: Jan S. <st...@us...> - 2002-01-27 23:18:28
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/actions In directory usw-pr-cvs1:/tmp/cvs-serv8192 Added Files: SnapshotSessionAction.java SnapshotAction.java Log Message: Snapshot action. --- NEW FILE: SnapshotSessionAction.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 javax.swing.Action; import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CookieAction; /** * Action that creates snapshots of the selected sessions. * * @author Jan Stola */ public class SnapshotSessionAction extends CookieAction { protected Class[] cookieClasses() { return new Class[]{SessionCookie.class}; } protected int mode() { return MODE_ALL; } protected void performAction(Node[] nodes) { for (int i=0; i<nodes.length; i++) { SessionCookie cookie=(SessionCookie)nodes[i].getCookie(SessionCookie.class); cookie.createSnapshot(); } } public String getName() { return NbBundle.getMessage(SnapshotSessionAction.class, "LBL_snapshotSessionAction"); } protected String iconResource() { return "/net/sourceforge/javaprofiler/module/resources/SnapshotSessionActionIcon.gif"; } public HelpCtx getHelpCtx() { return new HelpCtx(SnapshotSessionAction.class); } protected void initialize() { super.initialize(); putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(SnapshotSessionAction.class, "HINT_snapshotSessionAction")); } } /* * $Log: SnapshotSessionAction.java,v $ * Revision 1.1 2002/01/27 23:18:26 stolis * Snapshot action. * */ --- NEW FILE: SnapshotAction.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 javax.swing.Action; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import net.sourceforge.javaprofiler.jpi.Snapshot; import net.sourceforge.javaprofiler.module.data.Session; import net.sourceforge.javaprofiler.module.data.ProfilerData; /** * Action that creates snapshot of the current session. * * @author Jan Stola */ public class SnapshotAction extends CallableSystemAction { public void performAction () { Session session=ProfilerData.getData().currentSession(); if (session!=null) { Snapshot snapshot=session.getVM().createSnapshot(); ProfilerData.getData().addSnapshot(new net.sourceforge.javaprofiler.module.data.Snapshot(snapshot)); } } public String getName () { return NbBundle.getMessage(SnapshotAction.class, "LBL_snapshotAction"); } protected String iconResource () { return "/net/sourceforge/javaprofiler/module/resources/SnapshotActionIcon.gif"; } public HelpCtx getHelpCtx () { return new HelpCtx(SnapshotAction.class); } protected void initialize () { super.initialize(); putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(SnapshotAction.class, "HINT_snapshotAction")); } } /* * $Log: SnapshotAction.java,v $ * Revision 1.1 2002/01/27 23:18:26 stolis * Snapshot action. * */ |