本文整理汇总了Java中org.eclipse.ui.texteditor.MarkerUtilities.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerUtilities.setMessage方法的具体用法?Java MarkerUtilities.setMessage怎么用?Java MarkerUtilities.setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.texteditor.MarkerUtilities
的用法示例。
在下文中一共展示了MarkerUtilities.setMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMarker
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private void createMarker(IResource resource, String message, int lineNumber, String markerType, int severity,
int charStart, int charEnd) throws CoreException {
if (lineNumber <= 0)
lineNumber = 1;
IMarker marker = findMarker(resource, message, lineNumber, markerType);
if (marker == null) {
HashMap<String, Object> map = new HashMap<>();
map.put(IMarker.SEVERITY, new Integer(severity));
map.put(IMarker.LOCATION, resource.getFullPath().toOSString());
map.put(IMarker.MESSAGE, message);
MarkerUtilities.setLineNumber(map, lineNumber);
MarkerUtilities.setMessage(map, message);
if (charStart != -1) {
MarkerUtilities.setCharStart(map, charStart);
MarkerUtilities.setCharEnd(map, charEnd);
}
internalCreateMarker(resource, map, markerType);
}
}
示例2: createMarkerForResource
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
* Creates a 'red cross' flag on the given file, at the line number specified, with the
* hover-message specificed.
*
* Remember that linenumber starts at 1!
*/
public static void createMarkerForResource(IResource resource, int linenumber, String message)
throws CoreException {
if (linenumber == 0) {
linenumber = 1;
}
HashMap<String, Object> map = new HashMap<String, Object>();
MarkerUtilities.setLineNumber(map, linenumber);
MarkerUtilities.setMessage(map, message);
map.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
}
示例3: createSyntacticMarkerIfApplicable
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private Map<String, Object> createSyntacticMarkerIfApplicable(final ParseException parseException) {
Location loc = parseException.getLoc();
if (Locations.isReal(loc)) {
try {
UserError userError = parseException.getUserError();
Map<String, Object> config = new HashMap<>();
// There is the option to set the line number as well. However, that config is ignored if
// we set the CharStart and CharEnd. So, we only set the latter.
MarkerUtilities.setCharStart(config, getStartOffset(loc));
MarkerUtilities.setCharEnd(config, getEndOffset(loc));
MarkerUtilities.setMessage(config,
printerUtil.getFactory().userErrorPrinter().print(userError, printContext));
// Not sure why there aren't any utilities methods for these fields in MarkerUtilities
// So set them directly instead.
config.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
config.put(IMarker.LOCATION, fFile.getFullPath().toString());
return config;
} catch (BadLocationException ble) {
logger.warn("Error calculating offset to document using parser position", ble);
return null;
}
} else {
return null;
}
}
示例4: reportProblem
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private void reportProblem(IResource resource, String message,
int severity, int lineNumber, String id, File file,
int originalLineNumber) throws CoreException {
// TODO: open external file, see
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=151005 on how to
// generate markers for external files
// Do not put in duplicates
IMarker[] cur = resource.findMarkers(CHECKER_MARKER_TYPE, false,
IResource.DEPTH_ZERO);
if (cur != null) {
for (IMarker element : cur) {
int oldLineNumber = element
.getAttribute(IMarker.LINE_NUMBER, 0);
if (lineNumber == oldLineNumber) {
String oldMessage = element.getAttribute(IMarker.MESSAGE,
""); //$NON-NLS-1$
int oldSeverity = element.getAttribute(IMarker.SEVERITY,
100);
if (severity == oldSeverity && message.equals(oldMessage))
return;
}
}
}
// see
// http://wiki.eclipse.org/FAQ_Why_don%27t_my_markers_appear_in_the_editor%27s_vertical_ruler%3F
Map<String, Object> attributes = new HashMap<String, Object>();
if (lineNumber != 0) {
MarkerUtilities.setLineNumber(attributes, lineNumber);
}
MarkerUtilities.setMessage(attributes, message);
attributes.put(IMarker.SEVERITY, severity);
// the following attributes are only used for the quick fixes
attributes.put(ATTRIBUTE_ID, id);
if (file != null) {
attributes.put(ATTRIBUTE_FILE, file.toString());
}
attributes.put(ATTRIBUTE_ORIGINAL_LINE_NUMBER, originalLineNumber);
MarkerUtilities.createMarker(resource, attributes, CHECKER_MARKER_TYPE);
}
示例5: nextError
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
protected XMLValidationError nextError(SAXParseException e, boolean isFatal) {
XMLValidationError validationError = super.nextError(e, isFatal);
Map <String, Object> map = new HashMap <String, Object> ();
int lineNumber = e.getLineNumber();
int columnNumber = e.getColumnNumber();
MarkerUtilities.setLineNumber(map, lineNumber);
Object[] tmp = { e.getMessage() };
MarkerUtilities.setMessage(map, NCLEditorMessages.getInstance()
.getString("NCLValidator.Error.XMLParserError", tmp));
map.put(IMarker.LOCATION, file.getFullPath().toString());
Integer charStart = getCharStart(lineNumber, columnNumber);
if (charStart != null)
map.put(IMarker.CHAR_START, charStart);
Integer charEnd = getCharEnd(lineNumber, columnNumber);
if (charEnd != null)
map.put(IMarker.CHAR_END, charEnd);
map.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
MessagesUtilities.put(NCLEditorMessages.getInstance()
.getString("NCLValidator.Error.XMLParserError", tmp), null);
map.put(MarkingErrorHandler.NCLValidatorMessage, NCLEditorMessages.getInstance()
.getString("NCLValidator.Error.XMLParserError", tmp) );
map.put(MarkingErrorHandler.NCLSourceDocument, document.get());
try {
MarkerUtilities.createMarker(file, map, NCLMarkerError);
} catch (CoreException ee) {
ee.printStackTrace();
}
return validationError;
}