当前位置: 首页>>代码示例>>Java>>正文


Java IMarker.getAttributes方法代码示例

本文整理汇总了Java中org.eclipse.core.resources.IMarker.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java IMarker.getAttributes方法的具体用法?Java IMarker.getAttributes怎么用?Java IMarker.getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.resources.IMarker的用法示例。


在下文中一共展示了IMarker.getAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printAttributes

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
static void printAttributes (IMarker marker) {
	try {
		Map<String, Object> attributes = marker.getAttributes();
		Iterator iter = attributes.keySet().iterator();
		while (iter.hasNext()) {
			String key = (String) iter.next();
			ResourceManager.logInfo(marker.getResource().getProject().getName(), key + " " + String.valueOf(attributes.get(key)));
		}
	} catch (CoreException e) {
		 ResourceManager.logException(e);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:13,代码来源:MarkerResolutionGenerator.java

示例2: createIssue

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
@Override
public Issue createIssue(IMarker marker) {
	final N4JSIssue issue = new N4JSIssue();
	issue.setMarker(marker);

	// ---- BEGIN: copied from super class ----

	try {
		Map<String, Object> attributes = marker.getAttributes();
		String markerType = marker.getType();
		Object message = attributes.get(IMarker.MESSAGE);
		issue.setMessage(message instanceof String ? (String) message : null);
		Object lineNumber = attributes.get(IMarker.LINE_NUMBER);
		issue.setLineNumber(lineNumber instanceof Integer ? (Integer) lineNumber - 1 : null);
		Object offset = attributes.get(IMarker.CHAR_START);
		Object endOffset = attributes.get(IMarker.CHAR_END);
		if (offset instanceof Integer && endOffset instanceof Integer) {
			issue.setOffset((Integer) offset);
			issue.setLength((Integer) endOffset - (Integer) offset);
		} else {
			issue.setOffset(-1);
			issue.setLength(0);
		}
		Object code = attributes.get(Issue.CODE_KEY);
		issue.setCode(code instanceof String ? (String) code : null);
		Object data = attributes.get(Issue.DATA_KEY);
		issue.setData(data instanceof String ? Strings.unpack((String) data) : null);
		Object uri = attributes.get(Issue.URI_KEY);
		issue.setUriToProblem(uri instanceof String ? URI.createURI((String) uri) : null);
		Object severity = attributes.get(IMarker.SEVERITY);
		Severity translatedSeverity = translateSeverity(severity instanceof Integer ? (Integer) severity : 0);
		if (translatedSeverity == null)
			throw new IllegalArgumentException(marker.toString());
		issue.setSeverity(translatedSeverity);
		if (markerTypeProvider != null)
			issue.setType(markerTypeProvider.getCheckType(markerType));
		else
			issue.setType(MarkerTypes.toCheckType(markerType));
	} catch (CoreException e) {
		return null;
	}
	return issue;

	// ---- END: copied from super class ----
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:46,代码来源:N4JSIssue.java

示例3: updateSourcesToDelete

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void updateSourcesToDelete(final IMarker beDeleted) {
  try {
    if (MarkUtilities.getSourceList(beDeleted).size() != 0) {
      final ArrayList<MarkElement> sourceElements = MarkUtilities.getSourceList(beDeleted);

      for (final MarkElement sourceElement : sourceElements) {

        final IMarker sourceMarker = sourceElement.getiMarker();
        List<IMarker> groupSourceMarkers = new ArrayList<IMarker>();

        if (MarkUtilities.getGroupId(sourceMarker) != null) {
          groupSourceMarkers = MarkerFactory.findMarkersByGroupId(sourceMarker.getResource(),
              MarkUtilities.getGroupId(sourceMarker));
        }
        if (groupSourceMarkers.isEmpty()) {
          groupSourceMarkers.add(sourceMarker);
        }

        for (final IMarker groupSourceMarker : groupSourceMarkers) {

          if (MarkUtilities.getTargetList(groupSourceMarker).size() != 0) {
            final ArrayList<MarkElement> targetElementsofSource =
                MarkUtilities.getTargetList(groupSourceMarker);

            for (int i = targetElementsofSource.size() - 1; i >= 0; i--) {
              if (MarkUtilities.compare(targetElementsofSource.get(i).getiMarker(), beDeleted)) {
                targetElementsofSource.remove(i);
              }
            }
            MarkUtilities.setTargetList(groupSourceMarker, targetElementsofSource);

            if (groupSourceMarker.getType().equals(MarkerFactory.MARKER_MAPPING)
                && targetElementsofSource.size() == 0) {
              // final IEditorPart part =
              IDE.openEditor(MarkerActivator.getActiveWorkbenchWindow().getActivePage(),
                  groupSourceMarker, false);
              final Map<String, Object> attributes = groupSourceMarker.getAttributes();
              final IResource res = groupSourceMarker.getResource();
              AnnotationFactory.removeAnnotation(groupSourceMarker);
              groupSourceMarker.delete();
              MarkerUtilities.createMarker(res, attributes, MarkerFactory.MARKER_MARKING);
              final IMarker newMarker = MarkerFactory.findMarkerBySourceId(res,
                  (String) attributes.get(IMarker.SOURCE_ID));
              AnnotationFactory.addAnnotation(newMarker, AnnotationFactory.ANNOTATION_MARKING);
            }
          }
        }
      }
    }
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:54,代码来源:MarkerUpdater.java


注:本文中的org.eclipse.core.resources.IMarker.getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。