1 19 20 package org.netbeans.modules.applemenu; 21 22 import java.awt.AWTEvent ; 23 import java.awt.Toolkit ; 24 import java.lang.reflect.*; 25 import org.openide.modules.ModuleInstall; 26 27 33 public class Install extends ModuleInstall { 34 private CtrlClickHack listener; 35 36 public void restored () { 37 listener = new CtrlClickHack(); 38 Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK); 39 if (System.getProperty("mrj.version") != null) { FontReferenceQueue.install(); 41 try { 42 Class adapter = Class.forName("org.netbeans.modules.applemenu.NbApplicationAdapter"); 43 Method m = adapter.getDeclaredMethod("install", new Class [0] ); 44 m.invoke(adapter, new Object [0]); 45 } catch (NoClassDefFoundError e) { 46 } catch (ClassNotFoundException e) { 47 } catch (Exception e) { 48 } 49 } 50 } 51 52 public void uninstalled () { 53 if (listener != null) { 54 Toolkit.getDefaultToolkit().removeAWTEventListener(listener); 55 listener = null; 56 } 57 if (System.getProperty("mrj.version") != null) { 59 try { 60 Class adapter = Class.forName("org.netbeans.modules.applemenu.NbApplicationAdapter"); 61 Method m = adapter.getDeclaredMethod("uninstall", new Class [0] ); 62 m.invoke(adapter, new Object [0]); 63 } catch (NoClassDefFoundError e) { 64 } catch (ClassNotFoundException e) { 65 } catch (Exception e) { 66 } 67 } 68 } 69 } 70 | Popular Tags |