Source Code Cross Referenced for Activator.java in  » Testing » KeY » visualdebugger » 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 » Testing » KeY » visualdebugger 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package visualdebugger;
002:
003:        import java.util.MissingResourceException;
004:        import java.util.ResourceBundle;
005:
006:        import org.eclipse.core.resources.IProject;
007:        import org.eclipse.jdt.core.ICompilationUnit;
008:        import org.eclipse.jdt.core.IJavaProject;
009:        import org.eclipse.jdt.core.IType;
010:        import org.eclipse.jdt.core.JavaModelException;
011:        import org.eclipse.jdt.core.dom.*;
012:        import org.eclipse.jface.resource.ImageDescriptor;
013:        import org.eclipse.ui.plugin.AbstractUIPlugin;
014:        import org.osgi.framework.BundleContext;
015:
016:        import visualdebugger.views.FindStatementById;
017:        import de.uka.ilkd.key.gui.Main;
018:        import de.uka.ilkd.key.visualdebugger.SourceElementId;
019:
020:        /**
021:         * The activator class controls the plug-in life cycle
022:         */
023:        public class Activator extends AbstractUIPlugin {
024:
025:            // The shared instance
026:            private static Activator plugin;
027:
028:            // The plug-in ID
029:            public static final String PLUGIN_ID = "VisualDebugger";
030:
031:            /**
032:             * Returns the shared instance
033:             * 
034:             * @return the shared instance
035:             */
036:            public static Activator getDefault() {
037:                return plugin;
038:            }
039:
040:            /**
041:             * Returns an image descriptor for the image file at the given plug-in
042:             * relative path
043:             * 
044:             * @param path
045:             *                the path
046:             * @return the image descriptor
047:             */
048:            public static ImageDescriptor getImageDescriptor(String path) {
049:                return imageDescriptorFromPlugin(PLUGIN_ID, path);
050:            }
051:
052:            /**
053:             * Returns the string from the plugin's resource bundle, or 'key' if not
054:             * found.
055:             */
056:            public static String getResourceString(String key) {
057:                ResourceBundle bundle = getDefault().getResourceBundle();
058:                try {
059:                    return (bundle != null) ? bundle.getString(key) : key;
060:                } catch (MissingResourceException e) {
061:                    return key;
062:                }
063:            }
064:
065:            private IProject iProject = null;
066:
067:            private IJavaProject project = null;
068:
069:            private ResourceBundle resourceBundle;
070:
071:            /**
072:             * The constructor
073:             */
074:            public Activator() {
075:                super ();
076:                plugin = this ;
077:            }
078:
079:            public ASTNode getASTNodeForStatementId(SourceElementId id) {
080:
081:                assert id != null && id.isStatement();
082:
083:                final ICompilationUnit unit = getCompilationUnit(id);
084:                if (unit == null) {
085:                    return null;
086:                }
087:
088:                final FindStatementById visitor = new FindStatementById(id);
089:
090:                findSourceElement(unit, visitor);
091:
092:                return visitor.getStatement();
093:            }
094:
095:            private void findSourceElement(final ICompilationUnit unit,
096:                    ASTVisitor visitor) {
097:                final ASTParser parser = ASTParser.newParser(AST.JLS3);
098:                parser.setResolveBindings(true);
099:                parser.setSource(unit);
100:                parser.createAST(null).accept(visitor);
101:            }
102:
103:            public ICompilationUnit getCompilationUnit(SourceElementId id) {
104:                assert id != null;
105:
106:                IType result = null;
107:
108:                try {
109:                    result = project.findType(id.getClassName());
110:                } catch (JavaModelException e) {
111:                    result = null;
112:                }
113:
114:                if (result == null) {
115:                    return null;
116:                }
117:
118:                return result.getCompilationUnit();
119:            }
120:
121:            public Expression getExpression(SourceElementId id) {
122:                assert id != null;
123:
124:                final ICompilationUnit unit = getCompilationUnit(id);
125:                if (unit == null) {
126:                    return null;
127:                }
128:
129:                final FindStatementById visitor = new FindStatementById(id);
130:                findSourceElement(unit, visitor);
131:
132:                return visitor.getExpression();
133:            }
134:
135:            public IProject getIProject() {
136:                return iProject;
137:            }
138:
139:            public IJavaProject getProject() {
140:                return project;
141:            }
142:
143:            /**
144:             * Returns the plugin's resource bundle,
145:             */
146:            public ResourceBundle getResourceBundle() {
147:                try {
148:                    if (resourceBundle == null)
149:                        resourceBundle = ResourceBundle
150:                                .getBundle("visualdebugger.VisualDebuggerResources");
151:                } catch (MissingResourceException x) {
152:                    resourceBundle = null;
153:                }
154:                return resourceBundle;
155:            }
156:
157:            public void setIProject(IProject project) {
158:                iProject = project;
159:            }
160:
161:            public void setProject(IJavaProject project) {
162:                this .project = project;
163:            }
164:
165:            /*
166:             * (non-Javadoc)
167:             * 
168:             * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
169:             */
170:            public void start(BundleContext context) throws Exception {
171:                super .start(context);
172:                Main.standalone = false;
173:            }
174:
175:            /*
176:             * (non-Javadoc)
177:             * 
178:             * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
179:             */
180:            public void stop(BundleContext context) throws Exception {
181:                super.stop(context);
182:                plugin = null;
183:                resourceBundle = null;
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.