Source Code Cross Referenced for EtlproViews.java in  » IDE-Netbeans » etl.project » org » netbeans » modules » etl » 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 » etl.project » org.netbeans.modules.etl.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:        package org.netbeans.modules.etl.project.ui;
020:
021:        import java.beans.PropertyChangeEvent;
022:        import java.beans.PropertyChangeListener;
023:        import java.util.ArrayList;
024:        import java.util.Collections;
025:        import java.util.List;
026:
027:        import javax.swing.event.ChangeEvent;
028:        import javax.swing.event.ChangeListener;
029:        import javax.swing.event.EventListenerList;
030:        import org.netbeans.api.project.Project;
031:
032:        import org.netbeans.api.queries.VisibilityQuery;
033:        import org.openide.filesystems.FileObject;
034:        import org.openide.loaders.DataFolder;
035:        import org.openide.nodes.Children;
036:        import org.openide.nodes.FilterNode;
037:        import org.openide.nodes.Node;
038:        import net.java.hulp.i18n.Logger;
039:        import org.netbeans.spi.project.support.ant.AntProjectHelper;
040:        import org.netbeans.spi.project.support.ant.PropertyEvaluator;
041:
042:        import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties;
043:        import org.netbeans.modules.etl.logger.Localizer;
044:        import org.netbeans.modules.etl.logger.LogUtil;
045:        import org.openide.filesystems.FileChangeListener;
046:        import org.openide.loaders.ChangeableDataFilter;
047:        import org.openide.loaders.DataFilter;
048:        import org.openide.loaders.DataObject;
049:        import org.openide.loaders.DataObjectNotFoundException;
050:
051:        class EtlproViews {
052:
053:            private EtlproViews() {
054:            }
055:
056:            static final class LogicalViewChildren extends Children.Keys
057:                    implements  FileChangeListener {
058:
059:                private static final String KEY_SOURCE_DIR = "srcDir"; // NOI18N        
060:                private static final String KEY_SETUP_DIR = "setupDir"; //NOI18N
061:                private AntProjectHelper helper;
062:                private final PropertyEvaluator evaluator;
063:                private FileObject projectDir;
064:                private Project project;
065:                private static transient final Logger mLogger = LogUtil
066:                        .getLogger(EtlproViews.class.getName());
067:                private static transient final Localizer mLoc = Localizer.get();
068:
069:                public LogicalViewChildren(AntProjectHelper helper,
070:                        PropertyEvaluator evaluator, Project project) {
071:                    assert helper != null;
072:                    this .helper = helper;
073:                    projectDir = helper.getProjectDirectory();
074:                    this .evaluator = evaluator;
075:                    this .project = project;
076:                }
077:
078:                protected void addNotify() {
079:                    super .addNotify();
080:                    projectDir.addFileChangeListener(this );
081:                    createNodes();
082:                }
083:
084:                private void createNodes() {
085:                    List l = new ArrayList();
086:
087:                    DataFolder srcDir = getFolder(IcanproProjectProperties.SRC_DIR);
088:                    if (srcDir != null) {
089:                        l.add(KEY_SOURCE_DIR);
090:                    }
091:
092:                    FileObject setupFolder = getSetupFolder();
093:                    if (setupFolder != null && setupFolder.isFolder()) {
094:                        l.add(KEY_SETUP_DIR);
095:                    }
096:                    setKeys(l);
097:                }
098:
099:                private FileObject getSetupFolder() {
100:                    return projectDir.getFileObject("setup"); //NOI18N
101:                }
102:
103:                @Override
104:                protected void removeNotify() {
105:                    setKeys(Collections.EMPTY_SET);
106:                    projectDir.removeFileChangeListener(this );
107:                    super .removeNotify();
108:                }
109:
110:                protected Node[] createNodes(Object key) {
111:                    Node n = null;
112:                    if (key == KEY_SOURCE_DIR) {
113:                        FileObject srcRoot = helper.resolveFileObject(evaluator
114:                                .getProperty(IcanproProjectProperties.SRC_DIR));
115:                        DataObject fileDO;
116:                        try {
117:                            fileDO = DataObject.find(srcRoot);
118:                            n = new ViewItemNode((DataFolder) fileDO,
119:                                    "collaborations", "collaborations");
120:                        } catch (DataObjectNotFoundException e) {
121:                            throw new AssertionError(e);
122:                        }
123:
124:                    }
125:                    return n == null ? new Node[0] : new Node[] { n };
126:                }
127:
128:                private DataFolder getFolder(String propName) {
129:                    try {
130:                        FileObject fo = helper.resolveFileObject(evaluator
131:                                .getProperty(propName));
132:                        if (fo != null) {
133:                            DataFolder df = DataFolder.findFolder(fo);
134:                            return df;
135:                        }
136:                    } catch (Exception ex) {
137:                        mLogger.errorNoloc(mLoc.t("PRSR021: Exception :{0}", ex
138:                                .getMessage()), ex);
139:                    }
140:                    return null;
141:                }
142:
143:                // file change events in the project directory
144:                public void fileAttributeChanged(
145:                        org.openide.filesystems.FileAttributeEvent fe) {
146:                }
147:
148:                public void fileChanged(org.openide.filesystems.FileEvent fe) {
149:                }
150:
151:                public void fileDataCreated(org.openide.filesystems.FileEvent fe) {
152:                }
153:
154:                public void fileDeleted(org.openide.filesystems.FileEvent fe) {
155:                    createNodes();
156:                }
157:
158:                public void fileFolderCreated(
159:                        org.openide.filesystems.FileEvent fe) {
160:                    createNodes();
161:                }
162:
163:                public void fileRenamed(
164:                        org.openide.filesystems.FileRenameEvent fe) {
165:                    createNodes();
166:                }
167:            }
168:
169:            private static final DataFilter FILTER = new CollabDataFilter();
170:
171:            private static final class ViewItemNode extends FilterNode
172:                    implements  PropertyChangeListener {
173:
174:                private final String name;
175:                private final String displayName;
176:
177:                public ViewItemNode(DataFolder folder, String name,
178:                        String displayName) {
179:                    super (folder.getNodeDelegate(), folder
180:                            .createNodeChildren(FILTER));
181:                    this .name = name;
182:                    this .displayName = displayName;
183:                }
184:
185:                public String getName() {
186:                    return name;
187:                }
188:
189:                public String getDisplayName() {
190:                    return displayName;
191:                }
192:
193:                public boolean canRename() {
194:                    return true;
195:                }
196:
197:                public boolean canDestroy() {
198:                    return true;
199:                }
200:
201:                public boolean canCut() {
202:                    return true;
203:                }
204:
205:                @Override
206:                public void setName(String arg0) {
207:                    super .setName(arg0);
208:                }
209:
210:                public void propertyChange(PropertyChangeEvent evt) {
211:                    fireNameChange(null, null);
212:                    fireDisplayNameChange(null, null);
213:                    fireIconChange();
214:                    fireOpenedIconChange();
215:                }
216:            }
217:
218:            static final class CollabDataFilter implements  ChangeListener,
219:                    ChangeableDataFilter {
220:
221:                EventListenerList ell = new EventListenerList();
222:
223:                public CollabDataFilter() {
224:                    VisibilityQuery.getDefault().addChangeListener(this );
225:                }
226:
227:                public boolean acceptDataObject(DataObject obj) {
228:                    FileObject fo = obj.getPrimaryFile();
229:                    return VisibilityQuery.getDefault().isVisible(fo);
230:                }
231:
232:                public void stateChanged(ChangeEvent e) {
233:                    Object[] listeners = ell.getListenerList();
234:                    ChangeEvent event = null;
235:                    for (int i = listeners.length - 2; i >= 0; i -= 2) {
236:                        if (listeners[i] == ChangeListener.class) {
237:                            if (event == null) {
238:                                event = new ChangeEvent(this );
239:                            }
240:                            ((ChangeListener) listeners[i + 1])
241:                                    .stateChanged(event);
242:                        }
243:                    }
244:                }
245:
246:                public void addChangeListener(ChangeListener listener) {
247:                    ell.add(ChangeListener.class, listener);
248:                }
249:
250:                public void removeChangeListener(ChangeListener listener) {
251:                    ell.remove(ChangeListener.class, listener);
252:                }
253:            }
254:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.