Index: openide/options/src/org/openide/options/ContextSystemOption.java =================================================================== RCS file: /cvs/openide/options/src/org/openide/options/ContextSystemOption.java,v retrieving revision 1.4 diff -u -r1.4 ContextSystemOption.java --- openide/options/src/org/openide/options/ContextSystemOption.java 28 Oct 2006 21:57:34 -0000 1.4 +++ openide/options/src/org/openide/options/ContextSystemOption.java 13 May 2007 07:05:38 -0000 @@ -161,7 +161,12 @@ // deserialization of its children. They can belong to disabled // or removed modules. try { - c.add(m.get()); + Object child = m.get(); + if (child instanceof SystemOption) { + c.add(child); + } else { + Logger.getLogger(ContextSystemOption.class.getName()).warning("Not a SystemOption, ignoring: " + child); //NOI18N + } } catch (Exception e) { Logger.getLogger(ContextSystemOption.class.getName()).log(Level.WARNING, null, e); } catch (LinkageError e) { Index: openide/util/src/org/openide/util/SharedClassObject.java =================================================================== RCS file: /cvs/openide/util/src/org/openide/util/SharedClassObject.java,v retrieving revision 1.10 diff -u -r1.10 SharedClassObject.java --- openide/util/src/org/openide/util/SharedClassObject.java 20 Sep 2006 05:49:40 -0000 1.10 +++ openide/util/src/org/openide/util/SharedClassObject.java 13 May 2007 07:05:38 -0000 @@ -659,7 +659,7 @@ private String name; /** shared instance */ - private transient SharedClassObject object; + private transient Object object; /** Constructor. * @param the instance @@ -676,7 +676,7 @@ throws IOException { oos.defaultWriteObject(); - object.writeExternal(oos); + ((SharedClassObject) object).writeExternal(oos); } /** Read object. @@ -696,13 +696,28 @@ } } - object = findObject(clazz, true); - object.inReadExternal = true; + if (SharedClassObject.class.isAssignableFrom(clazz)) { + SharedClassObject sco = findObject(clazz, true); + sco.inReadExternal = true; - try { - object.readExternal(ois); - } finally { - object.inReadExternal = false; + try { + sco.readExternal(ois); + } finally { + sco.inReadExternal = false; + } + + object = sco; + } else { + // The class is no more SharedClassObject, fall back to a standard + // deserialization. We are probably deserializing a legacy object + // that does not wish to be SharedClassObject anymore. + try { + object = clazz.newInstance(); + } catch (Exception e) { + IOException ioe = new IOException(); + ioe.initCause(e); + throw ioe; + } } } @@ -711,10 +726,9 @@ * is necessary for achieving back compatability of certain types of settings etc. */ private Object readResolve() throws ObjectStreamException { - SharedClassObject resolved = object; Method resolveMethod = findReadResolveMethod(object.getClass()); - + if (resolveMethod != null) { // invoke resolve method and accept its result try { @@ -731,7 +745,7 @@ } } - return resolved; + return object; } /** Tries to find readResolve method in given class. Finds Index: html/editor/src/org/netbeans/modules/html/editor/HTMLEditorModule.java =================================================================== RCS file: /cvs/html/editor/src/org/netbeans/modules/html/editor/HTMLEditorModule.java,v retrieving revision 1.5 diff -u -r1.5 HTMLEditorModule.java --- html/editor/src/org/netbeans/modules/html/editor/HTMLEditorModule.java 30 Nov 2006 15:45:29 -0000 1.5 +++ html/editor/src/org/netbeans/modules/html/editor/HTMLEditorModule.java 13 May 2007 07:05:39 -0000 @@ -21,14 +21,9 @@ import org.netbeans.editor.Settings; import org.netbeans.editor.ext.html.HTMLSettingsInitializer; -import org.netbeans.modules.editor.NbLocalizer; import org.netbeans.modules.editor.html.HTMLKit; import org.netbeans.modules.editor.html.NbHTMLSettingsInitializer; -import org.netbeans.modules.html.editor.options.HTMLPrintOptions; import org.openide.modules.ModuleInstall; -import org.openide.options.SystemOption; -import org.openide.text.PrintSettings; -import org.openide.util.SharedClassObject; /** * Module installation class for editor. @@ -37,13 +32,8 @@ */ public class HTMLEditorModule extends ModuleInstall { - private NbLocalizer optionsLocalizer; - /** Module installed again. */ public void restored () { - PrintSettings ps = (PrintSettings) SharedClassObject.findObject(PrintSettings.class, true); - ps.addOption((SystemOption)SharedClassObject.findObject(HTMLPrintOptions.class, true)); - Settings.addInitializer(new HTMLSettingsInitializer(HTMLKit.class)); Settings.addInitializer(new NbHTMLSettingsInitializer()); Settings.reset(); @@ -51,14 +41,9 @@ /** Called when module is uninstalled. Overrides superclass method. */ public void uninstalled() { - // Options - PrintSettings ps = (PrintSettings) SharedClassObject.findObject(PrintSettings.class, true); - ps.removeOption((SystemOption)SharedClassObject.findObject(HTMLPrintOptions.class, true)); - Settings.removeInitializer(HTMLSettingsInitializer.NAME); Settings.removeInitializer(NbHTMLSettingsInitializer.NAME); Settings.reset(); - } Index: html/editor/src/org/netbeans/modules/html/editor/options/HTMLPrintOptions.java =================================================================== RCS file: /cvs/html/editor/src/org/netbeans/modules/html/editor/options/HTMLPrintOptions.java,v retrieving revision 1.4 diff -u -r1.4 HTMLPrintOptions.java --- html/editor/src/org/netbeans/modules/html/editor/options/HTMLPrintOptions.java 30 Jun 2006 19:36:39 -0000 1.4 +++ html/editor/src/org/netbeans/modules/html/editor/options/HTMLPrintOptions.java 13 May 2007 07:05:39 -0000 @@ -19,8 +19,8 @@ package org.netbeans.modules.html.editor.options; -import org.netbeans.modules.editor.html.HTMLKit; -import org.netbeans.modules.editor.options.BasePrintOptions; +import java.io.IOException; +import java.io.ObjectStreamException; /** * Options for the java editor kit @@ -28,29 +28,32 @@ * @author Miloslav Metelka * @version 1.00 */ -public class HTMLPrintOptions extends BasePrintOptions { +public class HTMLPrintOptions { public static final String HTML = "html"; // NOI18N static final long serialVersionUID =5891998739446259286L; public HTMLPrintOptions() { - this(HTMLKit.class, HTML); } public HTMLPrintOptions(Class kitClass, String typeName) { - super(kitClass, typeName); } - /** - * Get localized string - */ - protected String getString(String key) { - try { - return org.openide.util.NbBundle.getMessage(HTMLOptions.class, key); - } catch (java.util.MissingResourceException e) { - return super.getString(key); - } + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + // no-op } - + + private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { + // no-op + } + + private Object writeReplace() throws ObjectStreamException { + return null; + } + + private Object readResolve() throws ObjectStreamException { + return null; + } + }