import java.awt.datatransfer.Transferable; import java.util.Comparator; import java.util.Iterator; import java.util.TreeSet; import java.util.Vector; import freemind.modes.MindMapNode; import java.util.regex.Pattern; import java.util.regex.*; import javax.swing.*; File locFile; def cookieKey = "cc_latex_import"; if(cookies.get(cookieKey) != null) { locFile=cookies.get(cookieKey); }else{ locFile = new File("D:/INRIA/Publications_And_Talks/_These/PhDThesis.tex"); } String filename = File.separator+"tmp"; JFileChooser fc = new JFileChooser(locFile); fc.showOpenDialog(); File f = fc.getSelectedFile(); if(f==null) return; cookies.put(cookieKey, f); def sectionhierarchy=["\\part", "\\chapter", "\\section", "\\subsection", "\\subsubsection", "\\paragraph", "\\subparagraph"]; MindMapNode prevNode=c.getRootNode(); prevLevel=0; String curNoteText=""; String lastNoteTextAdd=""; c.setNodeText(prevNode, "PhDThesis"); f.eachLine{ secFound=false; for(i=0; i0){ //curNoteText=curNoteText+lastNoteTextAdd; curNoteText=curNoteText+"\n"; c.setNoteText(prevNode, curNoteText); //c.setXmlNoteText(prevNode, curNoteText); } lastNoteTextAdd=""; curNoteText=""; //Deal with new node openAcc=it.indexOf('{'); closeAcc=it.indexOf('}'); curLevel=i; sectionName=it.substring(openAcc+1, closeAcc); while(prevLevel>=curLevel && prevNode!=c.getRootNode()){ prevNode=prevNode.getParentNode(); prevLevel--; } MindMapNode newNode; newNode=c.addNewNode(prevNode, prevNode.getChildren().size(), false); c.setNodeText(newNode, sectionName); prevNode=newNode; prevLevel=curLevel; secFound=true; break; } } if(!secFound){ if(it.length()>0 || curNoteText.length()>0 || lastNoteTextAdd.length()>0){ if(curNoteText.length()==0){ curNoteText=curNoteText+"\n\n\n\n"; } curNoteText=curNoteText+lastNoteTextAdd; lastNoteTextAdd="

"+it+"

\n"; } } };