1 19 20 package org.netbeans.modules.gsf.browser; 21 22 import javax.swing.event.ChangeEvent ; 23 import javax.swing.event.ChangeListener ; 24 import javax.swing.text.JTextComponent ; 25 import org.netbeans.editor.Registry; 26 import org.openide.modules.ModuleInstall; 27 28 32 public class ModuleInstaller extends ModuleInstall { 33 34 private static ChangeListener listener; 36 37 public void restored() { 38 assert listener == null; 39 listener = new ChangeListener () { 40 public void stateChanged(ChangeEvent e) { 41 HighlightSections.getDefault().install(Registry.getMostActiveComponent()); 42 } 43 }; 44 Registry.addChangeListener(listener); 45 46 JTextComponent component = Registry.getMostActiveComponent(); 49 if (component != null) { 50 HighlightSections.getDefault().install(component); 51 } 52 } 53 54 public void uninstalled() { 55 Registry.removeChangeListener(listener); 56 listener = null; 57 HighlightSections.getDefault().uninstall(); 58 } 59 } 60 | Popular Tags |