KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbjarproject > ui > logicalview > LogicalViewChildren


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbjarproject.ui.logicalview;
21 import java.awt.event.ActionEvent JavaDoc;
22 import java.beans.PropertyChangeEvent JavaDoc;
23 import java.beans.PropertyChangeListener JavaDoc;
24 import java.io.IOException JavaDoc;
25 import java.math.BigDecimal JavaDoc;
26 import java.util.ArrayList JavaDoc;
27 import java.util.Collection JavaDoc;
28 import java.util.Collections JavaDoc;
29 import java.util.List JavaDoc;
30 import javax.swing.AbstractAction JavaDoc;
31 import javax.swing.Action JavaDoc;
32 import javax.swing.SwingUtilities JavaDoc;
33 import javax.swing.event.ChangeEvent JavaDoc;
34 import javax.swing.event.ChangeListener JavaDoc;
35 import org.netbeans.api.java.classpath.ClassPath;
36 import org.netbeans.api.java.project.JavaProjectConstants;
37 import org.netbeans.api.project.Project;
38 import org.netbeans.api.project.ProjectUtils;
39 import org.netbeans.api.project.SourceGroup;
40 import org.netbeans.api.project.Sources;
41 import org.netbeans.modules.j2ee.api.ejbjar.EjbJar;
42 import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
43 import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
44 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
45 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject;
46 import org.netbeans.modules.j2ee.ejbjarproject.UpdateHelper;
47 import org.netbeans.modules.j2ee.spi.ejbjar.support.J2eeProjectView;
48 import org.netbeans.modules.j2ee.ejbjarproject.classpath.ClassPathSupport;
49 import org.netbeans.modules.j2ee.ejbjarproject.ui.customizer.CustomizerProviderImpl;
50 import org.netbeans.modules.j2ee.ejbjarproject.ui.customizer.EjbJarProjectProperties;
51 import org.netbeans.modules.j2ee.ejbjarproject.ui.customizer.CustomizerLibraries;
52 import org.netbeans.modules.j2ee.ejbjarproject.ui.logicalview.libraries.LibrariesNode;
53 import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
54 import org.netbeans.modules.websvc.api.client.WebServicesClientView;
55 import org.netbeans.modules.websvc.api.jaxws.client.JAXWSClientSupport;
56 import org.netbeans.modules.websvc.api.jaxws.client.JAXWSClientView;
57 import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
58 import org.netbeans.modules.websvc.api.webservices.WebServicesView;
59 import org.netbeans.modules.websvc.jaxws.api.JAXWSSupport;
60 import org.netbeans.modules.websvc.jaxws.api.JAXWSView;
61 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel;
62 import org.netbeans.spi.java.project.support.ui.PackageView;
63 import org.netbeans.spi.project.support.ant.AntProjectHelper;
64 import org.netbeans.spi.project.support.ant.PropertyEvaluator;
65 import org.netbeans.spi.project.support.ant.ReferenceHelper;
66
67 import org.openide.ErrorManager;
68 import org.openide.filesystems.FileChangeAdapter;
69 import org.openide.filesystems.FileEvent;
70 import org.openide.filesystems.FileObject;
71 import org.openide.nodes.Children;
72 import org.openide.nodes.FilterNode;
73 import org.openide.nodes.Node;
74 import org.openide.util.NbBundle;
75
76
77
78
79 public final class LogicalViewChildren extends Children.Keys implements ChangeListener JavaDoc {
80
81     private static final boolean DISPLAY_EJB_NODE =
82         Boolean.getBoolean("org.netbeans.modules.j2ee.ejbjarproject.ui.logicalview.DISPLAY_EJB_NODE"); // NOI18N
83

84
85     public static final String JavaDoc KEY_TEST_DIR = "testDir"; // NOI18N
86
public static final String JavaDoc KEY_DOC_BASE = "docBase"; //NOI18N
87
public static final String JavaDoc KEY_EJBS = "ejbKey"; //NOI18N
88
public static final String JavaDoc KEY_SERVICE_REFS = "serviceRefs"; // NOI18N
89
public static final String JavaDoc WEBSERVICES_DIR = "webservicesDir"; // NOI18N
90
public static final String JavaDoc KEY_SETUP_DIR = "setupDir"; //NOI18N
91
public static final String JavaDoc KEY_LIBRARIES = "libraries"; //NOI18N
92
public static final String JavaDoc KEY_TEST_LIBRARIES = "testLibraries"; //NOI18N
93

94     private static final String JavaDoc JAX_WS_PATH="nbproject/jax-ws.xml"; //NOI18N
95

96     private Sources sources;
97     private EjbJar jp;
98     private ClassPath cp;
99     private Project project;
100     private PropertyEvaluator evaluator;
101     private UpdateHelper updateHelper;
102     private ReferenceHelper refHelper;
103     private AntProjectHelper helper;
104     
105     private JaxWsChangeListener jaxWsListener;
106     private MetaInfListener metaInfListener;
107     private WsdlCreationListener wsdlListener;
108     private JaxRPCChangeListener jaxrpcChangeListener;
109     private FileObject wsdlFolder;
110
111 // private WsdlCreationListener wsdlListener;
112

113     public LogicalViewChildren(Project project, UpdateHelper updateHelper, PropertyEvaluator evaluator, ReferenceHelper refHelper ) {
114         assert project != null;
115         this.project = project;
116         // AB,MA: hack: this class is used for the logical view of the ejb freeform project
117
// updateHelper, evaluator and refHelper will be null when called from the freeform project
118
this.evaluator = evaluator;
119         this.updateHelper = updateHelper;
120         if (updateHelper != null) {
121             this.helper = updateHelper.getAntProjectHelper();
122         }
123         this.refHelper = refHelper;
124         EjbJar jps[] = EjbJar.getEjbJars(project);
125         assert jps.length > 0;
126         jp = jps[0];
127
128         sources = ProjectUtils.getSources(project);
129         assert sources != null;
130         cp = org.netbeans.spi.java.classpath.support.ClassPathSupport.createClassPath(getRoots());
131         
132         metaInfListener = new MetaInfListener();
133         wsdlListener = new WsdlCreationListener();
134         jaxrpcChangeListener = new JaxRPCChangeListener();
135         jaxWsListener = new JaxWsChangeListener();
136     }
137
138     private FileObject[] getRoots() {
139         SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
140         FileObject[] roots = new FileObject[groups.length];
141         for (int i = 0; i < groups.length; i++) {
142             roots[i] = groups[i].getRootFolder();
143         }
144         return roots;
145     }
146
147     protected void addNotify() {
148         super.addNotify();
149         sources.addChangeListener( this );
150         
151         JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class);
152         if (jaxWsModel!=null) jaxWsModel.addPropertyChangeListener(jaxWsListener);
153         
154         EjbJar ejbModule = EjbJar.getEjbJar(helper.getProjectDirectory());
155         if (ejbModule != null) {
156             FileObject metaInf = ejbModule.getMetaInf();
157             if (metaInf!=null) {
158                 metaInf.addFileChangeListener(metaInfListener);
159                 metaInf.addFileChangeListener(jaxrpcChangeListener);
160             }
161         }
162         WebServicesClientSupport wsClientSupportImpl =
163                 WebServicesClientSupport.getWebServicesClientSupport(helper.getProjectDirectory());
164         FileObject wsdlDir = null;
165         try {
166             wsdlDir = wsClientSupportImpl.getWsdlFolder(false);
167             if (wsdlDir!=null) wsdlFolder = wsdlDir;
168         } catch (IOException JavaDoc ex) {
169             ex.printStackTrace();
170         }
171         if (wsdlFolder != null) {
172             wsdlFolder.addFileChangeListener(wsdlListener);
173         }
174         
175         createNodes();
176     }
177
178     private void createNodes() {
179         List JavaDoc l = new ArrayList JavaDoc();
180         l.add(KEY_EJBS);
181   
182         // show WS and WSClient nodes only if there are any web services in the project
183
JAXWSSupport jwss = JAXWSSupport.getJAXWSSupport(project.getProjectDirectory());
184         JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class);
185         if ((jwss != null) &&
186             (jaxWsModel != null) &&
187             (jaxWsModel.getServices() != null) &&
188             (jaxWsModel.getServices().length > 0)) {
189                 l.add(WEBSERVICES_DIR);
190         } else {
191             WebServicesSupport wss = WebServicesSupport.getWebServicesSupport(project.getProjectDirectory());
192             if (wss!=null) {
193                 List JavaDoc wServices = wss.getServices();
194                 if ((wServices != null) && (!wServices.isEmpty())) {
195                     l.add(WEBSERVICES_DIR);
196                 }
197             }
198         }
199         JAXWSClientSupport jwcss = JAXWSClientSupport.getJaxWsClientSupport(project.getProjectDirectory());
200         if ((jwcss != null) &&
201             (jaxWsModel != null) &&
202             (jaxWsModel.getClients() != null) &&
203             (jaxWsModel.getClients().length > 0)) {
204                 l.add(KEY_SERVICE_REFS);
205         } else {
206             WebServicesClientSupport wscs = WebServicesClientSupport.getWebServicesClientSupport(project.getProjectDirectory());
207             if (wscs!=null) {
208                 List JavaDoc wsClients = wscs.getServiceClients();
209                 if ((wsClients != null) && (!wsClients.isEmpty())) {
210                     l.add(KEY_SERVICE_REFS);
211                 }
212             }
213         }
214             
215         //l.add(KEY_SERVICE_REFS);
216
//l.add(WEBSERVICES_DIR);
217

