/plugins/ProjectViewer/tags/pv_2_1_3_4/pvdebug/ProjectEventDumper.java

# · Java · 95 lines · 31 code · 10 blank · 54 comment · 2 complexity · 48bb372d82b876e7a9396a8152f80735 MD5 · raw file

  1. /*
  2. * :tabSize=4:indentSize=4:noTabs=false:
  3. * :folding=explicit:collapseFolds=1:
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. package pvdebug;
  20. import java.util.Iterator;
  21. import projectviewer.vpt.VPTFile;
  22. import projectviewer.event.*;
  23. import org.gjt.sp.util.Log;
  24. /**
  25. * Debugging project events.
  26. *
  27. * @author Marcelo Vanzin
  28. * @version $Id: ProjectEventDumper.java 6358 2005-10-01 20:11:52Z vanza $
  29. */
  30. public class ProjectEventDumper implements ProjectListener {
  31. /**
  32. * Method called when a single file has been added to a project. The event
  33. * object will contain a reference to the file, returned by the
  34. * {@link ProjectEvent#getAddedFile() getFile()} method.
  35. *
  36. * @param pe The project event.
  37. */
  38. public void fileAdded(ProjectEvent pe) {
  39. Log.log(Log.ERROR, this, "File added: " + pe.getAddedFile().getFile().getAbsolutePath());
  40. }
  41. /**
  42. * Method called when several files have been added to a project. The event
  43. * object will contain the list of files, returned by the
  44. * {@link ProjectEvent#getAddedFiles() getFiles()} method.
  45. *
  46. * @param pe The project event.
  47. */
  48. public void filesAdded(ProjectEvent pe) {
  49. Log.log(Log.ERROR, this, "Multiple files added!");
  50. for (Iterator i = pe.getAddedFiles().iterator(); i.hasNext(); ) {
  51. Log.log(Log.ERROR, this, "File added: " + ((VPTFile)i.next()).getFile().getAbsolutePath());
  52. }
  53. }
  54. /**
  55. * Method called when a single file has been removed from a project.
  56. *
  57. * @param pe The project event.
  58. */
  59. public void fileRemoved(ProjectEvent pe) {
  60. Log.log(Log.ERROR, this, "File removed: " + pe.getRemovedFile().getFile().getAbsolutePath());
  61. }
  62. /**
  63. * Method called when more than one file have been removed from a project.
  64. *
  65. * @param pe The project event.
  66. */
  67. public void filesRemoved(ProjectEvent pe) {
  68. Log.log(Log.ERROR, this, "Multiple files removed!");
  69. for (Iterator i = pe.getRemovedFiles().iterator(); i.hasNext(); ) {
  70. Log.log(Log.ERROR, this, "File removed: " + ((VPTFile)i.next()).getFile().getAbsolutePath());
  71. }
  72. }
  73. /**
  74. * Method called when project properties (such as name and root) have
  75. * changed.
  76. *
  77. * @param pe The project event.
  78. */
  79. public void propertiesChanged(ProjectEvent pe) {
  80. Log.log(Log.ERROR, this, "Project properties changed.");
  81. }
  82. public void nodeSelected(ProjectViewerEvent evt) {
  83. Log.log(Log.ERROR, this, "node selected: " + evt.getNode());
  84. }
  85. }