1 19 20 package org.netbeans.modules.websvc.api.webservices; 21 22 import java.util.Iterator ; 23 import org.netbeans.modules.websvc.webservices.WebServicesViewAccessor; 24 import org.netbeans.modules.websvc.spi.webservices.*; 25 import org.openide.filesystems.FileObject; 26 import org.openide.util.Lookup; 27 import org.openide.nodes.Node; 28 import org.netbeans.api.project.Project; 29 30 39 public final class WebServicesView { 40 41 private WebServicesViewImpl impl; 42 private static final Lookup.Result implementations = 43 Lookup.getDefault().lookup(new Lookup.Template(WebServicesViewProvider.class)); 44 45 static { 46 WebServicesViewAccessor.DEFAULT = new WebServicesViewAccessor() { 47 public WebServicesView createWebServicesView(WebServicesViewImpl spiWebServicesView) { 48 return new WebServicesView(spiWebServicesView); 49 } 50 51 public WebServicesViewImpl getWebServicesViewImpl(WebServicesView wsv) { 52 return wsv == null ? null : wsv.impl; 53 } 54 }; 55 } 56 57 private WebServicesView(WebServicesViewImpl impl) { 58 if (impl == null) 59 throw new IllegalArgumentException (); 60 this.impl = impl; 61 } 62 63 66 public static WebServicesView getWebServicesView(FileObject f) { 67 if (f != null) { 68 Iterator it = implementations.allInstances().iterator(); 69 while (it.hasNext()) { 70 WebServicesViewProvider impl = (WebServicesViewProvider)it.next(); 71 WebServicesView wsv = impl.findWebServicesView (f); 72 if (wsv != null) { 73 return wsv; 74 } 75 } 76 } 77 return null; 78 } 79 80 82 public Node createWebServicesView(FileObject srcRoot) { 83 return impl.createWebServicesView(srcRoot); 84 } 85 86 87 88 103 } 104 | Popular Tags |