Package org.eclipse.jface.text.source

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


      String contentTypeId = getContentType(getDocument());
      if (contentTypeId == null) {
        contentTypeId = IContentTypeManager.CT_TEXT;
      }
      if (getTextViewer() instanceof ISourceViewer) {
        ISourceViewer viewer = (ISourceViewer) getTextViewer();
        fSpellcheckStrategy = new SpellcheckStrategy(viewer, contentTypeId);
        fSpellcheckStrategy.setDocument(getDocument());
      }
    }
    return fSpellcheckStrategy;
View Full Code Here


   */
  protected ValidatorStrategy getValidatorStrategy() {
    ValidatorStrategy validatorStrategy = null;
    if (fValidatorStrategy == null && fValidationEnabled) {
      if (getTextViewer() instanceof ISourceViewer) {
        ISourceViewer viewer = (ISourceViewer) getTextViewer();
        String contentTypeId = null;

        IDocument doc = viewer.getDocument();
        contentTypeId = getContentType(doc);

        if (contentTypeId != null) {
          validatorStrategy = new ValidatorStrategy(viewer, contentTypeId);
          ValidatorBuilder vBuilder = new ValidatorBuilder();
View Full Code Here

   * @return Set of quick assist processors or null if none exist
   */
  private Set getQuickAssistProcessors(IQuickAssistInvocationContext invocationContext) {
    Set processsors = null;

    ISourceViewer sourceViewer = invocationContext.getSourceViewer();
    if (sourceViewer != null) {
      IDocument document = sourceViewer.getDocument();
      try {
        String partitionType;
        if (document != null)
          partitionType = TextUtilities.getContentType(document, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, invocationContext.getOffset(), true);
        else
View Full Code Here

    }
    return false;
  }

  public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) {
    ISourceViewer viewer = quickAssistContext.getSourceViewer();
    int documentOffset = quickAssistContext.getOffset();
    int length = viewer != null ? viewer.getSelectedRange().y : 0;

    IAnnotationModel model = viewer.getAnnotationModel();
    if (model == null)
      return null;

    List allProposals = new ArrayList();
    if (model instanceof IAnnotationModelExtension2) {
View Full Code Here

    if (semanticHighlightingStrategy != null && document != null) {
      semanticHighlightingStrategy.reconcile(new Region(0, document.getLength()));
    }

    if ((getTextViewer() instanceof ISourceViewer)) {
      ISourceViewer sourceViewer = (ISourceViewer) getTextViewer();
      IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
      for (int i = 0; i < fReconcileListeners.length; i++) {
        fReconcileListeners[i].reconciled(document, annotationModel, false, new NullProgressMonitor());
      }
    }
  }
View Full Code Here

      String contentTypeId = getContentType(getDocument());
      if (contentTypeId == null) {
        contentTypeId = IContentTypeManager.CT_TEXT;
      }
      if (getTextViewer() instanceof ISourceViewer) {
        ISourceViewer viewer = (ISourceViewer) getTextViewer();
        fSpellcheckStrategy = new SpellcheckStrategy(viewer, contentTypeId);
        fSpellcheckStrategy.setDocument(getDocument());
      }
    }
    return fSpellcheckStrategy;
View Full Code Here

   */
  protected ValidatorStrategy getValidatorStrategy() {
    ValidatorStrategy validatorStrategy = null;
    if (fValidatorStrategy == null && fValidationEnabled) {
      if (getTextViewer() instanceof ISourceViewer) {
        ISourceViewer viewer = (ISourceViewer) getTextViewer();
        String contentTypeId = null;

        IDocument doc = viewer.getDocument();
        contentTypeId = getContentType(doc);

        if (contentTypeId != null) {
          validatorStrategy = new ValidatorStrategy(viewer, contentTypeId);
          ValidatorBuilder vBuilder = new ValidatorBuilder();
View Full Code Here

        // conflict with superclass' key bindings.
        _preview.createPartControl((Composite) _container.getItem(1)
                .getControl());
        super.createPartControl((Composite) _container.getItem(0).getControl());

        ISourceViewer sourceViewer = getSourceViewer();

        if (sourceViewer == null) {
            return;
        }

        IDocument document = sourceViewer.getDocument();

        if (document != null) {
            document.addDocumentListener(new IDocumentListener() {
                public void documentAboutToBeChanged(DocumentEvent event) {
                }
View Full Code Here

    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


    public void updateFoldingRegions()
    {

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

        IDocument document = viewer.getDocument();

        try
        {
            ProjectionAnnotationModel projectionAnnotationModel = ( ProjectionAnnotationModel ) editor
                .getAdapter( ProjectionAnnotationModel.class );
View Full Code Here

TOP

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

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.