Examples of ISourceViewer


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

    public abstract IErlProject getProject();

    public abstract String getScannerName();

    protected void setupBracketInserter() {
        final ISourceViewer sourceViewer = getSourceViewer();
        if (sourceViewer instanceof ITextViewerExtension) {
            ((ITextViewerExtension) sourceViewer)
                    .prependVerifyKeyListener(getBracketInserter());
        }
    }
View Full Code Here

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

    }

    @Override
    protected ISourceViewer createSourceViewer(final Composite parent,
            final IVerticalRuler ruler, final int styles) {
        final ISourceViewer viewer = new ErlangSourceViewer(parent, ruler,
                getOverviewRuler(), true, styles, new IBracketInserterValidator() {
                    @Override
                    public boolean earlyCancelCheck() {
                        return getInsertMode() != ITextEditorExtension3.SMART_INSERT;
                    }
View Full Code Here

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

   *
   * @param start
   * @param length
   */
  private void highlight(int start, int length) {
    ISourceViewer sourceViewer = getSourceViewer();

    assert sourceViewer != null;

    StyledText text = sourceViewer.getTextWidget();

    if (mCurrentStyleRange != null) {
      // reset current style range
      StyleRange resetedStyleRange = new StyleRange(mCurrentStyleRange.start,
              mCurrentStyleRange.length, null, null);
View Full Code Here

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

    protected void handlePreferenceStoreChanged( PropertyChangeEvent event )
    {
        try
        {

            ISourceViewer sourceViewer = getSourceViewer();
            if ( sourceViewer == null )
            {
                return;
            }
View Full Code Here

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

     */
    protected ISourceViewer createSourceViewer( Composite parent, IVerticalRuler ruler, int styles )
    {
        getAnnotationAccess();
        getOverviewRuler();
        ISourceViewer viewer = new ProjectionViewer( parent, ruler, getOverviewRuler(), true, styles );
        getSourceViewerDecorationSupport( viewer );

        return viewer;
    }
View Full Code Here

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

            }

            sb.append( old.substring( containers[containers.length - 1].getOffset()
                + containers[containers.length - 1].getLength(), old.length() ) );

            ISourceViewer sourceViewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
            int topIndex = sourceViewer.getTopIndex();
            document.set( sb.toString() );
            sourceViewer.setTopIndex( topIndex );
        }
    }
View Full Code Here

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


    protected void doRun()
    {
        IDocument document = editor.getDocumentProvider().getDocument( editor.getEditorInput() );
        ISourceViewer sourceViewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
        int topIndex = sourceViewer.getTopIndex();
        document.set( super.getLdifModel().toFormattedString( Utils.getLdifFormatParameters() ) );
        sourceViewer.setTopIndex( topIndex );
    }
View Full Code Here

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

    public void updateAnnotations()
    {

        LdifFile model = editor.getLdifModel();
        ISourceViewer viewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
        if ( viewer == null )
            return;

        IDocument document = viewer.getDocument();
        IAnnotationModel annotationModel = viewer.getAnnotationModel();
        if ( document == null || annotationModel == null || model == null )
            return;

        if ( annotationModel instanceof IAnnotationModelExtension )
        {
            ( ( IAnnotationModelExtension ) annotationModel ).removeAllAnnotations();

            List positionList = new ArrayList();

            LdifContainer[] containers = model.getContainers();
            for ( int i = 0; i < containers.length; i++ )
            {
                LdifContainer container = containers[i];

                // LdifPart errorPart = null;
                int errorOffset = -1;
                int errorLength = -1;
                StringBuffer errorText = null;

                LdifPart[] parts = container.getParts();
                for ( int k = 0; k < parts.length; k++ )
                {
                    LdifPart part = parts[k];
                    if ( !part.isValid() )
                    {
                        if ( errorOffset == -1 )
                        {
                            // errorPart = part;
                            errorOffset = part.getOffset();
                            errorLength = part.getLength();
                            errorText = new StringBuffer();
                            errorText.append( part.toRawString() );
                        }
                        else
                        {
                            errorLength += part.getLength();
                            errorText.append( part.toRawString() );
                        }
                    }
                }

                if ( errorOffset == -1 && !container.isValid() )
                {
                    errorOffset = container.getOffset();
                    errorLength = container.getLength();
                    errorText = new StringBuffer();
                    errorText.append( container.toRawString() );
                }

                if ( errorOffset > -1 )
                {
                    // Annotation annotation = new Annotation("DEFAULT",
                    // true,
                    // invalidFilters[i].toString());
                    // if(errorPart instanceof LdifUnknownPart) {
                    // errorOffset = container.getOffset();
                    // errorLength = container.getLength();
                    // errorText = new StringBuffer(container.toString());
                    // }
                    Annotation annotation = new Annotation( ERROR_ANNOTATION_TYPE, true, errorText.toString() );
                    Position position = new Position( errorOffset, errorLength );
                    positionList.add( position );
                    viewer.getAnnotationModel().addAnnotation( annotation, position );
                }

            }
        }
    }
View Full Code Here

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

        annotationModel = viewer.getProjectionAnnotationModel();
    }

    protected ISourceViewer createSourceViewer(Composite parent,
            IVerticalRuler ruler, int styles) {
        ISourceViewer viewer = new ProjectionViewer(parent, ruler,
                getOverviewRuler(), isOverviewRulerVisible(), styles);
        // ensure decoration support has been created and configured.
        getSourceViewerDecorationSupport(viewer);
        return viewer;
    }
View Full Code Here

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

   *
   * @param start
   * @param length
   */
  private void highlight(int start, int length) {
    ISourceViewer sourceViewer = getSourceViewer();

    assert sourceViewer != null;

    StyledText text = sourceViewer.getTextWidget();

    if (mCurrentStyleRange != null) {
      // reset current style range
      StyleRange resetedStyleRange = new StyleRange(mCurrentStyleRange.start,
              mCurrentStyleRange.length, null, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.