Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module In directory usw-pr-cvs1:/tmp/cvs-serv5269 Modified Files: Bundle.properties Added Files: SnapshotDataObject.java SnapshotDataNode.java SnapshotDataLoaderBeanInfo.java SnapshotDataLoader.java Log Message: Datasystem (loader, data object, node) for snapshots. --- NEW FILE: SnapshotDataObject.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; import java.io.*; import org.openide.TopManager; import org.openide.actions.*; import org.openide.cookies.*; import org.openide.filesystems.FileObject; import org.openide.loaders.*; import org.openide.nodes.*; import org.openide.util.HelpCtx; import net.sourceforge.javaprofiler.jpi.Snapshot; import net.sourceforge.javaprofiler.module.data.ProfilerData; /** * Represents a Snapshot object in the Repository. * * @author Jan Stola */ public class SnapshotDataObject extends MultiDataObject { public SnapshotDataObject(FileObject pf, SnapshotDataLoader loader) throws DataObjectExistsException { super(pf, loader); init(); } private void init() { CookieSet cookies = getCookieSet(); cookies.add(new OpenCookie() { public void open() { ObjectInputStream ois=null; try { ois=new ObjectInputStream(getPrimaryFile().getInputStream()); Snapshot snapshot=(Snapshot)ois.readObject(); ProfilerData.getData().addSnapshot(new net.sourceforge.javaprofiler.module.data.Snapshot(snapshot)); } catch (Exception e) { TopManager.getDefault().notifyException(e); } finally { try { if (ois!=null) ois.close(); } catch (IOException e) {} } } }); } public HelpCtx getHelpCtx() { return new HelpCtx(SnapshotDataObject.class); } protected Node createNodeDelegate() { return new SnapshotDataNode(this); } } /* * $Log: SnapshotDataObject.java,v $ * Revision 1.1 2002/02/26 00:36:00 stolis * Datasystem (loader, data object, node) for snapshots. * */ --- NEW FILE: SnapshotDataNode.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; import org.openide.actions.OpenAction; import org.openide.util.actions.SystemAction; /** * A node to representing snapshot in the Repository. * * @author Jan Stola */ public class SnapshotDataNode extends org.openide.loaders.DataNode { public SnapshotDataNode(SnapshotDataObject obj) { this(obj, org.openide.nodes.Children.LEAF); } public SnapshotDataNode(SnapshotDataObject obj, org.openide.nodes.Children ch) { super(obj, ch); setIconBase("/net/sourceforge/javaprofiler/module/resources/SnapshotDataIcon"); } protected SnapshotDataObject getSnapshotDataObject() { return (SnapshotDataObject) getDataObject(); } public SystemAction getDefaultAction () { return SystemAction.get(OpenAction.class); } } /* * $Log: SnapshotDataNode.java,v $ * Revision 1.1 2002/02/26 00:36:00 stolis * Datasystem (loader, data object, node) for snapshots. * */ --- NEW FILE: SnapshotDataLoaderBeanInfo.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; import java.awt.Image; import java.beans.*; import org.openide.TopManager; import org.openide.util.NbBundle; import org.openide.util.Utilities; /** * Description of {@link SnapshotDataLoader}. * * @author Jan Stola */ public class SnapshotDataLoaderBeanInfo extends SimpleBeanInfo { public BeanInfo[] getAdditionalBeanInfo () { try { return new BeanInfo[] { Introspector.getBeanInfo(SnapshotDataLoader.class.getSuperclass()) }; } catch (IntrospectionException ie) { TopManager.getDefault().getErrorManager().notify(ie); return null; } } public Image getIcon(int type) { if (type==BeanInfo.ICON_COLOR_16x16||type==BeanInfo.ICON_MONO_16x16) { return Utilities.loadImage("/net/sourceforge/javaprofiler/module/resources/SnapshotDataIcon.gif"); } else { return Utilities.loadImage("/net/sourceforge/javaprofiler/module/resources/SnapshotDataIcon32.gif"); } } } /* * $Log: SnapshotDataLoaderBeanInfo.java,v $ * Revision 1.1 2002/02/26 00:36:00 stolis * Datasystem (loader, data object, node) for snapshots. * */ --- NEW FILE: SnapshotDataLoader.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; import java.io.IOException; import org.openide.actions.*; import org.openide.filesystems.*; import org.openide.loaders.*; import org.openide.util.NbBundle; import org.openide.util.actions.SystemAction; /** * Recognizes snapshot files. * * @author Jan Stola */ public class SnapshotDataLoader extends UniFileLoader { public SnapshotDataLoader() { this("net.sourceforge.javaprofiler.module.SnapshotDataObject"); } protected SnapshotDataLoader(String recognizedObjectClass) { super(recognizedObjectClass); } protected String defaultDisplayName() { return NbBundle.getMessage(SnapshotDataLoader.class, "LBL_snapshotLoaderName"); } protected void initialize() { super.initialize(); ExtensionList extensions=new ExtensionList(); extensions.addExtension("snapshot"); setExtensions(extensions); } protected SystemAction[] defaultActions () { return new SystemAction[] { SystemAction.get (OpenAction.class), null, SystemAction.get (CutAction.class), SystemAction.get (CopyAction.class), SystemAction.get (PasteAction.class), null, SystemAction.get (DeleteAction.class), SystemAction.get (RenameAction.class), null, SystemAction.get (ToolsAction.class), SystemAction.get (PropertiesAction.class), }; } protected MultiDataObject createMultiObject (FileObject primaryFile) throws DataObjectExistsException, IOException { return new SnapshotDataObject(primaryFile, this); } } /* * $Log: SnapshotDataLoader.java,v $ * Revision 1.1 2002/02/26 00:36:00 stolis * Datasystem (loader, data object, node) for snapshots. * */ Index: Bundle.properties =================================================================== RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/Bundle.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Bundle.properties 14 Oct 2001 22:15:06 -0000 1.1.1.1 --- Bundle.properties 26 Feb 2002 00:36:00 -0000 1.2 *************** *** 74,75 **** --- 74,80 ---- HINT_alloc=Do you want to collect information about object allocations. LBL_settings=Profiler Settings + + PROP_snapshotOnExit=Snapshot on Exit + + HINT_snapshotOnExit=Create snapshot when session finishes. + LBL_loaderName=Snapshot Objects |