1 19 package org.netbeans.modules.css.text; 20 21 import java.io.*; 22 import java.awt.event.*; 23 import javax.swing.Timer ; 24 import javax.swing.JEditorPane ; 25 import javax.swing.event.*; 26 import javax.swing.text.*; 27 28 import org.openide.text.EditorSupport; 29 import org.openide.text.Line; 30 import org.openide.windows.*; 31 import org.openide.loaders.*; 32 import org.openide.cookies.*; 33 34 import org.netbeans.modules.css.*; 35 36 42 public class CSSEditorSupport extends EditorSupport { 43 44 public CSSEditorSupport(MultiDataObject.Entry entry) { 45 super (entry); 46 setMIMEType (CSSObject.MIME_TYPE); 47 } 48 49 52 protected CloneableTopComponent createCloneableTopComponent () { 53 prepareDocument (); 55 56 return createCSSEditorComponent(); 57 } 58 59 62 CSSEditorComponent createCSSEditorComponent() { 63 CSSEditorComponent editor = new CSSEditorComponent (findDataObject()); 64 65 Workspace current = WindowManager.getDefault().getCurrentWorkspace(); 67 Mode editorMode = current.findMode (EDITOR_MODE); 68 if (editorMode != null) 69 editorMode.dockInto (editor); 70 71 return editor; 72 } 73 74 76 129 130 public static class CSSEditorComponent extends EditorSupport.Editor { 133 134 CSSEditorSupport support; 135 136 private static final long serialVersionUID = 1997409673385969462L; 137 138 139 public CSSEditorComponent () { 140 super(); 141 } 142 143 144 public CSSEditorComponent (DataObject obj) { 145 super (obj); 146 initialize(); 147 } 148 149 150 private void initialize () { 151 support = (CSSEditorSupport)obj.getCookie (CSSEditorSupport.class); 152 } 153 154 161 165 protected CloneableTopComponent createClonedObject () { 166 return support.createCSSEditorComponent(); 167 } 168 169 170 174 protected void componentActivated () { 175 super.componentActivated(); 176 } 177 178 183 protected void componentDeactivated () { 184 super.componentDeactivated(); 185 } 186 187 190 public void readExternal (ObjectInput in) throws IOException, ClassNotFoundException { 191 super.readExternal (in); 192 initialize(); 193 } 194 } 195 196 } 197 | Popular Tags |