Source Code Cross Referenced for EtlproActionProvider.java in  » IDE-Netbeans » etl.project » org » netbeans » modules » etl » project » 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 
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;
020:
021:        import java.awt.Dialog;
022:        import java.io.IOException;
023:        import java.util.HashMap;
024:        import java.util.Map;
025:        import java.util.Properties;
026:        import org.apache.tools.ant.module.api.support.ActionUtils;
027:        import org.netbeans.spi.project.ActionProvider;
028:        import org.netbeans.spi.project.support.ant.AntProjectHelper;
029:        import org.openide.filesystems.FileObject;
030:        import org.openide.util.NbBundle;
031:        import org.openide.util.Lookup;
032:        import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties;
033:        import org.netbeans.spi.project.support.ant.ReferenceHelper;
034:        import org.openide.*;
035:
036:        import org.netbeans.modules.compapp.projects.base.ui.NoSelectedServerWarning;
037:        import org.netbeans.modules.compapp.projects.base.IcanproConstants;
038:        import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
039:
040:        /** Action provider of the Web project. This is the place where to do
041:         * strange things to Web actions. E.g. compile-single.
042:         */
043:        class EtlproActionProvider implements  ActionProvider {
044:
045:            // Definition of commands
046:
047:            // Commands available from Web project
048:            private static final String[] supportedActions = { COMMAND_BUILD,
049:                    COMMAND_CLEAN, COMMAND_REBUILD, COMMAND_COMPILE_SINGLE,
050:                    EtlproProject.COMMAND_GENWSDL,
051:                    EtlproProject.COMMAND_SCHEMA,
052:                    EtlproProject.COMMAND_BULK_LOADER, COMMAND_DELETE,
053:                    COMMAND_COPY, COMMAND_MOVE, COMMAND_RENAME, };
054:
055:            // Project
056:            EtlproProject project;
057:            // Ant project helper of the project
058:            private AntProjectHelper antProjectHelper;
059:            private ReferenceHelper refHelper;
060:            /** Map from commands to ant targets */
061:            Map/*<String,String[]>*/commands;
062:
063:            public EtlproActionProvider(EtlproProject project,
064:                    AntProjectHelper antProjectHelper, ReferenceHelper refHelper) {
065:                commands = new HashMap();
066:                commands.put(COMMAND_BUILD, new String[] { "dist" }); // NOI18N
067:                commands.put(COMMAND_CLEAN, new String[] { "clean" }); // NOI18N
068:                commands.put(COMMAND_REBUILD, new String[] { "clean", "dist" }); // NOI18N
069:                commands.put(EtlproProject.COMMAND_GENWSDL,
070:                        new String[] { "gen-wsdl" }); // NOI18N
071:                commands.put(EtlproProject.COMMAND_SCHEMA,
072:                        new String[] { "gen-schema" }); // NOI18N
073:                commands.put(EtlproProject.COMMAND_BULK_LOADER,
074:                        new String[] { "etl_bulkloader" }); // NOI18N
075:                //commands.put(IcanproConstants.COMMAND_REDEPLOY, new String[] {"run"}); // NOI18N
076:                //commands.put(IcanproConstants.COMMAND_DEPLOY, new String[] {"run"}); // NOI18N
077:
078:                this .antProjectHelper = antProjectHelper;
079:                this .project = project;
080:                this .refHelper = refHelper;
081:            }
082:
083:            private FileObject findBuildXml() {
084:                return project.getProjectDirectory().getFileObject(
085:                        project.getBuildXmlName());
086:            }
087:
088:            public String[] getSupportedActions() {
089:                return supportedActions;
090:            }
091:
092:            public void invokeAction(String command, Lookup context)
093:                    throws IllegalArgumentException {
094:                Properties p = null;
095:                String[] targetNames = (String[]) commands.get(command);
096:
097:                if (COMMAND_COPY.equals(command)) {
098:                    DefaultProjectOperations
099:                            .performDefaultCopyOperation(project);
100:                    return;
101:                }
102:
103:                if (COMMAND_MOVE.equals(command)) {
104:                    DefaultProjectOperations
105:                            .performDefaultMoveOperation(project);
106:                    return;
107:                }
108:
109:                if (COMMAND_RENAME.equals(command)) {
110:                    DefaultProjectOperations.performDefaultRenameOperation(
111:                            project, null);
112:                    return;
113:                }
114:                if (COMMAND_DELETE.equals(command)) {
115:                    try {
116:                        project.getAntProjectHelper().resolveFileObject("data")
117:                                .delete();
118:                        DefaultProjectOperations
119:                                .performDefaultDeleteOperation(project);
120:                        return;
121:                    } catch (IOException ex) {
122:                    }
123:                }
124:                //EXECUTION PART
125:                if (command.equals(IcanproConstants.COMMAND_DEPLOY)
126:                        || command.equals(IcanproConstants.COMMAND_REDEPLOY)) {
127:                    if (!isSelectedServer()) {
128:                        return;
129:                    }
130:                } /*else {
131:                           p = null;
132:                           if (targetNames == null) {
133:                               throw new IllegalArgumentException(command);
134:                           }
135:                       }*/
136:
137:                try {
138:                    ActionUtils.runTarget(findBuildXml(), targetNames, p);
139:                } catch (IOException e) {
140:                    ErrorManager.getDefault().notify(e);
141:                }
142:            }
143:
144:            public boolean isActionEnabled(String command, Lookup context) {
145:                return findBuildXml() != null;
146:            }
147:
148:            // Private methods -----------------------------------------------------
149:            private boolean isDebugged() {
150:                return false;
151:            }
152:
153:            String[] getTargetNames(String command, Lookup context, Properties p)
154:                    throws IllegalArgumentException {
155:                String[] targetNames = (String[]) commands.get(command);
156:                return targetNames;
157:            }
158:
159:            private boolean isSelectedServer() {
160:                String instance = antProjectHelper
161:                        .getStandardPropertyEvaluator().getProperty(
162:                                IcanproProjectProperties.J2EE_SERVER_INSTANCE);
163:                boolean selected;
164:                if (instance != null) {
165:                    selected = true;
166:                } else {
167:                    // no selected server => warning
168:                    String server = antProjectHelper
169:                            .getStandardPropertyEvaluator().getProperty(
170:                                    IcanproProjectProperties.J2EE_SERVER_TYPE);
171:                    NoSelectedServerWarning panel = new NoSelectedServerWarning(
172:                            server);
173:
174:                    Object[] options = new Object[] {
175:                            DialogDescriptor.OK_OPTION,
176:                            DialogDescriptor.CANCEL_OPTION };
177:                    DialogDescriptor desc = new DialogDescriptor(
178:                            panel,
179:                            NbBundle.getMessage(NoSelectedServerWarning.class,
180:                                    "CTL_NoSelectedServerWarning_Title"), // NOI18N
181:                            true, options, options[0],
182:                            DialogDescriptor.DEFAULT_ALIGN, null, null);
183:                    Dialog dlg = DialogDisplayer.getDefault()
184:                            .createDialog(desc);
185:                    dlg
186:                            .getAccessibleContext()
187:                            .setAccessibleDescription(
188:                                    "This dialog displays warning if no server is selected");
189:                    dlg.setVisible(true);
190:                    if (desc.getValue() != options[0]) {
191:                        selected = false;
192:                    } else {
193:                        instance = panel.getSelectedInstance();
194:                        selected = instance != null;
195:                        if (selected) {
196:                            IcanproProjectProperties wpp = new IcanproProjectProperties(
197:                                    project, antProjectHelper, refHelper);
198:                            wpp
199:                                    .put(
200:                                            IcanproProjectProperties.J2EE_SERVER_INSTANCE,
201:                                            instance);
202:                            wpp.store();
203:                        }
204:                    }
205:                    dlg.dispose();
206:                }
207:                return selected;
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.