Examples of ISourceViewer


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

    protected ISourceViewer createSourceViewer( Composite parent, IVerticalRuler ruler, int styles ) {

        fAnnotationAccess = createAnnotationAccess();
        fOverviewRuler = createOverviewRuler(getSharedColors());

        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

    /*
     * @see org.eclipse.ui.texteditor.AbstractTextEditor#adjustHighlightRange(int, int)
     */
    protected void adjustHighlightRange( int offset, int length ) {
        ISourceViewer viewer = getSourceViewer();
        if (viewer instanceof ITextViewerExtension5) {
            ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
            extension.exposeModelRange(new Region(offset, length));
        }
    }
View Full Code Here

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

   
    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);
   
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
    }
  }
View Full Code Here

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

    }
  }
 
  @Override
  public void dispose() {
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);
    }
    super.dispose();
  }
View Full Code Here

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

  private void installChangeRulerModel(IVerticalRulerColumn column) {
    if (column instanceof IChangeRulerColumn) {
      IAnnotationModel model= getAnnotationModelWithDiffer();
      ((IChangeRulerColumn) column).setModel(model);
      if (model != null) {
        ISourceViewer viewer= fViewer;
        if (viewer != null && viewer.getAnnotationModel() == null)
          viewer.showAnnotations(true);
        }
    }
  }
View Full Code Here

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

      ((IChangeRulerColumn) column).setModel(null);
    IAnnotationModel model= getDiffer();
    if (model instanceof ILineDifferExtension)
      ((ILineDifferExtension) model).suspend();

    ISourceViewer viewer= fViewer;
    if (viewer != null && viewer.getAnnotationModel() == null)
      viewer.showAnnotations(false);
  }
View Full Code Here

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

   *
   * @return the annotation model that contains the line differ, or <code>null</code> if none could be found or created
   * @see IChangeRulerColumn#QUICK_DIFF_MODEL_ID
   */
  private IAnnotationModel getAnnotationModelWithDiffer() {
    ISourceViewer viewer= fViewer;
    if (viewer == null)
      return null;
   
    IAnnotationModel m= viewer.getAnnotationModel();
    IAnnotationModelExtension model= null;
    if (m instanceof IAnnotationModelExtension)
      model= (IAnnotationModelExtension) m;
   
    IAnnotationModel differ= getDiffer();
View Full Code Here

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

   *
   * @return the line differ, or <code>null</code> if none could be found
   */
  private IAnnotationModel getDiffer() {
    // get annotation model extension
    ISourceViewer viewer= fViewer;
    if (viewer == null)
      return null;

    IAnnotationModel m= viewer.getAnnotationModel();
    if (m == null && fDelegate instanceof IChangeRulerColumn)
      m= ((IChangeRulerColumn)fDelegate).getModel();
   
    if (!(m instanceof IAnnotationModelExtension))
      return null;
View Full Code Here

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

      return;

    if (!validateEditorInputState())
      return;

    ISourceViewer viewer= fEditor.getSourceViewer();
    if (viewer == null)
      return;

    IDocument document= viewer.getDocument();
    if (document == null)
      return;

    StyledText widget= viewer.getTextWidget();
    if (widget == null)
      return;

    // get selection
    Point p= viewer.getSelectedRange();
    if (p == null)
      return;

    ITextSelection sel= new TextSelection(document, p.x, p.y);

    ITextSelection skippedLine= getSkippedLine(document, sel);
    if (skippedLine == null)
      return;

    try {

      ITextSelection movingArea= getMovingSelection(document, sel, viewer);

      // if either the skipped line or the moving lines are outside the widget's
      // visible area, bail out
      if (!containedByVisibleRegion(movingArea, viewer) || !containedByVisibleRegion(skippedLine, viewer))
        return;

      // get the content to be moved around: the moving (selected) area and the skipped line
      String moving= movingArea.getText();
      String skipped= skippedLine.getText();
      if (moving == null || skipped == null || document.getLength() == 0)
        return;

      String delim;
      String insertion;
      int offset, deviation;
      if (fUpwards) {
        delim= document.getLineDelimiter(skippedLine.getEndLine());
        if (fCopy) {
          delim= TextUtilities.getDefaultLineDelimiter(document);
          insertion= moving + delim;
          offset= movingArea.getOffset();
          deviation= 0;
        } else {
          Assert.isNotNull(delim);
          insertion= moving + delim + skipped;
          offset= skippedLine.getOffset();
          deviation= -skippedLine.getLength() - delim.length();
        }
      } else {
        delim= document.getLineDelimiter(movingArea.getEndLine());
        if (fCopy) {
          if (delim == null) {
            delim= TextUtilities.getDefaultLineDelimiter(document);
            insertion= delim + moving;
          } else {
            insertion= moving + delim;
          }
          offset= skippedLine.getOffset();
          deviation= movingArea.getLength() + delim.length();
        } else {
          Assert.isNotNull(delim);
          insertion= skipped + delim + moving;
          offset= movingArea.getOffset();
          deviation= skipped.length() + delim.length();
        }
      }

      // modify the document
      beginCompoundEdit();
      if (fCopy) {
//        fDescription= new EditDescription(offset, 0, insertion.length());
        document.replace(offset, 0, insertion);
      } else {
//        fDescription= new EditDescription(offset, insertion.length(), insertion.length());
        document.replace(offset, insertion.length(), insertion);
      }

      // move the selection along
      int selOffset= movingArea.getOffset() + deviation;
      int selLength= movingArea.getLength() + (fAddDelimiter ? delim.length() : 0);
      if (! (viewer instanceof ITextViewerExtension5))
        selLength= Math.min(selLength, viewer.getVisibleRegion().getOffset() + viewer.getVisibleRegion().getLength() - selOffset);
      else {
        // TODO need to check what is necessary in the projection case
      }
      selectAndReveal(viewer, selOffset, selLength);
    } catch (BadLocationException x) {
View Full Code Here

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

   * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent)
   * @since 3.3
   */
  protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
      ISourceViewer viewer= getSourceViewer();
     
      if (!(viewer instanceof ISourceViewerExtension2))
        return; // cannot unconfigure - do nothing

      // XXX: this is pretty heavy-weight
      ((ISourceViewerExtension2)viewer).unconfigure();
      viewer.configure(getSourceViewerConfiguration());
     
      if (Boolean.FALSE.equals(event.getNewValue()))
        SpellingProblem.removeAllInActiveEditor(this, null);
     
      IAction quickAssistAction= getAction(ITextEditorActionConstants.QUICK_ASSIST);
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.