Package org.eclipse.wst.sse.ui.internal.reconcile

Examples of org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation


        Position p = new Position(offset, length);
        ReconcileAnnotationKey key = createKey(getPartitionType(getDocument(), offset), getScope());

        // create an annotation w/ problem ID and fix info
        TemporaryAnnotation annotation = new TemporaryAnnotation(p, type, messageText, key);
        Object extraInfo = info.getAdditionalFixInfo();
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170988
        // add quick fix information
        if (extraInfo == null) {
          extraInfo = validationMessage.getAttribute(QUICKASSISTPROCESSOR);
        }
        annotation.setAdditionalFixInfo(extraInfo);
        annotation.setAttributes(validationMessage.getAttributes());
        annotations.add(annotation);
      }
    }
    return (IReconcileResult[]) annotations.toArray(new IReconcileResult[annotations.size()]);
  }
View Full Code Here


      while (i.hasNext()) {
        Object obj = i.next();
        if (!(obj instanceof TemporaryAnnotation))
          continue;

        TemporaryAnnotation annotation = (TemporaryAnnotation) obj;
        ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();

        // then if this strategy knows how to add/remove this
        // partition type
        if (key != null && key.equals(fReconcileAnnotationKey)) {
          if (key.getScope() == ReconcileAnnotationKey.PARTIAL && (annotationOverlaps || annotation.getPosition().overlapsWith(region.getOffset(), region.getLength()))) {
            toRemove.add(annotation);
          }
          else if (key.getScope() == ReconcileAnnotationKey.TOTAL) {
            toRemove.add(annotation);
          }
View Full Code Here

  private class SpellingProblemCollector implements ISpellingProblemCollector {
    List annotations = new ArrayList();

    public void accept(SpellingProblem problem) {
      if (isInterestingProblem(problem)) {
        TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(problem.getOffset(), problem.getLength()), SpellingAnnotation.TYPE, problem.getMessage(), fReconcileAnnotationKey);

        SpellingQuickAssistProcessor quickAssistProcessor = new SpellingQuickAssistProcessor();
        quickAssistProcessor.setSpellingProblem(problem);
        annotation.setAdditionalFixInfo(quickAssistProcessor);
        annotations.add(annotation);
        if (_DEBUG_SPELLING_PROBLEMS) {
          Logger.log(Logger.INFO, problem.getMessage());
        }
      }
View Full Code Here

      while (i.hasNext()) {
        Object obj = i.next();
        if (!(obj instanceof TemporaryAnnotation))
          continue;

        TemporaryAnnotation annotation = (TemporaryAnnotation) obj;
        ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();

        // then if this strategy knows how to add/remove this
        // partition type
        if (key != null && key.equals(fReconcileAnnotationKey)) {
          if (key.getScope() == ReconcileAnnotationKey.PARTIAL && (annotationOverlaps || annotation.getPosition().overlapsWith(region.getOffset(), region.getLength()))) {
            toRemove.add(annotation);
          }
          else if (key.getScope() == ReconcileAnnotationKey.TOTAL) {
            toRemove.add(annotation);
          }
View Full Code Here

  private class SpellingProblemCollector implements ISpellingProblemCollector {
    List annotations = new ArrayList();

    public void accept(SpellingProblem problem) {
      if (isInterestingProblem(problem)) {
        TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(problem.getOffset(), problem.getLength()), SpellingAnnotation.TYPE, problem.getMessage(), fReconcileAnnotationKey);

        SpellingQuickAssistProcessor quickAssistProcessor = new SpellingQuickAssistProcessor();
        quickAssistProcessor.setSpellingProblem(problem);
        annotation.setAdditionalFixInfo(quickAssistProcessor);
        annotations.add(annotation);
        if (_DEBUG_SPELLING_PROBLEMS) {
          Logger.log(Logger.INFO, problem.getMessage());
        }
      }
View Full Code Here

   */
  public boolean canFix(Annotation annotation) {
    boolean result = false;

    if (annotation instanceof TemporaryAnnotation) {
      TemporaryAnnotation tempAnnotation = (TemporaryAnnotation) annotation;
      int problemID = tempAnnotation.getProblemID();
      switch (problemID) {
        case ProblemIDsXML.EmptyTag :
        case ProblemIDsXML.MissingEndTag :
        case ProblemIDsXML.AttrsInEndTag :
        case ProblemIDsXML.MissingAttrValue :
View Full Code Here

   */
  public ICompletionProposal[] getProposals(Annotation annotation) throws CoreException {
    ArrayList proposals = new ArrayList();

    if (annotation instanceof TemporaryAnnotation) {
      TemporaryAnnotation tempAnnotation = (TemporaryAnnotation) annotation;
      int problemID = tempAnnotation.getProblemID();
      switch (problemID) {
        case ProblemIDsXML.EmptyTag :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_0, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.MissingEndTag :
          String tagName = (String) ((Object[]) tempAnnotation.getAdditionalFixInfo())[0];
          String tagClose = (String) ((Object[]) tempAnnotation.getAdditionalFixInfo())[1];
          int tagCloseOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[2]).intValue();
          int startTagEndOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[3]).intValue();
          int firstChildStartOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[4]).intValue();
          int endOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[5]).intValue();
          proposals.add(new CompletionProposal(tagClose, tagCloseOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_1, null, "")); //$NON-NLS-1$
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), startTagEndOffset - tempAnnotation.getPosition().getOffset(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_2, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          proposals.add(new CompletionProposal("</" + tagName + ">", firstChildStartOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_3, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          proposals.add(new CompletionProposal("</" + tagName + ">", endOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_4, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          break;
        case ProblemIDsXML.AttrsInEndTag :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_5, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.MissingAttrValue :
          String defaultAttrValue = (String) ((Object[]) tempAnnotation.getAdditionalFixInfo())[0];
          int insertOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[1]).intValue();
          proposals.add(new CompletionProposal("\"" + defaultAttrValue + "\"", tempAnnotation.getPosition().getOffset() + tempAnnotation.getPosition().getLength() + insertOffset, 0, defaultAttrValue.length() + 2, getImage(), XMLUIMessages.QuickFixProcessorXML_6, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.NoAttrValue :
          defaultAttrValue = (String) tempAnnotation.getAdditionalFixInfo();
          proposals.add(new CompletionProposal("=\"" + defaultAttrValue + "\"", tempAnnotation.getPosition().getOffset() + tempAnnotation.getPosition().getLength(), 0, defaultAttrValue.length() + 3, getImage(), XMLUIMessages.QuickFixProcessorXML_6, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.SpacesBeforeTagName :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_8, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.SpacesBeforePI :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_9, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.NamespaceInPI :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_10, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.UnknownElement :
          proposals.add(new RemoveUnknownElementQuickFixProposal(tempAnnotation.getAdditionalFixInfo(), getImage(), XMLUIMessages.QuickFixProcessorXML_11));
          proposals.add(new RenameInFileQuickAssistProposal());
          break;
        case ProblemIDsXML.UnknownAttr :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          proposals.add(new RenameInFileQuickAssistProposal());
          break;
        case ProblemIDsXML.InvalidAttrValue :
          proposals.add(new CompletionProposal("", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_12, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
        case ProblemIDsXML.MissingRequiredAttr :
          String requiredAttr = (String) ((Object[]) tempAnnotation.getAdditionalFixInfo())[0];
          insertOffset = ((Integer) ((Object[]) tempAnnotation.getAdditionalFixInfo())[1]).intValue();
          proposals.add(new CompletionProposal(requiredAttr, tempAnnotation.getPosition().getOffset() + insertOffset, 0, requiredAttr.length(), getImage(), XMLUIMessages.QuickFixProcessorXML_13, null, "")); //$NON-NLS-1$
          break;
        case ProblemIDsXML.AttrValueNotQuoted :
          String attrValue = (String) tempAnnotation.getAdditionalFixInfo();
          proposals.add(new CompletionProposal("\"" + attrValue + "\"", tempAnnotation.getPosition().getOffset(), tempAnnotation.getPosition().getLength(), attrValue.length() + 2, getImage(), XMLUIMessages.QuickFixProcessorXML_14, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          break;
        case ProblemIDsXML.MissingClosingBracket :
          proposals.add(new CompletionProposal(">", tempAnnotation.getPosition().getOffset() + tempAnnotation.getPosition().getLength(), 0, 1, getImage(), XMLUIMessages.QuickFixProcessorXML_15, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
          break;
      }
    }

    return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
View Full Code Here

        Position p = new Position(offset, length);
        ReconcileAnnotationKey key = createKey(getPartitionType(getDocument(), offset), getScope());

        // create an annotation w/ problem ID and fix info
        TemporaryAnnotation annotation = new TemporaryAnnotation(p, type, messageText, key);
        Object extraInfo = info.getAdditionalFixInfo();
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170988
        // add quick fix information
        if (extraInfo == null) {
          extraInfo = validationMessage.getAttribute(QUICKASSISTPROCESSOR);
        }
        annotation.setAdditionalFixInfo(extraInfo);
        annotation.setAttributes(validationMessage.getAttributes());
        annotations.add(annotation);
      }
    }
    return (IReconcileResult[]) annotations.toArray(new IReconcileResult[annotations.size()]);
  }
View Full Code Here

        // create an annotation to mark the occurrence
        ReconcileAnnotationKey reconcileAnnotationKey = new ReconcileAnnotationKey(
            null, PHPPartitionTypes.PHP_DEFAULT,
            ReconcileAnnotationKey.TOTAL);
        TemporaryAnnotation annotation = new TemporaryAnnotation(
            position, annotationType, description,
            reconcileAnnotationKey) {

          // Supply an occurrence image to display in the vertical
          // ruler
View Full Code Here

                // create an annotation to mark the occurrence
                ReconcileAnnotationKey reconcileAnnotationKey = new ReconcileAnnotationKey(
                        null, PHPPartitionTypes.PHP_DEFAULT,
                        ReconcileAnnotationKey.TOTAL);
                TemporaryAnnotation annotation = new TemporaryAnnotation(
                        position, annotationType, description,
                        reconcileAnnotationKey) {

                    // Supply an occurrence image to display in the vertical
                    // ruler
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation

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.