PageRenderTime 38ms CodeModel.GetById 33ms app.highlight 3ms RepoModel.GetById 1ms 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
 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
20package org.gjt.sp.util;
21
22/**
23 * A subclass of the Runnable interface.
24 * @since jEdit 2.6pre1
25 */
26public abstract class WorkRequest implements Runnable
27{
28	/**
29	 * Sets if the request can be aborted.
30	 */
31	public void setAbortable(boolean abortable)
32	{
33		Thread thread = Thread.currentThread();
34		if(thread instanceof WorkThread)
35			((WorkThread)thread).setAbortable(abortable);
36	}
37
38	/**
39	 * Sets the status text.
40	 * @param status The status text
41	 */
42	public void setStatus(String status)
43	{
44		Thread thread = Thread.currentThread();
45		if(thread instanceof WorkThread)
46			((WorkThread)thread).setStatus(status);
47	}
48
49	/**
50	 * Sets the progress value.
51	 * @param status The progress value.
52	 */
53	public void setProgressValue(int value)
54	{
55		Thread thread = Thread.currentThread();
56		if(thread instanceof WorkThread)
57			((WorkThread)thread).setProgressValue(value);
58	}
59
60	/**
61	 * Sets the maximum progress value.
62	 * @param status The progress value.
63	 */
64	public void setProgressMaximum(int value)
65	{
66		Thread thread = Thread.currentThread();
67		if(thread instanceof WorkThread)
68			((WorkThread)thread).setProgressMaximum(value);
69	}
70}