1 2 /* 3 * The contents of this file are subject to the terms of the Common Development 4 * and Distribution License (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 8 * or http://www.netbeans.org/cddl.txt. 9 * 10 * When distributing Covered Code, include this CDDL Header Notice in each file 11 * and include the License file at http://www.netbeans.org/cddl.txt. 12 * If applicable, add the following below the CDDL Header, with the fields 13 * enclosed by brackets [] replaced by your own identifying information: 14 * "Portions Copyrighted [year] [name of copyright owner]" 15 * 16 * The Original Software is NetBeans. The Initial Developer of the Original 17 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 18 * Microsystems, Inc. All Rights Reserved. 19 */ 20 21 package org.netbeans.modules.xml.refactoring.ui.tree; 22 23 import java.beans.BeanInfo; 24 import java.util.List; 25 import javax.swing.Icon; 26 import javax.swing.ImageIcon; 27 28 import org.netbeans.modules.refactoring.api.RefactoringElement; 29 import org.netbeans.modules.refactoring.spi.ui.TreeElement; 30 import org.netbeans.modules.refactoring.spi.ui.TreeElementFactory; 31 import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation; 32 import org.netbeans.modules.xml.refactoring.spi.UIHelper; 33 import org.netbeans.modules.xml.xam.Component; 34 import org.openide.filesystems.FileObject; 35 import org.openide.nodes.Node; 36 37 /** 38 * 39 * @author Sonali Kochar 40 */ 41 public class ComponentTreeElement implements TreeElement { 42 43 Node node; 44 Object parent; 45 Component comp; 46 UIHelper uiHelper = new UIHelper(); 47 48 49 ComponentTreeElement(Object element) { 50 node=(Node) element; 51 } 52 53 public TreeElement getParent(boolean isLogical) { 54 if(parent instanceof ComponentTreeElement) 55 return (ComponentTreeElement)parent; 56 else 57 return TreeElementFactory.getTreeElement((FileObject)parent); 58 59 } 60 61 void setParent(Object p) { 62 this.parent = p; 63 } 64 65 66 public Icon getIcon() { 67 return new ImageIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16)); 68 69 } 70 71 public String getText(boolean isLogical) { 72 return node.getName(); 73 74 } 75 76 public Object getUserObject() { 77 //return node.getLookup().lookup(Component.class); 78 //temp fix since WSDL doesnt have lookup 79 return node; 80 81 } 82 } 83