PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/org/gjt/sp/jedit/EBMessage.java

#
Java | 98 lines | 28 code | 7 blank | 63 comment | 0 complexity | f77597e631af8ed9c2ad73a9ac520ac0 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * EBMessage.java - An EditBus message
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 1999, 2002 Slava Pestov
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package org.gjt.sp.jedit;
  23. /**
  24. * The base class of all EditBus messages.<p>
  25. *
  26. * Message classes extending this class typically add
  27. * other data members and methods to provide subscribers with whatever is
  28. * needed to handle the message appropriately.<p>
  29. *
  30. * Message types sent by jEdit can be found in the
  31. * {@link org.gjt.sp.jedit.msg} package.
  32. *
  33. * @author Slava Pestov
  34. * @author John Gellene (API documentation)
  35. * @version $Id: EBMessage.java 5167 2005-01-09 01:47:38Z spestov $
  36. *
  37. * @since jEdit 2.2pre6
  38. */
  39. public abstract class EBMessage
  40. {
  41. //{{{ EBMessage constructor
  42. /**
  43. * Creates a new message.
  44. * @param source The message source
  45. * @since jEdit 4.2pre1
  46. */
  47. public EBMessage(Object source)
  48. {
  49. this.source = source;
  50. } //}}}
  51. //{{{ EBMessage constructor
  52. /**
  53. * Creates a new message.
  54. * @param source The message source
  55. */
  56. public EBMessage(EBComponent source)
  57. {
  58. this.source = source;
  59. } //}}}
  60. //{{{ getSource() method
  61. /**
  62. * Returns the sender of this message.
  63. * @since jEdit 4.2pre1
  64. */
  65. public Object getSource()
  66. {
  67. return source;
  68. } //}}}
  69. //{{{ toString() method
  70. /**
  71. * Returns a string representation of this message.
  72. */
  73. public String toString()
  74. {
  75. String className = getClass().getName();
  76. int index = className.lastIndexOf('.');
  77. return className.substring(index + 1)
  78. + "[" + paramString() + "]";
  79. } //}}}
  80. //{{{ paramString() method
  81. /**
  82. * Returns a string representation of this message's parameters.
  83. */
  84. public String paramString()
  85. {
  86. return "source=" + source;
  87. } //}}}
  88. //{{{ Private members
  89. private Object source;
  90. //}}}
  91. }