org.eclipse.ui.texteditor.MarkerAnnotationPreferences Java Examples

The following examples show how to use org.eclipse.ui.texteditor.MarkerAnnotationPreferences. 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: BookmarkColumn.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public BookmarkColumn() {
    super();
    fDelegate = new BookmarkRulerColumn();

   // some initialization (is it required? hz..) :
    new MarkerAnnotationPreferences().getAnnotationPreferences(); 
}
 
Example #2
Source File: StyledTextXtextAdapter.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates decoration support for the sourceViewer. code is entirely copied from
 * {@link XtextEditor} and its super class {@link AbstractDecoratedTextEditor}.
 *
 */
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
	MarkerAnnotationPreferences annotationPreferences = new MarkerAnnotationPreferences();
	List<AnnotationPreference> prefs = annotationPreferences.getAnnotationPreferences();
	for (AnnotationPreference annotationPreference : prefs) {
		support.setAnnotationPreference(annotationPreference);
	}

	support.setCharacterPairMatcher(getCharacterPairMatcher());
	support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
			BracketMatchingPreferencesInitializer.COLOR_KEY);

	support.install(getPreferenceStoreAccess().getPreferenceStore());
}
 
Example #3
Source File: ThemeManager.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private void setAnnotationColorsToMatchTheme(Theme theme)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("org.eclipse.ui.editors"); //$NON-NLS-1$
	if (!theme.hasEntry("override.searchResultIndication")) //$NON-NLS-1$
	{
		prefs.put("searchResultIndicationColor", toString(theme.getSearchResultColor())); //$NON-NLS-1$
	}
	// TODO Use markup.changed bg color for "decoration color" in Prefs>General>Appearance>Colors and Fonts

	// TODO Move this stuff over to theme change listeners in the XML/HTML/Ruby editor plugins?
	if (!theme.hasEntry("override.xmlTagPairOccurrenceIndication")) //$NON-NLS-1$
	{
		prefs.putBoolean("xmlTagPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
		prefs.putBoolean("xmlTagPairOccurrenceIndication", true); //$NON-NLS-1$
		prefs.put("xmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
		prefs.put("xmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
	}
	if (!theme.hasEntry("override.htmlTagPairOccurrenceIndication")) //$NON-NLS-1$
	{
		prefs.putBoolean("htmlTagPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
		prefs.putBoolean("htmlTagPairOccurrenceIndication", true); //$NON-NLS-1$
		prefs.put("htmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
		prefs.put("htmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
	}
	if (!theme.hasEntry("override.rubyBlockPairOccurrenceIndication")) //$NON-NLS-1$
	{
		prefs.putBoolean("rubyBlockPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
		prefs.putBoolean("rubyBlockPairOccurrenceIndication", true); //$NON-NLS-1$
		prefs.put("rubyBlockPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
		prefs.put("rubyBlockPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
	}
	// PyDev Occurrences (com.python.pydev.occurrences)
	// Override them if pydev is set to use our themes
	if (Platform.getPreferencesService().getBoolean("org.python.pydev.red_core", "PYDEV_USE_APTANA_THEMES", true, //$NON-NLS-1$ //$NON-NLS-2$
			null))
	{
		if (!theme.hasEntry("override.pydevOccurrenceIndication")) //$NON-NLS-1$
		{
			MarkerAnnotationPreferences preferences = new MarkerAnnotationPreferences();
			AnnotationPreference pydevOccurPref = null;
			for (Object obj : preferences.getAnnotationPreferences())
			{
				AnnotationPreference pref = (AnnotationPreference) obj;
				Object type = pref.getAnnotationType();
				if ("com.python.pydev.occurrences".equals(type)) //$NON-NLS-1$
				{
					pydevOccurPref = pref;
				}
			}
			if (pydevOccurPref != null)
			{
				if (pydevOccurPref.getTextStylePreferenceKey() != null)
				{
					// Now that pydev supports text style, use the box style and don't highlight.
					prefs.putBoolean("pydevOccurrenceHighlighting", false); //$NON-NLS-1$
					prefs.putBoolean("pydevOccurrenceIndication", true); //$NON-NLS-1$
					prefs.put("pydevOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
					prefs.put("pydevOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
				}
				else
				{
					// Must use highlighting, since we're against older pydev that had no text style
					prefs.putBoolean("pydevOccurrenceHighlighting", true); //$NON-NLS-1$
					prefs.putBoolean("pydevOccurrenceIndication", true); //$NON-NLS-1$
					prefs.put("pydevOccurrenceIndicationColor", toString(theme.getSearchResultColor())); //$NON-NLS-1$
				}
			}
		}
	}

	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}