From: Jan S. <st...@us...> - 2002-02-26 00:47:06
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/actions In directory usw-pr-cvs1:/tmp/cvs-serv7821 Modified Files: Bundle.properties Added Files: SaveSnapshotAction.java CloseSnapshotAction.java Log Message: Save and Close snapshot actions. --- NEW FILE: SaveSnapshotAction.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 java.io.IOException; import javax.swing.Action; import org.openide.TopManager; import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CookieAction; /** * Action that saves selected snapshot. * * @author Jan Stola */ public class SaveSnapshotAction extends CookieAction { protected Class[] cookieClasses() { return new Class[]{SnapshotCookie.class}; } protected int mode() { return MODE_EXACTLY_ONE; } protected void performAction(Node[] nodes) { if (nodes.length!=0) { SnapshotCookie cookie=(SnapshotCookie)nodes[0].getCookie(SnapshotCookie.class); try { cookie.save(); } catch (IOException e) { TopManager.getDefault().notifyException(e); } } } public String getName() { return NbBundle.getMessage(SaveSnapshotAction.class, "LBL_saveSnapshotAction"); } protected String iconResource() { return "/net/sourceforge/javaprofiler/module/resources/SaveSnapshotActionIcon.gif"; } public HelpCtx getHelpCtx() { return new HelpCtx(SaveSnapshotAction.class); } protected void initialize() { super.initialize(); putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(SaveSnapshotAction.class, "HINT_saveSnapshotAction")); } } /* * $Log: SaveSnapshotAction.java,v $ * Revision 1.1 2002/02/26 00:47:03 stolis * Save and Close snapshot actions. * */ --- NEW FILE: CloseSnapshotAction.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 closes selected snapshots. * * @author Jan Stola */ public class CloseSnapshotAction extends CookieAction { protected Class[] cookieClasses() { return new Class[]{SnapshotCookie.class}; } protected int mode() { return MODE_ALL; } protected void performAction(Node[] nodes) { for (int i=0; i<nodes.length; i++) { SnapshotCookie cookie=(SnapshotCookie)nodes[i].getCookie(SnapshotCookie.class); cookie.close(); } } public String getName() { return NbBundle.getMessage(CloseSnapshotAction.class, "LBL_closeSnapshotAction"); } protected String iconResource() { return "/net/sourceforge/javaprofiler/module/resources/CloseSnapshotActionIcon.gif"; } public HelpCtx getHelpCtx() { return new HelpCtx(CloseSnapshotAction.class); } protected void initialize() { super.initialize(); putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(CloseSnapshotAction.class, "HINT_closeSnapshotAction")); } } /* * $Log: CloseSnapshotAction.java,v $ * Revision 1.1 2002/02/26 00:47:03 stolis * Save and Close snapshot actions. * */ Index: Bundle.properties =================================================================== RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/actions/Bundle.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Bundle.properties 27 Jan 2002 23:21:36 -0000 1.2 --- Bundle.properties 26 Feb 2002 00:47:03 -0000 1.3 *************** *** 69,70 **** --- 69,78 ---- HINT_snapshotSessionAction=Creates snapshots of the selected sessions. + + LBL_closeSnapshotAction=Close + + HINT_closeSnapshotAction=Closes selected snapshots. + + HINT_saveSnapshotAction=Saves selected snapshot. + + LBL_saveSnapshotAction=Save |