PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/msg/BufferUpdate.java

#
Java | 153 lines | 43 code | 22 blank | 88 comment | 2 complexity | 5e26094b231ca73b365a0bf378d6549e 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 4013 2002-02-05 06:28:10Z $
  28. *
  29. * @since jEdit 2.2pre6
  30. */
  31. public class BufferUpdate extends EBMessage.NonVetoable
  32. {
  33. //{{{ Message types
  34. /**
  35. * Buffer created.
  36. */
  37. public static final Object CREATED = "CREATED";
  38. /**
  39. * Buffer load started.
  40. * @since jEdit 2.6pre1
  41. */
  42. public static final Object LOAD_STARTED = "LOAD_STARTED";
  43. /**
  44. * Buffer loaded.
  45. */
  46. public static final Object LOADED = "LOADED";
  47. /**
  48. * Buffer closed.
  49. */
  50. public static final Object CLOSED = "CLOSED";
  51. /**
  52. * Buffer dirty changed.
  53. */
  54. public static final Object DIRTY_CHANGED = "DIRTY_CHANGED";
  55. /**
  56. * Buffer markers changed.
  57. */
  58. public static final Object MARKERS_CHANGED = "MARKERS_CHANGED";
  59. /**
  60. * Buffer mode changed.
  61. */
  62. public static final Object MODE_CHANGED = "MODE_CHANGED";
  63. /**
  64. * Character encoding changed.
  65. * @since jEdit 3.2pre4
  66. */
  67. public static final Object ENCODING_CHANGED = "ENCODING_CHANGED";
  68. /**
  69. * Fold handler changed.
  70. * @since jEdit 4.0pre1
  71. */
  72. public static final Object FOLD_HANDLER_CHANGED = "FOLD_HANDLER_CHANGED";
  73. /**
  74. * Buffer saving.
  75. */
  76. public static final Object SAVING = "SAVING";
  77. /**
  78. * Buffer saved.
  79. * @since jEdit 4.0pre4
  80. */
  81. public static final Object SAVED = "SAVED";
  82. //}}}
  83. //{{{ BufferUpdate constructor
  84. /**
  85. * Creates a new buffer update message.
  86. * @param buffer The buffer
  87. * @param what What happened
  88. */
  89. public BufferUpdate(Buffer buffer, View view, Object what)
  90. {
  91. super(buffer);
  92. this.view = view;
  93. if(what == null)
  94. throw new NullPointerException("What must be non-null");
  95. this.what = what;
  96. } //}}}
  97. //{{{ getWhat() method
  98. /**
  99. * Returns what caused this buffer update.
  100. */
  101. public Object getWhat()
  102. {
  103. return what;
  104. } //}}}
  105. //{{{ getBuffer() method
  106. /**
  107. * Returns the buffer involved.
  108. */
  109. public Buffer getBuffer()
  110. {
  111. return (Buffer)getSource();
  112. } //}}}
  113. //{{{ getView() method
  114. /**
  115. * Returns the view involved, which may be null.
  116. */
  117. public View getView()
  118. {
  119. return view;
  120. } //}}}
  121. //{{{ paramString() method
  122. public String paramString()
  123. {
  124. return super.paramString() + ",what=" + what
  125. + ",view=" + view;
  126. } //}}}
  127. //{{{ Private members
  128. private Object what;
  129. private View view;
  130. //}}}
  131. }