/** Finds engine associated with given document. * If no engine is associated returns default one. */ public static IndentEngine find(Document doc) { Object o = doc.getProperty("indentEngine"); // NOI18N if (o instanceof IndentEngine) { return (IndentEngine) o; } else { o = doc.getProperty("mimeType"); // NOI18N String s = (o instanceof String) ? (String) o : "text/plain"; // NOI18N return find(s); } }
public CodeWriter write (String text) { assert ! committed; if (forceValue != null) return this; try { if (writer == null) { memory = new StringWriter (512); IndentEngine indentEngine = IndentEngine.find (document); if (indentEngine != null) writer = indentEngine.createWriter (document, offset, memory); else writer = memory; } writer.write (text); return this; } catch (IOException e) { throw Debug.error (e); } }
/** Finds engine associated with given document. * If no engine is associated returns default one. */ public static IndentEngine find (Document doc) { Object o = doc.getProperty("indentEngine"); // NOI18N if (o instanceof IndentEngine) { return (IndentEngine)o; } else { o = doc.getProperty("mimeType"); // NOI18N String s = (o instanceof String) ? (String)o : "text/plain"; // NOI18N return find(s); } }
/** Finds engine associated with given document. * If no engine is associated returns default one. */ public static IndentEngine find (Document doc) { Object o = doc.getProperty("indentEngine"); // NOI18N if (o instanceof IndentEngine) { return (IndentEngine)o; } else { o = doc.getProperty("mimeType"); // NOI18N String s = (o instanceof String) ? (String)o : "text/plain"; // NOI18N return find(s); } }