當前位置: 首頁>>代碼示例>>Java>>正文


Java IFile.createMarker方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IFile.createMarker方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.createMarker方法的具體用法?Java IFile.createMarker怎麽用?Java IFile.createMarker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IFile的用法示例。


在下文中一共展示了IFile.createMarker方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addMarker

import org.eclipse.core.resources.IFile; //導入方法依賴的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: createJimpleMarker

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private IMarker createJimpleMarker(IMarker marker) throws CoreException {
	String project = (String) marker.getAttribute("Jimple.project");
	String file = (String) marker.getAttribute("Jimple.file");
	IFile jimpleFile = getFile(project, file);

	IMarker jimpleMarker = null;
	IMarker[] markers = jimpleFile.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
	if(markers != null) {
		List<IMarker> jimpleBreakpoints = filterJimpleChildBreakpoints(Arrays.asList(markers));
		if(!jimpleBreakpoints.isEmpty()) {
			jimpleMarker = jimpleBreakpoints.get(0);
		} else {
			jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
		}
	} else {
		jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
	}

	jimpleMarker.setAttribute(IMarker.LINE_NUMBER, marker.getAttribute("Jimple." + IMarker.LINE_NUMBER));
	jimpleMarker.setAttribute("Jimple.unit.charStart", marker.getAttribute("Jimple.unit.charStart"));
	jimpleMarker.setAttribute("Jimple.unit.charEnd", marker.getAttribute("Jimple.unit.charEnd"));
	jimpleMarker.setAttribute("Jimple.unit.fqn", marker.getAttribute("Jimple.unit.fqn"));
	jimpleMarker.setAttribute("Jimple.project", marker.getAttribute("Jimple.project"));
	jimpleMarker.setAttribute("Jimple.file", marker.getAttribute("Jimple.file"));
	return jimpleMarker;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:27,代碼來源:JimpleBreakpointManager.java

示例3: openInEditor

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
public static void openInEditor(IFile file, int startpos, int length) {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	HashMap map = new HashMap();
	map.put(IMarker.CHAR_START, new Integer(startpos));
	map.put(IMarker.CHAR_END, new Integer(startpos+length));
	map.put(IWorkbenchPage.EDITOR_ID_ATTR, 
			"org.eclipse.ui.DefaultTextEditor");
	try {
		IMarker marker = file.createMarker(IMarker.TEXT);
		marker.setAttributes(map);

		IDE.openEditor(page, marker);
	} catch (Exception e) {
		e.printStackTrace();
	}
   }
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:18,代碼來源:RulesView.java

示例4: createBreakpointMarkerForNextUnit

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private IMarker createBreakpointMarkerForNextUnit(UnitLocation location, IMarker marker) throws CoreException, IOException {
	IFile file = location.project.getFile(location.jimpleFile);
	IMarker m = file.createMarker(marker.getType());
	m.setAttribute("Jimple.breakpoint.type", "unit");
	m.setAttribute(IMarker.LINE_NUMBER, location.line);
	m.setAttribute("Jimple.file", file.getProjectRelativePath().toString());
	m.setAttribute("Jimple.project", marker.getAttribute("Jimple.project"));
	m.setAttribute("Jimple.unit.charStart", location.charStart);
	m.setAttribute("Jimple.unit.charEnd", location.charEnd);
	m.setAttribute("Jimple.unit.fqn", location.vfUnit.getFullyQualifiedName());
	m.setAttribute("Jimple.temporary", true);
	return m;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:14,代碼來源:JimpleBreakpointManager.java

示例5: createJimpleBreakpoint

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private void createJimpleBreakpoint() throws CoreException, BadLocationException {
	IDocument document = getDocument();
	IFile file = getFile();
	int lineNumber = getLineNumber();

	int offset = document.getLineOffset(lineNumber - 1);
	int length = document.getLineInformation(lineNumber - 1).getLength();
	int charStart = offset;
	int charEnd = offset + length;
	try {
		String unitFqn = getUnitFqn(lineNumber - 1, offset, length);

		IMarker m = file.createMarker(JIMPLE_BREAKPOINT_MARKER);
		m.setAttribute(IMarker.LINE_NUMBER, getLineNumber());
		m.setAttribute(IMarker.MESSAGE, "Unit breakpoint: " + file.getName() + " [Line "+getLineNumber()+"]");
		m.setAttribute("Jimple.file", file.getProjectRelativePath().toPortableString());
		m.setAttribute("Jimple.project", file.getProject().getName());
		m.setAttribute("Jimple.unit.charStart", charStart);
		m.setAttribute("Jimple.unit.charEnd", charEnd);
		m.setAttribute("Jimple.unit.fqn", unitFqn);

		JimpleBreakpointManager.getInstance().createBreakpoint(m);
	} catch(UnitNotFoundException e) {
		String msg = "The selected unit couldn't be found in our Jimple model. This might be a problem related to Jimple optimizations.";
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Breakpoint could not be placed", msg);
	}
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:28,代碼來源:ToggleJimpleBreakpointsTarget.java

示例6: addNewInstructionPointer

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private void addNewInstructionPointer(String project, String path, int line, int charStart, int charEnd) throws CoreException {
	IFile file = getFile(project, path);
	IMarker marker = file.createMarker("visuflow.debug.instructionPointer.marker");
	marker.setAttribute(IMarker.MESSAGE, "");
	marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
	marker.setAttribute(IMarker.LINE_NUMBER, line);
	marker.setAttribute(IMarker.CHAR_START, charStart);
	marker.setAttribute(IMarker.CHAR_END, charEnd);
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:10,代碼來源:JavaBreakpointListener.java

示例7: addMarker

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static void addMarker(IFile file, String markerType, String message, int severity) throws CoreException {
	IMarker marker = file.createMarker(markerType);
	marker.setAttribute(IMarker.MESSAGE, message);
	marker.setAttribute(IMarker.SEVERITY, severity);
	marker.setAttribute(IMarker.LINE_NUMBER, 1);
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:7,代碼來源:IFileUtils.java


注:本文中的org.eclipse.core.resources.IFile.createMarker方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。