1 6 7 package org.netbeans.modules.logger; 8 9 import org.netbeans.modules.logger.listeners.ListenerTools; 10 import org.netbeans.modules.logger.listeners.TCRPropertyListener; 11 import org.netbeans.modules.logger.listeners.WMPropertyListener; 12 import org.openide.modules.ModuleInstall; 13 import org.openide.windows.TopComponent; 14 import org.openide.windows.WindowManager; 15 16 17 18 19 24 public class Main extends ModuleInstall{ 25 26 TCRPropertyListener tcr; 27 WMPropertyListener wm; 28 31 public Waiter waiter; 32 33 static String name; 34 static String level; 35 36 39 public void restored(){ 40 41 try{ 42 if(!ListenerTools.findOutProperties()){ 44 new UserInput(this).setVisible(true); 45 waiter = new Waiter(); 46 new Thread (waiter).start(); 47 waiter.makeMeWait(); 48 } 49 }catch(Exception e){ 50 ListenerTools.logError(e); 51 }catch(Error e){ 52 ListenerTools.logError(e); 53 } 54 55 57 try{ 59 tcr = new TCRPropertyListener(); 60 TopComponent.Registry r=WindowManager.getDefault().getRegistry(); 61 r.addPropertyChangeListener(tcr); 62 }catch(Exception e){ 63 ListenerTools.logError(e); 64 }catch(Error e){ 65 ListenerTools.logError(e); 66 } 67 68 try{ 70 wm = new WMPropertyListener(); 71 WindowManager.getDefault().addPropertyChangeListener(wm); 72 }catch(Exception e){ 73 ListenerTools.logError(e); 74 }catch(Error e){ 75 ListenerTools.logError(e); 76 } 77 78 try{ 82 new Zipper().zipUIExceptCurrent(); 83 }catch(Exception e){ 84 ListenerTools.logError(e); 85 }catch(Error e){ 86 ListenerTools.logError(e); 87 } 88 } 89 90 95 public boolean closing(){ 96 try{ 97 new Zipper().zipUI(); 98 }catch(Exception e){ 99 ListenerTools.logError(e); 100 }catch(Error e){ 101 ListenerTools.logError(e); 102 } 103 return true; 104 } 105 106 107 110 public void installed() { 111 this.restored(); 112 } 113 114 117 public void wakeUp(){ 118 waiter.wakeUp(); 119 } 120 121 122 } 123 | Popular Tags |