Source Code Cross Referenced for TextEditorPlugin.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » texteditor » 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 Eclipse » ui workbench » org.eclipse.ui.internal.texteditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.internal.texteditor;
011:
012:        import java.util.HashSet;
013:        import java.util.Iterator;
014:        import java.util.Set;
015:
016:        import org.osgi.framework.BundleContext;
017:
018:        import org.eclipse.core.runtime.Assert;
019:        import org.eclipse.core.runtime.IRegistryChangeEvent;
020:        import org.eclipse.core.runtime.IRegistryChangeListener;
021:        import org.eclipse.core.runtime.Platform;
022:
023:        import org.eclipse.jface.action.IAction;
024:
025:        import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffExtensionsRegistry;
026:        import org.eclipse.ui.internal.texteditor.spelling.SpellingEngineRegistry;
027:        import org.eclipse.ui.plugin.AbstractUIPlugin;
028:
029:        /**
030:         * The plug-in runtime class for the text editor UI plug-in (id <code>"org.eclipse.ui.workbench.texteditor"</code>).
031:         * This class provides static methods for:
032:         * <ul>
033:         *  <li> getting the last editor position.</li>
034:         * </ul>
035:         * <p>
036:         * This class provides static methods and fields only; it is not intended to be
037:         * instantiated or subclassed by clients.
038:         * </p>
039:         *
040:         * @since 2.1
041:         */
042:        public final class TextEditorPlugin extends AbstractUIPlugin implements 
043:                IRegistryChangeListener {
044:
045:            /** The plug-in instance */
046:            private static TextEditorPlugin fgPlugin;
047:
048:            /** The last edit position */
049:            private EditPosition fLastEditPosition;
050:            /** The action which goes to the last edit position */
051:            private Set fLastEditPositionDependentActions;
052:
053:            /**
054:             * The quick diff extension registry.
055:             * @since 3.0
056:             */
057:            private QuickDiffExtensionsRegistry fQuickDiffExtensionRegistry;
058:
059:            /**
060:             * The spelling engine registry
061:             * @since 3.1
062:             */
063:            private SpellingEngineRegistry fSpellingEngineRegistry;
064:
065:            /**
066:             * Creates a plug-in instance.
067:             */
068:            public TextEditorPlugin() {
069:                super ();
070:                Assert.isTrue(fgPlugin == null);
071:                fgPlugin = this ;
072:            }
073:
074:            /**
075:             * Returns the plug-in instance.
076:             *
077:             * @return the text editor plug-in instance
078:             * @since 3.0
079:             */
080:            public static TextEditorPlugin getDefault() {
081:                return fgPlugin;
082:            }
083:
084:            /**
085:             * Text editor UI plug-in Id (value <code>"org.eclipse.ui.workbench.texteditor"</code>).
086:             */
087:            public static final String PLUGIN_ID = "org.eclipse.ui.workbench.texteditor"; //$NON-NLS-1$
088:
089:            /**
090:             * Extension Id of quick diff reference provider extension point.
091:             * (value <code>"quickDiffReferenceProvider"</code>).
092:             * @since 3.0
093:             */
094:            public static final String REFERENCE_PROVIDER_EXTENSION_POINT = "quickDiffReferenceProvider"; //$NON-NLS-1$
095:
096:            /**
097:             * Returns the last edit position.
098:             *
099:             * @return	the last edit position or <code>null</code>	if there is no last edit position
100:             * @see EditPosition
101:             */
102:            EditPosition getLastEditPosition() {
103:                return fLastEditPosition;
104:            }
105:
106:            /**
107:             * Sets the last edit position.
108:             *
109:             * @param lastEditPosition	the last edit position
110:             * @see EditPosition
111:             */
112:            public void setLastEditPosition(EditPosition lastEditPosition) {
113:                fLastEditPosition = lastEditPosition;
114:                if (fLastEditPosition != null
115:                        && fLastEditPositionDependentActions != null) {
116:                    Iterator iter = fLastEditPositionDependentActions
117:                            .iterator();
118:                    while (iter.hasNext())
119:                        ((IAction) iter.next()).setEnabled(true);
120:                    fLastEditPositionDependentActions = null;
121:                }
122:            }
123:
124:            /**
125:             * Adds the given action to the last edit position dependent actions.
126:             *
127:             * @param action the goto last edit position action
128:             */
129:            void addLastEditPositionDependentAction(IAction action) {
130:                if (fLastEditPosition != null)
131:                    return;
132:                if (fLastEditPositionDependentActions == null)
133:                    fLastEditPositionDependentActions = new HashSet();
134:                fLastEditPositionDependentActions.add(action);
135:            }
136:
137:            /**
138:             * Removes the given action from the last edit position dependent actions.
139:             *
140:             * @param action the action that depends on the last edit position
141:             */
142:            void removeLastEditPositionDependentAction(IAction action) {
143:                if (fLastEditPosition != null)
144:                    return;
145:                if (fLastEditPositionDependentActions != null)
146:                    fLastEditPositionDependentActions.remove(action);
147:            }
148:
149:            /*
150:             * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
151:             * @since 3.0
152:             */
153:            public void start(BundleContext context) throws Exception {
154:                super .start(context);
155:                fQuickDiffExtensionRegistry = new QuickDiffExtensionsRegistry();
156:                fSpellingEngineRegistry = new SpellingEngineRegistry();
157:                Platform.getExtensionRegistry().addRegistryChangeListener(this ,
158:                        PLUGIN_ID);
159:            }
160:
161:            /*
162:             * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
163:             * @since 3.0
164:             */
165:            public void stop(BundleContext context) throws Exception {
166:                Platform.getExtensionRegistry().removeRegistryChangeListener(
167:                        this );
168:                fQuickDiffExtensionRegistry = null;
169:                fSpellingEngineRegistry = null;
170:                super .stop(context);
171:            }
172:
173:            /*
174:             * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
175:             * @since 3.0
176:             */
177:            public void registryChanged(IRegistryChangeEvent event) {
178:                if (fQuickDiffExtensionRegistry != null
179:                        && event.getExtensionDeltas(PLUGIN_ID,
180:                                REFERENCE_PROVIDER_EXTENSION_POINT).length > 0)
181:                    fQuickDiffExtensionRegistry.reloadExtensions();
182:                if (fSpellingEngineRegistry != null
183:                        && event
184:                                .getExtensionDeltas(
185:                                        PLUGIN_ID,
186:                                        SpellingEngineRegistry.SPELLING_ENGINE_EXTENSION_POINT).length > 0)
187:                    fSpellingEngineRegistry.reloadExtensions();
188:            }
189:
190:            /**
191:             * Returns this plug-ins quick diff extension registry.
192:             *
193:             * @return the quick diff extension registry or <code>null</code> if this plug-in has been shutdown
194:             * @since 3.0
195:             */
196:            public QuickDiffExtensionsRegistry getQuickDiffExtensionRegistry() {
197:                return fQuickDiffExtensionRegistry;
198:            }
199:
200:            /**
201:             * Returns this plug-ins spelling engine registry.
202:             *
203:             * @return the spelling engine registry or <code>null</code> if this plug-in has been shutdown
204:             * @since 3.1
205:             */
206:            public SpellingEngineRegistry getSpellingEngineRegistry() {
207:                return fSpellingEngineRegistry;
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.