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


Java IMarker.setAttribute方法代码示例

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


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

示例1: showInstruction

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
/**
 * Show the given {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instruction
 *            the {@link EObject instruction} to show
 */
public static void showInstruction(DialectEditor editorPart, EObject instruction) {
	final URI resourceURI = instruction.eResource().getURI();
	if (resourceURI.isPlatformResource()) {
		final String resourcePath = resourceURI.toPlatformString(true);
		final IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
				resourcePath));
		try {
			final IMarker marker = resource.createMarker(EValidator.MARKER);
			marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
			final TraceabilityMarkerNavigationProvider navigationProvider = new TraceabilityMarkerNavigationProvider(
					(DialectEditor)editorPart);
			navigationProvider.gotoMarker(marker);
			marker.delete();
		} catch (CoreException e) {
			DebugSiriusIdeUiPlugin.INSTANCE.log(e);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:SiriusEditorUtils.java

示例2: createJimpleMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的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: addMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的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

示例4: updateMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void updateMarker(IResource resource, String message, int start, int end, int severity,
		IMarker marker) {
	try {
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severity);
		if (resource.getType() != IResource.FILE) {
			return;
		}
		IFile file = (IFile) resource;
		ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
		ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);

		if (textFileBuffer == null) {
			manager.connect(file.getFullPath(), LocationKind.IFILE, new NullProgressMonitor());
			textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
		}

		IDocument document = textFileBuffer.getDocument();

		marker.setAttribute(IMarker.CHAR_START, start);
		marker.setAttribute(IMarker.CHAR_END, end);
		marker.setAttribute(IMarker.LINE_NUMBER, document.getLineOfOffset(start) + 1);
	} catch (CoreException | BadLocationException e) {
		e.printStackTrace();
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:27,代码来源:ValidateEditorConfigStrategy.java

示例5: createMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
@Override
public void createMarker(Resource res, String message, Severity severity) {

	final int severityEclipse;
	switch (severity) {
	case INFO:
		severityEclipse = IMarker.SEVERITY_INFO;
		break;
	case WARNING:
		severityEclipse = IMarker.SEVERITY_WARNING;
		break;
	default:
		severityEclipse = IMarker.SEVERITY_ERROR;
		break;
	}

	try {
		IMarker marker = toIFile(res).createMarker(MARKER__ORG_ECLIPSE_IDE_N4JS_UI_COMPILER_ERROR);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severityEclipse);
		marker.setAttribute(IMarker.LINE_NUMBER, 1);
	} catch (CoreException e) {
		LOGGER.error(e.getStatus());
		String resInfo = "";
		if (res != null) {
			if (res.getURI() != null) {
				resInfo = "on resource with uri=" + res.getURI();
			} else {
				resInfo = "on resource=" + res;
			}
		}
		throw new RuntimeException("Cannot create error marker with message='" + message + "' " + resInfo + ".", e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:35,代码来源:GeneratorMarkerSupport.java

示例6: processMarkers

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void processMarkers() {
	try {
		for (MarkerInfo mi: pendingMarkers) {
			IMarker marker = mi.file.createMarker(MARKER_TYPE);
			marker.setAttribute(IMarker.MESSAGE, mi.message);
			marker.setAttribute(IMarker.SEVERITY, mi.severity);
			if (mi.lineNumber == -1) {
				mi.lineNumber = 1;
			}
			marker.setAttribute(IMarker.LINE_NUMBER, mi.lineNumber);
		}
		pendingMarkers.clear();
	} catch (CoreException e) {
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:16,代码来源:MinifyBuilder.java

示例7: setXpath

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static String setXpath(final IMarker iMarker, final String xPath) {
  try {
    iMarker.setAttribute("xpath", xPath);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:MarkUtilities.java

示例8: reportError

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void reportError(IResource resource, String message)
{
	try
	{
		IMarker marker = resource.createMarker(JPFClasspathPlugin.MARKER_ID);
		marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.LINE_NUMBER, 1);
	}
	catch( CoreException e )
	{
		// nothing
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:15,代码来源:JPFManifestBuilder.java

示例9: setText

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void setText(final IMarker iMarker, final String text) {
  try {
    iMarker.setAttribute(IMarker.TEXT, text);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:MarkUtilities.java

示例10: setUri

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void setUri(final IMarker iMarker, final String uri) {
  try {
    iMarker.setAttribute(URI, uri);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:MarkUtilities.java

示例11: setGroupId

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void setGroupId(final IMarker iMarker, final String groupId) {
  try {
    iMarker.setAttribute(MarkUtilities.GROUP_ID, groupId);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:MarkUtilities.java

示例12: createBreakpointMarkerForNextUnit

import org.eclipse.core.resources.IMarker; //导入方法依赖的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

示例13: setLinenumber

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void setLinenumber(final IMarker iMarker, final int linenumber) {
  try {
    iMarker.setAttribute(IMarker.LOCATION, linenumber);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:MarkUtilities.java

示例14: createJimpleBreakpoint

import org.eclipse.core.resources.IMarker; //导入方法依赖的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

示例15: setSourceId

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static void setSourceId(final IMarker imarker, final String id) {
  try {
    imarker.setAttribute(IMarker.SOURCE_ID, id);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:MarkUtilities.java


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