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

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/msg/BufferUpdate.java

#
Java | 147 lines | 42 code | 20 blank | 85 comment | 2 complexity | 3a6988b1d171b91e94ef97a3cc8ee68c 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. * BufferUpdate.java - Buffer update message
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 1999, 2001 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.msg;
  23. import org.gjt.sp.jedit.*;
  24. /**
  25. * Message sent when a buffer-related change occurs.
  26. * @author Slava Pestov
  27. * @version $Id: BufferUpdate.java 12504 2008-04-22 23:12:43Z ezust $
  28. *
  29. * @since jEdit 2.2pre6
  30. */
  31. public class BufferUpdate extends EBMessage
  32. {
  33. //{{{ Message types
  34. /**
  35. * Buffer created.
  36. */
  37. public static final Object CREATED = "CREATED";
  38. /**
  39. * About to be closed
  40. * @since jEdit 4.2pre3
  41. */
  42. public static final Object CLOSING = "CLOSING";
  43. /**
  44. * Buffer load started.
  45. * @since jEdit 2.6pre1
  46. */
  47. public static final Object LOAD_STARTED = "LOAD_STARTED";
  48. /**
  49. * Buffer loaded.
  50. */
  51. public static final Object LOADED = "LOADED";
  52. /**
  53. * Buffer closed.
  54. */
  55. public static final Object CLOSED = "CLOSED";
  56. /**
  57. * Buffer dirty changed.
  58. */
  59. public static final Object DIRTY_CHANGED = "DIRTY_CHANGED";
  60. /**
  61. * Buffer markers changed.
  62. */
  63. public static final Object MARKERS_CHANGED = "MARKERS_CHANGED";
  64. /**
  65. * Buffer saving.
  66. */
  67. public static final Object SAVING = "SAVING";
  68. /**
  69. * Buffer saved.
  70. * @since jEdit 4.0pre4
  71. */
  72. public static final Object SAVED = "SAVED";
  73. /**
  74. * Properties changed.
  75. * @since jEdit 4.1pre1
  76. */
  77. public static final Object PROPERTIES_CHANGED = "PROPERTIES_CHANGED";
  78. //}}}
  79. //{{{ BufferUpdate constructor
  80. /**
  81. * Creates a new buffer update message.
  82. * @param buffer The buffer
  83. * @param what What happened
  84. */
  85. public BufferUpdate(Buffer buffer, View view, Object what)
  86. {
  87. super(buffer);
  88. this.view = view;
  89. if(what == null)
  90. throw new NullPointerException("What must be non-null");
  91. this.what = what;
  92. } //}}}
  93. //{{{ getWhat() method
  94. /**
  95. * Returns what caused this buffer update.
  96. */
  97. public Object getWhat()
  98. {
  99. return what;
  100. } //}}}
  101. //{{{ getBuffer() method
  102. /**
  103. * Returns the buffer involved.
  104. */
  105. public Buffer getBuffer()
  106. {
  107. return (Buffer)getSource();
  108. } //}}}
  109. //{{{ getView() method
  110. /**
  111. * Returns the view involved, which may be null.
  112. */
  113. public View getView()
  114. {
  115. return view;
  116. } //}}}
  117. //{{{ paramString() method
  118. public String paramString()
  119. {
  120. return "what=" + what + ",view=" + view + ","
  121. + super.paramString();
  122. } //}}}
  123. //{{{ Private members
  124. private Object what;
  125. private View view;
  126. //}}}
  127. }