Changeset 137


Ignore:
Timestamp:
07/29/11 14:32:08 (13 years ago)
Author:
jhall
Message:

Console waits for DlgSequences? being disposed to avoid inconsistent data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowSequences.java

    r135 r137  
    33import java.security.InvalidParameterException; 
    44import java.util.List; 
     5import java.util.concurrent.Semaphore; 
    56 
    67import de.ugoe.cs.eventbench.swing.DlgSequences; 
     
    1112 
    1213public class CMDshowSequences implements Command { 
    13          
     14 
    1415        public void help() { 
    1516                Console.println("Usage: showSequences"); 
    1617        } 
    17          
     18 
    1819        @SuppressWarnings("unchecked") 
    1920        public void run(List<Object> parameters) { 
    20                  
    21                 if(parameters.size() > 0) throw new InvalidParameterException(); 
    22                          
    23                  
     21 
     22                if (parameters.size() > 0) 
     23                        throw new InvalidParameterException(); 
     24 
    2425                List<List<Event<?>>> containedSequences = null; 
    25                  
     26 
    2627                try { 
    27                         containedSequences = (List<List<Event<?>>>) GlobalDataContainer.getInstance().getData("sequences"); 
    28                 } 
    29                 catch(ClassCastException e) { 
     28                        containedSequences = (List<List<Event<?>>>) GlobalDataContainer 
     29                                        .getInstance().getData("sequences"); 
     30                } catch (ClassCastException e) { 
    3031                        Console.println("Not able to cast Data in GlobalDataContainer to List of Sequences"); 
    3132                } 
    32                  
    33                 if(containedSequences == null) Console.printerrln("No sequences found."); 
    34                 else DlgSequences.showDialog();  
     33 
     34                if (containedSequences == null) { 
     35                        Console.printerrln("No sequences found."); 
     36                } else { 
     37 
     38                        DlgSequences.showDialog(); 
     39 
     40                        synchronized (Console.getInstance()) { 
     41                                try { 
     42                                        Console.getInstance().wait(); 
     43                                } catch (InterruptedException e) { 
     44                                        e.printStackTrace(); 
     45                                } 
     46                        } 
     47                } 
    3548        } 
    3649} 
Note: See TracChangeset for help on using the changeset viewer.