private void initialize() { synchronized (EditorsPlugin.getDefault()) { if (!EditorsPlugin.getDefault().isMarkerAnnotationPreferencesInitialized()) EditorsPlugin.getDefault() .setMarkerAnnotationPreferences(new MarkerAnnotationPreferences(true)); } MarkerAnnotationPreferences sharedPrefs = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); fFragments = cloneAnnotationPreferences(sharedPrefs.fFragments); fPreferences = cloneAnnotationPreferences(sharedPrefs.fPreferences); }
public static void setSpacesPerIndent(String tabWidth) { PreferenceConstants.getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, tabWidth); EditorsPlugin.getDefault() .getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, tabWidth); }
private void initFromPrefs() { IPreferenceStore editorPreferences = EditorsPlugin.getDefault().getPreferenceStore(); IPreferenceStore toolsPreferences = PreferenceConstants.getPreferenceStore(); lineNumbersCheck.setSelection( editorPreferences.getBoolean( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER)); printMarginCheck.setSelection(DartFormatter.getMaxLineLengthEnabled()); printMarginText.setText(DartFormatter.getMaxLineLength()); printMarginText.setEnabled(printMarginCheck.getSelection()); enableAutoCompletion.setSelection( toolsPreferences.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION)); if (!DartCoreDebug.ENABLE_ANALYSIS_SERVER) { enableFolding.setSelection( toolsPreferences.getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED)); } removeTrailingWhitespaceCheck.setSelection( toolsPreferences.getBoolean(PreferenceConstants.EDITOR_REMOVE_TRAILING_WS)); formatCheck.setSelection( toolsPreferences.getBoolean(PreferenceConstants.EDITOR_FORMAT_ON_SAVES)); IEclipsePreferences prefs = DartCore.getPlugin().getPrefs(); if (prefs != null) { runPubAutoCheck.setSelection(prefs.getBoolean(DartCore.PUB_AUTO_RUN_PREFERENCE, true)); enableAnalysisServerButton.setSelection( prefs.getBoolean(DartCoreDebug.ENABLE_ANALYSIS_SERVER_PREF, true)); } }
public static void setMaxLineLength(String maxLineLength) { EditorsPlugin.getDefault() .getPreferenceStore() .setValue( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, maxLineLength); }
private SpellingService spellingService() { if (spellingService == null) { IPreferenceStore preferenceStore = EditorsPlugin.getDefault().getPreferenceStore(); spellingService = new SpellingService(preferenceStore); } return spellingService; }
public static void setInsertSpacesForTabs(boolean useSpaces) { PreferenceConstants.getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, useSpaces); EditorsPlugin.getDefault() .getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, useSpaces); }
/** * Removes the marker annotation values which are shown on the general Annotations page from the * given store and prevents setting the default values in the future. * * <p>Note: In order to work this method must be called before any call to {@link * #initializeDefaultValues(IPreferenceStore)} * * <p>This method is not part of the API and must only be called by {@link * org.eclipse.ui.editors.text.EditorsUI} * * @param store the preference store to be initialized * @throws IllegalStateException if not called by {@link org.eclipse.ui.editors.text.EditorsUI} * @since 3.0 */ public static void useAnnotationsPreferencePage(IPreferenceStore store) throws IllegalStateException { checkAccess(); store.putValue( AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE, Boolean.toString(true)); MarkerAnnotationPreferences preferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info = e.next(); // Only reset annotations shown on Annotations preference page if (!info.isIncludeOnPreferencePage() || !isComplete(info)) continue; store.setToDefault(info.getTextPreferenceKey()); store.setToDefault(info.getOverviewRulerPreferenceKey()); if (info.getVerticalRulerPreferenceKey() != null) store.setToDefault(info.getVerticalRulerPreferenceKey()); store.setToDefault(info.getColorPreferenceKey()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey()); if (info.getIsGoToNextNavigationTargetKey() != null) store.setToDefault(info.getIsGoToNextNavigationTargetKey()); if (info.getIsGoToPreviousNavigationTargetKey() != null) store.setToDefault(info.getIsGoToPreviousNavigationTargetKey()); if (info.getHighlightPreferenceKey() != null) store.setToDefault(info.getHighlightPreferenceKey()); if (info.getTextStylePreferenceKey() != null) store.setToDefault(info.getTextStylePreferenceKey()); } }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore( new IPreferenceStore[] { CSSPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
/** * @see * org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ public void initializeDefaultPreferences() { IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); store.setDefault(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP, true); store.setDefault(IPreferenceConstants.CACHE_BUST_BROWSERS, true); store.setDefault(IPreferenceConstants.PIANO_KEY_DIFFERENCE, 7); store.setDefault(IPreferenceConstants.MATCH_BRACKETS, "true"); // $NON-NLS-1$ store.setDefault( IPreferenceConstants.MATCH_BRACKETS_COLOR, StringConverter.asString(new RGB(150, 150, 150))); store.setDefault(IPreferenceConstants.SHOW_WHITESPACE, false); store.setDefault(IPreferenceConstants.ENABLE_WORD_WRAP, false); store.setDefault(IPreferenceConstants.USER_AGENT_PREFERENCE, "IE,Mozilla"); // $NON-NLS-1$ store.setDefault(IPreferenceConstants.INSERT_ON_TAB, false); store.setDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END, false); store.setDefault(IPreferenceConstants.CONTENT_ASSIST_DELAY, 200); store.setDefault(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED, false); store.setDefault( IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR, StringConverter.asString(new RGB(212, 212, 212))); store.setDefault(IPreferenceConstants.COLORIZER_MAXCOLUMNS, 500); store.setDefault(IPreferenceConstants.EXPAND_EDITOR_OPTIONS, true); store.setDefault(IPreferenceConstants.EXPAND_TOKENS, true); store.setDefault(IPreferenceConstants.EXPAND_REGIONS, false); store.setDefault(IPreferenceConstants.SHOW_ERRORS, true); store.setDefault(IPreferenceConstants.SHOW_WARNINGS, false); store.setDefault(IPreferenceConstants.SHOW_INFOS, false); store.setDefault(IPreferenceConstants.DRAG_AND_DROP_ENABLED, true); store.setDefault(IPreferenceConstants.SORT_OUTLINE_ALPHABETICALLY, false); store.setDefault(IPreferenceConstants.PARSER_OFF_UI, true); // Tasks store.setDefault(IPreferenceConstants.COMPILER_TASK_CASE_SENSITIVE, true); store.setDefault(IPreferenceConstants.COMPILER_TASK_TAGS, "TODO,FIXME,XXX,OPTIMIZE"); store.setDefault(IPreferenceConstants.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL,LOW"); // These two _must_ be set as a preference, or UnifiedEditor will crash // hard without // warning on initialization. // store.setDefault(ColorizerPreferencePage.HRD_SET, "default"); // store.setDefault(ColorizerPreferencePage.USE_BACK, true); // // store.setDefault(ColorizerPreferencePage.FULL_BACK, true); // store.setDefault(ColorizerPreferencePage.PAIRS_MATCH, // "PAIRS_OUTLINE"); // // store.setDefault(ColorizerPreferencePage.HORZ_CROSS, true); // store.setDefault(ColorizerPreferencePage.VERT_CROSS, true); // To set preferences for AbstractTextEditor store = org.eclipse.ui.internal.editors.text.EditorsPlugin.getDefault().getPreferenceStore(); store.setToDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, 500); }
@Override protected ITokenScanner createScanner() { return new LuaCodeScanner( new DLTKColorManager(true), EditorsPlugin.getDefault().getPreferenceStore()) { @Override public Token getToken(String key) { Token token = super.getToken(key); token.setData(key); return token; } }; }
/** * Initializes the given preference store with the default marker annotation values. * * @param store the preference store to be initialized * @since 3.0 */ public static void initializeDefaultValues(IPreferenceStore store) { boolean ignoreAnnotationsPrefPage = store.getBoolean( AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE); boolean ignoreQuickDiffPrefPage = store.getBoolean( AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE); MarkerAnnotationPreferences preferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info = e.next(); if (ignoreAnnotationsPrefPage && info.isIncludeOnPreferencePage() && isComplete(info)) continue; if (ignoreQuickDiffPrefPage && (info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") // $NON-NLS-1$ || (info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) // $NON-NLS-1$ || (info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) // $NON-NLS-1$ )) continue; store.setDefault(info.getTextPreferenceKey(), info.getTextPreferenceValue()); store.setDefault( info.getOverviewRulerPreferenceKey(), info.getOverviewRulerPreferenceValue()); if (info.getVerticalRulerPreferenceKey() != null) store.setDefault( info.getVerticalRulerPreferenceKey(), info.getVerticalRulerPreferenceValue()); PreferenceConverter.setDefault( store, info.getColorPreferenceKey(), info.getColorPreferenceValue()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setDefault( info.getShowInNextPrevDropdownToolbarActionKey(), info.isShowInNextPrevDropdownToolbarAction()); if (info.getIsGoToNextNavigationTargetKey() != null) store.setDefault( info.getIsGoToNextNavigationTargetKey(), info.isGoToNextNavigationTarget()); if (info.getIsGoToPreviousNavigationTargetKey() != null) store.setDefault( info.getIsGoToPreviousNavigationTargetKey(), info.isGoToPreviousNavigationTarget()); if (info.getHighlightPreferenceKey() != null) store.setDefault(info.getHighlightPreferenceKey(), info.getHighlightPreferenceValue()); if (info.getTextStylePreferenceKey() != null) store.setDefault(info.getTextStylePreferenceKey(), info.getTextStyleValue()); } }
/* * (non-Javadoc) * * @see org.eclipse.ui.IWorkbenchPart#dispose() */ public void dispose() { getSite() .getWorkbenchWindow() .getSelectionService() .removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); DebugPlugin.getDefault().removeDebugEventListener(fTerminateListener); if (fPartListener != null) { getSite().getPage().removePartListener(fPartListener); fPartListener = null; } if (fPropertyChangeListener != null) { EditorsPlugin.getDefault() .getPreferenceStore() .removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener = null; } super.dispose(); }
/** * Removes the Quick Diff marker annotation values which are shown on the general Quick Diff page * from the given store and prevents setting the default values in the future. * * <p>Note: In order to work this method must be called before any call to {@link * #initializeDefaultValues(IPreferenceStore)} * * <p>This method is not part of the API and must only be called by {@link EditorsUI} * * @param store the preference store to be initialized * @throws IllegalStateException if not called by {@link EditorsUI} * @since 3.0 */ public static void useQuickDiffPreferencePage(IPreferenceStore store) throws IllegalStateException { checkAccess(); store.putValue( AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE, Boolean.toString(true)); MarkerAnnotationPreferences preferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info = e.next(); // Only reset annotations shown on Quick Diff preference page if (!(info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") // $NON-NLS-1$ || (info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) // $NON-NLS-1$ || (info.getAnnotationType() .equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) // $NON-NLS-1$ )) continue; store.setToDefault(info.getTextPreferenceKey()); store.setToDefault(info.getOverviewRulerPreferenceKey()); if (info.getVerticalRulerPreferenceKey() != null) store.setToDefault(info.getVerticalRulerPreferenceKey()); store.setToDefault(info.getColorPreferenceKey()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey()); if (info.getIsGoToNextNavigationTargetKey() != null) store.setToDefault(info.getIsGoToNextNavigationTargetKey()); if (info.getIsGoToPreviousNavigationTargetKey() != null) store.setToDefault(info.getIsGoToPreviousNavigationTargetKey()); if (info.getHighlightPreferenceKey() != null) store.setToDefault(info.getHighlightPreferenceKey()); if (info.getTextStylePreferenceKey() != null) store.setToDefault(info.getTextStylePreferenceKey()); } }
public void testEditorPreferences() { String spacesForTabs; EditorsPlugin.getDefault() .getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, false); spacesForTabs = CSSSourceEditor.getChainedPreferenceStore() .getString(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS); assertEquals("false", spacesForTabs); CSSPlugin.getDefault() .getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, true); spacesForTabs = CSSSourceEditor.getChainedPreferenceStore() .getString(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS); assertEquals("true", spacesForTabs); }
private void setBackgroundColor() { IPreferenceStore store = EditorsPlugin.getDefault().getPreferenceStore(); fSourceViewer.getTextWidget().setBackground(getBackgroundColor(store)); if (fPropertyChangeListener == null) { fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { IPreferenceStore store = EditorsPlugin.getDefault().getPreferenceStore(); String prop = event.getProperty(); if (prop.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) || prop.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null || fSourceViewer.getTextWidget().isDisposed()) { return; } fSourceViewer.getTextWidget().setBackground(getBackgroundColor(store)); } } }; store.addPropertyChangeListener(fPropertyChangeListener); } }
/** * Returns the image for the given annotation and the given annotation preferences or <code>null * </code> if there is no such image. * * @param annotation the annotation * @param preference the annotation preference * @param annotationType the annotation type * @return the image or <code>null</code> * @since 3.0 */ private Image getImage( Annotation annotation, AnnotationPreference preference, String annotationType) { if (annotation instanceof AnnotationBag) { AnnotationBag bag = (AnnotationBag) annotation; if (!bag.isEmpty()) annotation = bag.iterator().next(); } ImageRegistry registry = EditorsPlugin.getDefault().getImageRegistry(); IAnnotationImageProvider annotationImageProvider = preference.getAnnotationImageProvider(); if (annotationImageProvider != null) { Image image = annotationImageProvider.getManagedImage(annotation); if (image != null) return image; String id = annotationImageProvider.getImageDescriptorId(annotation); if (id != null) { image = registry.get(id); if (image == null) { ImageDescriptor descriptor = annotationImageProvider.getImageDescriptor(id); registry.put(id, descriptor); image = registry.get(id); } return image; } } if (annotationType == null) return null; if (hasQuickFix(annotation)) { ImageDescriptor quickFixImageDesc = preference.getQuickFixImageDescriptor(); if (quickFixImageDesc != null) { Image image = registry.get(quickFixImageDesc.toString()); if (image == null) { registry.put(quickFixImageDesc.toString(), quickFixImageDesc); image = registry.get(quickFixImageDesc.toString()); } if (image != null) return image; } } Image image = registry.get(annotationType); if (image == null) { ImageDescriptor descriptor = preference.getImageDescriptor(); if (descriptor != null) { registry.put(annotationType, descriptor); image = registry.get(annotationType); } else { String symbolicImageName = preference.getSymbolicImageName(); if (symbolicImageName != null) { String key = getSharedImageName(preference.getSymbolicImageName()); if (key != null) { ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); image = sharedImages.getImage(key); } } } } return image; }
/** * Returns the annotation type hierarchy used by this annotation access. * * @return the annotation type hierarchy * @since 3.0 * @noreference This method is not intended to be referenced by clients. */ protected AnnotationTypeHierarchy getAnnotationTypeHierarchy() { return EditorsPlugin.getDefault().getAnnotationTypeHierarchy(); }
public static String getMaxLineLength() { return EditorsPlugin.getDefault() .getPreferenceStore() .getString(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN); }
@Override public boolean performOk() { IPreferenceStore editorPreferences = EditorsPlugin.getDefault().getPreferenceStore(); editorPreferences.setValue( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, lineNumbersCheck.getSelection()); DartFormatter.setMaxLineLengthEnabled(printMarginCheck.getSelection()); if (printMarginCheck.getSelection()) { DartFormatter.setMaxLineLength(printMarginText.getText()); } IPreferenceStore toolsPreferenceStore = PreferenceConstants.getPreferenceStore(); toolsPreferenceStore.setValue( PreferenceConstants.CODEASSIST_AUTOACTIVATION, enableAutoCompletion.getSelection()); if (!DartCoreDebug.ENABLE_ANALYSIS_SERVER) { toolsPreferenceStore.setValue( PreferenceConstants.EDITOR_FOLDING_ENABLED, enableFolding.getSelection()); } toolsPreferenceStore.setValue( PreferenceConstants.EDITOR_REMOVE_TRAILING_WS, removeTrailingWhitespaceCheck.getSelection()); toolsPreferenceStore.setValue( PreferenceConstants.EDITOR_FORMAT_ON_SAVES, formatCheck.getSelection()); handleSave(editorPreferences); handleSave(toolsPreferenceStore); IEclipsePreferences prefs = DartCore.getPlugin().getPrefs(); if (prefs != null) { prefs.putBoolean(DartCore.PUB_AUTO_RUN_PREFERENCE, runPubAutoCheck.getSelection()); try { DartCore.getPlugin().savePrefs(); } catch (CoreException e) { DartToolsPlugin.log(e); } // // If the user has changed the preference to true, // then run pub on all pubspecs in the workspace // if (runPubChanged) { UIInstrumentationBuilder instrumentation = UIInstrumentation.builder(this.getClass()); try { boolean autoRunPubEnabled = runPubAutoCheck.getSelection(); instrumentation.metric("autoRunPubEnabled", autoRunPubEnabled); if (autoRunPubEnabled) { PlatformUI.getWorkbench() .getDisplay() .asyncExec( new Runnable() { @Override public void run() { runPubNow(); } }); } } catch (RuntimeException e) { instrumentation.record(e); throw e; } finally { instrumentation.log(); } } } boolean serverChanged = setPrefBool(DartCoreDebug.ENABLE_ANALYSIS_SERVER_PREF, true, enableAnalysisServerButton); if (serverChanged) { MessageDialog.openInformation( getShell(), "Restart Required", "These changes will only take effect once the IDE has been restarted."); } return true; }
public static void setMaxLineLengthEnabled(boolean enabled) { EditorsPlugin.getDefault() .getPreferenceStore() .setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, enabled); }
public static boolean getMaxLineLengthEnabled() { return EditorsPlugin.getDefault() .getPreferenceStore() .getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN); }
/* * overview ruler problem: displayed in both viewers. the diff editor ruler is actually custom drawn (see * TextMergeViewer.fBirdsEyeCanvas) the ruler that gets created in this method is longer than the editor, meaning its * not an overview (not next to the scrollbar) */ @SuppressWarnings("unused") private void createOverviewRuler(IDocument newInput, Class<SourceViewer> sourceViewerClazz) throws SecurityException, NoSuchMethodException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { sourceViewer.setOverviewRulerAnnotationHover(new CommentAnnotationHover(null)); OverviewRuler ruler = new OverviewRuler( new DefaultMarkerAnnotationAccess(), 15, EditorsPlugin.getDefault().getSharedTextColors()); Field compositeField = sourceViewerClazz.getDeclaredField("fComposite"); compositeField.setAccessible(true); ruler.createControl((Composite) compositeField.get(sourceViewer), sourceViewer); ruler.setModel(annotationModel); // ruler.setModel(compareAnnotationModel.leftAnnotationModel); // XXX should go through SourceViewerDecorationSupport instead // ruler.addAnnotationType("org.eclipse.mylyn.reviews.ui.comment.Annotation"); // ruler.setAnnotationTypeLayer("org.eclipse.mylyn.reviews.ui.comment.Annotation", 1); // ruler.update(); IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess(); final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport( sourceViewer, ruler, annotationAccess, EditorsUI.getSharedTextColors()); Iterator<?> e = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator(); while (e.hasNext()) { support.setAnnotationPreference((AnnotationPreference) e.next()); } support.install(EditorsUI.getPreferenceStore()); sourceViewer .getControl() .addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { support.dispose(); } }); Field overViewRulerField = sourceViewerClazz.getDeclaredField("fOverviewRuler"); overViewRulerField.setAccessible(true); if (overViewRulerField.get(sourceViewer) == null) { overViewRulerField.set(sourceViewer, ruler); } Method declareMethod = sourceViewerClazz.getDeclaredMethod("ensureOverviewHoverManagerInstalled"); declareMethod.setAccessible(true); declareMethod.invoke(sourceViewer); // overviewRuler is null Field hoverManager = sourceViewerClazz.getDeclaredField("fOverviewRulerHoveringController"); hoverManager.setAccessible(true); AnnotationBarHoverManager manager = (AnnotationBarHoverManager) hoverManager.get(sourceViewer); if (manager != null) { Field annotationHover = AnnotationBarHoverManager.class.getDeclaredField("fAnnotationHover"); annotationHover.setAccessible(true); IAnnotationHover hover = (IAnnotationHover) annotationHover.get(manager); annotationHover.set(manager, new CommentAnnotationHover(null)); } sourceViewer.showAnnotations(true); sourceViewer.showAnnotationsOverview(true); declareMethod = sourceViewerClazz.getDeclaredMethod("showAnnotationsOverview", new Class[] {Boolean.TYPE}); declareMethod.setAccessible(true); }
/** * Returns the annotation preference lookup used by this annotation access. * * @return the annotation preference lookup * @since 3.0 */ protected AnnotationPreferenceLookup getAnnotationPreferenceLookup() { return EditorsPlugin.getDefault().getAnnotationPreferenceLookup(); }