当前位置: 首页>>代码示例>>Java>>正文


Java MarkerAnnotationPreferences.getAnnotationPreferences方法代码示例

本文整理汇总了Java中org.eclipse.ui.texteditor.MarkerAnnotationPreferences.getAnnotationPreferences方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerAnnotationPreferences.getAnnotationPreferences方法的具体用法?Java MarkerAnnotationPreferences.getAnnotationPreferences怎么用?Java MarkerAnnotationPreferences.getAnnotationPreferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.texteditor.MarkerAnnotationPreferences的用法示例。


在下文中一共展示了MarkerAnnotationPreferences.getAnnotationPreferences方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureSourceViewerDecorationSupport

import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; //导入方法依赖的package包/类
/**
 * 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();
	@SuppressWarnings("unchecked")
	List<AnnotationPreference> prefs = annotationPreferences.getAnnotationPreferences();
	for (AnnotationPreference annotationPreference : prefs) {
		support.setAnnotationPreference(annotationPreference);
	}

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

	support.install(preferenceStoreAccess.getPreferenceStore());

}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:StyledTextXtextAdapter.java

示例2: configureSourceViewerDecorationSupport

import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; //导入方法依赖的package包/类
/**
 * 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());
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:StyledTextXtextAdapter.java

示例3: setAnnotationColorsToMatchTheme

import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:80,代码来源:ThemeManager.java

示例4: highlightLines

import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; //导入方法依赖的package包/类
/**
 * Highlights the differences within the unified difference editor.
 * 
 * @return the color to unified lines mapping.
 */
@SuppressWarnings({ "unchecked" })
public Map<Integer, Color> highlightLines() {
    // initialize local variables
    UnifiedDiffConnectorModel diffModel = editorInput.getDiffConnectorModel();
    Map<Integer, Color> colorToUnifiedLinesMapping = new HashMap<Integer, Color>();
    MarkerAnnotationPreferences maPrefs = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    List<AnnotationPreference> aPrefs = (List<AnnotationPreference>) (List<?>) maPrefs.getAnnotationPreferences();
    IFile ressource = (IFile) editorInput.getAdapter(IFile.class);

    // add new markers from connector content
    int offset = 0;
    int lineCount = editor.getViewer().getTextWidget().getLineCount();
    int lineTextLength = 0;
    String lineText = "";
    for (int line = 0; line < lineCount - 1; line++) {
        lineText = editor.getViewer().getTextWidget().getLine(line);
        lineTextLength = lineText.length();

        // create marker according to type
        MarkerType markerType = diffModel.getMarkerTypeFor(line);
        if (markerType != MarkerType.NONE) {
            try {
                IMarker marker = ressource.createMarker(UIConstants.UNIFIED_DIFF_MARKERTYPE);
                TextSelection selection = new TextSelection(offset, lineTextLength);
                createAnnotation(marker, selection, this.editor, markerType);
                
            } catch (CoreException exception) {
                LOGGER.error("An error occurred while creating a marker or setting an attribute for said marker!",
                        exception);
            }

            // get and add color to mapping
            IGetMarkerColor getMarkerColor = markerTypeToGetMarkerColor.get(markerType);
            colorToUnifiedLinesMapping.put(line, getMarkerColor.get(aPrefs)); 
        }
        
        offset += lineTextLength + 1;
    }

    return colorToUnifiedLinesMapping;
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:47,代码来源:UnifiedDiffHighlighter.java


注:本文中的org.eclipse.ui.texteditor.MarkerAnnotationPreferences.getAnnotationPreferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。