use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.
the class AbstractPairMatcherTest method testSimpleMatchSameMatcher.
/**
* Very simple checks.
*
* @throws BadLocationException test failure
*/
@Test
public void testSimpleMatchSameMatcher() throws BadLocationException {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
performMatch(matcher, "#( )%");
performMatch(matcher, "#[ ]%");
performMatch(matcher, "#{ }%");
performMatch(matcher, "(% )#");
performMatch(matcher, "[% ]#");
performMatch(matcher, "{% }#");
performMatch(matcher, "#( %)%");
performMatch(matcher, "#[ %]%");
performMatch(matcher, "#{ %}%");
performMatch(matcher, "%(% )#");
performMatch(matcher, "%[% ]#");
performMatch(matcher, "%{% }#");
performMatch(matcher, "#( % )#");
performMatch(matcher, "#[ % ]#");
performMatch(matcher, "#{ % }#");
performMatch(matcher, "#( % % )#");
performMatch(matcher, "#[ % % ]#");
performMatch(matcher, "#{ % % }#");
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher 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);
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher 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");
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project webtools.sourceediting by eclipse.
the class AbstractPairMatcherTest method testCloseMatches.
/**
* Close matches.
*
* @throws BadLocationException
*/
public void testCloseMatches() throws BadLocationException {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
performMatch(matcher, "#()%");
performMatch(matcher, "(%)#");
performMatch(matcher, "#(())%");
performMatch(matcher, "(%())#");
performMatch(matcher, "((%)#)");
performMatch(matcher, "(#()%)");
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project webtools.sourceediting by eclipse.
the class AbstractPairMatcherTest method performMatch.
private void performMatch(final String delims, final String testCase) {
final ICharacterPairMatcher matcher = createMatcher(delims);
performMatch(matcher, testCase);
matcher.dispose();
}
Aggregations