@Override
  public void connectorXReferenceRemoved(Connector connector, final IXReference xref) {
    //        Thread thread = new Thread(new Runnable() {
    //
    //			@Override
    //			public void run() {
    IResource resource = xref.getSource().getResource();

    try {
      String strId = ArchitectureModel.xrefStringFactory.toString(xref);
      Long id = violations.get(strId);
      if (id == null) return;

      IMarker marker = resource.findMarker(id.longValue());
      if (marker != null) marker.delete();
      violations.remove(strId);
    } catch (CoreException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    //			}
    //		});thread.start();

  }
コード例 #2
0
 public static int getErrorTicksFromMarkers(
     final IResource res, final int depth, final ISourceReference sourceElement)
     throws CoreException {
   if (res == null || !res.isAccessible()) {
     return 0;
   }
   int severity = 0;
   if (sourceElement == null) {
     severity = res.findMaxProblemSeverity(IMarker.PROBLEM, true, depth);
   } else {
     final IMarker[] markers = res.findMarkers(IMarker.PROBLEM, true, depth);
     if (markers != null && markers.length > 0) {
       for (int i = 0; i < markers.length && severity != IMarker.SEVERITY_ERROR; i++) {
         final IMarker curr = markers[i];
         if (isMarkerInRange(curr, sourceElement)) {
           final int val = curr.getAttribute(IMarker.SEVERITY, -1);
           if (val == IMarker.SEVERITY_WARNING || val == IMarker.SEVERITY_ERROR) {
             severity = val;
           }
         }
       }
     }
   }
   if (severity == IMarker.SEVERITY_ERROR) {
     return ERRORTICK_ERROR;
   } else if (severity == IMarker.SEVERITY_WARNING) {
     return ERRORTICK_WARNING;
   }
   return 0;
 }
コード例 #3
0
  private final void handleOutputLine(String line) {
    Matcher m = warningErrorPattern.matcher(line);

    if (m.find()) {
      String filename = m.group(1);
      int lineNumber = Integer.parseInt(m.group(2));
      // int colNumber = Integer.parseInt(m.group(3));
      String msg = m.group(4);

      // Determine the severity
      int severity = IMarker.SEVERITY_INFO;
      if (msg.toLowerCase().contains("error")) severity = IMarker.SEVERITY_ERROR;
      else if (msg.toLowerCase().contains("warning")) severity = IMarker.SEVERITY_WARNING;

      // Find the resource and create a marker
      for (Resource r : sourceResources) {
        IResource res = getIResource(r);
        if (filename.equals(res.getName())) {
          IMarker marker;
          try {
            marker = res.createMarker(IMarker.PROBLEM);
            marker.setAttribute(IMarker.MESSAGE, msg);
            marker.setAttribute(IMarker.SEVERITY, severity);
            marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
            marker.setAttribute(PreferenceConstants.OCARINA_MARKER, "true");
          } catch (CoreException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }

    out().println(line);
  }
コード例 #4
0
  private static String insertTagsForErrors(String fileText, IMarker[] markers)
      throws CoreException {
    StringBuilder result = new StringBuilder(fileText);

    Integer offset = 0;
    for (IMarker marker : markers) {
      int openTagStartOffset = getOpenTagStartOffset(marker);
      int closeTagStartOffset = getCloseTagStartOffset(marker);

      switch (marker.getAttribute(IMarker.SEVERITY, 0)) {
        case IMarker.SEVERITY_ERROR:
          offset += insertTagByOffset(result, ERROR_TAG_OPEN, openTagStartOffset, offset);
          offset += insertTagByOffset(result, ERROR_TAG_CLOSE, closeTagStartOffset, offset);
          break;
        case IMarker.SEVERITY_WARNING:
          offset += insertTagByOffset(result, WARNING_TAG_OPEN, openTagStartOffset, offset);
          offset += insertTagByOffset(result, WARNING_TAG_CLOSE, closeTagStartOffset, offset);
          break;
        default:
          break;
      }
    }

    return result.toString();
  }
コード例 #5
0
 /**
  * Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>
  * null</code> if no breakpoint exists or the operation fails.
  *
  * @param editor the editor
  * @param info the current ruler information
  * @return the {@link IBreakpoint} from the current editor position or <code>null</code>
  */
 protected IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
   IAnnotationModel annotationModel =
       editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
   IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
   if (annotationModel != null) {
     @SuppressWarnings("unchecked")
     Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
     while (iterator.hasNext()) {
       Object object = iterator.next();
       if (object instanceof SimpleMarkerAnnotation) {
         SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
         IMarker marker = markerAnnotation.getMarker();
         try {
           if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
             Position position = annotationModel.getPosition(markerAnnotation);
             int line = document.getLineOfOffset(position.getOffset());
             if (line == info.getLineOfLastMouseButtonActivity()) {
               IBreakpoint breakpoint =
                   DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
               if (breakpoint != null) {
                 return breakpoint;
               }
             }
           }
         } catch (CoreException e) {
         } catch (BadLocationException e) {
         }
       }
     }
   }
   return null;
 }
コード例 #6
0
 /** @since 2.3 */
 @Override
 public List<?> getTargetObjects(Object object, IMarker marker) {
   if (object instanceof AdapterFactoryEditingDomain) {
     ArrayList<Object> result = new ArrayList<Object>();
     AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) object;
     String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
     if (uriAttribute != null) {
       URI uri = URI.createURI(uriAttribute);
       EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
       if (eObject != null) {
         result.add(editingDomain.getWrapper(eObject));
       }
     }
     String relatedURIsAttribute = marker.getAttribute(EValidator.RELATED_URIS_ATTRIBUTE, null);
     if (relatedURIsAttribute != null) {
       for (String relatedURI : relatedURIsAttribute.split(" ")) {
         URI uri = URI.createURI(URI.decode(relatedURI));
         EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
         if (eObject != null) {
           result.add(editingDomain.getWrapper(eObject));
         }
       }
     }
     return result;
   } else {
     return super.getTargetObjects(object, marker);
   }
 }
コード例 #7
0
 public void markFile() {
   if (!markerHandle.exists()) {
     return;
   }
   try {
     IMarker[] markers =
         markerHandle.findMarkers(modelMarker.getMarkerId(), true, IResource.DEPTH_ZERO);
     if (modelMarker.isActive(markers)) {
       if (markers.length == 0) {
         IMarker marker = markerHandle.createMarker(modelMarker.getMarkerId());
         IResource resource = (IResource) markerHandle.getAdapter(IResource.class);
         marker.setAttributes(
             new String[] {
               MarkerProblem.ATTRIB_DESCRIPTION,
               MarkerProblem.ATTRIB_PATH,
               MarkerProblem.ATTRIB_SOURCE_OPENER
             },
             getMarkerAttributes(resource));
       }
     } else {
       markerHandle.deleteMarkers(modelMarker.getMarkerId(), true, IResource.DEPTH_ZERO);
     }
   } catch (CoreException e) {
     new Logger(CharacterCorePlugin.ID).error(Messages.ResourceModelMarker_ErrorWhileMarking, e);
   }
 }
コード例 #8
0
  @Override
  public ICompletionProposal getCompletionProposal(final IMarker marker, final IDocument document) {
    String msg = marker.getAttribute(IMarker.MESSAGE, ""); // $NON-NLS-1$
    String toSearch = GhcMessages.WARNING_INFERREDTYPE_START;
    int ix = msg.toLowerCase().indexOf(toSearch);
    String type = msg.substring(ix + toSearch.length()).trim();

    int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
    try {

      int offset = document.getLineOffset(line - 1);
      String txt = type + PlatformUtil.NL;
      return new CompletionProposal(
          getLineStartAddition(txt, marker.getResource()),
          offset,
          0,
          offset + txt.length(),
          HaskellUIImages.getImage(IImageNames.TYPE_SIGNATURE),
          getLabel(),
          null,
          null);
      // doc.replace( offset, 0, type+NL );

    } catch (BadLocationException ex) {
      HaskellUIPlugin.log(ex);
    }
    return null;
  }
コード例 #9
0
 /**
  * This method is here for use by the SABER validator's reporter instance ONLY. Do not use. See
  * defect 260144 for details.
  */
 @SuppressWarnings("unchecked")
 public static IMarker setPriority(IMarker item, int priority) throws CoreException {
   Map attrib = item.getAttributes();
   attrib.put(IMarker.PRIORITY, new Integer(priority));
   item.setAttributes(attrib);
   return item;
 }
コード例 #10
0
  private void updateStatusLine(IStructuredSelection selection) {
    String message;

    if (selection == null || selection.size() == 0) {
      message = "";
    } else if (selection.size() == 1) {
      Object sel = selection.getFirstElement();

      if (sel instanceof IMarker) {
        IMarker marker = (IMarker) sel;

        message = marker.getAttribute(IMarker.MESSAGE, "");
      } else {
        message = "";
      }
    } else {
      List<IMarker> selMarkers = new ArrayList<IMarker>();

      for (Object obj : selection.toList()) {
        if (obj instanceof IMarker) {
          selMarkers.add((IMarker) obj);
        }
      }

      message = getStatusSummary(selMarkers.toArray(new IMarker[selMarkers.size()]));
    }

    getViewSite().getActionBars().getStatusLineManager().setMessage(message);
  }
コード例 #11
0
ファイル: ManifestEditor.java プロジェクト: qqedfr/kitkat-2
  /**
   * Processes a new/old/updated marker.
   *
   * @param marker The marker being added/removed/changed
   * @param nodeList the list of activity/service/provider/receiver nodes.
   * @param kind the change kind. Can be {@link IResourceDelta#ADDED}, {@link
   *     IResourceDelta#REMOVED}, or {@link IResourceDelta#CHANGED}
   */
  private void processMarker(IMarker marker, List<UiElementNode> nodeList, int kind) {
    // get the data from the marker
    String nodeType = marker.getAttribute(AdtConstants.MARKER_ATTR_TYPE, EMPTY);
    if (nodeType == EMPTY) {
      return;
    }

    String className = marker.getAttribute(AdtConstants.MARKER_ATTR_CLASS, EMPTY);
    if (className == EMPTY) {
      return;
    }

    for (UiElementNode ui_node : nodeList) {
      if (ui_node.getDescriptor().getXmlName().equals(nodeType)) {
        for (UiAttributeNode attr : ui_node.getAllUiAttributes()) {
          if (attr.getDescriptor()
              .getXmlLocalName()
              .equals(AndroidManifestDescriptors.ANDROID_NAME_ATTR)) {
            if (attr.getCurrentValue().equals(className)) {
              if (kind == IResourceDelta.REMOVED) {
                attr.setHasError(false);
              } else {
                attr.setHasError(true);
              }
              return;
            }
          }
        }
      }
    }
  }
コード例 #12
0
 public void setMarker(IMarker marker) throws CoreException {
   super.setMarker(marker);
   fCondition = (String) marker.getAttribute(IPHPDebugConstants.Condition);
   Boolean enabled = (Boolean) marker.getAttribute(IPHPDebugConstants.ConditionEnabled);
   fConditionEnabled = enabled != null ? enabled.booleanValue() : false;
   addConditionToBP();
 }
コード例 #13
0
  private int hasBreakpointChanges(IMarkerDelta delta, IScriptBreakpoint breakpoint) {
    final String[] attrs = breakpoint.getUpdatableAttributes();
    try {
      final IMarker marker = delta.getMarker();
      for (int i = 0; i < attrs.length; ++i) {
        final String attr = attrs[i];

        final Object oldValue = delta.getAttribute(attr);
        final Object newValue = marker.getAttribute(attr);

        if (oldValue == null) {
          if (newValue != null) {
            return classifyBreakpointChange(delta, breakpoint, attr);
          }
          continue;
        }
        if (newValue == null) {
          return classifyBreakpointChange(delta, breakpoint, attr);
        }
        if (!oldValue.equals(newValue)) {
          return classifyBreakpointChange(delta, breakpoint, attr);
        }
      }
    } catch (CoreException e) {
      DLTKDebugPlugin.log(e);
    }
    return NO_CHANGES;
  }
コード例 #14
0
 private static int hasSpawnpointChanges(IMarkerDelta delta, IScriptBreakpoint breakpoint) {
   final String[] attrs = breakpoint.getUpdatableAttributes();
   try {
     final IMarker marker = delta.getMarker();
     for (int i = 0; i < attrs.length; ++i) {
       final String attr = attrs[i];
       if (IBreakpoint.ENABLED.equals(attr) || IMarker.LINE_NUMBER.equals(attr)) {
         final Object oldValue = delta.getAttribute(attr);
         final Object newValue = marker.getAttribute(attr);
         if (oldValue == null) {
           if (newValue != null) {
             return IMarker.LINE_NUMBER.equals(attr) ? MAJOR_CHANGE : MINOR_CHANGE;
           }
           continue;
         }
         if (newValue == null) {
           return IMarker.LINE_NUMBER.equals(attr) ? MAJOR_CHANGE : MINOR_CHANGE;
         }
         if (!oldValue.equals(newValue)) {
           return IMarker.LINE_NUMBER.equals(attr) ? MAJOR_CHANGE : MINOR_CHANGE;
         }
       }
     }
   } catch (CoreException e) {
     DLTKDebugPlugin.log(e);
   }
   return NO_CHANGES;
 }
コード例 #15
0
 /** @since 2.7 */
 protected void addMarkerAndLogError(URI uri, Throwable e) {
   for (Pair<IStorage, IProject> storage : getStorage2UriMapper().getStorages(uri)) {
     IResource resource = null;
     if (storage.getFirst() instanceof IResource) {
       resource = (IResource) storage.getFirst();
     } else {
       resource = storage.getSecond();
     }
     if (resource != null) {
       try {
         IMarker marker = resource.createMarker(MarkerTypes.NORMAL_VALIDATION);
         marker.setAttribute(IMarker.MESSAGE, e.getMessage() + " - See error log for details");
         marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
         marker.setAttribute(IMarker.LINE_NUMBER, 1);
       } catch (CoreException ce) {
         logger.error("Could not create marker", ce);
       }
     }
   }
   Throwable cause = e;
   if (cause instanceof CoreException) {
     cause = cause.getCause();
   }
   if (uri == null) {
     logger.error("Error during compilation.", e);
   } else {
     logger.error("Error during compilation of '" + uri + "'.", e);
   }
 }
コード例 #16
0
  /** @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object) */
  public IEditorInput getEditorInput(Object element) {
    IStorageEditorInput i;
    AtlStackFrame frame;
    //		String projectName;
    String fileName;

    if (element instanceof AtlStackFrame) {
      frame = (AtlStackFrame) element;
      if (((AtlDebugTarget) frame.getDebugTarget()).isDisassemblyMode())
        return getDisassemblyEditorInput(frame);
      ILaunchConfiguration configuration =
          frame.getDebugTarget().getLaunch().getLaunchConfiguration();
      try {
        // TODO Recuperer le nom du fichier sur la stackframe
        fileName =
            configuration.getAttribute(
                AtlLauncherTools.ATLFILENAME, AtlLauncherTools.NULLPARAMETER);

        IWorkspace wks = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot wksroot = wks.getRoot();

        i = new FileEditorInput(wksroot.getFile(new Path(fileName)));
        return i;
      } catch (CoreException e) {
        e.printStackTrace();
      }
    } else if (element instanceof AtlBreakpoint) {
      IMarker marker = ((AtlBreakpoint) element).getMarker();
      IFile ifile = (IFile) marker.getResource();
      return new FileEditorInput(ifile);
    }
    return null;
  }
コード例 #17
0
  /**
   * Returns the maximum problem marker severity for the given resource, and, if depth is
   * IResource.DEPTH_INFINITE, its children. The return value will be one of IMarker.SEVERITY_ERROR,
   * IMarker.SEVERITY_WARNING, IMarker.SEVERITY_INFO or 0, indicating that no problem markers exist
   * on the given resource.
   *
   * @param depth TODO
   */
  public static int getMaxProblemMarkerSeverity(IResource res, int depth) {
    if (res == null || !res.isAccessible()) return 0;

    boolean hasWarnings = false; // if resource has errors, will return error image immediately
    IMarker[] markers = null;

    try {
      markers = res.findMarkers(IMarker.PROBLEM, true, depth);
    } catch (CoreException e) {
      e.printStackTrace();
    }
    if (markers == null) return 0; // don't know - say no errors/warnings/infos

    for (int i = 0; i < markers.length; i++) {
      IMarker m = markers[i];
      int priority = m.getAttribute(IMarker.SEVERITY, -1);

      if (priority == IMarker.SEVERITY_WARNING) {
        hasWarnings = true;
      } else if (priority == IMarker.SEVERITY_ERROR) {
        return IMarker.SEVERITY_ERROR;
      }
    }
    return hasWarnings ? IMarker.SEVERITY_WARNING : 0;
  }
コード例 #18
0
  /** This leaves a bit of a mess e.g. "import " or "from " for some later process to clean up. */
  private void deleteImport(PySelection ps, MarkerAnnotationAndPosition markerInfo)
      throws BadLocationException, CoreException {
    IMarker marker = markerInfo.markerAnnotation.getMarker();

    Integer start = (Integer) marker.getAttribute(IMarker.CHAR_START);
    Integer end = (Integer) marker.getAttribute(IMarker.CHAR_END);
    IDocument doc = ps.getDoc();
    while (start > 0) {
      char c;
      try {
        c = doc.getChar(start - 1);
      } catch (Exception e) {
        break;
      }
      if (c == '\r' || c == '\n') {
        break;
      }
      if (Character.isWhitespace(c) || c == ',') {
        start--;
        continue;
      }
      break;
    }
    ps.setSelection(start, end);
    ps.deleteSelection();
  }
コード例 #19
0
  private void openSelectedMarker() {
    ISelection sel = tableViewer.getSelection();

    if (sel instanceof IStructuredSelection) {
      Object element = ((IStructuredSelection) sel).getFirstElement();

      if (element instanceof IMarker) {
        IMarker marker = (IMarker) element;

        if (marker.getResource() instanceof IFile) {
          try {
            IDE.openEditor(getViewSite().getPage(), marker);
          } catch (PartInitException e) {
            ErrorDialog.openError(
                getSite().getShell(),
                "Error Opening Marker",
                "Unable to open an editor for the given marker: " + e.getClass().getSimpleName(),
                new Status(IStatus.ERROR, DartToolsPlugin.PLUGIN_ID, e.toString(), e));

            DartToolsPlugin.log(e);
          }
        }
      }
    }
  }
コード例 #20
0
  private static IMarker[] getValidationTasks(
      IResource resource, String[] messageOwners, int depth) {
    IMarker[] markers = getValidationTasks(resource, IMessage.ALL_MESSAGES, depth);
    if (markers.length == 0) return NO_MARKERS;

    IMarker[] temp = new IMarker[markers.length];
    int validCount = 0;
    for (IMarker marker : markers) {
      Object owner = null;
      try {
        owner = marker.getAttribute(VALIDATION_MARKER_OWNER);
      } catch (CoreException e) {
        // eat it -- if it no longer exists there is nothing we can do about it
      }

      if ((owner == null) || !(owner instanceof String)) {
        // The ValidationMigrator will remove any "unowned" validation markers.
        continue;
      }

      for (String messageOwner : messageOwners) {
        if (((String) owner).equals(messageOwner)) {
          temp[validCount++] = marker;
          break;
        }
      }
    }

    if (validCount == 0) return NO_MARKERS;

    IMarker[] result = new IMarker[validCount];
    System.arraycopy(temp, 0, result, 0, validCount);
    return result;
  }
コード例 #21
0
  private IMarker addMarker(
      IResource resource,
      String type,
      String message,
      int lineNumber,
      int severity,
      boolean isTransient) {
    IMarker marker = null;
    try {
      if (resource.isAccessible()) {
        if (lineNumber == -1) {
          lineNumber = 1;
        }

        // mkleint: this strongly smells like some sort of workaround for a problem with bad marker
        // cleanup.
        // adding is adding and as such shall always be performed.
        marker = findMarker(resource, type, message, lineNumber, severity, isTransient);
        if (marker != null) {
          // This marker already exists
          return marker;
        }
        marker = resource.createMarker(type);
        marker.setAttribute(IMarker.MESSAGE, message);
        marker.setAttribute(IMarker.SEVERITY, severity);
        marker.setAttribute(IMarker.TRANSIENT, isTransient);

        marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
        log.debug("Created marker '{}' on resource '{}'.", message, resource.getFullPath());
      }
    } catch (CoreException ex) {
      log.error("Unable to add marker; " + ex.toString(), ex); // $NON-NLS-1$
    }
    return marker;
  }
コード例 #22
0
 public boolean isDefinedInParent() {
   IMarker mark = ann.getMarker();
   String isElsewhere = mark.getAttribute(IMavenConstants.MARKER_CAUSE_RESOURCE_PATH, null);
   if (isElsewhere != null) {
     return true;
   }
   return false;
 }
コード例 #23
0
    @Override
    public String getText(Object element) {
      if (element instanceof IMarker) {
        IMarker marker = (IMarker) element;

        return marker.getAttribute(IMarker.MESSAGE, null);
      } else {
        return super.getText(element);
      }
    }
コード例 #24
0
 static void applyCatchByReferenceQuickFix(IMarker marker, IDocument document, boolean addConst) {
   try {
     int left = marker.getAttribute(IMarker.CHAR_START, -1);
     int right = marker.getAttribute(IMarker.CHAR_END, -1);
     String inStr = document.get(left, right - left);
     document.replace(left, right - left, getCatchByReferenceString(inStr, addConst));
   } catch (BadLocationException e) {
     CheckersUiActivator.log(e);
   }
 }
コード例 #25
0
  @Test
  public void testNewArrayDeleteQuickFix() throws CoreException {
    IMarker newArrayDeleteMarker = markers[9];
    int markerLine = newArrayDeleteMarker.getAttribute(IMarker.LINE_NUMBER, -1);

    createResolutionAndApply(newArrayDeleteMarker);

    String newContent = getLineContent(document, markerLine);
    assertTrue(newContent.contains("delete[]")); // $NON-NLS-1$
  }
コード例 #26
0
 /**
  * Create a marker on the given resource
  *
  * @param resource the resource
  * @param severity the severity constant
  * @param message the message
  * @param lineNumber the line number
  */
 public void createMarker(IResource resource, int severity, String message, Integer lineNumber) {
   try {
     IMarker marker = resource.createMarker(MARKER_TYPE);
     marker.setAttribute(IMarker.MESSAGE, message);
     marker.setAttribute(IMarker.SEVERITY, severity);
     marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
   } catch (CoreException e) {
     logException(e.getMessage(), e);
   }
 }
コード例 #27
0
 @Override
 public void setMarker(IMarker marker) throws CoreException {
   super.setMarker(marker);
   m_methodName = marker.getAttribute(METHOD_NAME, null);
   m_methodSignature = marker.getAttribute(METHOD_SIGNATURE, null);
   String typePattern = marker.getAttribute(TYPE_NAME, ""); // $NON-NLS-1$
   if (typePattern != null) {
     fPattern = Pattern.compile(convertToRegularExpression(typePattern));
   }
 }
 private boolean isNeedToCreate(IMarker marker) {
   String message = marker.getAttribute(IMarker.MESSAGE, "");
   String attribute = marker.getAttribute(ATTRIBUTE_NAME, "");
   if (attribute.equals(VALIDATOR_ID)
       && marker.getResource() instanceof IFile
       && message.endsWith(MESSAGE)) {
     return true;
   }
   return false;
 }
コード例 #29
0
  /**
   * This method changes all validator markers on the IResource and its children. All markers owned
   * by "from" have their owner reassigned to "to".
   */
  public static void updateOwner(String from, String to, IResource resource) throws CoreException {
    IMarker[] ownedMarkers = getValidationTasks(resource, from);
    if (ownedMarkers == null) {
      return;
    }

    for (int i = 0; i < ownedMarkers.length; i++) {
      IMarker marker = ownedMarkers[i];
      marker.setAttribute(VALIDATION_MARKER_OWNER, to);
    }
  }
コード例 #30
0
  public static boolean canHandle(final IMarker marker) {
    final int code = marker.getAttribute(IMarker.PROBLEM, 0);
    final String sourceId = marker.getAttribute(IMarker.SOURCE_ID, "");

    if (marker.getResource().getName().endsWith(SpdPackage.FILE_EXTENSION)
        && code == EventPortConstraint.STATUS_CODE
        && sourceId.equals(EventPortConstraint.SOURCE_ID)) {
      return true;
    }
    return false;
  }