1 19 20 package org.netbeans.core.windows.view.ui.toolbars; 21 22 import org.openide.cookies.InstanceCookie; 23 import org.openide.loaders.XMLDataObject; 24 import org.openide.util.WeakListeners; 25 26 import java.io.IOException ; 27 28 33 public class ToolbarProcessor implements XMLDataObject.Processor, InstanceCookie { 34 35 protected XMLDataObject xmlDataObject; 36 37 private ToolbarConfiguration configuration; 38 39 40 public void attachTo (XMLDataObject o) { 41 xmlDataObject = o; 42 } 43 44 47 public String instanceName () { 48 return instanceClass().getName(); 49 } 50 51 54 public Class instanceClass () { 55 return ToolbarConfiguration.class; 56 } 57 58 61 public Object instanceCreate () throws IOException { 62 if (configuration != null) { 63 return configuration; 64 } 65 ToolbarConfiguration tc = new ToolbarConfiguration (xmlDataObject); 66 xmlDataObject.addPropertyChangeListener(WeakListeners.propertyChange ( 67 tc, xmlDataObject 68 )); 69 configuration = tc; 70 return tc; 71 } 72 } 73 74 | Popular Tags |