/** * Creates configuration by given adaptable * * @param adaptable * must provide {@link ColorManager} and {@link IFile} */ public BatchSourceViewerConfiguration(IAdaptable adaptable) { IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); this.fPreferenceStore = new ChainedPreferenceStore( new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore }); Assert.isNotNull(adaptable, "adaptable may not be null!"); this.annotationHoover = new BatchEditorAnnotationHoover(); this.contentAssistant = new ContentAssistant(); contentAssistProcessor = new BatchEditorSimpleWordContentAssistProcessor(); contentAssistant.enableColoredLabels(true); contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE); for (BatchDocumentIdentifier identifier: BatchDocumentIdentifiers.values()){ contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId()); } contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener()); this.colorManager = adaptable.getAdapter(ColorManager.class); Assert.isNotNull(colorManager, " adaptable must support color manager"); this.defaultTextAttribute = new TextAttribute( colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT))); this.adaptable=adaptable; }
/** * Creates configuration by given adaptable * * @param adaptable * must provide {@link ColorManager} and {@link IFile} */ public BashSourceViewerConfiguration(IAdaptable adaptable) { IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); this.fPreferenceStore = new ChainedPreferenceStore( new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore }); Assert.isNotNull(adaptable, "adaptable may not be null!"); this.annotationHoover = new BashEditorAnnotationHoover(); this.contentAssistant = new ContentAssistant(); contentAssistProcessor = new BashEditorSimpleWordContentAssistProcessor(); contentAssistant.enableColoredLabels(true); contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE); for (BashDocumentIdentifier identifier: BashDocumentIdentifiers.values()){ contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId()); } contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener()); this.colorManager = adaptable.getAdapter(ColorManager.class); Assert.isNotNull(colorManager, " adaptable must support color manager"); this.defaultTextAttribute = new TextAttribute( colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT))); this.adaptable=adaptable; }
/** * Returns the content of the .editorconfig file to generate. * * @param container * * @return the content of the .editorconfig file to generate. */ private InputStream openContentStream(IContainer container) { IPreferenceStore store = EditorsUI.getPreferenceStore(); boolean spacesForTabs = store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS); int tabWidth = store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); String lineDelimiter = getLineDelimiter(container); String endOfLine = org.ec4j.core.model.PropertyType.EndOfLineValue.ofEndOfLineString(lineDelimiter).name(); StringBuilder content = new StringBuilder("# EditorConfig is awesome: http://EditorConfig.org"); content.append(lineDelimiter); content.append(lineDelimiter); content.append("[*]"); content.append(lineDelimiter); content.append("indent_style = "); content.append(spacesForTabs ? "space" : "tab"); content.append(lineDelimiter); content.append("indent_size = "); content.append(tabWidth); if (endOfLine != null) { content.append(lineDelimiter); content.append("end_of_line = "); content.append(endOfLine); } return new ByteArrayInputStream(content.toString().getBytes()); }
@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); } }
private String getEditorId(IFileStore file) { // IWorkbench workbench= fWindow.getWorkbench(); 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; }
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; }
@Override public void initializeDefaultPreferences() { IPreferenceStore store = PreferenceConstants.getPreferenceStore(); EditorsUI.useAnnotationsPreferencePage(store); EditorsUI.useQuickDiffPreferencePage(store); PreferenceConstants.initializeDefaultValues(); // Override HTML Editor content assist sort to set at first the HTML // Angular proposal in the completion. IPreferenceStore htmlStore = HTMLUIPlugin.getDefault().getPreferenceStore(); String htmlContentAssistSort = htmlStore .getDefaultString(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER); if (htmlContentAssistSort != null && !htmlContentAssistSort.contains("ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0")) { htmlStore.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER, "ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0" + htmlContentAssistSort); } }
private void configurePreferenceKeys() { preferenceKeysForEnablement = new HashSet<>(); preferenceKeysForActivation = new HashSet<>(); // Global settings (master switch) preferenceKeysForEnablement .add(AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED); preferenceKeysForActivation .add(AbstractTextEditor.PREFERENCE_HYPERLINK_KEY_MODIFIER); // All applicable individual hyperlink detectors settings. Map targets = configuration.getHyperlinkDetectorTargets(this); for (HyperlinkDetectorDescriptor desc : EditorsUI .getHyperlinkDetectorRegistry() .getHyperlinkDetectorDescriptors()) { if (targets.keySet().contains(desc.getTargetId())) { preferenceKeysForEnablement.add(desc.getId()); preferenceKeysForActivation.add(desc.getId() + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX); } } }
public void initializeDefaultPreferences() { IPreferenceStore store = JuliaEditorPlugin.getDefault().getPreferenceStore(); EditorsUI.useAnnotationsPreferencePage(store); EditorsUI.useQuickDiffPreferencePage(store); PreferenceConstants.initializeDefaultValues(store); PreferenceConverter.setDefault(store, JuliaColourConstants.COMMENT, COMMENT_COLOUR); PreferenceConverter.setDefault(store, JuliaColourConstants.KEYWORD, KEYWORD_COLOUR); PreferenceConverter.setDefault(store, JuliaColourConstants.STRING, STRING_COLOUR); store.setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_BOLD_SUFFIX, false); store .setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false); store.setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_BOLD_SUFFIX, true); store .setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false); store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4); store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true); store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB); store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "4"); store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "4"); }
@Override public void initializeDefaultPreferences() { IPreferenceStore store = BfActivator.getDefault().getPreferenceStore(); store.setDefault(TEMPLATE_KEY, ""); IPreferenceStore editorStore = EditorsUI.getPreferenceStore(); editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS, true); editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_CARET, false); editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_ENCLOSING, false); PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY)); PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_KEY_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_MAGENTA)); PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_OTHER_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY)); PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_COMMENT_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GREEN)); PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_TEMPLATE_PARAMS_COLOR, getSystemColorRGB(SWT.COLOR_BLUE)); editorStore.setDefault(EditorConstants.PREF_EDITOR_CLOSE_BRACKET, true); }
@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); } }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer sourceViewer = super.createSourceViewer(parent, ruler, styles); // Apply preference settings from the default editor IPreferenceStore store = EditorsUI.getPreferenceStore(); Color backgroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_BACKGROUND)); Color foregroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_FOREGROUND)); Color selectionBackgroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_SELECTION_BACKGROUND), new RGB(99, 99, 99)); Color selectionForegroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_SELECTION_FOREGROUND), new RGB(0, 0, 0)); final StyledText textWidget = sourceViewer.getTextWidget(); textWidget.setBackground(backgroundColor); textWidget.setForeground(foregroundColor); textWidget.setSelectionBackground(selectionBackgroundColor); textWidget.setSelectionForeground(selectionForegroundColor); return sourceViewer; }
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); } }
@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); }
@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; }
/** * Creates and returns the preference store for this Java editor with the given input. * * @param input The editor input for which to create the preference store * @return the preference store for this editor * * @since 3.0 */ private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) { List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3); IJavaProject project= EditorUtility.getJavaProject(input); if (project != null) { stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), JavaCore.PLUGIN_ID)); } stores.add(JavaPlugin.getDefault().getPreferenceStore()); stores.add(new PreferencesAdapter(JavaPlugin.getJavaCorePluginPreferences())); stores.add(EditorsUI.getPreferenceStore()); stores.add(PlatformUI.getPreferenceStore()); return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()])); }
@Override public IInformationControl doCreateInformationControl(Shell parent) { String tooltipAffordanceString= fAdditionalInfoAffordance ? JavaPlugin.getAdditionalInfoAffordanceString() : EditorsUI.getTooltipAffordanceString(); if (BrowserInformationControl.isAvailable(parent)) { String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT; BrowserInformationControl iControl= new BrowserInformationControl(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); } }
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(); } }
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; }
@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; }
/** * Returns the String to use for indenting based on the General/Editors/Text Editors preferences * that are respected by the underlying platform editing code. * * @return the String to use for indenting */ private static String indentStringFromEditorsUIPreferences() { IPreferencesService ps = Platform.getPreferencesService(); boolean spacesForTabs = ps.getBoolean( EditorsUI.PLUGIN_ID, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, false, null ); if (spacesForTabs) { int tabWidth = ps.getInt( EditorsUI.PLUGIN_ID, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4, null ); StringBuilder sb = new StringBuilder(tabWidth); for (int i = 0; i < tabWidth; i++) { sb.append(" "); } return sb.toString(); } else { return "\t"; } }
private NSISSourceViewer createPreviewer(Composite parent) { NSISSourceViewer previewer = new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.WRAP); NSISTextUtility.hookSourceViewer(previewer); SourceViewerConfiguration configuration = new NSISSourceViewerConfiguration( new ChainedPreferenceStore(new IPreferenceStore[] { NSISPreferences.getInstance().getPreferenceStore(), EditorsUI.getPreferenceStore() })); previewer.configure(configuration); new NSISDocumentSetupParticipant().setup(mCommandDoc); previewer.setDocument(mCommandDoc); previewer.setEditable(false); final StyledText textWidget = previewer.getTextWidget(); textWidget.getCaret().setVisible(false); textWidget.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { textWidget.setSelectionRange(e.x, 0); } }); return previewer; }
private Control createPreviewer(Composite parent) { mPreviewer= new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); NSISTextUtility.hookSourceViewer(mPreviewer); SourceViewerConfiguration configuration= new NSISSourceViewerConfiguration(new ChainedPreferenceStore(new IPreferenceStore[]{mPreferenceStore,getPreferenceStore(), EditorsUI.getPreferenceStore()})); mPreviewer.configure(configuration); InputStream is = null; String content= ""; //$NON-NLS-1$ try { is = getClass().getResourceAsStream("NSISPreview.txt"); //$NON-NLS-1$ content= new String(IOUtility.loadContentFromStream(is)); } catch(Exception e) { EclipseNSISPlugin.getDefault().log(e); } finally { IOUtility.closeIO(is); } IDocument document= new Document(content); new NSISDocumentSetupParticipant().setup(document); mPreviewer.setDocument(document); mPreviewer.setEditable(false); return mPreviewer.getControl(); }
@Override protected SourceViewer createViewer(Composite parent) { mViewer = new NSISTemplateSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); NSISTextUtility.hookSourceViewer(mViewer); SourceViewerConfiguration configuration = new NSISTemplateSourceViewerConfiguration(new ChainedPreferenceStore( new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() })); mViewer.configure(configuration); IDocument document = new Document(); new NSISDocumentSetupParticipant().setup(document); mViewer.setDocument(document); mViewer.setEditable(false); return mViewer; }
/** * 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}) ); } } }
public void dispose() { if (fForegroundColor != null) { fForegroundColor.dispose(); fForegroundColor = null; } if (fBackgroundColor != null) { fBackgroundColor.dispose(); fBackgroundColor = null; } if (fSelectionForegroundColor != null) { fSelectionForegroundColor.dispose(); fSelectionForegroundColor = null; } if (fSelectionBackgroundColor != null) { fSelectionBackgroundColor.dispose(); fSelectionBackgroundColor = null; } if (fListener != null) { final IPreferenceStore store = EditorsUI.getPreferenceStore(); if (store != null) { store.removePropertyChangeListener(fListener); } } super.dispose(); }
@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); } } }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } //Overridden (just) to return a PyReconciler! IReconcilingStrategy strategy = new PyReconciler(sourceViewer, spellingService); MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setIsIncrementalReconciler(false); reconciler.setProgressMonitor(new NullProgressMonitor()); reconciler.setDelay(500); return reconciler; }
@Override public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { @Override public IInformationControl createInformationControl(Shell parent) { String tooltipAffordanceString = null; try { tooltipAffordanceString = EditorsUI.getTooltipAffordanceString(); } catch (Throwable e) { //Not available on Eclipse 3.2 } informationControl = new PyInformationControl(parent, tooltipAffordanceString, informationPresenter); return informationControl; } }; }
public synchronized final void shutdown() { Activator.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; }
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)); }