org.eclipse.ui.editors.text.EditorsUI Java Examples
The following examples show how to use
org.eclipse.ui.editors.text.EditorsUI.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractLangEditor.java From goclipse with Eclipse Public License 1.0 | 6 votes |
protected IPreferenceStore createCombinedPreferenceStore(IEditorInput input) { List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(4); IProject project = EditorUtils.getAssociatedProject(input); if (project != null) { stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), LangUIPlugin.PLUGIN_ID)); } stores.add(LangUIPlugin.getInstance().getPreferenceStore()); stores.add(LangUIPlugin.getInstance().getCorePreferenceStore()); alterCombinedPreferenceStores_beforeEditorsUI(stores); stores.add(EditorsUI.getPreferenceStore()); return new ChainedPreferenceStore(ArrayUtil.createFrom(stores, IPreferenceStore.class)); }
Example #2
Source File: DefaultEObjectHoverProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME: PreferenceConstants.APPEARANCE_JAVADOC_FONT; IXtextBrowserInformationControl iControl = new XtextBrowserInformationControl(parent, font, tooltipAffordanceString) { /* * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator() */ @Override public IInformationControlCreator getInformationPresenterControlCreator() { return fInformationPresenterControlCreator; } }; addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, tooltipAffordanceString); } }
Example #3
Source File: DecoratedScriptEditor.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Constructs a decorated script editor with the specified parent and the * specified script. * * @param parent * the parent editor. * @param script * the script to edit */ public DecoratedScriptEditor( IEditorPart parent, String script ) { super( ); this.parent = parent; this.sourceViewerConfiguration = new ScriptSourceViewerConfiguration( context ); setSourceViewerConfiguration( this.sourceViewerConfiguration ); setDocumentProvider( new ScriptDocumentProvider( parent ) ); setScript( script ); IPreferences preferences = PreferenceFactory.getInstance( ) .getPreferences( ReportPlugin.getDefault( ) ); if ( preferences instanceof PreferenceWrapper ) { IPreferenceStore store = ( (PreferenceWrapper) preferences ).getPrefsStore( ); if ( store != null ) { IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore(); setPreferenceStore( new ChainedPreferenceStore(new IPreferenceStore[]{store, baseEditorPrefs}) ); } } }
Example #4
Source File: XbaseHoverProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { String font = "org.eclipse.jdt.ui.javadocfont"; IXtextBrowserInformationControl iControl = new XbaseInformationControl(parent, font, tooltipAffordanceString, xbaseHoverConfiguration) { @Override public IInformationControlCreator getInformationPresenterControlCreator() { return fInformationPresenterControlCreator; } }; addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, tooltipAffordanceString); } }
Example #5
Source File: CustomCSSHelpHoverProvider.java From solidity-ide with Eclipse Public License 1.0 | 6 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { String tooltipAffordanceString = EditorsUI .getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { String font = "org.eclipse.jdt.ui.javadocfont"; BrowserInformationControl iControl = new BrowserInformationControl( parent, font, false) { @Override public IInformationControlCreator getInformationPresenterControlCreator() { return fInformationPresenterControlCreator; } }; addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, tooltipAffordanceString); } }
Example #6
Source File: SpellCheckEngine.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * Creates a new spell check manager. */ private SpellCheckEngine() { try { Locale locale= null; final Enumeration<URL> locations= getDictionaryLocations(); while (locations != null && locations.hasMoreElements()) { URL location= locations.nextElement(); for (final Iterator<Locale> iterator= getLocalesWithInstalledDictionaries(location).iterator(); iterator.hasNext();) { locale= iterator.next(); fLocaleDictionaries.put(locale, new LocaleSensitiveSpellDictionary(locale, location)); } } } catch (IOException exception) { // Do nothing } PreferenceKeys.PKEY_SPELLING_LOCALE.addChangeListener(this); EditorsUI.getPreferenceStore().addPropertyChangeListener(this); }
Example #7
Source File: SpellCheckEngine.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public synchronized final void shutdown() { PreferenceKey.removeChangeListener(PreferenceKeys.PKEY_SPELLING_LOCALE.getQualifier(), this); EditorsUI.getPreferenceStore().removePropertyChangeListener(this); ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) { dictionary= iterator.next(); dictionary.unload(); } fGlobalDictionaries= null; for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) { dictionary= iterator.next(); dictionary.unload(); } fLocaleDictionaries= null; fUserDictionary= null; fChecker= null; }
Example #8
Source File: HelpHoverProvider.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { String font = "org.eclipse.jdt.ui.javadocfont"; boolean areHoverDocsScrollable = true; // resizable flag of BrowserInformationControl causes the scrollbar to be always // enabled. BrowserInformationControl iControl = new BrowserInformationControl(parent, font, areHoverDocsScrollable) { @Override public IInformationControlCreator getInformationPresenterControlCreator() { return fInformationPresenterControlCreator; } }; addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, tooltipAffordanceString); } }
Example #9
Source File: GamlHoverProvider.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public IInformationControl doCreateInformationControl(final Shell parent) { final String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { final String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME: // PreferenceConstants.APPEARANCE_JAVADOC_FONT; final IXtextBrowserInformationControl iControl = new GamlInformationControl(parent, font, tooltipAffordanceString) { }; addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, tooltipAffordanceString); } }
Example #10
Source File: AbstractDocumentationHover.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public IInformationControl doCreateInformationControl(Shell parent) { if (CustomBrowserInformationControl.isAvailable(parent)) { CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null, EditorsUI.getTooltipAffordanceString()) { public IInformationControlCreator getInformationPresenterControlCreator() { return informationPresenterControlCreator; } }; iControl.setBackgroundColor(getBackgroundColor()); iControl.setForegroundColor(getForegroundColor()); return iControl; } else { // return new ThemedInformationControl(parent, null, EditorsUI.getTooltipAffordanceString()); return new DefaultInformationControl(parent, true); } }
Example #11
Source File: SVNConflictResolver.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private String getEditorId(IFileStore file) { IWorkbench workbench = PlatformUI.getWorkbench(); IEditorRegistry editorRegistry= workbench.getEditorRegistry(); IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file)); // check the OS for in-place editor (OLE on Win32) if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName())) descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID); // check the OS for external editor if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName())) descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); if (descriptor != null) return descriptor.getId(); return EditorsUI.DEFAULT_TEXT_EDITOR_ID; }
Example #12
Source File: PropertiesFileEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected void initializeEditor() { setDocumentProvider(JavaPlugin.getDefault().getPropertiesFileDocumentProvider()); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); setPreferenceStore(store); JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools(); setSourceViewerConfiguration(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, this, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING)); setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$ setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR); configureInsertMode(SMART_INSERT, false); setInsertMode(INSERT); // Need to listen on Editors UI preference store because JDT disables this functionality in its preferences. fPropertyChangeListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(event.getProperty())) handlePreferenceStoreChanged(event); } }; EditorsUI.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener); }
Example #13
Source File: PropertiesFileSourceViewerConfiguration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) return null; IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) { @Override protected IContentType getContentType() { return PROPERTIES_CONTENT_TYPE; } }; MonoReconciler reconciler= new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
Example #14
Source File: PyOpenResourceAction.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) { for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) { try { if (PythonPathHelper.isValidSourceFile(n.zipPath)) { new PyOpenAction().run(new ItemPointer(n.zipStructure.file, new Location(), new Location(), null, n.zipPath)); } else { IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.zipPath); PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath); PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage); if (defaultEditor != null) { IDE.openEditor(page, input, defaultEditor.getId()); } else { IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID); } } } catch (PartInitException e) { Log.log(e); } } }
Example #15
Source File: SpellCheckEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public final void propertyChange(final PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) { resetSpellChecker(); return; } if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) { resetUserDictionary(); return; } if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) { resetUserDictionary(); return; } if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { if (this == fgEngine) SpellCheckEngine.shutdownInstance(); else shutdown(); } }
Example #16
Source File: SpellCheckEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public synchronized final void shutdown() { JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); EditorsUI.getPreferenceStore().removePropertyChangeListener(this); ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) { dictionary= iterator.next(); dictionary.unload(); } fGlobalDictionaries= null; for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) { dictionary= iterator.next(); dictionary.unload(); } fLocaleDictionaries= null; fUserDictionary= null; fChecker= null; }
Example #17
Source File: EditorConfigSourceViewerConfiguration.java From editorconfig-eclipse with Apache License 2.0 | 6 votes |
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) return null; IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) { @Override protected IContentType getContentType() { return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
Example #18
Source File: JavaSourceViewerConfiguration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates and returns a preference store which combines the preference * stores from the text tools and which is read-only. * * @param javaTextTools the Java text tools * @return the combined read-only preference store * @since 3.0 */ private static final IPreferenceStore createPreferenceStore(JavaTextTools javaTextTools) { Assert.isNotNull(javaTextTools); IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore(); if (javaTextTools.getCorePreferenceStore() == null) return new ChainedPreferenceStore(new IPreferenceStore[] { javaTextTools.getPreferenceStore(), generalTextStore}); return new ChainedPreferenceStore(new IPreferenceStore[] { javaTextTools.getPreferenceStore(), new PreferencesAdapter(javaTextTools.getCorePreferenceStore()), generalTextStore }); }
Example #19
Source File: TexSourceViewerConfiguration.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Creates a new source viewer configuration. * * @param te The editor that this configuration is associated to */ public TexSourceViewerConfiguration(TexEditor editor) { super(EditorsUI.getPreferenceStore()); this.editor = editor; this.colorManager = new ColorManager(); this.annotationHover = new TexAnnotationHover(); // Adds a listener for changing content assistant properties if // these are changed in the preferences TexlipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (assistant == null) return; String property = event.getProperty(); if (TexlipseProperties.TEX_COMPLETION.equals(property)) { assistant.enableAutoActivation( TexlipsePlugin.getDefault().getPreferenceStore().getBoolean( TexlipseProperties.TEX_COMPLETION)); } else if (TexlipseProperties.TEX_COMPLETION_DELAY.equals(property)) { assistant.setAutoActivationDelay( TexlipsePlugin.getDefault().getPreferenceStore().getInt( TexlipseProperties.TEX_COMPLETION_DELAY)); } }; }); }
Example #20
Source File: PropertiesFileEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose() { EditorsUI.getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); if (fJob != null) fJob.cancel(); super.dispose(); }
Example #21
Source File: PyDevUiPrefs.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public static List<IPreferenceStore> getDefaultStores(boolean addEditorsUIStore) { List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(); stores.add(PydevPlugin.getDefault().getPreferenceStore()); if (addEditorsUIStore) { stores.add(EditorsUI.getPreferenceStore()); } return stores; }
Example #22
Source File: ThemeableEditorExtension.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void createBackgroundPainter(ISourceViewer viewer) { if (fFullLineBackgroundPainter == null) { if (viewer instanceof ITextViewerExtension2) { boolean lineHighlight = Platform.getPreferencesService().getBoolean(EditorsUI.PLUGIN_ID, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true, null); fFullLineBackgroundPainter = new LineBackgroundPainter(viewer); fFullLineBackgroundPainter.setHighlightLineEnabled(lineHighlight); ITextViewerExtension2 extension = (ITextViewerExtension2) viewer; extension.addPainter(fFullLineBackgroundPainter); } } }
Example #23
Source File: CommonSourceViewerConfiguration.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public IInformationControlCreator getHoverControlCreator() { if (activeTextHover instanceof ITextHoverExtension) { return ((ITextHoverExtension) activeTextHover).getHoverControlCreator(); } return new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { return createTextHoverInformationControl(parent, EditorsUI.getTooltipAffordanceString()); } }; }
Example #24
Source File: AbstractHover.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { @Override public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString()); } }; }
Example #25
Source File: JavaSelectAnnotationRulerAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public JavaSelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) { super(bundle, prefix, editor, ruler); fBundle= bundle; fTextEditor= editor; fAnnotationPreferenceLookup= EditorsUI.getAnnotationPreferenceLookup(); fStore= JavaPlugin.getDefault().getCombinedPreferenceStore(); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION); }
Example #26
Source File: SarosAnnotation.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Returns the color for the given annotation type and user color id. * *<p>E.g: <code>getColor("saros.annotations.viewport", 2) * <p><b>Important notice:</b> Every returned color instance allocates OS resources that need to * be disposed with {@link Color#dispose()}! * * @see Annotation#getType() * @param type annotation type as defined in the plugin.xml * @param colorId the color id * @return the corresponding color or a default one if no color is stored */ public static Color getColor(final String type, final int colorId) { final String typeToLookup = getNumberedType(type, colorId); final AnnotationPreference ap = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(typeToLookup); if (ap == null) throw new IllegalArgumentException( "could not read color value of annotation '" + typeToLookup + "' because it does not exists"); RGB rgb = PreferenceConverter.getColor(EditorsUI.getPreferenceStore(), ap.getColorPreferenceKey()); if (rgb == PreferenceConverter.COLOR_DEFAULT_DEFAULT) { // NOPMD rgb = ap.getColorPreferenceValue(); } if (rgb == null) throw new IllegalArgumentException( "annotation '" + typeToLookup + "' does not have a default color"); return new Color(Display.getDefault(), rgb); }
Example #27
Source File: AbstractSimpleLangSourceViewerConfiguration.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static final String getAdditionalInfoAffordanceString() { IPreferenceStore store = EditorsUI.getPreferenceStore(); if(!store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { return null; } return LangUIMessages.SourceHover_additionalInfo_affordance; }
Example #28
Source File: AbstractJavaEditorTextHover.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString()); } }; }
Example #29
Source File: NLSStringHover.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { return new NLSHoverControl(parent, EditorsUI.getTooltipAffordanceString()) { /* * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator() */ @Override public IInformationControlCreator getInformationPresenterControlCreator() { return fPresenterControlCreator; } }; }
Example #30
Source File: AbstractAnnotationHover.java From goclipse with Eclipse Public License 1.0 | 5 votes |
/** * Returns the annotation preference for the given annotation. * * @param annotation the annotation * @return the annotation preference or <code>null</code> if none */ private static AnnotationPreference getAnnotationPreference(Annotation annotation) { if (annotation.isMarkedDeleted()) return null; return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation); }