1 19 20 21 package org.openide.text; 22 23 24 import java.beans.PropertyChangeListener ; 25 import java.beans.VetoableChangeListener ; 26 import java.io.FileInputStream ; 27 import java.io.FileOutputStream ; 28 import java.io.InputStream ; 29 import java.io.IOException ; 30 import java.io.OutputStream ; 31 import java.io.StringBufferInputStream ; 32 import java.util.Date ; 33 34 import org.openide.text.CloneableEditorSupport; 35 import org.openide.text.CloneableEditor; 36 import org.openide.text.Line; 37 import org.openide.windows.CloneableOpenSupport; 38 import org.openide.windows.CloneableTopComponent; 39 40 41 48 public class EmptyCESHidden extends CloneableEditorSupport { 49 50 private Line.Set pls; 51 52 public EmptyCESHidden(CloneableEditorSupport.Env env) { 53 super (env); 54 pls = getLineSet(); 55 } 56 57 60 protected CloneableTopComponent createCloneableTopComponent() { 61 prepareDocument (); 63 64 Thread tstThread = new Thread 65 (new Runnable () { 66 public void run() { 67 synchronized (new java.awt.Panel ().getTreeLock()) { 68 System.out.println(System.currentTimeMillis() + " Thread runs"); 69 pls.getOriginal(0); 70 System.out.println(System.currentTimeMillis() + " Thread finish"); 71 } 72 } 73 },"Test" 74 ); 75 76 tstThread.start(); 77 78 System.out.println(System.currentTimeMillis() + " Main sleeping"); 79 try { 80 Thread.sleep(500); 81 } catch (InterruptedException e) { 82 } 83 System.out.println(System.currentTimeMillis() + " Main wakeuped"); 84 85 CloneableEditor ed = createCloneableEditor (); 86 initializeCloneableEditor (ed); 87 return ed; 88 } 89 90 93 protected String messageOpening() { 94 return "Test Opening"; 95 } 96 97 100 protected String messageOpened() { 101 return "Test Opened"; 102 } 103 104 108 protected String messageName() { 109 return "Test Name"; 110 } 111 112 117 protected String messageSave() { 118 return "Test Save"; 119 } 120 121 125 protected String messageToolTip() { 126 return "Test Tool Tip"; 127 } 128 129 public static class Env implements CloneableEditorSupport.Env { 130 131 private StringBufferInputStream input; 132 private FileOutputStream outFile; 133 private CloneableOpenSupport tstInst; 134 135 public void setInstance(CloneableOpenSupport tst) { 136 tstInst = tst; 137 } 138 139 144 public void markModified() throws java.io.IOException { 145 } 146 147 150 public void unmarkModified() { 151 } 152 153 155 public void removePropertyChangeListener(PropertyChangeListener l) { 156 } 157 158 161 public boolean isModified() { 162 return false; 163 } 164 165 167 public void removeVetoableChangeListener(VetoableChangeListener l) { 168 } 169 170 176 public boolean isValid() { 177 return true; 178 } 179 180 182 public void addVetoableChangeListener(VetoableChangeListener l) { 183 } 184 185 187 public void addPropertyChangeListener(PropertyChangeListener l) { 188 } 189 190 193 public CloneableOpenSupport findCloneableOpenSupport() { 194 return tstInst; 195 } 196 197 199 public Date getTime() { 200 return null; 201 } 202 203 206 public OutputStream outputStream() throws IOException { 207 if (outFile == null) { 208 outFile = new FileOutputStream ("outFile"); 209 } 210 return outFile; 211 } 212 213 216 public String getMimeType() { 217 return "text/plain"; 218 } 219 220 223 public InputStream inputStream() throws IOException { 224 if (input == null) { 225 input = new StringBufferInputStream ("Test text"); 226 } 227 return input; 228 } 229 230 } 231 } 232 | Popular Tags |