示例#1
0
 private void writePendingComment() throws IOException {
   if (pendingComment != null) {
     if (isPretty()) write("   ");
     if (levels.inComment()) write("<!-- " + pendingComment + " -- >");
     else write("<!-- " + pendingComment + " -->");
   }
 }
示例#2
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock()
  */
 @Override
 public void startCommentBlock() throws IOException {
   if (levels.inComment()) throw new IOException("cannot nest comments");
   levels.current().setInComment(true);
   if (isPretty()) writePretty();
   write("<!--");
   if (isPretty()) writePretty();
 }
示例#3
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock()
  */
 @Override
 public void endCommentBlock() throws IOException {
   if (!levels.inComment()) throw new IOException("cannot close a comment block when it is open");
   if (!levels.current().isInComment())
     throw new IOException("cannot close a comment block when it is open");
   if (isPretty()) writePretty();
   write("-->");
   if (isPretty()) writePretty();
   levels.current().setInComment(false);
 }
示例#4
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean)
  */
 @Override
 public void comment(String comment, boolean doPretty) throws IOException {
   checkStarted();
   if (pendingClose) {
     write('>');
     writePendingComment();
     pendingClose = false;
   }
   if (doPretty) {
     writePretty();
     if (isPretty()) {
       for (int i = 0; i < levels.size(); i++) write("  ");
     }
   }
   if (levels.inComment()) write("<!-- " + comment + " -- >");
   else write("<!-- " + comment + " -->");
   if (doPretty && !isPretty()) writePretty();
 }