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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 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.editors.text;
011:
012:        import java.nio.charset.UnmappableCharacterException;
013:
014:        import org.eclipse.core.runtime.Preferences;
015:
016:        import org.eclipse.core.resources.IResource;
017:
018:        import org.eclipse.core.filebuffers.IFileBuffer;
019:        import org.eclipse.core.filebuffers.IFileBufferStatusCodes;
020:
021:        import org.eclipse.jface.preference.IPreferenceStore;
022:
023:        import org.eclipse.jface.text.source.ISharedTextColors;
024:
025:        import org.eclipse.ui.PlatformUI;
026:        import org.eclipse.ui.internal.editors.text.EditorsPlugin;
027:        import org.eclipse.ui.internal.editors.text.NLSUtility;
028:        import org.eclipse.ui.keys.IBindingService;
029:        import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
030:        import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
031:        import org.eclipse.ui.texteditor.AnnotationTypeLookup;
032:        import org.eclipse.ui.texteditor.HyperlinkDetectorRegistry;
033:        import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
034:        import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
035:        import org.eclipse.ui.texteditor.spelling.SpellingService;
036:
037:        /**
038:         * The central class for access to this plug-in.
039:         * This class cannot be instantiated; all functionality is provided by
040:         * static methods.
041:         *
042:         * @since 3.0
043:         */
044:        public final class EditorsUI {
045:
046:            /**
047:             * TextEditor Plug-in ID (value <code>"org.eclipse.ui.editors"</code>).
048:             */
049:            public static final String PLUGIN_ID = "org.eclipse.ui.editors"; //$NON-NLS-1$
050:
051:            /**
052:             * The ID of the default text editor.
053:             */
054:            public static final String DEFAULT_TEXT_EDITOR_ID = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
055:
056:            /**
057:             * Returns the annotation type lookup of this plug-in.
058:             *
059:             * @return the annotation type lookup
060:             */
061:            public static AnnotationTypeLookup getAnnotationTypeLookup() {
062:                return EditorsPlugin.getDefault().getAnnotationTypeLookup();
063:            }
064:
065:            /**
066:             * Returns the annotation preference lookup of this plug-in.
067:             *
068:             * @return the annotation preference lookup
069:             */
070:            public static AnnotationPreferenceLookup getAnnotationPreferenceLookup() {
071:                return EditorsPlugin.getDefault()
072:                        .getAnnotationPreferenceLookup();
073:            }
074:
075:            /**
076:             * Returns the preference store of this plug-in.
077:             *
078:             * @return this plug-in's preference store
079:             */
080:            public static IPreferenceStore getPreferenceStore() {
081:                return EditorsPlugin.getDefault().getPreferenceStore();
082:            }
083:
084:            /**
085:             * Removes all preference which are handled by this plug-in's
086:             * general preference pages from the given store and prevents
087:             * setting the default values in the future.
088:             * <p>
089:             * To access the
090:             * general preference from another plug-in use a
091:             * {@link org.eclipse.ui.texteditor.ChainedPreferenceStore}:
092:             * <pre>
093:             *		List stores= new ArrayList(3);
094:             *		stores.add(YourPlugin.getDefault().getPreferenceStore());
095:             *		stores.add(EditorsUI.getPreferenceStore());
096:             *		combinedStore= new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()]));
097:             *
098:             * </pre>
099:             * </p>
100:             * <p>
101:             * Note: In order to work this method must be called before
102:             * the store's default values are set.
103:             * </p>
104:             *
105:             * @param store the preference store to mark
106:             */
107:            public static void useAnnotationsPreferencePage(
108:                    IPreferenceStore store) {
109:                MarkerAnnotationPreferences.useAnnotationsPreferencePage(store);
110:            }
111:
112:            /**
113:             * Removes all preference which are handled by this plug-in's
114:             * Quick Diff preference page from the given store and prevents
115:             * setting the default values in the future.
116:             * <p>
117:             * To access the
118:             * general preference from another plug-in use a
119:             * {@link org.eclipse.ui.texteditor.ChainedPreferenceStore}:
120:             * <pre>
121:             *		List stores= new ArrayList(3);
122:             *		stores.add(YourPlugin.getDefault().getPreferenceStore());
123:             *		stores.add(EditorsUI.getPreferenceStore());
124:             *		combinedStore= new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()]));
125:             *
126:             * </pre>
127:             * </p>
128:             * <p>
129:             * Note: In order to work this method must be called before
130:             * the store's default values are set.
131:             * </p>
132:             *
133:             * @param store the preference store to mark
134:             */
135:            public static void useQuickDiffPreferencePage(IPreferenceStore store) {
136:                MarkerAnnotationPreferences.useQuickDiffPreferencePage(store);
137:
138:                store
139:                        .setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON);
140:                store
141:                        .setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE);
142:                store
143:                        .setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER);
144:            }
145:
146:            private EditorsUI() {
147:                // block instantiation
148:            }
149:
150:            /**
151:             * Returns the preferences of this plug-in.
152:             *
153:             * @return the plug-in preferences
154:             * @see org.eclipse.core.runtime.Plugin#getPluginPreferences()
155:             */
156:            public static Preferences getPluginPreferences() {
157:                return EditorsPlugin.getDefault().getPluginPreferences();
158:            }
159:
160:            /**
161:             * Returns the spelling service.
162:             *
163:             * @return the spelling service
164:             * @since 3.1
165:             */
166:            public static SpellingService getSpellingService() {
167:                return EditorsPlugin.getDefault().getSpellingService();
168:            }
169:
170:            /**
171:             * Returns the shared text colors of this plug-in.
172:             *
173:             * @return the shared text colors
174:             * @since 3.3
175:             */
176:            public static ISharedTextColors getSharedTextColors() {
177:                return EditorsPlugin.getDefault().getSharedTextColors();
178:            }
179:
180:            /**
181:             * Returns the registry that contains the hyperlink detectors contributed
182:             * by  the <code>org.eclipse.ui.workbench.texteditor.hyperlinkDetectors</code>
183:             * extension point.
184:             * 
185:             * @return the hyperlink detector registry
186:             * @since 3.3
187:             */
188:            public static HyperlinkDetectorRegistry getHyperlinkDetectorRegistry() {
189:                return EditorsPlugin.getDefault()
190:                        .getHyperlinkDetectorRegistry();
191:            }
192:
193:            // --------------- Status codes for this plug-in ---------------
194:
195:            // NOTE: See also IEditorsStatusConstants 
196:
197:            /**
198:             * Editor UI plug-in status code indicating that an operation failed
199:             * because a character could not be mapped using the given
200:             * charset.
201:             * <p>
202:             * Value: {@value}</p>
203:             * 
204:             * @see UnmappableCharacterException
205:             * @since 3.2
206:             */
207:            public static final int CHARSET_MAPPING_FAILED = 1;
208:
209:            /**
210:             * Editor UI plug-in status code indicating that state
211:             * validation failed.
212:             * <p>
213:             * Value: {@value}</p>
214:             * 
215:             * @see IFileBuffer#validateState(org.eclipse.core.runtime.IProgressMonitor, Object)
216:             * @since 3.3
217:             */
218:            public static final int STATE_VALIDATION_FAILED = IFileBufferStatusCodes.STATE_VALIDATION_FAILED;
219:
220:            /**
221:             * Editor UI plug-in status code indicating that
222:             * a resource is marked derived.
223:             * <p>
224:             * Value: {@value}</p>
225:             * 
226:             * @see IResource#isDerived()
227:             * @since 3.3
228:             */
229:            public static final int DERIVED_FILE = IFileBufferStatusCodes.DERIVED_FILE;
230:
231:            /**
232:             * Returns the tool tip affordance string.
233:             *
234:             * @return the affordance string which is empty if the preference is enabled
235:             *			but the key binding not active or <code>null</code> if the
236:             *			preference is disabled or the binding service is unavailable
237:             * @since 3.3
238:             */
239:            public static final String getTooltipAffordanceString() {
240:                if (!getPreferenceStore()
241:                        .getBoolean(
242:                                AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE))
243:                    return null;
244:
245:                IBindingService bindingService = (IBindingService) PlatformUI
246:                        .getWorkbench().getAdapter(IBindingService.class);
247:                if (bindingService == null)
248:                    return null;
249:
250:                String keySequence = bindingService
251:                        .getBestActiveBindingFormattedFor(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
252:                if (keySequence == null)
253:                    return ""; //$NON-NLS-1$
254:
255:                return NLSUtility.format(
256:                        TextEditorMessages.Editor_toolTip_affordance,
257:                        keySequence);
258:            }
259:
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.