Package org.eclipse.jface.text.source

Examples of org.eclipse.jface.text.source.DefaultCharacterPairMatcher


  @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(
      GoUIPreferenceConstants.EDITOR_MATCHING_BRACKETS,
      GoUIPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);
  }
View Full Code Here


    GoEditor editor = (GoEditor) targetEditor;
   
    ISelection selection = editor.getSelectionProvider().getSelection();
   
    if (selection != null && selection instanceof TextSelection) {
      DefaultCharacterPairMatcher matcher = editor.getPairMatcher();
      IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
      Object obj = editor.getAdapter(Control.class);
      if (obj != null && obj instanceof StyledText) {
        StyledText st = (StyledText)obj;
        int startOffset = st.getCaretOffset();
        IRegion r = matcher.match(doc, startOffset);
        if (r != null) {
          int ro = r.getOffset();
          int low = ro + 1;
          int high = ro + r.getLength();
          int pairOffset = low == startOffset?high:low;
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.DefaultCharacterPairMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.