本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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) {
}
}
示例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;
}
示例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
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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();
}
}