1 19 20 package org.netbeans.modules.editor.options; 21 22 import java.io.IOException ; 23 import java.io.ObjectInput ; 24 import java.util.List ; 25 import java.util.HashMap ; 26 import org.netbeans.editor.Settings; 27 import org.openide.options.ContextSystemOption; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 import org.openide.text.PrintSettings; 31 import org.netbeans.editor.EditorState; 32 33 40 public class AllOptions extends ContextSystemOption { 41 42 static final long serialVersionUID =-5703125420292694573L; 43 44 private static final String HELP_ID = "editing.global"; 46 private transient BaseOptions baseOptions 48 = (BaseOptions)BaseOptions.findObject(BaseOptions.class, true); 49 50 53 public AllOptions() { 54 Settings.addInitializer(baseOptions.getSettingsInitializer(), 57 Settings.OPTION_LEVEL); 58 } 59 60 65 public void init() { 66 refreshContextListeners(); 67 } 68 69 private void refreshContextListeners() { 70 PrintSettings ps = (PrintSettings) PrintSettings.findObject(PrintSettings.class, true); 71 ContextOptionsListener.processExistingAndListen(ps); 73 ContextOptionsListener.processExistingAndListen(this); 74 } 75 76 public String displayName() { 77 return NbBundle.getBundle(AllOptions.class).getString("OPTIONS_all"); } 79 80 public HelpCtx getHelpCtx () { 81 return new HelpCtx (HELP_ID); 82 } 83 84 public List getKeyBindingList() { 85 return baseOptions.getKeyBindingList(); 86 } 87 88 public void setKeyBindingList(List list) { 89 baseOptions.setKeyBindingList(list); 90 } 91 92 public int getOptionsVersion() { 93 return baseOptions.getOptionsVersion(); 94 } 95 96 public void setOptionsVersion(int optionsVersion) { 97 baseOptions.setOptionsVersion(optionsVersion); 98 } 99 100 public HashMap getEditorState() { 101 return EditorState.getStateObject(); 102 } 103 104 public void setEditorState( HashMap stateObject ) { 105 EditorState.setStateObject( stateObject ); 106 } 107 108 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 109 116 baseOptions.setOptionsVersion(0); 117 118 super.readExternal(in); 119 120 int ov = baseOptions.getOptionsVersion(); 122 if (ov < BaseOptions.LATEST_OPTIONS_VERSION) { 123 baseOptions.upgradeOptions(ov, BaseOptions.LATEST_OPTIONS_VERSION); 124 } 125 126 baseOptions.setOptionsVersion(BaseOptions.LATEST_OPTIONS_VERSION); 128 129 refreshContextListeners(); 131 } 132 133 } 134 | Popular Tags |