Java 类org.eclipse.ui.texteditor.SourceViewerDecorationSupport 实例源码
项目:ncl30-eclipse
文件:NCLEditor.java
@Override
protected void configureSourceViewerDecorationSupport(
SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
char[] matchChars = { '<', '>' }; // which brackets to match
ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(
matchChars, IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(
EDITOR_MATCHING_BRACKETS, EDITOR_MATCHING_BRACKETS_COLOR);
// Enable bracket highlighting in the preference store
IPreferenceStore store = getPreferenceStore();
store.setDefault(EDITOR_MATCHING_BRACKETS, true);
store.setDefault(EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128");
}
项目:brainfuck
文件:BfEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
DefaultCharacterPairMatcher matcher =
new DefaultCharacterPairMatcher(
new char[]{'[', ']'},
EditorConstants.BF_PARTITIONING,
true);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(
EditorConstants.PREF_EDITOR_MATCHING_BRACKETS,
EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_COLOR,
EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_CARET,
EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_ENCLOSING);
}
项目:PDFReporter-Studio
文件:StyledTextXtextAdapter.java
/**
* 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());
}
项目:wt-studio
文件:JsonTextEditor.java
@Override
public void createPartControl(Composite parent) {
JsonPreferenceStore jsonPreferenceStore = JsonPreferenceStore.getJsonPreferenceStore();
viewerConfiguration = new JsonSourceViewerConfiguration(this, jsonPreferenceStore);
setSourceViewerConfiguration(viewerConfiguration);
super.createPartControl(parent);
ProjectionViewer viewer =(ProjectionViewer) getSourceViewer();
projectionSupport = new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
projectionSupport.install();
//turn projection mode on
viewer.doOperation(ProjectionViewer.TOGGLE);
annotationModel = viewer.getProjectionAnnotationModel();
SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
support.install(getPreferenceStore());
IFile file = (IFile) getEditorInput().getAdapter(IFile.class);
platformPreferenceListener = new PlatformPreferenceListener(viewerConfiguration, jsonPreferenceStore);
platformPreferenceListener.setPreferenceChangeListener(file);
}
项目:eclipse-batch-editor
文件:BatchEditor.java
/**
* Installs an additional source viewer support which uses editor
* preferences instead of standard text preferences. If standard source
* viewer support would be set with editor preferences all standard
* preferences would be lost or had to be reimplmented. To avoid this
* another source viewer support is installed...
*/
private void installAdditionalSourceViewerSupport() {
additionalSourceViewerSupport = new SourceViewerDecorationSupport(getSourceViewer(), getOverviewRuler(),
getAnnotationAccess(), getSharedColors());
additionalSourceViewerSupport.setCharacterPairMatcher(bracketMatcher);
additionalSourceViewerSupport.setMatchingCharacterPainterPreferenceKeys(
P_EDITOR_MATCHING_BRACKETS_ENABLED.getId(), P_EDITOR_MATCHING_BRACKETS_COLOR.getId(),
P_EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION.getId(), P_EDITOR_ENCLOSING_BRACKETS.getId());
IPreferenceStore preferenceStoreForDecorationSupport = BatchEditorUtil.getPreferences().getPreferenceStore();
additionalSourceViewerSupport.install(preferenceStoreForDecorationSupport);
}
项目:eclipse-bash-editor
文件:BashEditor.java
/**
* Installs an additional source viewer support which uses editor
* preferences instead of standard text preferences. If standard source
* viewer support would be set with editor preferences all standard
* preferences would be lost or had to be reimplmented. To avoid this
* another source viewer support is installed...
*/
private void installAdditionalSourceViewerSupport() {
additionalSourceViewerSupport = new SourceViewerDecorationSupport(getSourceViewer(), getOverviewRuler(),
getAnnotationAccess(), getSharedColors());
additionalSourceViewerSupport.setCharacterPairMatcher(bracketMatcher);
additionalSourceViewerSupport.setMatchingCharacterPainterPreferenceKeys(
P_EDITOR_MATCHING_BRACKETS_ENABLED.getId(), P_EDITOR_MATCHING_BRACKETS_COLOR.getId(),
P_EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION.getId(), P_EDITOR_ENCLOSING_BRACKETS.getId());
IPreferenceStore preferenceStoreForDecorationSupport = BashEditorUtil.getPreferences().getPreferenceStore();
additionalSourceViewerSupport.install(preferenceStoreForDecorationSupport);
}
项目:Hydrograph
文件:SourceViewer.java
private void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
while (e.hasNext()) {
support.setAnnotationPreference((AnnotationPreference) e.next());
}
support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
support.setSymbolicFontName(JFaceResources.TEXT_FONT);
}
项目:egradle
文件:AbstractGroovyBasedEditor.java
/**
* Installs an additional source viewer support which uses editor
* preferences instead of standard text preferences. If standard source
* viewer support would be set with editor preferences all standard
* preferences would be lost or had to be reimplmented. To avoid this
* another source viewer support is installed...
*/
private void installAdditionalSourceViewerSupport() {
additionalSourceViewerSupport = new SourceViewerDecorationSupport(getSourceViewer(), getOverviewRuler(),
getAnnotationAccess(), getSharedColors());
additionalSourceViewerSupport.setCharacterPairMatcher(bracketMatcher);
additionalSourceViewerSupport.setMatchingCharacterPainterPreferenceKeys(
getPreferences().getP_EDITOR_MATCHING_BRACKETS_ENABLED().getId(),
getPreferences().getP_EDITOR_MATCHING_BRACKETS_COLOR().getId(),
getPreferences().getP_EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION().getId(),
getPreferences().getP_EDITOR_ENCLOSING_BRACKETS().getId());
IPreferenceStore preferenceStoreForDecorationSupport = getPreferences().getPreferenceStore();
additionalSourceViewerSupport.install(preferenceStoreForDecorationSupport);
}
项目:GradleEditor
文件:GradleEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
char[] matchChars = { '(', ')', '[', ']', '{', '}' }; // which brackets
// to match
matcher = new DefaultCharacterPairMatcher(matchChars, IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(EDITOR_MATCHING_BRACKETS, EDITOR_MATCHING_BRACKETS_COLOR);
// Enable bracket highlighting in the preference store
IPreferenceStore store = getPreferenceStore();
store.setDefault(EDITOR_MATCHING_BRACKETS, true);
store.setDefault(EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128");
}
项目:texlipse
文件:BibEditor.java
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);
}
项目:texlipse
文件:TexEditor.java
/**
* @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);
}
项目:mesfavoris
文件:SpellcheckableMessageArea.java
private SourceViewerDecorationSupport configureAnnotationPreferences() {
ISharedTextColors textColors = EditorsUI.getSharedTextColors();
IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(
sourceViewer, null, annotationAccess, textColors);
List annotationPreferences = new MarkerAnnotationPreferences()
.getAnnotationPreferences();
Iterator e = annotationPreferences.iterator();
while (e.hasNext())
support.setAnnotationPreference((AnnotationPreference) e.next());
support.install(EditorsUI.getPreferenceStore());
return support;
}
项目:typescript.java
文件:JavaScriptLightWeightEditor.java
@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);
}
项目:bts
文件:XtextEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
if (characterPairMatcher != null) {
support.setCharacterPairMatcher(characterPairMatcher);
support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
BracketMatchingPreferencesInitializer.COLOR_KEY);
}
}
项目:statecharts
文件:StyledTextXtextAdapter.java
/**
* 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());
}
项目:PDFReporter-Studio
文件:StyledTextXtextAdapter.java
protected void createXtextSourceViewer() {
sourceviewer = new XtextSourceViewerEx(styledText, preferenceStoreAccess.getPreferenceStore());
sourceviewer.configure(configuration);
sourceviewer.setDocument(document, new AnnotationModel());
SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceviewer, null,
new DefaultMarkerAnnotationAccess(), getSharedColors());
configureSourceViewerDecorationSupport(support);
}
项目:APICloud-Studio
文件:AbstractThemeableEditor.java
@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);
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaEditor.java
@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);
}
项目:idecore
文件:ApexCodeEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
// JavaPairMatcher only matches "<>" for certain compiler versions
fBracketMatcher.setSourceVersion(getPreferenceStore().getString(PreferenceConstants.COMPILER_SOURCE));
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(PreferenceConstants.EDITOR_MATCHING_BRACKETS,
PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:JavaEditor.java
@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);
}
项目:Eclipse-Markdown-Editor-Plugin
文件:MarkdownEditor.java
@Override
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
// if (true) return super.createSourceViewer(parent, ruler, styles);
// Create with code-folding
ISourceViewer viewer = new ProjectionViewer(parent, ruler,
getOverviewRuler(), isOverviewRulerVisible(), styles);
// ensure decoration support has been created and configured.
SourceViewerDecorationSupport decSupport = getSourceViewerDecorationSupport(viewer);
// SourceViewer viewer = (SourceViewer) super.createSourceViewer(parent, ruler, styles);
// Setup word-wrapping
final StyledText widget = viewer.getTextWidget();
// Listen to pref changes
prefChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(MarkdownPreferencePage.PREF_WORD_WRAP)) {
widget.setWordWrap(MarkdownPreferencePage.wordWrap());
}
}
};
pStore.addPropertyChangeListener(prefChangeListener);
// Switch on word-wrapping
if (MarkdownPreferencePage.wordWrap()) {
widget.setWordWrap(true);
}
return viewer;
}
项目:rustyeclipse
文件:RustEditor.java
@Override
protected void configureSourceViewerDecorationSupport (@Nullable SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
IPreferenceStore store = getPreferenceStore();
char[] matchChars = {'(', ')', '[', ']', '{', '}'}; //which brackets to match
ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(matchChars ,
IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(RustConstants.EDITOR_MATCHING_BRACKETS,RustConstants. EDITOR_MATCHING_BRACKETS_COLOR);
//Enable bracket highlighting in the preference store
store.setDefault(RustConstants.EDITOR_MATCHING_BRACKETS, true);
store.setDefault(RustConstants.EDITOR_MATCHING_BRACKETS_COLOR, RustConstants.DEFAULT_MATCHING_BRACKETS_COLOR);
}
项目:wt-studio
文件:JsonTextEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
support.setCharacterPairMatcher(pairsMatcher);
support.setMatchingCharacterPainterPreferenceKeys(JsonPreferenceStore.EDITOR_MATCHING_BRACKETS,
JsonPreferenceStore.EDITOR_MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
项目:Pydev
文件:PyEditProjection.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
support.setCharacterPairMatcher(fBracketMatcher);
support.setMatchingCharacterPainterPreferenceKeys(PydevEditorPrefs.USE_MATCHING_BRACKETS,
PydevEditorPrefs.MATCHING_BRACKETS_COLOR);
}
项目:goclipse
文件:AbstractLangEditor.java
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);
}
项目:egradle
文件:AbstractGroovyBasedEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
// @formatter:off
super.configureSourceViewerDecorationSupport(support);
// @formatter:on
}
项目:bts
文件:WrappedSourceViewer.java
public void createPartControl(Composite parent)
{
int VERTICAL_RULER_WIDTH = 12;
int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors();
IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors);
CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH);
_document = new Document();
_document.set(_docString);
_annotationModel = new AnnotationModel();
_annotationModel.connect(_document);
_sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles);
_sourceViewer.configure(new SourceViewerConfiguration());
_sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors);
AnnotationPreference ap = new AnnotationPreference();
ap.setColorPreferenceKey(ANNO_KEY_COLOR);
ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT);
ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL);
ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW);
ap.setTextPreferenceKey(ANNO_KEY_TEXT);
ap.setAnnotationType(ANNO_TYPE);
_sds.setAnnotationPreference(ap);
// _sds.install(EditorsPlugin.getDefault().getPreferenceStore());
_sourceViewer.setDocument(_document, _annotationModel);
_sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
ruler.addDecorator(0, new LineNumberRulerColumn());
Annotation annotation = new Annotation(false);
annotation.setType(ANNO_TYPE);
Position position = new Position(0, 4);
_annotationModel.addAnnotation(annotation, position);
parent.layout();
}
项目:statecharts
文件:StyledTextXtextAdapter.java
protected void unconfigureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
support.uninstall();
}
项目:statecharts
文件:StyledTextXtextAdapter.java
protected SourceViewerDecorationSupport createSourceViewerDecorationSupport() {
return new SourceViewerDecorationSupport(getXtextSourceviewer(), null, new DefaultMarkerAnnotationAccess(),
getSharedColors());
}
项目:statecharts
文件:StyledTextXtextAdapter.java
protected SourceViewerDecorationSupport getDecorationSupport() {
return this.decorationSupport;
}
项目:goclipse
文件:AbstractLangEditor.java
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
configureBracketMatcher(support);
super.configureSourceViewerDecorationSupport(support);
}