Source Code Cross Referenced for SootPlugin.java in  » Code-Analyzer » soot » ca » mcgill » sable » soot » 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 » Code Analyzer » soot » ca.mcgill.sable.soot 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Soot - a J*va Optimization Framework
002:         * Copyright (C) 2003 Jennifer Lhotak
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the
016:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017:         * Boston, MA 02111-1307, USA.
018:         */
019:
020:        package ca.mcgill.sable.soot;
021:
022:        import org.eclipse.ui.PlatformUI;
023:        import org.eclipse.ui.plugin.*;
024:        import org.eclipse.core.runtime.*;
025:        import org.eclipse.core.resources.*;
026:        import org.eclipse.jface.preference.*;
027:        import org.eclipse.jface.resource.*;
028:        import org.eclipse.jface.text.source.ISourceViewer;
029:        import org.eclipse.swt.graphics.*;
030:        import org.eclipse.swt.*;
031:
032:        import java.net.*;
033:        import java.util.*;
034:
035:        import ca.mcgill.sable.soot.editors.ColorManager;
036:        import ca.mcgill.sable.soot.launching.*;
037:        import ca.mcgill.sable.soot.resources.*;
038:        import ca.mcgill.sable.soot.interaction.*;
039:
040:        /**
041:         * The main plugin class to be used in the desktop.
042:         */
043:        public class SootPlugin extends AbstractUIPlugin {
044:            //The shared instance.
045:            private static SootPlugin plugin;
046:            //Resource bundle.
047:            private ResourceBundle resourceBundle;
048:
049:            // used for showing soot ouptut
050:            private SootDocument soot_output_doc;
051:
052:            // listeners for soot output events
053:            private Vector sootOutputEventListeners = new Vector();
054:
055:            // list of jimple editor viewers
056:            private ArrayList editorViewers = new ArrayList();
057:
058:            private SootPartManager partManager;
059:
060:            private ColorManager colorManager;
061:
062:            private DataKeeper dataKeeper;
063:
064:            private Font sootFont = new Font(null, "Arial", 8, SWT.NORMAL);
065:
066:            private IProject currentProject;
067:
068:            /**
069:             * Method addSootOutputEventListener.
070:             * @param listener
071:             */
072:            public void addSootOutputEventListener(
073:                    ISootOutputEventListener listener) {
074:                sootOutputEventListeners.add(listener);
075:            }
076:
077:            /**
078:             * Method removeSootOutputEventListener.
079:             * @param listener
080:             */
081:            public void removeSootOutputEventListener(
082:                    ISootOutputEventListener listener) {
083:                sootOutputEventListeners.remove(listener);
084:            }
085:
086:            /**
087:             * Method fireSootOutputEvent.
088:             * @param event
089:             */
090:            public void fireSootOutputEvent(SootOutputEvent event) {
091:                Iterator it = sootOutputEventListeners.iterator();
092:                while (it.hasNext()) {
093:                    ((ISootOutputEventListener) it.next())
094:                            .handleSootOutputEvent(event);
095:                }
096:            }
097:
098:            /**
099:             * The constructor.
100:             */
101:            public SootPlugin(IPluginDescriptor descriptor) {
102:                super (descriptor);
103:                plugin = this ;
104:                // should work from startUp method
105:                soot_output_doc = new SootDocument();
106:                soot_output_doc.startUp();
107:
108:                try {
109:                    resourceBundle = ResourceBundle
110:                            .getBundle(ISootConstants.SOOT_PLUGIN_RESOURCES_ID);
111:                } catch (MissingResourceException x) {
112:                    resourceBundle = null;
113:                }
114:
115:                // maybe should go in startUp method
116:                // resource manager
117:                setManager(new SootResourceManager());
118:
119:                PlatformUI.getWorkbench().addWindowListener(
120:                        new SootWorkbenchListener());
121:                setPartManager(new SootPartManager());
122:            }
123:
124:            // used for getting any needed images for content outline
125:            // and possibly for attribute markers
126:            public static ImageDescriptor getImageDescriptor(String name) {
127:                try {
128:                    URL installURL = getDefault().getDescriptor()
129:                            .getInstallURL();
130:                    URL iconURL = new URL(installURL, ISootConstants.ICON_PATH
131:                            + name);
132:                    return ImageDescriptor.createFromURL(iconURL);
133:                } catch (MalformedURLException e) {
134:                    return ImageDescriptor.getMissingImageDescriptor();
135:                }
136:            }
137:
138:            protected void initializeDefaultPreferences(IPreferenceStore store) {
139:                // These settings will show up when Preference dialog
140:                // opens up for the first time.
141:                store.setDefault(
142:                        Messages.getString("SootPlugin.classes"), "soot.Main"); //$NON-NLS-1$ //$NON-NLS-2$
143:                store.setDefault(
144:                        Messages.getString("SootPlugin.selected"), "soot.Main"); //$NON-NLS-1$ //$NON-NLS-2$
145:            }
146:
147:            private SootResourceManager manager;
148:
149:            /**
150:             * Returns the shared instance.
151:             */
152:            public static SootPlugin getDefault() {
153:                return plugin;
154:            }
155:
156:            /**
157:             * Returns the workspace instance.
158:             */
159:            public static IWorkspace getWorkspace() {
160:                return ResourcesPlugin.getWorkspace();
161:            }
162:
163:            /**
164:             * Returns the string from the plugin's resource bundle,
165:             * or 'key' if not found.
166:             */
167:            public static String getResourceString(String key) {
168:                ResourceBundle bundle = SootPlugin.getDefault()
169:                        .getResourceBundle();
170:                try {
171:                    return bundle.getString(key);
172:                } catch (MissingResourceException e) {
173:                    return key;
174:                }
175:            }
176:
177:            /**
178:             * Returns the plugin's resource bundle,
179:             */
180:            public ResourceBundle getResourceBundle() {
181:                return resourceBundle;
182:            }
183:
184:            /**
185:             * Method startUp.
186:             * @throws CoreException
187:             */
188:            public void startUp() throws CoreException {
189:                super .startup();
190:                soot_output_doc = new SootDocument();
191:                soot_output_doc.startUp();
192:            }
193:
194:            /**
195:             * @see org.eclipse.core.runtime.Plugin#shutdown()
196:             */
197:            public void shutdown() throws CoreException {
198:                super .shutdown();
199:                sootOutputEventListeners.removeAllElements();
200:            }
201:
202:            /**
203:             * @return
204:             */
205:            public SootResourceManager getManager() {
206:                return manager;
207:            }
208:
209:            /**
210:             * @param manager
211:             */
212:            public void setManager(SootResourceManager manager) {
213:                this .manager = manager;
214:            }
215:
216:            public void addEditorViewer(ISourceViewer viewer) {
217:                viewer.addTextListener(getManager());
218:                getEditorViewers().add(viewer);
219:            }
220:
221:            /**
222:             * @return
223:             */
224:            public ArrayList getEditorViewers() {
225:                return editorViewers;
226:            }
227:
228:            /**
229:             * @param list
230:             */
231:            public void setEditorViewers(ArrayList list) {
232:                editorViewers = list;
233:            }
234:
235:            /**
236:             * @return
237:             */
238:            public SootPartManager getPartManager() {
239:                return partManager;
240:            }
241:
242:            /**
243:             * @param manager
244:             */
245:            public void setPartManager(SootPartManager manager) {
246:                partManager = manager;
247:            }
248:
249:            /**
250:             * @return
251:             */
252:            public ColorManager getColorManager() {
253:                if (colorManager == null) {
254:                    colorManager = new ColorManager();
255:                }
256:                return colorManager;
257:            }
258:
259:            /**
260:             * @param manager
261:             */
262:            public void setColorManager(ColorManager manager) {
263:                colorManager = manager;
264:            }
265:
266:            /**
267:             * @return
268:             */
269:            public DataKeeper getDataKeeper() {
270:                return dataKeeper;
271:            }
272:
273:            /**
274:             * @param keeper
275:             */
276:            public void setDataKeeper(DataKeeper keeper) {
277:                dataKeeper = keeper;
278:            }
279:
280:            /**
281:             * @return
282:             */
283:            public Font getSootFont() {
284:                return sootFont;
285:            }
286:
287:            /**
288:             * @param font
289:             */
290:            public void setSootFont(Font font) {
291:                sootFont = font;
292:            }
293:
294:            /**
295:             * @return
296:             */
297:            public IProject getCurrentProject() {
298:                return currentProject;
299:            }
300:
301:            /**
302:             * @param project
303:             */
304:            public void setCurrentProject(IProject project) {
305:                currentProject = project;
306:            }
307:
308:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.