Source Code Cross Referenced for OpenAction.java in  » Byte-Code » asm » de » loskutov » bco » ui » actions » 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 » Byte Code » asm » de.loskutov.bco.ui.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************************
002:         * Copyright (c) 2004 Andrei Loskutov. All rights reserved. This program and the
003:         * accompanying materials are made available under the terms of the BSD License which
004:         * accompanies this distribution, and is available at
005:         * http://www.opensource.org/licenses/bsd-license.php Contributor: Andrei Loskutov -
006:         * initial API and implementation
007:         ****************************************************************************************/package de.loskutov.bco.ui.actions;
008:
009:        import org.eclipse.core.resources.IContainer;
010:        import org.eclipse.core.resources.IFile;
011:        import org.eclipse.core.resources.IResource;
012:        import org.eclipse.core.resources.ResourcesPlugin;
013:        import org.eclipse.jdt.core.IJavaElement;
014:        import org.eclipse.jdt.core.JavaCore;
015:        import org.eclipse.jface.action.IAction;
016:        import org.eclipse.jface.dialogs.IDialogConstants;
017:        import org.eclipse.swt.widgets.Shell;
018:        import org.eclipse.ui.IObjectActionDelegate;
019:        import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
020:
021:        import de.loskutov.bco.BytecodeOutlinePlugin;
022:
023:        /**
024:         * @author Andrei
025:         */
026:        public class OpenAction extends BytecodeAction implements 
027:                IObjectActionDelegate {
028:
029:            /**
030:             * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
031:             */
032:            public void run(IAction action) {
033:                // always only one element!
034:                IJavaElement[] resources = getSelectedResources();
035:
036:                // select one from input dialog
037:                IJavaElement element2 = selectJavaElement();
038:                if (element2 == null) {
039:                    return;
040:                }
041:                try {
042:                    exec(resources[0], element2);
043:                } catch (Exception e) {
044:                    BytecodeOutlinePlugin.error("Failed to run Compare: "
045:                            + e.getMessage(), e);
046:                }
047:            }
048:
049:            private IJavaElement selectJavaElement() {
050:                IContainer input = ResourcesPlugin.getWorkspace().getRoot();
051:
052:                OpenClassFileDialog dialog = new OpenClassFileDialog(shell,
053:                        input, IResource.FILE);
054:
055:                int resultCode = dialog.open();
056:                if (resultCode != IDialogConstants.OK_ID) {
057:                    return null;
058:                }
059:
060:                Object[] result = dialog.getResult();
061:                if (result == null || result.length == 0
062:                        || !(result[0] instanceof  IFile)) {
063:                    return null;
064:                }
065:                return JavaCore.create((IFile) result[0]);
066:            }
067:
068:            /**
069:             * @author Andrei
070:             */
071:            private static final class OpenClassFileDialog extends
072:                    ResourceListSelectionDialog {
073:
074:                /**
075:                 * @param parentShell
076:                 * @param container
077:                 * @param typesMask
078:                 */
079:                public OpenClassFileDialog(Shell parentShell,
080:                        IContainer container, int typesMask) {
081:                    super (parentShell, container, typesMask);
082:                    setTitle("Bytecode compare");
083:                    setMessage("Please select class file to compare");
084:                }
085:
086:                /**
087:                 * Extends the super's filter to exclude derived resources.
088:                 * @since 3.0
089:                 */
090:                protected boolean select(IResource resource) {
091:                    if (resource == null) {
092:                        return false;
093:                    }
094:                    String fileExtension = resource.getFileExtension();
095:                    return super .select(resource)
096:                            && ("java".equals(fileExtension) || "class"
097:                                    .equals(fileExtension));
098:                }
099:            }
100:
101:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.