1   package debugger.gui;
2   
3   import debugger.gui.debugging.MainDebugPanel;
4   import debugger.gui.editor.DocumentEditor;
5   import debugger.gui.resources.ResourceTree;
6   
7   /**
8    * Copyright (c) Ontos AG (http://www.ontosearch.com).
9    * This class is part of JAPE Debugger component for
10   * GATE (Copyright (c) "The University of Sheffield" see http://gate.ac.uk/) <br>
11   * @author Andrey Shafirin, Oleg Mishenko
12   */
13  
14  public class GuiFactory {
15    private static final boolean DEBUG = false;
16    
17      private static debugger.gui.editor.DocumentEditor documentEditor;
18      private static MainDebugPanel debugPanel;
19      private static ResourceTree resourceView;
20  
21      public static ResourceTree getResourceView() {
22          if (resourceView == null) {
23            if (DEBUG)
24              System.out.println("Initializing resources...");
25  
26            long i = System.currentTimeMillis();
27              resourceView = new debugger.gui.resources.ResourceTree();
28              long j = System.currentTimeMillis();
29              if (DEBUG)
30                System.out.println("Time: " + (j - i));
31          }
32          return resourceView;
33      }
34  
35      public static DocumentEditor getDocumentEditor() {
36          if (documentEditor == null) {
37            if (DEBUG)
38              System.out.println("Initializing editor...");
39  
40            long i = System.currentTimeMillis();
41              documentEditor = new DocumentEditor();
42              long j = System.currentTimeMillis();
43              if (DEBUG)
44                System.out.println("Time: " + (j - i));
45          }
46          return documentEditor;
47      }
48  
49      public static MainDebugPanel getDebugPanel() {
50          if (debugPanel == null) {
51            if (DEBUG)
52              System.out.println("Initializing debugging...");
53            
54              long i = System.currentTimeMillis();
55              debugPanel = new MainDebugPanel();
56              long j = System.currentTimeMillis();
57              if (DEBUG)
58                System.out.println("Time: " + (j - i));
59          }
60          return debugPanel;
61      }
62  }
63