Examples of TextPresentation


Examples of org.eclipse.jface.text.TextPresentation

   * @param damage the damage to be repaired
   * @param document the document whose presentation must be repaired
   */
  private void processDamage(IRegion damage, IDocument document) {
    if (damage != null && damage.getLength() > 0) {
      TextPresentation p= createPresentation(damage, document);
      if (p != null)
        applyTextRegionCollection(p);
    }
  }
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

    fContentAssistSubjectControlAdapter.installValidator(frame);

    if (frame.fPresenter != null) {
      if (fTextPresentation == null)
        fTextPresentation= new TextPresentation();
      fContentAssistSubjectControlAdapter.installContextInformationPresenter(frame);
      frame.fPresenter.updatePresentation(frame.fOffset, fTextPresentation);
    }

    createContextInfoPopup();
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

          }
        }
        reconcilePositions(subtrees);
      }

      TextPresentation textPresentation = null;
      if (!fJobPresenter.isCanceled()) {
        textPresentation = fJobPresenter.createPresentation(
            fAddedPositions, fRemovedPositions);
      }
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

    frame.fValidator.install(frame.fInformation, fViewer, frame.fOffset);

    if (frame.fPresenter != null) {
      if (fTextPresentation == null)
        fTextPresentation= new TextPresentation();
      frame.fPresenter.install(frame.fInformation, fViewer, frame.fBeginOffset);
      frame.fPresenter.updatePresentation(frame.fOffset, fTextPresentation);
    }

    createContextInfoPopup();
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

    int height= trim.height;
   
    //FIXME: The HTML2TextReader does not render <p> like a browser.
    // Instead of inserting an empty line, it just adds a single line break.
    // Furthermore, the indentation of <dl><dd> elements is too small (e.g with a long @see line)
    TextPresentation presentation= new TextPresentation();
    HTML2TextReader reader= new HTML2TextReader(new StringReader(fInput.getHtml()), presentation);
    String text;
    try {
      text= reader.getString();
    } catch (IOException e) {
      text= ""; //$NON-NLS-1$
    }

    fTextLayout.setText(text);
    fTextLayout.setWidth(sizeConstraints == null ? SWT.DEFAULT : sizeConstraints.x - trim.width);
    Iterator iter= presentation.getAllStyleRangeIterator();
    while (iter.hasNext()) {
      StyleRange sr= (StyleRange)iter.next();
      if (sr.fontStyle == SWT.BOLD)
        fTextLayout.setStyle(fBoldStyle, sr.start, sr.start + sr.length - 1);
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

        SashForm rightPane = new SashForm(sash, SWT.VERTICAL);
        rightPane.setLayoutData(new GridData(GridData.FILL_BOTH));

        Group group1 = createGroup(rightPane, "Description");
        htmlControl = new StyledText(group1, SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP);
        presentation = new TextPresentation();
        htmlControl.setLayoutData(new GridData(GridData.FILL_BOTH));
        presenter = new HTMLTextPresenter(false);

        Group group2 = createGroup(rightPane, "Filtered pattern types and patterns");
        selectedIds = new Text(group2, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP);
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

    return result;
  }

  private void applyDiffPresentation(SourceViewer oldViewer, SourceViewer newViewer,
      UpdatableScript.TextualDiff textualDiff) {
    TextPresentation oldPresentation = new TextPresentation();
    TextPresentation newPresentation = new TextPresentation();

    List<Long> chunkNumbers = textualDiff.getChunks();
    int posOld = 0;
    int posNew = 0;
    for (int i = 0; i < chunkNumbers.size(); i += 3) {
      int startOld = chunkNumbers.get(i + 0).intValue();
      int endOld = chunkNumbers.get(i + 1).intValue();
      int endNew = chunkNumbers.get(i + 2).intValue();
      int startNew = startOld - posOld + posNew;

      if (startOld == endOld) {
        // Add
        newPresentation.addStyleRange(new StyleRange(startNew, endNew - startNew,
            null, colors.get(ColorName.ADDED_BACKGROUND)));
      } else if (startNew == endNew) {
        // Remove
        oldPresentation.addStyleRange(new StyleRange(startOld, endOld - startOld,
            null, colors.get(ColorName.ADDED_BACKGROUND)));
      } else {
        // Replace
        newPresentation.addStyleRange(new StyleRange(startNew, endNew - startNew,
            null, colors.get(ColorName.CHANGED_BACKGROUND)));
        oldPresentation.addStyleRange(new StyleRange(startOld, endOld - startOld,
            null, colors.get(ColorName.CHANGED_BACKGROUND)));
      }
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

   *         <code>null</code> if the partitioning could not be computed
   */
  protected TextPresentation createPresentation(IRegion damage, IDocument document) {
    try {
      if (fRepairers == null || fRepairers.isEmpty()) {
        TextPresentation presentation= new TextPresentation(damage, 100);
        presentation.setDefaultStyleRange(new StyleRange(damage.getOffset(), damage.getLength(), null, null));
        return presentation;
      }

      TextPresentation presentation= new TextPresentation(damage, 1000);

      ITypedRegion[] partitioning= TextUtilities.computePartitioning(document, getDocumentPartitioning(), damage.getOffset(), damage.getLength(), false);
      for (int i= 0; i < partitioning.length; i++) {
        ITypedRegion r= partitioning[i];
        IPresentationRepairer repairer= getRepairer(r.getType());
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

   * @param damage the damage to be repaired
   * @param document the document whose presentation must be repaired
   */
  private void processDamage(IRegion damage, IDocument document) {
    if (damage != null && damage.getLength() > 0) {
      TextPresentation p= createPresentation(damage, document);
      if (p != null)
        applyTextRegionCollection(p);
    }
  }
View Full Code Here

Examples of org.eclipse.jface.text.TextPresentation

        PyPartitionScanner pyPartitionScanner = new PyPartitionScanner();
        FastPartitioner fastPartitioner = new FastPartitioner(pyPartitionScanner, IPythonPartitions.types);
        Document doc = new Document(result);
        fastPartitioner.connect(doc);

        TextPresentation textPresentation = new TextPresentation();
        PyCodeScanner scanner = new PyCodeScanner(colorCache);
        try {
            ITypedRegion[] computePartitioning = fastPartitioner.computePartitioning(0, doc.getLength());
            for (ITypedRegion region : computePartitioning) {
                String type = region.getType();
                int offset = region.getOffset();
                int len = region.getLength();
                if (IPythonPartitions.PY_DEFAULT.equals(type) || type == null) {
                    createDefaultRanges(textPresentation, scanner, doc, offset, len);

                } else if (IPythonPartitions.PY_COMMENT.equals(type)) {
                    TextAttribute textAttribute = colorCache.getCommentTextAttribute();
                    textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
                            textAttribute.getStyle()));

                } else if (IPythonPartitions.PY_BACKQUOTES.equals(type)) {
                    TextAttribute textAttribute = colorCache.getBackquotesTextAttribute();
                    textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
                            textAttribute.getStyle()));

                } else if (IPythonPartitions.PY_MULTILINE_STRING1.equals(type)
                        || IPythonPartitions.PY_MULTILINE_STRING2.equals(type)
                        || IPythonPartitions.PY_SINGLELINE_STRING1.equals(type)
                        || IPythonPartitions.PY_SINGLELINE_STRING2.equals(type)) {
                    TextAttribute textAttribute = colorCache.getStringTextAttribute();
                    textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
                            textAttribute.getStyle()));
                }
            }
        } finally {
            fastPartitioner.disconnect();
        }

        if (showSpacesAndNewLines) {
            for (int i = 0; i < result.length(); i++) {
                char curr = result.charAt(i);
                if (curr == '\\' && i + 1 < result.length() && result.charAt(i + 1) == 'n') {
                    textPresentation.mergeStyleRange(new StyleRange(i, 2, colorCache.getColor(new RGB(180, 180, 180)),
                            null));
                    i += 1;
                } else if (curr == ' ') {
                    int finalI = i;
                    for (; finalI < result.length() && result.charAt(finalI) == ' '; finalI++) {
                        //just iterate (the finalI will have the right value at the end).
                    }
                    textPresentation.mergeStyleRange(new StyleRange(i, finalI - i, colorCache.getColor(new RGB(180,
                            180, 180)), null));

                }
            }
        }

        ArrayList<StyleRange> list = new ArrayList<StyleRange>();
        Iterator<StyleRange> it = textPresentation.getAllStyleRangeIterator();
        while (it.hasNext()) {
            list.add(it.next());
        }
        StyleRange[] ranges = list.toArray(new StyleRange[list.size()]);
        return new Tuple<String, StyleRange[]>(finalResult, ranges);
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.