Source Code Cross Referenced for IcanproViews.java in  » IDE-Netbeans » bpel » org » netbeans » modules » bpel » project » ui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » bpel » org.netbeans.modules.bpel.project.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.modules.bpel.project.ui;
021:
022:        import java.awt.Image;
023:
024:        import java.util.ArrayList;
025:        import java.util.Collections;
026:        import java.util.List;
027:        import javax.swing.Action;
028:        import org.netbeans.api.project.*;
029:        import org.netbeans.spi.project.ui.support.CommonProjectActions; //import org.netbeans.modules.j2ee.common.ui.ServerResourceNode;
030:        //import org.netbeans.modules.j2ee.dd.api.ejb.DDProvider;
031:
032:        import org.openide.filesystems.FileObject;
033:        import org.openide.loaders.DataFolder;
034:        import org.openide.loaders.DataObjectNotFoundException;
035:        import org.openide.nodes.Children;
036:        import org.openide.nodes.FilterNode;
037:        import org.openide.nodes.Node;
038:        import org.openide.util.NbBundle;
039:        import org.openide.util.Utilities;
040:
041:        //import org.netbeans.spi.java.project.support.ui.PackageView;
042:        import org.netbeans.spi.project.support.ant.AntProjectHelper;
043:        import org.netbeans.spi.project.support.ant.PropertyEvaluator;
044:
045:        import org.netbeans.modules.bpel.project.IcanproProject;
046:        import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties; // import org.netbeans.modules.websvc.api.webservices.WebServicesView;
047:        import org.openide.filesystems.FileChangeListener;
048:        import org.openide.loaders.DataObject;
049:        import java.util.logging.Logger;
050:        import javax.swing.event.ChangeEvent;
051:        import javax.swing.event.ChangeListener;
052:        import javax.swing.event.EventListenerList;
053:        import org.netbeans.api.queries.VisibilityQuery;
054:        import org.openide.loaders.ChangeableDataFilter;
055:        import org.openide.loaders.DataFilter;
056:
057:        class IcanproViews {
058:            private static Logger logger = Logger.getLogger(IcanproViews.class
059:                    .getName());
060:
061:            private static final DataFilter NO_FOLDERS_FILTER = new NoFoldersDataFilter();
062:
063:            private IcanproViews() {
064:            }
065:
066:            static final class LogicalViewChildren extends Children.Keys
067:                    implements  FileChangeListener {
068:
069:                private static final String KEY_SOURCE_DIR = "srcDir"; // NOI18N
070:                private static final String KEY_DOC_BASE = "docBase"; //NOI18N
071:                private static final String KEY_EJBS = "ejbKey"; //NOI18N
072:                private static final String WEBSERVICES_DIR = "webservicesDir"; // NOI18N 
073:                private static final String KEY_SETUP_DIR = "setupDir"; //NOI18N
074:
075:                private AntProjectHelper helper;
076:                private final PropertyEvaluator evaluator;
077:                private FileObject projectDir;
078:                private Project project;
079:
080:                public LogicalViewChildren(AntProjectHelper helper,
081:                        PropertyEvaluator evaluator, Project project) {
082:                    assert helper != null;
083:                    this .helper = helper;
084:                    projectDir = helper.getProjectDirectory();
085:                    this .evaluator = evaluator;
086:                    this .project = project;
087:                }
088:
089:                protected void addNotify() {
090:                    super .addNotify();
091:                    projectDir.addFileChangeListener(this );
092:                    createNodes();
093:                }
094:
095:                private void createNodes() {
096:                    List l = new ArrayList();
097:                    /*
098:                    l.add(KEY_EJBS);
099:                     */
100:
101:                    DataFolder docBaseDir = getFolder(IcanproProjectProperties.META_INF);
102:                    if (docBaseDir != null) {
103:                        /*
104:                        l.add(KEY_DOC_BASE);
105:                         */
106:                    }
107:
108:                    DataFolder srcDir = getFolder(IcanproProjectProperties.SRC_DIR);
109:                    if (srcDir != null) {
110:                        l.add(KEY_SOURCE_DIR);
111:                    }
112:
113:                    FileObject setupFolder = getSetupFolder();
114:                    if (setupFolder != null && setupFolder.isFolder()) {
115:                        l.add(KEY_SETUP_DIR);
116:                    }
117:                    /*
118:                     l.add(WEBSERVICES_DIR);
119:                     */
120:                    if (l.size() > 0) {
121:                        setKeys(l);
122:                    }
123:
124:                }
125:
126:                private FileObject getSetupFolder() {
127:                    return projectDir.getFileObject("setup"); //NOI18N
128:                }
129:
130:                protected void removeNotify() {
131:                    setKeys(Collections.EMPTY_SET);
132:                    projectDir.removeFileChangeListener(this );
133:                    super .removeNotify();
134:                }
135:
136:                protected Node[] createNodes(Object key) {
137:                    Node n = null;
138:                    if (key == KEY_SOURCE_DIR) {
139:                        FileObject srcRoot = helper.resolveFileObject(evaluator
140:                                .getProperty(IcanproProjectProperties.SRC_DIR));
141:                        Project p = FileOwnerQuery.getOwner(srcRoot);
142:                        Sources s = ProjectUtils.getSources(p);
143:                        SourceGroup sgs[] = ProjectUtils.getSources(p)
144:                                .getSourceGroups(
145:                                        IcanproProject.SOURCES_TYPE_ICANPRO);
146:                        for (int i = 0; i < sgs.length; i++) {
147:                            if (sgs[i].contains(srcRoot)) {
148:                                try {
149:                                    FileObject folder = sgs[i].getRootFolder();
150:                                    DataObject dobj = DataObject.find(folder);
151:                                    n = new RootNode(dobj.getNodeDelegate(),
152:                                            (DataFolder) dobj);
153:                                } catch (DataObjectNotFoundException ex) {
154:                                }
155:                                break;
156:                            }
157:                        }
158:                        /*
159:                        } else if (key == KEY_DOC_BASE) {
160:                            n = new DocBaseNode (getFolder(IcanproProjectProperties.META_INF).getNodeDelegate());
161:                        } else if (key == KEY_EJBS) {
162:                            FileObject srcRoot = helper.resolveFileObject(evaluator.getProperty (IcanproProjectProperties.SRC_DIR));
163:                            Project project = FileOwnerQuery.getOwner (srcRoot);
164:                            DDProvider provider = DDProvider.getDefault();
165:                            EjbJarImplementation jp = (EjbJarImplementation) project.getLookup().lookup(EjbJarImplementation.class);
166:                            org.netbeans.modules.j2ee.dd.api.ejb.EjbJar ejbJar = null;
167:                            try {
168:                                ejbJar = provider.getDDRoot(jp.getDeploymentDescriptor());
169:                            } catch (IOException ioe) {
170:                                ErrorManager.getDefault().notify(ioe);
171:                            }
172:                            ClassPathProvider cpp = (ClassPathProvider)
173:                                project.getLookup().lookup(ClassPathProvider.class);
174:                            assert cpp != null;
175:                            ClassPath classPath = cpp.findClassPath(srcRoot, ClassPath.SOURCE);
176:                            n = new EjbContainerNode(ejbJar, classPath);
177:                            //Node nws =  new WebServicesNode(ejbJar, classPath);
178:                            return n == null ? new Node[0] : new Node[] {n};
179:                        } else if (key == WEBSERVICES_DIR){
180:                        FileObject 	srcRoot = helper.resolveFileObject(evaluator.getProperty (IcanproProjectProperties.SRC_DIR));
181:                            WebServicesView webServicesView = WebServicesView.getWebServicesView(srcRoot);
182:                            if(webServicesView != null)
183:                        {
184:                        n = webServicesView.createWebServicesView(srcRoot);
185:                            }
186:                        } else if (key == KEY_SETUP_DIR) {
187:                            try {
188:                                DataObject sdo = DataObject.find(getSetupFolder());
189:                                n = new ServerResourceNode(project); // sdo.getNodeDelegate());
190:                            } catch (org.openide.loaders.DataObjectNotFoundException dnfe) {}
191:                         */
192:                    }
193:                    return n == null ? new Node[0] : new Node[] { n };
194:                }
195:
196:                private DataFolder getFolder(String propName) {
197:                    String propertyValue = evaluator.getProperty(propName);
198:                    if (propertyValue != null) {
199:                        FileObject fo = helper.resolveFileObject(evaluator
200:                                .getProperty(propName));
201:                        if (fo != null && fo.isValid()) {
202:                            try {
203:                                DataFolder df = DataFolder.findFolder(fo);
204:                                return df;
205:                            } catch (Exception ex) {
206:                                logger.fine(ex.getMessage());
207:                            }
208:                        }
209:                    }
210:                    return null;
211:                }
212:
213:                // file change events in the project directory
214:                public void fileAttributeChanged(
215:                        org.openide.filesystems.FileAttributeEvent fe) {
216:                }
217:
218:                public void fileChanged(org.openide.filesystems.FileEvent fe) {
219:                }
220:
221:                public void fileDataCreated(org.openide.filesystems.FileEvent fe) {
222:                }
223:
224:                public void fileDeleted(org.openide.filesystems.FileEvent fe) {
225:                    //            if (!projectDir.isValid()){
226:                    //                    org.netbeans.api.project.ui.OpenProjects.getDefault().close(new Project[] { project });                
227:                    //            }
228:
229:                }
230:
231:                public void fileFolderCreated(
232:                        org.openide.filesystems.FileEvent fe) {
233:                    // setup folder could be created
234:                    createNodes();
235:                }
236:
237:                public void fileRenamed(
238:                        org.openide.filesystems.FileRenameEvent fe) {
239:                    // setup folder could be renamed
240:                    createNodes();
241:                }
242:            }
243:
244:            private static final class RootNode extends FilterNode {
245:                public RootNode(Node n, DataFolder dataFolder) {
246:                    super (n, dataFolder.createNodeChildren(NO_FOLDERS_FILTER));
247:                    disableDelegation(DELEGATE_GET_DISPLAY_NAME
248:                            | DELEGATE_SET_DISPLAY_NAME
249:                            | DELEGATE_GET_SHORT_DESCRIPTION
250:                            | DELEGATE_GET_ACTIONS);
251:                    setDisplayName(NbBundle.getMessage(RootNode.class,
252:                            "LBL_ProcessFiles"));
253:
254:                }
255:
256:                @Override
257:                public Action[] getActions(boolean context) {
258:                    return new Action[] {
259:                            CommonProjectActions.newFileAction(),
260:                            null,
261:                            org.openide.util.actions.SystemAction
262:                                    .get(org.openide.actions.FileSystemAction.class),
263:                            null,
264:                            org.openide.util.actions.SystemAction
265:                                    .get(org.openide.actions.FindAction.class),
266:                            null,
267:                            org.openide.util.actions.SystemAction
268:                                    .get(org.openide.actions.PasteAction.class),
269:                            null,
270:                            org.openide.util.actions.SystemAction
271:                                    .get(org.openide.actions.ToolsAction.class), };
272:                }
273:
274:                public boolean canDestroy() {
275:                    return false;
276:                }
277:
278:                @Override
279:                public boolean canRename() {
280:                    return false;
281:                }
282:
283:                @Override
284:                public boolean canCopy() {
285:                    return false;
286:                }
287:
288:                @Override
289:                public boolean canCut() {
290:                    return false;
291:                }
292:
293:            }
294:
295:            private static final class DocBaseNode extends FilterNode {
296:                private static Image CONFIGURATION_FILES_BADGE = Utilities
297:                        .loadImage(
298:                                "org/netbeans/modules/bpel/project/ui/resources/docjar.gif",
299:                                true); // NOI18N
300:
301:                DocBaseNode(Node orig) {
302:                    super (orig);
303:                }
304:
305:                public Image getIcon(int type) {
306:                    return computeIcon(false, type);
307:                }
308:
309:                public Image getOpenedIcon(int type) {
310:                    return computeIcon(true, type);
311:                }
312:
313:                private Image computeIcon(boolean opened, int type) {
314:                    Node folderNode = getOriginal();
315:                    Image image = opened ? folderNode.getOpenedIcon(type)
316:                            : folderNode.getIcon(type);
317:                    return Utilities.mergeImages(image,
318:                            CONFIGURATION_FILES_BADGE, 7, 7);
319:                }
320:
321:                public String getDisplayName() {
322:                    return NbBundle.getMessage(IcanproViews.class,
323:                            "LBL_Node_DocBase"); //NOI18N
324:                }
325:            }
326:
327:            static final class NoFoldersDataFilter implements  ChangeListener,
328:                    ChangeableDataFilter {
329:
330:                EventListenerList ell = new EventListenerList();
331:
332:                public NoFoldersDataFilter() {
333:                    VisibilityQuery.getDefault().addChangeListener(this );
334:                }
335:
336:                public boolean acceptDataObject(DataObject obj) {
337:                    FileObject fo = obj.getPrimaryFile();
338:                    return VisibilityQuery.getDefault().isVisible(fo);
339:                }
340:
341:                public void stateChanged(ChangeEvent e) {
342:                    Object[] listeners = ell.getListenerList();
343:                    ChangeEvent event = null;
344:                    for (int i = listeners.length - 2; i >= 0; i -= 2) {
345:                        if (listeners[i] == ChangeListener.class) {
346:                            if (event == null) {
347:                                event = new ChangeEvent(this );
348:                            }
349:                            ((ChangeListener) listeners[i + 1])
350:                                    .stateChanged(event);
351:                        }
352:                    }
353:                }
354:
355:                public void addChangeListener(ChangeListener listener) {
356:                    ell.add(ChangeListener.class, listener);
357:                }
358:
359:                public void removeChangeListener(ChangeListener listener) {
360:                    ell.remove(ChangeListener.class, listener);
361:                }
362:
363:            }
364:
365:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.