Search in sources :

Example 1 with DefaultCharacterPairMatcher

use of org.eclipse.jface.text.source.DefaultCharacterPairMatcher in project abstools by abstools.

the class ABSEditor method configureSourceViewerDecorationSupport.

@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
    IPreferenceStore store = getPreferenceStore();
    store.setValue(LOCATION_TYPE_NEAR_TEXTSTYLE_KEY, LOCATION_TYPE_NEAR_TEXTSTYLE_VALUE);
    store.setValue(LOCATION_TYPE_FAR_TEXTSTYLE_KEY, LOCATION_TYPE_FAR_TEXTSTYLE_VALUE);
    store.setValue(LOCATION_TYPE_SOMEWHERE_TEXTSTYLE_KEY, LOCATION_TYPE_SOMEWHERE_TEXTSTYLE_VALUE);
    super.configureSourceViewerDecorationSupport(support);
    // which brackets to match
    char[] matchChars = { '(', ')', '[', ']', '{', '}' };
    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
    store.setDefault(EDITOR_MATCHING_BRACKETS, true);
    store.setDefault(EDITOR_MATCHING_BRACKETS_COLOR, Constants.DEFAULT_MATCHING_BRACKETS_COLOR);
}
Also used : DefaultCharacterPairMatcher(org.eclipse.jface.text.source.DefaultCharacterPairMatcher) ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 2 with DefaultCharacterPairMatcher

use of org.eclipse.jface.text.source.DefaultCharacterPairMatcher in project jbosstools-hibernate by jbosstools.

the class HQLEditor method configureSourceViewerDecorationSupport.

@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
    super.configureSourceViewerDecorationSupport(support);
    // which brackets to match
    char[] matchChars = { '(', ')', '[', ']', '{', '}' };
    ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(matchChars, IDocumentExtension3.DEFAULT_PARTITIONING);
    support.setCharacterPairMatcher(matcher);
    support.setMatchingCharacterPainterPreferenceKeys(HQL_EDITOR_MATCHING_BRACKETS, HQL_EDITOR_MATCHING_BRACKETS_COLOR);
    // Enable bracket highlighting in the preference store
    IPreferenceStore store = getPreferenceStore();
    store.setDefault(HQL_EDITOR_MATCHING_BRACKETS, true);
    // $NON-NLS-1$
    store.setDefault(HQL_EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128");
}
Also used : DefaultCharacterPairMatcher(org.eclipse.jface.text.source.DefaultCharacterPairMatcher) ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 3 with DefaultCharacterPairMatcher

use of org.eclipse.jface.text.source.DefaultCharacterPairMatcher in project xtext-eclipse by eclipse.

the class BracePairMatcher method setBracePairProvider.

@Inject
public void setBracePairProvider(final IBracePairProvider bracePairProvider) {
    final ArrayList<Character> chars = this.getChars(bracePairProvider);
    DefaultCharacterPairMatcher _defaultCharacterPairMatcher = new DefaultCharacterPairMatcher(((char[]) Conversions.unwrapArray(chars, char.class)));
    this.characterPairMatcher = _defaultCharacterPairMatcher;
}
Also used : DefaultCharacterPairMatcher(org.eclipse.jface.text.source.DefaultCharacterPairMatcher) Inject(com.google.inject.Inject)

Example 4 with DefaultCharacterPairMatcher

use of org.eclipse.jface.text.source.DefaultCharacterPairMatcher in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method createCharacterPairMatcher.

protected ICharacterPairMatcher createCharacterPairMatcher() {
    ICharacterPairMatcher matcher = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; matcher == null && i < ids.length; i++) {
        matcher = (ICharacterPairMatcher) builder.getConfiguration(DocumentRegionEdgeMatcher.ID, ids[i]);
    }
    if (matcher == null) {
        matcher = new DefaultCharacterPairMatcher(new char[] { '(', ')', '{', '}', '[', ']', '<', '>', '"', '"', '\'', '\'' });
    }
    return matcher;
}
Also used : DefaultCharacterPairMatcher(org.eclipse.jface.text.source.DefaultCharacterPairMatcher) ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Aggregations

DefaultCharacterPairMatcher (org.eclipse.jface.text.source.DefaultCharacterPairMatcher)4 ICharacterPairMatcher (org.eclipse.jface.text.source.ICharacterPairMatcher)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 Inject (com.google.inject.Inject)1 Point (org.eclipse.swt.graphics.Point)1 ExtendedConfigurationBuilder (org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)1