218         FileObject docBaseDir = jp.getMetaInf();
219         if (docBaseDir != null) {
220             l.add(KEY_DOC_BASE);
221         }
222         
223         l.add(KEY_SETUP_DIR);
224
225         l.addAll(getSourceRoots());
226
227         l.add(KEY_LIBRARIES);
228         l.add(KEY_TEST_LIBRARIES);
229
230         setKeys(l);
231     }
232
233     protected void removeNotify() {
234         setKeys(Collections.EMPTY_SET);
235         sources.removeChangeListener( this );
236
237         JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class);
238         if (jaxWsModel!=null) jaxWsModel.removePropertyChangeListener(jaxWsListener);
239    
240         EjbJar ejbModule = EjbJar.getEjbJar(helper.getProjectDirectory());
241         if (ejbModule != null) {
242             FileObject metaInf = ejbModule.getMetaInf();
243             if (metaInf!=null) {
244                 metaInf.removeFileChangeListener(metaInfListener);
245                 metaInf.removeFileChangeListener(jaxrpcChangeListener);
246             }
247         }
248         
249         if (wsdlFolder != null) {
250             wsdlFolder.removeFileChangeListener(wsdlListener);
251         }
252
253         setKeys(Collections.EMPTY_SET);
254 // getSources().removeChangeListener( this );
255

