1 19 20 21 package org.openide.text; 22 23 24 import java.beans.PropertyChangeListener ; 25 import java.beans.VetoableChangeListener ; 26 import java.io.InputStream ; 27 import java.io.IOException ; 28 import java.io.OutputStream ; 29 import java.util.Date ; 30 31 import org.openide.filesystems.FileObject; 32 import org.openide.text.CloneableEditorSupport; 33 import org.openide.windows.CloneableOpenSupport; 34 35 36 43 public class SimpleCESHidden extends CloneableEditorSupport { 44 45 private FileObject fo; 46 47 public SimpleCESHidden(Env env) { 48 super(env); 49 50 this.fo = env.fo; 51 } 52 53 56 protected String messageOpening() { 57 return "Opening " + fo.getName(); 58 } 59 60 63 protected String messageOpened() { 64 return "Opened " + fo.getName(); 65 } 66 67 71 protected String messageName() { 72 return fo.getName(); 73 } 74 75 80 protected String messageSave() { 81 return fo.getName() + "*"; 82 } 83 84 88 protected String messageToolTip() { 89 return fo.getNameExt(); 90 } 91 92 93 94 public static class Env extends Object implements CloneableEditorSupport.Env { 95 96 97 private FileObject fo; 98 99 100 private CloneableOpenSupport support; 101 102 103 109 public Env (FileObject fo) { 110 this.fo = fo; 111 } 112 113 114 public void setSupport(CloneableOpenSupport support) { 115 this.support = support; 116 } 117 118 124 public CloneableOpenSupport findCloneableOpenSupport() { 125 return support; 126 } 127 128 131 public InputStream inputStream () throws IOException { 132 return fo.getInputStream(); 133 } 134 135 138 public OutputStream outputStream () throws IOException { 139 return fo.getOutputStream(fo.lock()); 140 } 141 142 143 public Date getTime () { 144 return null; 145 } 146 147 150 public String getMimeType () { 151 return fo.getMIMEType(); 152 } 153 154 156 public void addPropertyChangeListener (PropertyChangeListener l) { 157 } 158 159 161 public void removePropertyChangeListener (PropertyChangeListener l) { 162 } 163 164 166 public void addVetoableChangeListener (VetoableChangeListener l) { 167 } 168 170 public void removeVetoableChangeListener (VetoableChangeListener l) { 171 } 172 173 179 public boolean isValid () { 180 return fo.isValid(); 181 } 182 183 186 public boolean isModified () { 187 return false; 188 } 189 190 195 public void markModified () throws java.io.IOException {} 196 197 200 public void unmarkModified () {} 201 202 } } 204 | Popular Tags |