1.1 --- a/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/AttributeNodeLook.java Thu Sep 05 12:46:02 2002 +0000
1.2 +++ b/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/AttributeNodeLook.java Thu Sep 05 18:05:18 2002 +0000
1.3 @@ -13,6 +13,9 @@
1.4
1.5 package org.netbeans.modules.mdrxml.looks;
1.6
1.7 +import java.awt.datatransfer.Transferable;
1.8 +import java.awt.datatransfer.StringSelection;
1.9 +import java.io.IOException;
1.10 import org.openide.nodes.*;
1.11 import org.openide.util.NbBundle;
1.12 import org.netbeans.api.looks.*;
1.13 @@ -64,4 +67,10 @@
1.14 return sets;
1.15 }
1.16
1.17 + public Transferable clipboardCopy (Look.NodeSubstitute substitute) throws IOException {
1.18 + AttributeNode node = (AttributeNode) substitute.getRepresentedObject ();
1.19 + String str = node.getName () + " = " + node.getValue (); //NOI18N
1.20 + return new StringSelection (str);
1.21 + }
1.22 +
1.23 }
2.1 --- a/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/DocumentsLook.java Thu Sep 05 12:46:02 2002 +0000
2.2 +++ b/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/DocumentsLook.java Thu Sep 05 18:05:18 2002 +0000
2.3 @@ -13,6 +13,9 @@
2.4
2.5 package org.netbeans.modules.mdrxml.looks;
2.6
2.7 +import java.awt.datatransfer.Transferable;
2.8 +import java.awt.datatransfer.StringSelection;
2.9 +import java.io.IOException;
2.10 import java.util.Collection;
2.11 import java.util.Iterator;
2.12 import javax.jmi.reflect.*;
2.13 @@ -82,4 +85,12 @@
2.14 }
2.15 }
2.16
2.17 + public Transferable clipboardCopy (Look.NodeSubstitute substitute) throws IOException {
2.18 + return new StringSelection (this.getName(substitute));
2.19 + }
2.20 +
2.21 + public boolean canCopy (Look.NodeSubstitute substitute) {
2.22 + return true;
2.23 + }
2.24 +
2.25 }
3.1 --- a/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/ElementNodeLook.java Thu Sep 05 12:46:02 2002 +0000
3.2 +++ b/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/ElementNodeLook.java Thu Sep 05 18:05:18 2002 +0000
3.3 @@ -13,6 +13,10 @@
3.4
3.5 package org.netbeans.modules.mdrxml.looks;
3.6
3.7 +import java.io.ByteArrayOutputStream;
3.8 +import java.io.IOException;
3.9 +import java.awt.datatransfer.Transferable;
3.10 +import java.awt.datatransfer.StringSelection;
3.11 import java.util.ArrayList;
3.12 import java.util.Collection;
3.13 import java.util.Iterator;
3.14 @@ -29,6 +33,7 @@
3.15 import org.netbeans.modules.mdrxml.looks.actions.NewAction;
3.16 import org.netbeans.modules.mdrxml.util.XMLModelEventTranslator;
3.17 import org.netbeans.modules.mdrxml.util.NodeEventTranslator;
3.18 +import org.netbeans.modules.mdrxml.util.XMLGenerator;
3.19 /**
3.20 *
3.21 * @author Tomas Zezula
3.22 @@ -92,4 +97,10 @@
3.23 }
3.24 }
3.25
3.26 + public Transferable clipboardCopy (Look.NodeSubstitute substitute) throws IOException {
3.27 + ByteArrayOutputStream bos = new ByteArrayOutputStream ();
3.28 + new XMLGenerator ().generateXML (bos, (ElementNode)substitute.getRepresentedObject());
3.29 + return new StringSelection (bos.toString());
3.30 + }
3.31 +
3.32 }
4.1 --- a/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/NodeLook.java Thu Sep 05 12:46:02 2002 +0000
4.2 +++ b/mdr/samples/xml/src/org/netbeans/modules/mdrxml/looks/NodeLook.java Thu Sep 05 18:05:18 2002 +0000
4.3 @@ -14,6 +14,8 @@
4.4 package org.netbeans.modules.mdrxml.looks;
4.5
4.6 import java.lang.ref.WeakReference;
4.7 +import java.io.IOException;
4.8 +import java.awt.datatransfer.Transferable;
4.9 import org.openide.actions.PropertiesAction;
4.10 import org.openide.nodes.*;
4.11 import org.openide.util.NbBundle;
4.12 @@ -93,4 +95,12 @@
4.13 };
4.14 }
4.15
4.16 + public boolean canCopy (Look.NodeSubstitute substitute) {
4.17 + return true;
4.18 + }
4.19 +
4.20 + public Transferable drag (Look.NodeSubstitute substitute) throws IOException {
4.21 + return this.clipboardCopy (substitute);
4.22 + }
4.23 +
4.24 }