256         super.removeNotify();
257     }
258
259     public Node[] createNodes(Object JavaDoc key) {
260         Node n = null;
261         if (key instanceof SourceGroupKey) {
262             n = new PackageViewFilterNode(((SourceGroupKey) key).group, project);
263         } else if (key == KEY_DOC_BASE) {
264             n = J2eeProjectView.createConfigFilesView(jp.getMetaInf());
265         } else if (key == KEY_EJBS) {
266             org.netbeans.modules.j2ee.dd.api.ejb.EjbJar ejbJar = null;
267             FileObject dd = jp.getDeploymentDescriptor();
268             try {
269                 ejbJar = org.netbeans.modules.j2ee.dd.api.ejb.DDProvider.getDefault().getMergedDDRoot(jp.getMetadataUnit());
270             } catch (IOException JavaDoc ioe) {
271                 ErrorManager.getDefault().notify(ioe);
272             }
273             if ((ejbJar != null && !ejbJar.getVersion().equals(new BigDecimal JavaDoc(ejbJar.VERSION_3_0))) || DISPLAY_EJB_NODE) {
274                 n = J2eeProjectView.createEjbsView(ejbJar, cp, dd, project);
275             }
276         } else if (key == WEBSERVICES_DIR){
277             EjbJar ejbModule = EjbJar.getEjbJar(helper.getProjectDirectory());
278             
279             java.util.Map JavaDoc properties = ((EjbJarProject)project).getAntProjectHelper().getStandardPropertyEvaluator().getProperties();
280             String JavaDoc serverInstance = (String JavaDoc)properties.get("j2ee.server.instance"); //NOI18N
281
J2eePlatform j2eePlatform = Deployment.getDefault().getJ2eePlatform(serverInstance);
282             boolean jwsdpSupported = j2eePlatform!=null && j2eePlatform.isToolSupported(J2eePlatform.TOOL_JWSDP);
283             
284             if (ejbModule!=null && ((EjbProjectConstants.JAVA_EE_5_LEVEL.equals(ejbModule.getJ2eePlatformVersion())) || (jwsdpSupported))) {
285                 JAXWSView view = JAXWSView.getJAXWSView();
286                 n = view.createJAXWSView(project);
287             } else {
288                 SourceGroup[] srcGroup = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
289                 if (srcGroup.length > 0) {
290                     FileObject srcRoot = srcGroup[0].getRootFolder();
291                     if (srcRoot != null) {
292                         WebServicesView webServicesView = WebServicesView.getWebServicesView(srcRoot);
293                         if (webServicesView != null) {
294                             n = webServicesView.createWebServicesView(srcRoot);
295                         }
296                     }
297                 }
298             }
299         } else if (key == KEY_SETUP_DIR) {
300             n = J2eeProjectView.createServerResourcesNode(project);
301         } else if (key == KEY_LIBRARIES) {
302             assert updateHelper != null;
303             assert evaluator != null;
304             assert refHelper != null;
305             n = new LibrariesNode(
306                 NbBundle.getMessage(LogicalViewChildren.class,"CTL_LibrariesNode"),
307                 project,
308                 evaluator,
309                 updateHelper,
310                 refHelper,
311                 EjbJarProjectProperties.JAVAC_CLASSPATH,
312                 new String JavaDoc[] { EjbJarProjectProperties.BUILD_CLASSES_DIR },
313                 "platform.active", //NOI18N
314
EjbJarProjectProperties.J2EE_SERVER_INSTANCE,
315                 new Action JavaDoc[] {
316                     LibrariesNode.createAddProjectAction(project, EjbJarProjectProperties.JAVAC_CLASSPATH,
317                                                          ClassPathSupport.ELEMENT_INCLUDED_LIBRARIES),
318                     LibrariesNode.createAddLibraryAction(project, updateHelper.getAntProjectHelper(),
319                                                          EjbJarProjectProperties.JAVAC_CLASSPATH, ClassPathSupport.ELEMENT_INCLUDED_LIBRARIES),
320                     LibrariesNode.createAddFolderAction(project, EjbJarProjectProperties.JAVAC_CLASSPATH,
321                                                         ClassPathSupport.ELEMENT_INCLUDED_LIBRARIES),
322                     null,
323                     new PreselectPropertiesAction(project, "Libraries", CustomizerLibraries.COMPILE), //NOI18N
324
},
325                 ClassPathSupport.ELEMENT_INCLUDED_LIBRARIES
326             );
327         }
328         else if (key == KEY_SERVICE_REFS) {
329             // !PW FIXME This needs to be a stable way to retrieve a FileObject, e.g. for META-INF
330
// (or we could use some other type) that will uniquely define the WebServicesClientView
331
// we want to retrieve.
332

333             java.util.Map JavaDoc properties = ((EjbJarProject)project).getAntProjectHelper().getStandardPropertyEvaluator().getProperties();
334             String JavaDoc serverInstance = (String JavaDoc)properties.get("j2ee.server.instance"); //NOI18N
335
J2eePlatform j2eePlatform = Deployment.getDefault().getJ2eePlatform(serverInstance);
336             boolean jwsdpSupported = j2eePlatform!=null && j2eePlatform.isToolSupported(J2eePlatform.TOOL_JWSDP);
337
338             EjbJar ejbModule = EjbJar.getEjbJar(project.getProjectDirectory());
339             if (ejbModule!=null && ((EjbProjectConstants.JAVA_EE_5_LEVEL.equals(ejbModule.getJ2eePlatformVersion())) || (jwsdpSupported))) {
340                 JAXWSClientView view = JAXWSClientView.getJAXWSClientView();
341                 n = view.createJAXWSClientView(project);
342             } else {
343                 FileObject clientRoot = helper.resolveFileObject(evaluator.getProperty(EjbJarProjectProperties.META_INF));
344                 if(clientRoot == null) {
345                     clientRoot = helper.resolveFileObject(evaluator.getProperty(EjbJarProjectProperties.SRC_DIR));
346                 }
347                 if (clientRoot != null) {
348                     WebServicesClientView clientView = WebServicesClientView.getWebServicesClientView(clientRoot);
349
350                     if(clientView != null) {
351                         WebServicesClientSupport wss = WebServicesClientSupport.getWebServicesClientSupport(clientRoot);
352                         if (wss != null) {
353                             FileObject wsdlFolder = wss.getWsdlFolder();
354
355                             // Only display this node if there is a WSDL folder (too
356
// difficult to handle without.)
357
if(wsdlFolder != null) {
358                                 n = clientView.createWebServiceClientView(wsdlFolder);
359                             }
360                         }
361                     }
362                 }
363             }
364         }
365         else if (key == KEY_TEST_LIBRARIES) {
366             n = new LibrariesNode(
367                 NbBundle.getMessage(LogicalViewChildren.class,"CTL_TestLibrariesNode"),
368                 project,
369                 evaluator,
370                 updateHelper,
371                 refHelper,
372                 EjbJarProjectProperties.JAVAC_TEST_CLASSPATH,
373                 new String JavaDoc[] {
374                     EjbJarProjectProperties.BUILD_TEST_CLASSES_DIR,
375                     EjbJarProjectProperties.JAVAC_CLASSPATH,
376                     EjbJarProjectProperties.BUILD_CLASSES_DIR,
377                 },
378                 null,
379                 null,
380                 new Action JavaDoc[] {
381                     LibrariesNode.createAddProjectAction(project, EjbJarProjectProperties.JAVAC_TEST_CLASSPATH, null),
382                     LibrariesNode.createAddLibraryAction(project, updateHelper.getAntProjectHelper(), EjbJarProjectProperties.JAVAC_TEST_CLASSPATH, null),
383                     LibrariesNode.createAddFolderAction(project, EjbJarProjectProperties.JAVAC_TEST_CLASSPATH, null),
384                     null,
385                     new PreselectPropertiesAction(project, "Libraries", CustomizerLibraries.COMPILE_TESTS), //NOI18N
386
},
387                 null
388             );
389         }
390
391         return n == null ? new Node[0] : new Node[] {n};
392     }
393
394     public void stateChanged( ChangeEvent JavaDoc e ) {
395         //The caller holds ProjectManager.mutex() read lock
396
SwingUtilities.invokeLater (new Runnable JavaDoc () {
397             public void run () {
398                 createNodes();
399             }
400         });
401     }
402
403     private Collection JavaDoc getSourceRoots() {
404         SourceGroup[] groups = sources.getSourceGroups( JavaProjectConstants.SOURCES_TYPE_JAVA );
405         List JavaDoc result = new ArrayList JavaDoc(groups.length);
406         for (int i = 0; i < groups.length; i++) {
407             result.add(new SourceGroupKey(groups[i]));
408         }
409         return result;
410     }
411     
412     private static class SourceGroupKey {
413
414         public final SourceGroup group;
415         public final FileObject fileObject;
416
417         SourceGroupKey( SourceGroup group ) {
418             this.group = group;
419             this.fileObject = group.getRootFolder();
420         }
421
422         public int hashCode() {
423             return fileObject.hashCode();
424         }
425
426         public boolean equals( Object JavaDoc obj ) {
427             if ( !(obj instanceof SourceGroupKey) ) {
428                 return false;
429             }
430             else {
431                 SourceGroupKey otherKey = (SourceGroupKey)obj;
432                 String JavaDoc thisDisplayName = this.group.getDisplayName();
433                 String JavaDoc otherDisplayName = otherKey.group.getDisplayName ();
434                 return fileObject.equals(otherKey.fileObject ) &&
435                      thisDisplayName == null ? otherDisplayName == null : thisDisplayName.equals(otherDisplayName);
436             }
437         }
438     }
439
440 // private final class WsdlCreationListener extends FileChangeAdapter {
441
// public void fileFolderCreated (FileEvent fe) {
442
// // !PW Could screen this for WSDL directory, but it is probably
443
// // cheaper to just always refresh. How many folders is the
444
// // user likely to create in WEB-INF anyway?
445
// SwingUtilities.invokeLater(new Runnable() {
446
// public void run() {
447
// refreshKey(KEY_SERVICE_REFS);
448
// }
449
// });
450
// }
451
// }
452

