1 19 package org.netbeans.modules.xml.text; 20 21 import org.openide.modules.ModuleInstall; 22 import org.openide.text.PrintSettings; 23 import org.openide.options.SystemOption; 24 import org.openide.util.*; 25 26 import org.netbeans.editor.Settings; 27 28 import org.netbeans.modules.xml.text.syntax.XMLPrintOptions; 29 import org.netbeans.modules.xml.text.syntax.DTDPrintOptions; 30 import org.netbeans.modules.xml.text.syntax.XMLSettingsInitializer; 31 32 37 public class TextEditModuleInstall extends ModuleInstall { 38 39 public void installed() { 40 restored(); 41 } 42 43 45 public void restored () { 46 restoredTextEditor(); 47 } 48 49 51 public void uninstalled () { 52 uninstalledTextEditor(); 53 } 54 55 57 public void restoredTextEditor () { 58 Settings.addInitializer (new XMLSettingsInitializer()); 60 61 PrintSettings ps = (PrintSettings)PrintSettings.findObject (PrintSettings.class, true); 63 ps.addOption ((XMLPrintOptions)XMLPrintOptions.findObject(XMLPrintOptions.class, true)); 64 ps.addOption ((DTDPrintOptions)DTDPrintOptions.findObject(DTDPrintOptions.class, true)); 65 } 66 67 69 public void uninstalledTextEditor () { 70 PrintSettings ps = (PrintSettings) PrintSettings.findObject (PrintSettings.class, true); 72 73 SystemOption opt = (SystemOption) SystemOption.findObject (XMLPrintOptions.class, false); 74 if (opt != null) 75 ps.removeOption (opt); 76 77 opt = (SystemOption) SystemOption.findObject (DTDPrintOptions.class, false); 78 if (opt != null) 79 ps.removeOption (opt); 80 81 Settings.removeInitializer (XMLSettingsInitializer.NAME); 83 } 84 85 } 86 | Popular Tags |