Examples of ISourceViewer


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

                    offset = range.getOffset();
                    length = range.getLength();
                }
            }
            if (moveCursor && offset > -1 && length > 0) {
                ISourceViewer sourceViewer = getSourceViewer();
                if (sourceViewer != null) {
                    sourceViewer.revealRange(offset, length);
                    sourceViewer.setSelectedRange(offset, length);
                }
            }
            return;
        } catch (Exception e) {
            BytecodeOutlinePlugin.log(e, IStatus.ERROR);
View Full Code Here

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

    protected ISourceReference computeHighlightRangeSourceReference() {
        if (!isDecompiled()) {
            return super.computeHighlightRangeSourceReference();
        }

        ISourceViewer sourceViewer = getSourceViewer();
        if (sourceViewer == null) {
            return null;
        }
        StyledText styledText = sourceViewer.getTextWidget();
        if (styledText == null) {
            return null;
        }

        int caret = 0;
        if (sourceViewer instanceof ITextViewerExtension5) {
            ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
            caret = extension.widgetOffset2ModelOffset(styledText
                .getCaretOffset());
        } else {
            int offset = sourceViewer.getVisibleRegion().getOffset();
            caret = offset + styledText.getCaretOffset();
        }

        IJavaElement element = getElementAt(caret);
View Full Code Here

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

                    return;
                }
            }

            if (input != null && input.equals(getEditorInput())) {
                ISourceViewer viewer = getSourceViewer();
                if (viewer != null) {
                    StyledText textWidget = viewer.getTextWidget();
                    if (textWidget != null && !textWidget.isDisposed()) {
                        synchronized (this) {
                            fPosted = true;
                            fClassFileEditorInput = input;
                        }
View Full Code Here

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

    }

    public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext context) {
        List<ICompletionProposal> proposals = new LinkedList<ICompletionProposal>();

        ISourceViewer viewer = context.getSourceViewer();
        IDocument document = viewer.getDocument();
        IAnnotationModel model = viewer.getAnnotationModel();

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
View Full Code Here

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

    }

    public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext context) {
        List<ICompletionProposal> proposals = new LinkedList<ICompletionProposal>();

        ISourceViewer viewer = context.getSourceViewer();
        @SuppressWarnings("unused")
        IDocument document = viewer.getDocument();
        IAnnotationModel model = viewer.getAnnotationModel();

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
View Full Code Here

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

        if (doc.getLength() == 0) return;

        StringBuffer text = new StringBuffer(doc.get());
        String anchor = getAnchorString(text);

        ISourceViewer viewer = getEditor().getViewer();
        int anchorOffset = getAnchorOffset(viewer, doc);
        // insert an anchor comment at the end of the line with carret
        // we'll find it back to reposition the caret after reformatting
        text.insert(anchorOffset, anchor);

        String formattedText = runFormatter(text);

        if (formattedText == null ||
            formattedText.equals(text.toString()) ||
            formattedText.equals(anchor))
        {
            return;
        }
       
        StringBuffer newText = new StringBuffer(formattedText);
        anchorOffset = newText.indexOf(anchor);
        if (anchorOffset > 0)
        {
            // remove the anchor comment and the preceeding whitespace
            // which might have been inserted by perltidy
            int len = anchor.length() + 1;
            anchorOffset--;
            while (anchorOffset >= 0 &&
                Character.isWhitespace(newText.charAt(anchorOffset)))
            {
                anchorOffset--;
                len++;
            }
            newText.delete(anchorOffset+1, anchorOffset+len);
        }
        else
            anchorOffset = 0;
       
        doc.set(newText.toString());
        viewer.setSelectedRange(anchorOffset, 0);
        viewer.revealRange(anchorOffset, 0);
    }
View Full Code Here

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

    annotationModel = viewer.getProjectionAnnotationModel();
  }

  @Override
  protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
    getSourceViewerDecorationSupport(viewer);
    viewer.getTextWidget().addVerifyListener(this);
    return viewer;
  }
View Full Code Here

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

  @Override
  public void propertyChange(PropertyChangeEvent event) {
    for (String type: getTypes()) {
      if (event.getProperty().equals(getStylePref(type))) {
        ISourceViewer viewer= getSourceViewer();
        if (viewer instanceof ISourceViewerExtension2) {
          ((ISourceViewerExtension2)viewer).unconfigure();
          viewer.configure(getSourceViewerConfiguration());
        }
        return;
      }
    }
  }
View Full Code Here

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

  protected boolean useSoftTabs = false;
  protected int softTabsWidth = 4;

  @Override
  protected ISourceViewer createSourceViewer(Composite parent,IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
    viewer.getTextWidget().addVerifyListener(this);
    return viewer;
  }
View Full Code Here

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

        return collector.getResolutions(marker);
    }

    private List<ICompletionProposal> computeProposals(
            final IQuickAssistInvocationContext invocationContext) {
        final ISourceViewer sourceViewer = invocationContext.getSourceViewer();
        final Iterator<Annotation> iter = sourceViewer.getAnnotationModel()
                .getAnnotationIterator();
        final List<ICompletionProposal> result = Lists.newArrayList();
        while (iter.hasNext()) {
            final Annotation annotation = iter.next();
            if (annotation instanceof MarkerAnnotation) {
                final MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
                final IMarker marker = markerAnnotation.getMarker();
                try {
                    if (!marker.getType().equals(MarkerUtils.PROBLEM_MARKER)) {
                        continue;
                    }
                    final int invocationLine = sourceViewer.getDocument()
                            .getLineOfOffset(invocationContext.getOffset());
                    final int markerLine = marker.getAttribute(IMarker.LINE_NUMBER, -1) - 1;

                    if (invocationLine == markerLine) {
                        final IMarkerResolution[] qfixes = getResolutions(marker);
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.