453     /** Yet another cool filter node just to add properties action
454      */

455     private static class PackageViewFilterNode extends FilterNode {
456         
457         private String JavaDoc nodeName;
458         private Project project;
459         private Action JavaDoc[] actions;
460         
461         public PackageViewFilterNode(SourceGroup sourceGroup, Project project) {
462             super(PackageView.createPackageView(sourceGroup));
463             this.project = project;
464             this.nodeName = "Sources";
465         }
466         
467         public Action JavaDoc[] getActions(boolean context) {
468             if (!context) {
469                 if (actions == null) {
470                     Action JavaDoc superActions[] = super.getActions(context);
471                     actions = new Action JavaDoc[superActions.length + 2];
472                     System.arraycopy(superActions, 0, actions, 0, superActions.length);
473                     actions[superActions.length] = null;
474                     actions[superActions.length + 1] = new PreselectPropertiesAction(project, nodeName, null);
475                 }
476                 return actions;
477             } else {
478                 return super.getActions(context);
479             }
480         }
481     }
482     
483     private static class PreselectPropertiesAction extends AbstractAction JavaDoc {
484
485         private Project project;
486         private String JavaDoc nodeName;
487         private String JavaDoc panelName;
488
489         public PreselectPropertiesAction( Project project, String JavaDoc nodeName, String JavaDoc panelName ) {
490             super( NbBundle.getMessage( LogicalViewChildren.class, "LBL_Properties_Action" ) );
491             this.project = project;
492             this.nodeName = nodeName;
493             this.panelName = panelName;
494         }
495
496         public void actionPerformed( ActionEvent JavaDoc e ) {
497             CustomizerProviderImpl cp = (CustomizerProviderImpl)project.getLookup().lookup( CustomizerProviderImpl.class );
498             if ( cp != null ) {
499                 cp.showCustomizer( nodeName, panelName );
500             }
501         }
502     }
503     
504     private final class JaxWsChangeListener implements PropertyChangeListener JavaDoc {
505         public void propertyChange(PropertyChangeEvent JavaDoc evt) {
506
507             SwingUtilities.invokeLater(new Runnable JavaDoc() {
508                 public void run() {
509                     createNodes();
510                 }
511             });
512         }
513     }
514     
515     private final class MetaInfListener extends FileChangeAdapter {
516         public void fileFolderCreated (FileEvent fe) {
517             if (fe.getFile().isFolder() && "wsdl".equals(fe.getFile().getName())) { //NOI18N
518
fe.getFile().addFileChangeListener(wsdlListener);
519                 wsdlFolder=fe.getFile();
520             }
521         }
522         public void fileDeleted (FileEvent fe) {
523             if (fe.getFile().isFolder() && "wsdl".equals(fe.getFile().getName())) { //NOI18N
524
fe.getFile().removeFileChangeListener(wsdlListener);
525                 SwingUtilities.invokeLater(new Runnable JavaDoc() {
526                     public void run() {
527                         refreshKey(KEY_SERVICE_REFS);
528                     }
529                 });
530             }
531         }
532     }
533     
534     private final class WsdlCreationListener extends FileChangeAdapter {
535
536         public void fileDataCreated (FileEvent fe) {
537             if ("wsdl".equalsIgnoreCase(fe.getFile().getExt())) { //NOI18N
538
SwingUtilities.invokeLater(new Runnable JavaDoc() {
539                     public void run() {
540                         refreshKey(KEY_SERVICE_REFS);
541                     }
542                 });
543             }
544         }
545
546         public void fileDeleted (FileEvent fe) {
547             if ("wsdl".equalsIgnoreCase(fe.getFile().getExt())) { //NOI18N
548
SwingUtilities.invokeLater(new Runnable JavaDoc() {
549                     public void run() {
550                         refreshKey(KEY_SERVICE_REFS);
551                     }
552                 });
553             }
554         }
555     }
556     
557     private final class JaxRPCChangeListener extends FileChangeAdapter {
558
559         String JavaDoc webservicesFile = "webservices.xml";
560         public void fileDataCreated (FileEvent fe) {
561             if (webservicesFile.equalsIgnoreCase(fe.getFile().getNameExt())) { //NOI18N
562
SwingUtilities.invokeLater(new Runnable JavaDoc() {
563                     public void run() {
564                         createNodes();
565                     }
566                 });
567             }
568         }
569
570         public void fileDeleted (FileEvent fe) {
571             if (webservicesFile.equalsIgnoreCase(fe.getFile().getNameExt())) { //NOI18N
572
SwingUtilities.invokeLater(new Runnable JavaDoc() {
573                     public void run() {
574                         createNodes();
575                     }
576                 });
577             }
578         }
579
580         public void fileChanged(FileEvent fe) {
581             if (webservicesFile.equalsIgnoreCase(fe.getFile().getNameExt())) { //NOI18N
582
SwingUtilities.invokeLater(new Runnable JavaDoc() {
583                     public void run() {
584                         createNodes();
585                     }
586                 });
587             }
588         }
589     }
590 }
591
592
593
Popular Tags