KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > treeeditor > extension > bpel > WSDLExtLookupProvider


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor.extension.bpel;
20
21 import javax.xml.namespace.QName JavaDoc;
22
23 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
24 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELQName;
25 import org.netbeans.modules.xml.wsdl.ui.api.property.ExtensibilityElementPropertyAdapter;
26 import org.netbeans.modules.xml.wsdl.ui.spi.NewCustomizerProvider;
27 import org.netbeans.modules.xml.wsdl.ui.spi.WSDLLookupProvider;
28 import org.openide.nodes.Node.Property;
29 import org.openide.util.Lookup;
30 import org.openide.util.Lookup.Provider;
31 import org.openide.util.lookup.AbstractLookup;
32 import org.openide.util.lookup.InstanceContent;
33 import org.openide.util.lookup.AbstractLookup.Content;
34
35 public class WSDLExtLookupProvider implements WSDLLookupProvider, Lookup.Provider {
36
37     private Lookup lookup;
38     private InstanceContent content;
39     
40     public WSDLExtLookupProvider() {
41         content = new InstanceContent();
42         lookup = new AbstractLookup(content);
43         content.add(new NewCustomizerProvider() {
44         
45             public Property getProperty(ExtensibilityElement element,
46                     QName JavaDoc elementQName, QName JavaDoc attributeQName, boolean isOptional) {
47                 if (elementQName.equals(BPELQName.PROPERTY_ALIAS.getQName())) {
48                     if (attributeQName.getLocalPart().equals("propertyName")) {
49                         try {
50                             return new PropertyNameProperty(new ExtensibilityElementPropertyAdapter(element, "propertyName", isOptional), String JavaDoc.class, "getValue", "setValue");
51                         } catch (NoSuchMethodException JavaDoc e) {
52                             // TODO Auto-generated catch block
53
e.printStackTrace();
54                         }
55                     }
56                 }
57                 return null;
58             }
59         
60         });
61     }
62
63     protected Content getContent() {
64         return content;
65     }
66     
67     public Provider getProvider(String JavaDoc namespace) {
68         if (namespace.equals(BPELQName.VARPROP_NS)) {
69             return this;
70         }
71         return null;
72     }
73
74     
75
76     public Lookup getLookup() {
77         return lookup;
78     }
79
80 }
81
Popular Tags