下面列出了怎么用org.eclipse.ui.texteditor.SourceViewerDecorationSupport的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
if (characterPairMatcher != null) {
support.setCharacterPairMatcher(characterPairMatcher);
support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
BracketMatchingPreferencesInitializer.COLOR_KEY);
}
}
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
// copy the necessary values from plugin preferences instead of overwriting editor preferences
getPreferenceStore().setValue(TexlipseProperties.MATCHING_BRACKETS,
TexlipsePlugin.getPreference(TexlipseProperties.MATCHING_BRACKETS));
getPreferenceStore().setValue(TexlipseProperties.MATCHING_BRACKETS_COLOR,
TexlipsePlugin.getPreference(TexlipseProperties.MATCHING_BRACKETS_COLOR));
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(TexlipseProperties.MATCHING_BRACKETS,
TexlipseProperties.MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
/**
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#configureSourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)
*/
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
// copy the necessary values from plugin preferences instead of overwriting editor preferences
getPreferenceStore().setValue(TexlipseProperties.MATCHING_BRACKETS, TexlipsePlugin.getPreference(TexlipseProperties.MATCHING_BRACKETS));
getPreferenceStore().setValue(TexlipseProperties.MATCHING_BRACKETS_COLOR, TexlipsePlugin.getPreference(TexlipseProperties.MATCHING_BRACKETS_COLOR));
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(TexlipseProperties.MATCHING_BRACKETS, TexlipseProperties.MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
@Override
protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
//TODO Initialize painter after editor input has been set.
painter = new TLACoveragePainter(this);
((TextViewer) viewer).addTextPresentationListener(painter);
return super.getSourceViewerDecorationSupport(viewer);
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
fBracketMatcher.setSourceVersion(getPreferenceStore().getString(JavaScriptCore.COMPILER_SOURCE));
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
/**
* 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());
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support)
{
super.configureSourceViewerDecorationSupport(support);
support.setCharacterPairMatcher(new CharacterPairMatcher(getPairMatchingCharacters()));
support.setMatchingCharacterPainterPreferenceKeys(IPreferenceConstants.ENABLE_CHARACTER_PAIR_COLORING,
IPreferenceConstants.CHARACTER_PAIR_COLOR);
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
fBracketMatcher.setSourceVersion(getPreferenceStore().getString(JavaCore.COMPILER_SOURCE));
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR, HIGHLIGHT_BRACKET_AT_CARET_LOCATION, ENCLOSING_BRACKETS);
super.configureSourceViewerDecorationSupport(support);
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(PyDevEditorPreferences.USE_MATCHING_BRACKETS,
PyDevEditorPreferences.MATCHING_BRACKETS_COLOR);
}
protected void configureBracketMatcher(SourceViewerDecorationSupport support) {
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(
EditorPrefConstants.MATCHING_BRACKETS_.key,
EditorPrefConstants.MATCHING_BRACKETS_COLOR2.getActiveKey(),
EditorPrefConstants.HIGHLIGHT_BRACKET_AT_CARET_LOCATION,
EditorPrefConstants.ENCLOSING_BRACKETS);
}
protected void unconfigureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
support.uninstall();
}
protected SourceViewerDecorationSupport createSourceViewerDecorationSupport() {
return new SourceViewerDecorationSupport(getXtextSourceviewer(), null, new DefaultMarkerAnnotationAccess(),
getSharedColors());
}
protected SourceViewerDecorationSupport getDecorationSupport() {
return this.decorationSupport;
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
configureBracketMatcher(support);
super.configureSourceViewerDecorationSupport(support);
}