Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
6   50   3   6
2   17   0.5   1
1     3  
1    
 
  GuiTask       Line # 27 6 0% 3 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Aug 11, 2008
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10    * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11    * or implied. See the License for the specific language governing permissions and limitations under
12    * the License.
13    *
14    * Copyright @2008-2010 the original author or authors.
15    */
16    package org.fest.swing.edt;
17   
18    import static javax.swing.SwingUtilities.isEventDispatchThread;
19   
20    import org.fest.swing.exception.ActionFailedException;
21   
22    /**
23    * Understands a task that should be executed in the event dispatch thread.
24    *
25    * @author Alex Ruiz
26    */
 
27    public abstract class GuiTask extends GuiAction {
28   
29    /**
30    * Runs this task action and verifies that it is executed in the event dispatch thread.
31    * @throws ActionFailedException if this task is not executed in the event dispatch thread.
32    */
 
33  11132 toggle public final void run() {
34  11132 if (!isEventDispatchThread())
35  1 throw ActionFailedException.actionFailure("Task should be executed in the event dispatch thread");
36  11131 try {
37  11131 executeInEDT();
38    } catch (Throwable t) {
39  120 catchedException(t);
40    } finally {
41  11131 notifyExecutionCompleted();
42    }
43    }
44   
45    /**
46    * Specifies the action to execute in the event dispatch thread.
47    * @throws Throwable any error thrown when executing an action in the event dispatch thread.
48    */
49    protected abstract void executeInEDT() throws Throwable;
50    }