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


Java IJavaModelMarker类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IJavaModelMarker的典型用法代码示例。如果您正苦于以下问题:Java IJavaModelMarker类的具体用法?Java IJavaModelMarker怎么用?Java IJavaModelMarker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addMarker

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
/**
 * Add a marker in the problem view for the passed file
 * 
 * @param file
 * @param e
 * @param severity
 * @param problemid
 * @throws CoreException
 */
public static void addMarker(IFile file, Object owner, ParserException e, int severity) {
	try {
		IMarker marker = file.createMarker(GW4EBuilder.MARKER_TYPE);
		marker.setAttribute(IMarker.MESSAGE, e.getMessage());
		marker.setAttribute(IMarker.SEVERITY, severity);
		marker.setAttribute(IJavaModelMarker.ID, e.getProblemId());
		marker.setAttribute(IMarker.CHAR_START, e.getStart());
		marker.setAttribute(IMarker.CHAR_END, e.getEnd());
		marker.setAttribute(IMarker.LINE_NUMBER, e.getLineNumber());
		marker.setAttribute(IMarker.SOURCE_ID, owner.getClass().getName());
		Properties p = e.getAttributes();
		Iterator iter = p.keySet().iterator();
		while (iter.hasNext()) {
			String key = (String) iter.next();
			marker.setAttribute(key, p.get(key));
		}
	} catch (Exception e1) {
		ResourceManager.logException(e1);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:30,代码来源:MarkerManager.java

示例2: removeMarkerForAbstractContextUsed

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
/**
 * @param project
 * @param file
 */
public static void removeMarkerForAbstractContextUsed (IFile file) {
	try {
		IMarker[] markers = file.findMarkers(GW4EBuilder.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
		for (int i = 0; i < markers.length; i++) {
			IMarker m = markers[i];
			Integer pbId = (Integer)m.getAttribute(IJavaModelMarker.ID);
			if (pbId!=null) {
				if (GW4EParser.ABSTRACT_CONTEXT_USED==pbId.intValue()) {
					m.delete();
				}
			}
		}
	} catch (CoreException ce) {
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:GW4EBuilder.java

示例3: getMarkers

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
public static IMarker[] getMarkers(IJavaProject project, int problemID) throws CoreException {
	IMarker[] markers = project.getProject().findMarkers(GW4EBuilder.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
	List<IMarker> ms = new ArrayList<IMarker>();
	for (IMarker iMarker : markers) {
		Object attr = iMarker.getAttribute(IJavaModelMarker.ID);
		Integer pbid = (Integer) attr;
		if (pbid == null)
			continue;
		if (pbid.equals(problemID)) {
			ms.add(iMarker);
		}
	}
	IMarker[] ret = new IMarker[ms.size()];
	ms.toArray(ret);
	return ret;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:17,代码来源:ProjectHelper.java

示例4: noErrorsAtLocation

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
static boolean noErrorsAtLocation(IProblemLocation[] locations) {
  if (locations != null) {
    for (int i = 0; i < locations.length; i++) {
      IProblemLocation location = locations[i];
      if (location.isError()) {
        if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())
            && JavaCore.getOptionForConfigurableSeverity(location.getProblemId()) != null) {
          // continue (only drop out for severe (non-optional) errors)
        } else {
          return false;
        }
      }
    }
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:QuickAssistProcessor.java

示例5: containsQuickFixableRenameLocal

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
private static boolean containsQuickFixableRenameLocal(IProblemLocation[] locations) {
  if (locations != null) {
    for (int i = 0; i < locations.length; i++) {
      IProblemLocation location = locations[i];
      if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())) {
        switch (location.getProblemId()) {
          case IProblem.LocalVariableHidingLocalVariable:
          case IProblem.LocalVariableHidingField:
          case IProblem.FieldHidingLocalVariable:
          case IProblem.FieldHidingField:
          case IProblem.ArgumentHidingLocalVariable:
          case IProblem.ArgumentHidingField:
            return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:QuickAssistProcessor.java

示例6: getHandledMarkerTypes

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
private Set<String> getHandledMarkerTypes(IConfigurationElement element) {
  HashSet<String> map = new HashSet<String>(7);
  IConfigurationElement[] children = element.getChildren(HANDLED_MARKER_TYPES);
  for (int i = 0; i < children.length; i++) {
    IConfigurationElement[] types = children[i].getChildren(MARKER_TYPE);
    for (int k = 0; k < types.length; k++) {
      String attribute = types[k].getAttribute(ID);
      if (attribute != null) {
        map.add(attribute);
      }
    }
  }
  if (map.isEmpty()) {
    map.add(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
    map.add(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER);
    map.add(IJavaModelMarker.TASK_MARKER);
  }
  return map;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:ContributedProcessorDescriptor.java

示例7: getId

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
public int getId() {
		IMarker marker= getMarker();
		if (marker == null  || !marker.exists())
			return -1;

		if (isProblem())
			return marker.getAttribute(IJavaModelMarker.ID, -1);

//		if (TASK_ANNOTATION_TYPE.equals(getAnnotationType())) {
//			try {
//				if (marker.isSubtypeOf(IJavaModelMarker.TASK_MARKER)) {
//					return IProblem.Task;
//				}
//			} catch (CoreException e) {
//				JavaPlugin.log(e); // should no happen, we test for marker.exists
//			}
//		}

		return -1;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaMarkerAnnotation.java

示例8: noErrorsAtLocation

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
static boolean noErrorsAtLocation(IProblemLocation[] locations) {
	if (locations != null) {
		for (int i= 0; i < locations.length; i++) {
			IProblemLocation location= locations[i];
			if (location.isError()) {
				if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())
						&& JavaCore.getOptionForConfigurableSeverity(location.getProblemId()) != null) {
					// continue (only drop out for severe (non-optional) errors)
				} else {
					return false;
				}
			}
		}
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:QuickAssistProcessor.java

示例9: containsQuickFixableRenameLocal

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
private static boolean containsQuickFixableRenameLocal(IProblemLocation[] locations) {
	if (locations != null) {
		for (int i= 0; i < locations.length; i++) {
			IProblemLocation location= locations[i];
			if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())) {
				switch (location.getProblemId()) {
					case IProblem.LocalVariableHidingLocalVariable:
					case IProblem.LocalVariableHidingField:
					case IProblem.FieldHidingLocalVariable:
					case IProblem.FieldHidingField:
					case IProblem.ArgumentHidingLocalVariable:
					case IProblem.ArgumentHidingField:
						return true;
				}
			}
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:QuickAssistProcessor.java

示例10: getHandledMarkerTypes

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
private Set<String> getHandledMarkerTypes(IConfigurationElement element) {
	HashSet<String> map= new HashSet<String>(7);
	IConfigurationElement[] children= element.getChildren(HANDLED_MARKER_TYPES);
	for (int i= 0; i < children.length; i++) {
		IConfigurationElement[] types= children[i].getChildren(MARKER_TYPE);
		for (int k= 0; k < types.length; k++) {
			String attribute= types[k].getAttribute(ID);
			if (attribute != null) {
				map.add(attribute);
			}
		}
	}
	if (map.isEmpty()) {
		map.add(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
		map.add(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER);
		map.add(IJavaModelMarker.TASK_MARKER);
	}
	return map;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ContributedProcessorDescriptor.java

示例11: createFromMarker

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
private static IProblemLocation createFromMarker(IMarker marker, ICompilationUnit cu) {
	try {
		int id= marker.getAttribute(IJavaModelMarker.ID, -1);
		int start= marker.getAttribute(IMarker.CHAR_START, -1);
		int end= marker.getAttribute(IMarker.CHAR_END, -1);
		int severity= marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
		String[] arguments= CorrectionEngine.getProblemArguments(marker);
		String markerType= marker.getType();
		if (cu != null && id != -1 && start != -1 && end != -1 && arguments != null) {
			boolean isError= (severity == IMarker.SEVERITY_ERROR);
			return new ProblemLocation(start, end - start, id, arguments, isError, markerType);
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:CorrectionMarkerResolutionGenerator.java

示例12: acceptProblem

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
/**
 * @see ICodeSnippetRequestor
 */
public void acceptProblem(CategorizedProblem problem, char[] fragmentSource, int fragmentKind) {
	try {
		IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker(IJavaModelMarker.TRANSIENT_PROBLEM);
		marker.setAttribute(IJavaModelMarker.ID, problem.getID());
		marker.setAttribute(IMarker.CHAR_START, problem.getSourceStart());
		marker.setAttribute(IMarker.CHAR_END, problem.getSourceEnd() + 1);
		marker.setAttribute(IMarker.LINE_NUMBER, problem.getSourceLineNumber());
		//marker.setAttribute(IMarker.LOCATION, "#" + problem.getSourceLineNumber());
		marker.setAttribute(IMarker.MESSAGE, problem.getMessage());
		marker.setAttribute(IMarker.SEVERITY, (problem.isWarning() ? IMarker.SEVERITY_WARNING : IMarker.SEVERITY_ERROR));
		marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID);
		this.requestor.acceptProblem(marker, new String(fragmentSource), fragmentKind);
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:RequestorWrapper.java

示例13: getCycleMarker

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
public IMarker getCycleMarker(){
	try {
		if (this.project.isAccessible()) {
			IMarker[] markers = this.project.findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
			for (int i = 0, length = markers.length; i < length; i++) {
				IMarker marker = markers[i];
				String cycleAttr = (String)marker.getAttribute(IJavaModelMarker.CYCLE_DETECTED);
				if (cycleAttr != null && cycleAttr.equals("true")){ //$NON-NLS-1$
					return marker;
				}
			}
		}
	} catch (CoreException e) {
		// could not get markers: return null
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:JavaProject.java

示例14: getResolutions

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
	Object attr;
	try {
		attr = marker.getAttribute(IJavaModelMarker.ID);
		IMarkerResolution[] resolutions = resolvers.get(attr);
		return resolutions;
	} catch (CoreException e) {
		ResourceManager.logException(e);
	}
	return new IMarkerResolution[0];
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:13,代码来源:MarkerResolutionGenerator.java

示例15: hasResolutions

import org.eclipse.jdt.core.IJavaModelMarker; //导入依赖的package包/类
@Override
public boolean hasResolutions(IMarker marker) {
	try {
		Object attr = marker.getAttribute(IJavaModelMarker.ID);
		return resolvers.get(attr) != null && resolvers.get(attr).length > 0;
	} catch (CoreException e) {
		return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:MarkerResolutionGenerator.java


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