Java 类org.eclipse.jface.text.source.CompositeRuler 实例源码

项目:codelens-eclipse    文件:LineNumberChangeRulerColumnPatch.java   
@Override
public Object invoke(Object obj, Method thisMethod, Method proceed, Object[] args) throws Throwable {
    if ("createControl".equals(thisMethod.getName())) {
        CompositeRuler parentRuler = (CompositeRuler) args[0];
        this.fCachedTextViewer = parentRuler.getTextViewer();
        this.fCachedTextWidget = fCachedTextViewer.getTextWidget();
    } else if ("setDisplayMode".equals(thisMethod.getName())) {
        this.fCharacterDisplay = (boolean) args[0];
    } else if ("doPaint".equals(thisMethod.getName()) && args.length > 1) {
        GC gc = (GC) args[0];
        ILineRange visibleLines = (ILineRange) args[1];

        if (fRevisionPainter == null) {
            fRevisionPainter = getValue("fRevisionPainter", obj);
            fDiffPainter = getValue("fDiffPainter", obj);
        }

        LineNumberChangeRulerColumn l = ((LineNumberChangeRulerColumn) obj);
        doPaint(gc, visibleLines, l);
        return null;
    }
    return proceed.invoke(obj, args);
}
项目:gama    文件:GamlEditor.java   
@Override
protected void handlePreferenceStoreChanged(final PropertyChangeEvent event) {
    final LineNumberColumn c;
    super.handlePreferenceStoreChanged(event);
    if (event.getProperty().equals(PREFERENCE_COLOR_BACKGROUND)) {
        // this.fSourceViewerDecorationSupport.updateOverviewDecorations();

        this.getVerticalRuler().getControl()
                .setBackground(GamaColors.get(AutoStartup.EDITOR_BACKGROUND_COLOR.getValue()).color());

        final Iterator e = ((CompositeRuler) getVerticalRuler()).getDecoratorIterator();
        while (e.hasNext()) {
            final IVerticalRulerColumn column = (IVerticalRulerColumn) e.next();
            column.getControl()
                    .setBackground(GamaColors.get(AutoStartup.EDITOR_BACKGROUND_COLOR.getValue()).color());
            column.redraw();
        }
    }
}
项目:pgcodekeeper    文件:SqlSourceViewer.java   
public SqlSourceViewer(Composite parent, int style) {
    super(parent, new CompositeRuler(),
            SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | style);
    this.setRangeIndicator(new DefaultRangeIndicator());
    this.configure(new SQLEditorSourceViewerConfiguration(EditorsUI
            .getSharedTextColors(), Activator.getDefault()
            .getPreferenceStore(), null));

    this.getTextWidget().setFont(JFaceResources.getTextFont());
}
项目:typescript.java    文件:TypeScriptMergeViewer.java   
@Override
public void createPartControl(Composite composite) {
    SourceViewer sourceViewer = (SourceViewer) createTypeScriptSourceViewer(composite, new CompositeRuler(),
            null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null));
    setSourceViewer(this, sourceViewer);
    createNavigationActions();
    getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
}
项目:bts    文件:EgyLineNumberRulerColumn.java   
@Override
public Control createControl(CompositeRuler parentRuler,
        Composite parentControl) {
    Control control = super.createControl(parentRuler, parentControl);
    setBackground(BTSUIConstants.COLOR_RULER_COLUMN_BACKGROUND);
    return control;
}
项目:APICloud-Studio    文件:ThemeableEditorExtension.java   
@SuppressWarnings("unchecked")
private void overrideRulerColors()
{
    IThemeableEditor editor = this.fEditor.get();

    // default to bg color of surrounding composite
    Color bg = null;
    // Use editor background color if we can
    if (editor != null)
    {
        ISourceViewer sv = editor.getISourceViewer();
        if (sv != null)
        {
            StyledText text = sv.getTextWidget();
            if (text != null)
            {
                bg = text.getBackground();
                // copy the color because for some reason it gets disposed
                bg = ThemePlugin.getDefault().getColorManager().getColor(bg.getRGB());
            }
        }

        // force the colors for all the ruler columns (specifically so we force the folding bg to match).
        CompositeRuler ruler = (CompositeRuler) editor.getIVerticalRuler();
        Iterator<IVerticalRulerColumn> iter = ruler.getDecoratorIterator();
        while (iter.hasNext())
        {
            IVerticalRulerColumn column = iter.next();
            column.getControl().setBackground(bg);
        }
    }

    if (fLineColumn != null)
    {
        fLineColumn.setBackground(bg);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
    if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
        return super.createAnnotationRulerColumn(ruler);

    AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
    column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            // for now: just invoke ruler double click action
            triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
        }

        private void triggerAction(String actionID) {
            IAction action= getAction(actionID);
            if (action != null) {
                if (action instanceof IUpdate)
                    ((IUpdate) action).update();
                // hack to propagate line change
                if (action instanceof ISelectionListener) {
                    ((ISelectionListener)action).selectionChanged(null, null);
                }
                if (action.isEnabled())
                    action.run();
            }
        }

    }));

    return column;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaMergeViewer.java   
