Java 类org.eclipse.swt.custom.BidiSegmentListener 实例源码

项目:mesfavoris    文件:SpellcheckableMessageArea.java   
private void computeBrokenBidiPlatformTextWidth(int textWidth) {
    class BidiSegmentListenerTester implements BidiSegmentListener {
        boolean called;

        @Override
        public void lineGetSegments(BidiSegmentEvent event) {
            called = true;
        }
    }
    BidiSegmentListenerTester tester = new BidiSegmentListenerTester();
    StyledText textWidget = getTextWidget();
    textWidget.addBidiSegmentListener(tester);
    textWidget.setText(" "); //$NON-NLS-1$
    textWidget.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    textWidget.removeBidiSegmentListener(tester);
}
项目:Pydev    文件:PythonSourceViewer.java   
public PythonSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    super(parent, ruler, null, false, styles, new PyAbstractIndentGuidePreferencesProvider() {

        @Override
        public int getTabWidth() {
            return DefaultIndentPrefs.get(null).getTabWidth();
        }
    });
    StyledText text = this.getTextWidget();
    text.addBidiSegmentListener(new BidiSegmentListener() {
        @Override
        public void lineGetSegments(BidiSegmentEvent event) {
            try {
                event.segments = getBidiLineSegments(event.lineOffset);
            } catch (BadLocationException x) {
                // ignore
            }
        }
    });
    updateViewerFont();
    updateViewerColors();
    getPreferenceStore().addPropertyChangeListener(propertyChangeListener);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaSourceViewer.java   
@Override
protected void createControl(Composite parent, int styles) {

    // Use LEFT_TO_RIGHT unless otherwise specified.
    if ((styles & SWT.RIGHT_TO_LEFT) == 0 && (styles & SWT.LEFT_TO_RIGHT) == 0)
        styles |= SWT.LEFT_TO_RIGHT;

    final int baseLevel= (styles & SWT.RIGHT_TO_LEFT) != 0 ? Bidi.DIRECTION_RIGHT_TO_LEFT : Bidi.DIRECTION_LEFT_TO_RIGHT;

    super.createControl(parent, styles);

    fBackspaceManager= new SmartBackspaceManager();
    fBackspaceManager.install(this);

    StyledText text= getTextWidget();
    text.addBidiSegmentListener(new BidiSegmentListener() {
        public void lineGetSegments(BidiSegmentEvent event) {
            if (redraws()) {
                try {
                    event.segments= getBidiLineSegments(getDocument(), baseLevel, widgetOffset2ModelOffset(event.lineOffset), event.lineText);
                } catch (BadLocationException e) {
                    // don't touch the segments
                }
            }
        }
    });
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaSourceViewer.java   
@Override
protected void createControl(Composite parent, int styles) {

    // Use LEFT_TO_RIGHT unless otherwise specified.
    if ((styles & SWT.RIGHT_TO_LEFT) == 0 && (styles & SWT.LEFT_TO_RIGHT) == 0)
        styles |= SWT.LEFT_TO_RIGHT;

    final int baseLevel= (styles & SWT.RIGHT_TO_LEFT) != 0 ? Bidi.DIRECTION_RIGHT_TO_LEFT : Bidi.DIRECTION_LEFT_TO_RIGHT;

    super.createControl(parent, styles);

    fBackspaceManager= new SmartBackspaceManager();
    fBackspaceManager.install(this);

    StyledText text= getTextWidget();
    text.addBidiSegmentListener(new BidiSegmentListener() {
        public void lineGetSegments(BidiSegmentEvent event) {
            if (redraws()) {
                try {
                    event.segments= getBidiLineSegments(getDocument(), baseLevel, widgetOffset2ModelOffset(event.lineOffset), event.lineText);
                } catch (BadLocationException e) {
                    // don't touch the segments
                }
            }
        }
    });
}