/plugins/ProjectViewer/tags/pv_2_0_2/projectviewer/event/ProjectViewerEvent.java

# · Java · 92 lines · 25 code · 11 blank · 56 comment · 0 complexity · 38dcb20137ca8b088d2b629ac68fbeb1 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 detaProjectTreeSelectionListenerils.
  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 projectviewer.event;
  20. import java.util.EventObject;
  21. import projectviewer.ProjectViewer;
  22. import projectviewer.vpt.VPTProject;
  23. /**
  24. * A project viewer event.
  25. *
  26. * @author Dale Anson, Marcelo Vanzin
  27. * @version $Id: ProjectViewerEvent.java 6120 2003-03-04 22:25:35Z vanza $
  28. */
  29. public final class ProjectViewerEvent extends EventObject {
  30. //{{{ Private Members
  31. private VPTProject project;
  32. private ProjectViewer viewer;
  33. //}}}
  34. /**
  35. * Create a new <code>ProjectViewerEvent</code>.
  36. *
  37. * @param src the project viewer instance that fired the event.
  38. * @param prj the project loaded (null if "All Projects").
  39. */
  40. public ProjectViewerEvent(ProjectViewer src, VPTProject prj) {
  41. this(src, src, prj);
  42. }
  43. /**
  44. * Create a new <code>ProjectViewerEvent</code>.
  45. *
  46. * @param src the project viewer instance that fired the event.
  47. * @param prj the project loaded (null if "All Projects").
  48. */
  49. public ProjectViewerEvent(Object src, VPTProject prj) {
  50. this(src, (src instanceof ProjectViewer) ? (ProjectViewer) src : null, prj);
  51. }
  52. /**
  53. * Create a new <code>ProjectViewerEvent</code>.
  54. *
  55. * @param src the project viewer instance that fired the event.
  56. * @param prj the project loaded (null if "All Projects").
  57. */
  58. public ProjectViewerEvent(Object src, ProjectViewer viewer, VPTProject prj) {
  59. super(src);
  60. this.viewer = viewer;
  61. project = prj;
  62. }
  63. /**
  64. * Returns the {@link ProjectViewer}.
  65. *
  66. * @return The viewer where the event occurred.
  67. */
  68. public ProjectViewer getProjectViewer() {
  69. return viewer;
  70. }
  71. /**
  72. * Returns the {@link VPTProject Project}. It is important to noticed that
  73. * this value can be <code>null</code>, which means that the "All Projects"
  74. * mode has been activated.
  75. *
  76. * @return The activated project, or null if "All Projects" was chosen.
  77. */
  78. public VPTProject getProject() {
  79. return project;
  80. }
  81. }