PageRenderTime 1084ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/util/WorkRequest.java

#
Java | 70 lines | 28 code | 5 blank | 37 comment | 4 complexity | 890c2a312009532fda90e98e35fa099e 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. * WorkRequest.java - Runnable subclass
  3. * Copyright (C) 2000 Slava Pestov
  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 org.gjt.sp.util;
  20. /**
  21. * A subclass of the Runnable interface.
  22. * @since jEdit 2.6pre1
  23. */
  24. public abstract class WorkRequest implements Runnable
  25. {
  26. /**
  27. * Sets if the request can be aborted.
  28. */
  29. public void setAbortable(boolean abortable)
  30. {
  31. Thread thread = Thread.currentThread();
  32. if(thread instanceof WorkThread)
  33. ((WorkThread)thread).setAbortable(abortable);
  34. }
  35. /**
  36. * Sets the status text.
  37. * @param status The status text
  38. */
  39. public void setStatus(String status)
  40. {
  41. Thread thread = Thread.currentThread();
  42. if(thread instanceof WorkThread)
  43. ((WorkThread)thread).setStatus(status);
  44. }
  45. /**
  46. * Sets the progress value.
  47. * @param status The progress value.
  48. */
  49. public void setProgressValue(int value)
  50. {
  51. Thread thread = Thread.currentThread();
  52. if(thread instanceof WorkThread)
  53. ((WorkThread)thread).setProgressValue(value);
  54. }
  55. /**
  56. * Sets the maximum progress value.
  57. * @param status The progress value.
  58. */
  59. public void setProgressMaximum(int value)
  60. {
  61. Thread thread = Thread.currentThread();
  62. if(thread instanceof WorkThread)
  63. ((WorkThread)thread).setProgressMaximum(value);
  64. }
  65. }