Package org.eclipse.jface.text.link.LinkedModeUI

Examples of org.eclipse.jface.text.link.LinkedModeUI.ExitFlags


                        return null;
                    }
                    if (level.fSecondPosition.offset == offset && length == 0) {
                        // don't enter the character if if its the closing
                        // peer
                        return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
                    }
                }
                // when entering an anonymous class between the parenthesis', we
                // don't want to jump after the closing parenthesis when return
                // is pressed
                if (event.character == SWT.CR && offset > 0) {
                    final IDocument document = sourceViewer.getDocument();
                    try {
                        if (document.getChar(offset - 1) == '{') {
                            return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
                        }
                    } catch (final BadLocationException e) {
                    }
                }
            }
View Full Code Here


    }

    public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
      if(!isMasked(offset)) {
        if (event.character == fExit)
          return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
      }
      return null;
    }
View Full Code Here

     */
    public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {

      if (event.character == fExitCharacter) {
        if (environment.anyPositionContains(offset))
          return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
        else
          return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
      }

      switch (event.character) {
        case ';':
          return new ExitFlags(ILinkedModeListener.NONE, true);
        case SWT.CR:
          // when entering an anonymous class as a parameter, we don't want
          // to jump after the parenthesis when return is pressed
          if (offset > 0) {
            try {
              if (fDocument.getChar(offset - 1) == '{')
                return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
            } catch (BadLocationException e) {
            }
          }
          return null;
        default:
View Full Code Here

                    BracketLevel level = fStack.peek();
                    if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
                        return null;
                    if (level.fSecondPosition.offset == offset && length == 0)
                        // don't enter the character if if its the closing peer
                        return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
                }
                // when entering an anonymous class between the parenthesis', we don't want
                // to jump after the closing parenthesis when return is pressed
                if (event.character == SWT.CR && offset > 0) {
                    IDocument document = getSourceViewer().getDocument();
                    try {
                        if (document.getChar(offset - 1) == '{')
                            return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
                    } catch (BadLocationException e) {}
                }
            }
            return null;
        }
View Full Code Here

  private static class LinkedModeExitPolicy implements
      LinkedModeUI.IExitPolicy {
    public ExitFlags doExit(LinkedModeModel model, VerifyEvent event,
        int offset, int length) {
      if (event.character == '=') {
        return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
      }
      return null;
    }
View Full Code Here

   * custom exit policy that exits when a space is detected
   */
  public static class exitOnSpacePolicy implements org.eclipse.jface.text.link.LinkedModeUI.IExitPolicy {
    public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
      if (length == 0 && (event.character == ' ')) {
        return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);       
      }
      return null; // don't change behavior
    }   
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.link.LinkedModeUI.ExitFlags

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.