1 19 20 package org.netbeans.modules.java.editor; 21 22 import java.beans.PropertyChangeListener ; 23 import java.beans.PropertyChangeSupport ; 24 import java.util.HashMap ; 25 import java.util.Map ; 26 import org.netbeans.editor.BaseDocument; 27 import org.netbeans.editor.LocaleSupport; 28 import org.netbeans.editor.Settings; 29 import org.netbeans.editor.SettingsChangeListener; 30 import org.netbeans.editor.SettingsNames; 31 import org.netbeans.editor.ext.java.JavaSettingsInitializer; 32 import org.netbeans.editor.ext.java.JavaSettingsNames; 33 import org.netbeans.modules.editor.FormatterIndentEngine; 34 import org.netbeans.modules.editor.NbEditorDocument; 35 import org.netbeans.modules.editor.java.JavaIndentEngine; 36 import org.netbeans.modules.editor.java.JavaKit; 37 import org.netbeans.modules.editor.java.NbJavaSettingsInitializer; 38 import org.netbeans.modules.editor.NbLocalizer; 39 import org.netbeans.modules.editor.options.BaseOptions; 40 import org.netbeans.modules.java.editor.options.JavaPrintOptions; 41 import org.netbeans.modules.java.editor.options.JavaOptions; 42 import org.openide.modules.ModuleInstall; 45 import org.openide.options.SystemOption; 46 import org.openide.text.IndentEngine; 47 import org.openide.text.PrintSettings; 48 import org.openide.util.SharedClassObject; 49 50 55 public class JavaEditorModule extends ModuleInstall { 56 57 private NbLocalizer settingsNamesLocalizer; 58 private NbLocalizer optionsLocalizer; 59 static boolean inited = false; 61 62 public static void init(){ 63 if (inited) return; 64 inited = true; 65 Settings.addInitializer(new JavaSettingsInitializer(JavaKit.class)); 66 Settings.addInitializer(new NbJavaSettingsInitializer()); 67 Settings.reset(); 68 } 69 70 71 public void restored () { 72 init(); 73 74 PrintSettings ps = (PrintSettings) SharedClassObject.findObject(PrintSettings.class, true); 75 ps.addOption((SystemOption)SharedClassObject.findObject(JavaPrintOptions.class, true)); 76 77 79 settingsNamesLocalizer = new NbLocalizer(JavaSettingsNames.class); 80 optionsLocalizer = new NbLocalizer(JavaOptions.class); 81 LocaleSupport.addLocalizer(settingsNamesLocalizer); 82 LocaleSupport.addLocalizer(optionsLocalizer); 83 88 } 89 90 91 public void uninstalled() { 92 93 99 PrintSettings ps = (PrintSettings) SharedClassObject.findObject(PrintSettings.class, true); 101 ps.removeOption((SystemOption)SharedClassObject.findObject(JavaPrintOptions.class, true)); 102 103 105 Settings.removeInitializer(JavaSettingsInitializer.NAME); 106 Settings.removeInitializer(NbJavaSettingsInitializer.NAME); 107 Settings.reset(); 108 109 LocaleSupport.removeLocalizer(settingsNamesLocalizer); 110 settingsNamesLocalizer = null; 111 LocaleSupport.removeLocalizer(optionsLocalizer); 112 optionsLocalizer = null; 113 114 } 115 116 } 204 | Popular Tags |