@Override
public void createPartControl(Composite composite) {
    SourceViewer sourceViewer= (SourceViewer)createJavaSourceViewer(composite, new CompositeRuler(), null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null));
    setSourceViewer(this, sourceViewer);
    createNavigationActions();
    getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
    if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
        return super.createAnnotationRulerColumn(ruler);

    AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
    column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            // for now: just invoke ruler double click action
            triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
        }

        private void triggerAction(String actionID) {
            IAction action= getAction(actionID);
            if (action != null) {
                if (action instanceof IUpdate)
                    ((IUpdate) action).update();
                // hack to propagate line change
                if (action instanceof ISelectionListener) {
                    ((ISelectionListener)action).selectionChanged(null, null);
                }
                if (action.isEnabled())
                    action.run();
            }
        }

    }));

    return column;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaMergeViewer.java   
@Override
public void createPartControl(Composite composite) {
    SourceViewer sourceViewer= (SourceViewer)createJavaSourceViewer(composite, new CompositeRuler(), null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null));
    setSourceViewer(this, sourceViewer);
    createNavigationActions();
    getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
}
项目:birt    文件:ScriptEditor.java   
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * 
 * @return the created line number column
 */
private CompositeRuler createCompositeRuler( )
{
    CompositeRuler ruler = new CompositeRuler( );

    ruler.setModel( new AnnotationModel( ) );
    return ruler;
}
项目:birt    文件:ScriptEditor.java   
/**
 * Creates the vertical ruler to be used by this editor.
 * 
 * @return the vertical ruler
 */
protected IVerticalRuler createVerticalRuler( )
{
    CompositeRuler ruler = createCompositeRuler( );

    ruler.addDecorator( 0, createLineNumberRulerColumn( ) );
    return ruler;
}
项目:birt    文件:ExpressionBuilder.java   
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * 
 * @return the created line number column
 */
private CompositeRuler createCompositeRuler( )
{
    CompositeRuler ruler = new CompositeRuler( );

    ruler.setModel( new AnnotationModel( ) );
    return ruler;
}
项目:birt    文件:ExpressionBuilder.java   
/**
 * Creates the vertical ruler to be used by this editor.
 * 
 * @return the vertical ruler
 */
private IVerticalRuler createVerticalRuler( )
{
    IVerticalRuler ruler = createCompositeRuler( );

    if ( ruler instanceof CompositeRuler )
    {
        CompositeRuler compositeRuler = (CompositeRuler) ruler;

        compositeRuler.addDecorator( 0, createLineNumberRulerColumn( ) );
    }
    return ruler;
}
项目:bts    文件:EmbeddedEditorFactory.java   
public static CompositeRuler getCpAnnotationRuler() {
    return cpAnnotationRuler;
}
项目:bts    文件:EmbeddedEditorFactory.java   
public static void setCpAnnotationRuler(CompositeRuler cpAnnotationRuler) {
    EmbeddedEditorFactory.cpAnnotationRuler = cpAnnotationRuler;
}
项目:bts    文件:WrappedSourceViewer.java   
public void createPartControl(Composite parent)
{
    int VERTICAL_RULER_WIDTH = 12;

    int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
    ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors();
    IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors);
    CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH);

    _document = new Document();
    _document.set(_docString);

    _annotationModel = new AnnotationModel();
    _annotationModel.connect(_document);

    _sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles);
    _sourceViewer.configure(new SourceViewerConfiguration());

    _sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors);

    AnnotationPreference ap = new AnnotationPreference();
    ap.setColorPreferenceKey(ANNO_KEY_COLOR);
    ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT);
    ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL);
    ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW);
    ap.setTextPreferenceKey(ANNO_KEY_TEXT);
    ap.setAnnotationType(ANNO_TYPE);
    _sds.setAnnotationPreference(ap);

    //      _sds.install(EditorsPlugin.getDefault().getPreferenceStore());

    _sourceViewer.setDocument(_document, _annotationModel);

    _sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    ruler.addDecorator(0, new LineNumberRulerColumn());

    Annotation annotation = new Annotation(false);
    annotation.setType(ANNO_TYPE);
    Position position = new Position(0, 4);
    _annotationModel.addAnnotation(annotation, position);
    parent.layout();
}
项目:APICloud-Studio    文件:CommonLineNumberChangeRulerColumn.java   
public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
    Control control= super.createControl(parentRuler, parentControl);
    fRevisionPainter.setParentRuler(parentRuler);
    fDiffPainter.setParentRuler(parentRuler);
    return control;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaExpandHover.java   
public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
    super(ruler, access, doubleClickListener);
}
项目:SPLevo    文件:UnifiedDiffEditor.java   
@Override
protected IVerticalRuler createVerticalRuler() {
    // main purpose of this is to get a reference to the vertical ruler object
    ruler = (CompositeRuler) super.createVerticalRuler();
    return ruler;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaExpandHover.java   
public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
    super(ruler, access, doubleClickListener);
}
项目:goclipse    文件:LangTextMergeViewer.java   
@Override
protected SourceViewer createSourceViewer(Composite parent, int textOrientation) {
    int styles = textOrientation | SWT.H_SCROLL | SWT.V_SCROLL;
    return new LangSourceViewer(parent, new CompositeRuler(), styles);
}
项目:Eclipse-Postfix-Code-Completion    文件:AnnotationExpandHover.java   
/**
 * Creates a new hover instance.
 *
 * @param ruler
 * @param access
 * @param doubleClickListener
 */
public AnnotationExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
    fCompositeRuler= ruler;
    fAnnotationAccess= access;
    fDblClickListener= doubleClickListener;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AnnotationExpandHover.java   
/**
 * Creates a new hover instance.
 *
 * @param ruler
 * @param access
 * @param doubleClickListener
 */
public AnnotationExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
    fCompositeRuler= ruler;
    fAnnotationAccess= access;
    fDblClickListener= doubleClickListener;
}