MAJ 4.3.1 (Correction Bug sur le collage d'un node)

This commit is contained in:
pablo rodriguez 2022-11-20 18:03:14 +01:00
parent da32cacfc2
commit 963098c9de
7 changed files with 15 additions and 6 deletions

View File

@ -15,4 +15,11 @@
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>
<linkedResources>
<link>
<name>cXML</name>
<type>2</type>
<location>C:/Users/pabr6/eclipse-workspace/cXML</location>
</link>
</linkedResources>
</projectDescription> </projectDescription>

Binary file not shown.

1
bin/.gitignore vendored
View File

@ -1,2 +1 @@
/MEPTL/
/fenetres/ /fenetres/

View File

@ -35,9 +35,12 @@ public class actCopy extends AbstractAction{
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection texto = new StringSelection(Run.ecritureNode(nod, 0).toString()); String textNodes = Run.ecritureNode(nod, 0).toString().replace("\t","").replace("\r", "").replace("\n", "");
StringSelection texto = new StringSelection(textNodes);
cb.setContents(texto, texto); cb.setContents(texto, null);
System.out.println(texto.toString());
fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()+"<hr><h2>Le node est copié dans le presse papier.</h2><hr>"); fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()+"<hr><h2>Le node est copié dans le presse papier.</h2><hr>");
} }

View File

@ -39,16 +39,16 @@ public class actPaste extends AbstractAction{
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
String paste; String paste;
try { try {
paste = c.getContents(null).getTransferData(DataFlavor.stringFlavor).toString(); paste = "<!-- ? -->" + c.getContents(null).getTransferData(DataFlavor.stringFlavor).toString().replace("\t","").replace("\r", "").replace("\n", "");
if (!paste.equals(initial)) { if (!paste.equals(initial)) {
node nodCopy = Run.XMLContent(paste); node nodCopy =new node(paste);
if(!nodCopy.getNomElt().isEmpty()) { if(!nodCopy.getNomElt().isEmpty()) {
node nod = (node) fenetres.create.getSelectNode().getUserObject(); node nod = (node) fenetres.create.getSelectNode().getUserObject();
nod.getNodes().add(nodCopy); nod.getNodes().add(nodCopy);
fenetres.create.constructionTree(); fenetres.create.constructionTree();
initial = paste; initial = paste;
}else { }else {
JOptionPane.showMessageDialog(null, "Le collage n'est pas réalisé.<br>Ce n'est pas un node."); JOptionPane.showMessageDialog(null, "Le collage n'est pas réalisé.");
} }
} }