1 19 package org.netbeans.modules.websvc.core.jaxws.nodes; 20 21 import java.awt.Image ; 22 import java.awt.datatransfer.Transferable ; 23 import java.io.IOException ; 24 import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlOperation; 25 import org.openide.filesystems.FileObject; 26 import org.openide.nodes.AbstractNode; 27 import org.openide.nodes.Children; 28 import org.openide.text.ActiveEditorDrop; 29 import org.openide.util.HelpCtx; 30 import org.openide.util.Utilities; 31 import org.openide.util.datatransfer.ExTransferable; 32 import org.openide.util.lookup.AbstractLookup; 33 import org.openide.util.lookup.InstanceContent; 34 35 39 public class OperationNode extends AbstractNode { 40 WsdlOperation operation; 41 FileObject srcRoot; 42 OperationEditorDrop editorDrop; 43 44 public OperationNode(WsdlOperation operation) { 45 this(operation, new InstanceContent()); 46 } 47 48 private OperationNode(WsdlOperation operation, InstanceContent content) { 49 super(Children.LEAF,new AbstractLookup(content)); 50 this.operation=operation; 51 setName(operation.getName()); 52 setDisplayName(operation.getName()); 53 content.add(this); 54 content.add(operation); 55 editorDrop = new OperationEditorDrop(this); 56 } 57 58 public Image getIcon(int type){ 59 return Utilities.loadImage("org/netbeans/modules/websvc/core/webservices/ui/resources/wsoperation.png"); } 61 62 public Image getOpenedIcon(int type){ 63 return getIcon( type); 64 } 65 66 public HelpCtx getHelpCtx() { 67 return HelpCtx.DEFAULT_HELP; 68 } 69 70 public boolean canDestroy() { 72 return false; 73 } 74 75 public Transferable clipboardCopy() throws IOException { 76 77 ExTransferable t = ExTransferable.create( super.clipboardCopy() ); 78 ActiveEditorDropTransferable s = new ActiveEditorDropTransferable(editorDrop); 79 t.put(s); 80 81 return t; 82 } 83 84 private static class ActiveEditorDropTransferable extends ExTransferable.Single { 85 86 private ActiveEditorDrop drop; 87 88 ActiveEditorDropTransferable(ActiveEditorDrop drop) { 89 super(ActiveEditorDrop.FLAVOR); 90 91 this.drop = drop; 92 } 93 94 public Object getData () { 95 return drop; 96 } 97 98 } 99 } 100 | Popular Tags |