Package org.eclipse.wst.sse.core.internal.provisional.text

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument


 
  private void updateEncodingMemento() {
    boolean failed = false;
    IStructuredModel internalModel = getInternalModel();
    if (internalModel != null) {
      IStructuredDocument doc = internalModel.getStructuredDocument();
      EncodingMemento memento = doc.getEncodingMemento();
      IDocumentCharsetDetector detector = internalModel.getModelHandler().getEncodingDetector();
      if (memento != null && detector != null) {
        detector.set(doc);
        try {
          String newEncoding = detector.getEncoding();
          if (newEncoding != null) {
            memento.setDetectedCharsetName(newEncoding);
          }
        }
        catch (IOException e) {
          failed = true;
        }
      }
      /**
       * Be sure to use the new value but only if no exception
       * occurred. (we may find cases we need to do more error recovery
       * there) should be near impossible to get IOException from
       * processing the _document_
       */
      if (!failed) {
        doc.setEncodingMemento(memento);
      }
    }
  }
View Full Code Here


   * (non-Javadoc)
   *
   * @see org.eclipse.core.filebuffers.IDocumentFactory#createDocument()
   */
  public IDocument createDocument() {
    IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(new JSPSourceParser());
    return structuredDocument;
  }
View Full Code Here

    performValidation(f, reporter, model, new Region(0, length));
  }

  protected void performValidation(IFile f, IReporter reporter, IStructuredModel model, IRegion validateRegion) {
    loadPreferences(f);
    IStructuredDocument sDoc = model.getStructuredDocument();

    fIsELIgnored = isElIgnored(f.getFullPath(), model);
    // iterate all document regions
    IStructuredDocumentRegion region = sDoc.getRegionAtCharacterOffset(validateRegion.getOffset());
    while (region != null && !reporter.isCancelled() && (region.getStartOffset() <= (validateRegion.getOffset() + validateRegion.getLength()))) {
      if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
        // only checking directives
        processDirective(reporter, f, model, region);
        fTaglibPrefixes.clear();
View Full Code Here

    if(fProjectionAnnotationModel != null) {
      try {
        model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
        if(model != null) {
          //use the structured doc to get all of the regions effected by the given dirty region
          IStructuredDocument structDoc = model.getStructuredDocument();
          IStructuredDocumentRegion[] structRegions = structDoc.getStructuredDocumentRegions(dirtyRegion.getOffset(), dirtyRegion.getLength());
          Set indexedRegions = getIndexedRegions(model, structRegions);

          //these are what are passed off to the annotation model to
          //actually create and maintain the annotations
          List modifications = new ArrayList();
View Full Code Here

    int documentPosition = context.getInvocationOffset();
   
    String partitionType = getPartitionType(viewer, documentPosition);
    if (partitionType == IJSPPartitions.JSP_CONTENT_JAVA)
      return true;
    IStructuredDocument structuredDocument = (IStructuredDocument) viewer.getDocument();
    IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
    IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(viewer, documentPosition);
    // ////////////////////////////////////////////////////////////////////////////
    // ANOTHER WORKAROUND UNTIL PARTITIONING TAKES CARE OF THIS
    // check for xml-jsp tags...
    if (partitionType == IJSPPartitions.JSP_DIRECTIVE && fn != null) {
View Full Code Here

  /**
   * @param result
   * @return
   */
  private StyleRange[] convertReadOnlyRegions(StyleRange[] result, int start, int length) {
    IStructuredDocument structuredDocument = getDocument();

    /**
     * (dmw) For client/provider simplicity (and consistent look and feel)
     * we'll handle readonly regions in one spot, here in the Highlighter.
     * Currently it is a fair assumption that each readonly region will be
     * on an ITextRegion boundary, so we combine consecutive styles when
     * found to be equivalent. Plus, for now, we'll just adjust
     * foreground. Eventually will use a "dimming" algrorithm to adjust
     * color's satuation/brightness.
     */
    if (structuredDocument.containsReadOnly(start, length)) {
      // something is read-only in the line, so go through each style,
      // and adjust
      for (int i = 0; i < result.length; i++) {
        StyleRange styleRange = result[i];
        if (structuredDocument.containsReadOnly(styleRange.start, styleRange.length)) {
          adjustForeground(styleRange);
        }
      }
    }
    return result;
View Full Code Here

    IStructuredDocumentRegion sdRegion = null;
    if (viewer == null || viewer.getDocument() == null)
      return null;

    int lastOffset = documentOffset;
    IStructuredDocument doc = (IStructuredDocument) viewer.getDocument();
    sdRegion = doc.getRegionAtCharacterOffset(documentOffset);
    while (sdRegion == null && lastOffset >= 0) {
      lastOffset--;
      sdRegion = doc.getRegionAtCharacterOffset(lastOffset);
    }
    return sdRegion;
  }
View Full Code Here

    private Composite createRegionTabContents(SashForm sashForm) {
      ISelection sel = fTextEditor.getSelectionProvider().getSelection();
      final ITextSelection textSelection = (ITextSelection) sel;
      final List documentRegions = new ArrayList();
      if (fDocument instanceof IStructuredDocument) {
        IStructuredDocument structuredDocument = (IStructuredDocument) fDocument;
        int pos = textSelection.getOffset();
        int end = textSelection.getOffset() + textSelection.getLength();
        IStructuredDocumentRegion docRegion = structuredDocument.getRegionAtCharacterOffset(pos);
        IStructuredDocumentRegion endRegion = structuredDocument.getRegionAtCharacterOffset(end);
        if (pos < end) {
          while (docRegion != endRegion) {
            documentRegions.add(docRegion);
            docRegion = docRegion.getNext();
          }
View Full Code Here

  protected void formatEndTag(IDOMNode node, IStructuredFormatContraints formatContraints) {
    if (!isEndTagMissing(node)) {
      // end tag exists

      IStructuredDocument structuredDocument = node.getModel().getStructuredDocument();
      String lineDelimiter = structuredDocument.getLineDelimiter();
      String nodeIndentation = getNodeIndent(node);
      IDOMNode lastChild = (IDOMNode) node.getLastChild();
      if (lastChild != null && lastChild.getNodeType() != Node.TEXT_NODE) {
        if (isEndTagMissing(lastChild)) {
          // find deepest child
View Full Code Here

      // append undefined regions
      String undefinedRegion = getUndefinedRegions(node, lastUndefinedRegionOffset, node.getEndOffset() - lastUndefinedRegionOffset);
      stringBuffer.append(undefinedRegion);

      IDOMModel structuredModel = node.getModel();
      IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
      // 1 is for "<"
      int offset = node.getStartOffset() + 1 + node.getNodeName().length();
      // 1 is for "<"
      int length = node.getFirstStructuredDocumentRegion().getTextLength() - 1 - node.getNodeName().length();
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

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.