本文整理汇总了Java中org.apache.tools.ant.BuildEvent.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java BuildEvent.getMessage方法的具体用法?Java BuildEvent.getMessage怎么用?Java BuildEvent.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.BuildEvent
的用法示例。
在下文中一共展示了BuildEvent.getMessage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
final StringBuffer message = new StringBuffer();
if (event.getTask() != null) {
String taskName = event.getTask().getTaskName();
message.append("[ant:").append(taskName).append("] ");
}
final String messageText = event.getMessage();
message.append(messageText);
LogLevel level = getLogLevelForMessagePriority(event.getPriority());
if (event.getException() != null) {
logger.log(level, message.toString(), event.getException());
} else {
logger.log(level, message.toString());
}
}
示例2: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public synchronized void messageLogged(BuildEvent event) {
final boolean failOnError = isFailOnError(event);
if (sendException(event, failOnError)) {
return;
}
int priority = event.getPriority();
if (priority == Project.MSG_ERR && !failOnError) {
// some ant tasks (like Copy) with 'failOnError' attribute set to 'false'
// send warnings with priority level = Project.MSG_ERR
// this heuristic corrects the priority level, so that IDEA considers the message not as an error but as a warning
priority = Project.MSG_WARN;
}
final String message = event.getMessage();
if (priority == Project.MSG_ERR) {
myMessagePriority.sendMessage(ERROR, priority, message);
} else {
myMessagePriority.sendMessage(MESSAGE, priority, message);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:HybrisIdeaAntLogger.java
示例3: processAnsiColor
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
private void processAnsiColor(final BuildEvent event) {
String message = event.getMessage();
if (message == null) {
return;
}
message = message.replace(END_COLOR, "");
message = removeLeadingChars(message, "\b ");
Integer priorityOverride = getPriorityOverride(message);
if (!message.startsWith(PREFIX)) {
event.setMessage(message, getPriority(event.getPriority(), priorityOverride));
return;
}
int mIndex = message.indexOf(SUFFIX);
if (mIndex < 0) {
event.setMessage(message, getPriority(event.getPriority(), priorityOverride));
return;
}
String attribute = message.substring(PREFIX.length(), mIndex);
int priority = getPriority(attribute);
message = message.substring(mIndex + 1);
event.setMessage(message, getPriority(priority, priorityOverride));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:HybrisAnsiAntLogger.java
示例4: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public synchronized void messageLogged(BuildEvent event) {
final boolean failOnError = isFailOnError(event);
if (sendException(event, failOnError)) {
return;
}
int priority = event.getPriority();
if (priority == Project.MSG_ERR && !failOnError) {
// some ant tasks (like Copy) with 'failOnError' attribute set to 'false'
// send warnings with priority level = Project.MSG_ERR
// this heuristic corrects the priority level, so that IDEA considers the message not as an error but as a warning
priority = Project.MSG_WARN;
}
final String message = event.getMessage();
if (priority == Project.MSG_ERR) {
myMessagePriority.sendMessage(ERROR, priority, message);
}
else {
myMessagePriority.sendMessage(MESSAGE, priority, message);
}
}
示例5: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
final StringBuffer message = new StringBuffer();
if (event.getTask() != null) {
String taskName = event.getTask().getTaskName();
message.append("[ant:").append(taskName).append("] ");
}
final String messageText = event.getMessage();
message.append(messageText);
LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());
if (event.getException() != null) {
logger.log(level, message.toString(), event.getException());
} else {
logger.log(level, message.toString());
}
}
示例6: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
@Override
public void messageLogged(BuildEvent event) {
actionPerformed(null);
if (hasProgressPattern()) {
String message = event.getMessage();
Matcher matcher = progressRegExpPattern.matcher(message);
if (matcher != null && matcher.matches()) {
String gr = matcher.group(1);
try {
pb.setValue(Math.min(Integer.parseInt(gr) * 2, MAX));
} catch (NumberFormatException e) {
event.getProject().log(
"Number parsing error in progressRegExp",
Project.MSG_VERBOSE);
}
}
}
}
示例7: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
@Override
public synchronized void messageLogged(BuildEvent event) {
super.messageLogged(event);
final String message = event.getMessage();
if (message == null) {
return;
}
processHybrisMessage(message);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:10,代码来源:HybrisParsingAntLogger.java
示例8: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
@Override
public void messageLogged(BuildEvent event) {
String msg = event.getMessage();
boolean processed = false;
if (!tasks.isEmpty()) {
Task task = tasks.peek();
for (MessageKind messageKind : task.msgs) {
if (messageKind.matches(msg)) {
event.setMessage(msg, messageKind.priority);
processed = true;
if (messageKind == MessageKind.JAVAC_CRASH) {
crashFound = true;
}
break;
}
}
}
if (event.getPriority() == MSG_ERR || crashFound) {
//we log errors regardless of owning task
logger.messageLogged(event);
suppressTaskFailures = true;
} else if (processed) {
logger.messageLogged(event);
}
}
示例9: targetFinished
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void targetFinished(BuildEvent event) {
if (Thread.currentThread().getThreadGroup() != group)
return;
Element myElement = (Element) elementStack.peek();
String message = event.getMessage();
if (message != null)
myElement.setAttribute("message", message);
Throwable t = event.getException();
if (t != null) {
myElement.setAttribute("status", "failure");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
t.printStackTrace(ps);
ps.flush();
String errorMessage = t.getMessage();
String stackTrace = baos.toString();
Element error = results.createElement("error");
Element errorMsgElement = results.createElement("message");
errorMsgElement.appendChild(results.createTextNode(errorMessage));
Element stackElement = results.createElement("stack");
stackElement.appendChild(results.createCDATASection(stackTrace));
error.appendChild(errorMsgElement);
error.appendChild(stackElement);
myElement.appendChild(error);
} else {
myElement.setAttribute("status", "success");
}
elementStack.pop();
}
示例10: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
* @see BuildListener#messageLogged
* {@inheritDoc}.
*/
@Override
public void messageLogged(final BuildEvent event) {
if (initialized) {
Object categoryObject = event.getTask();
String categoryString;
String categoryDetail = null;
if (categoryObject == null) {
categoryObject = event.getTarget();
if (categoryObject == null) {
categoryString = PROJECT_LOG;
categoryDetail = event.getProject().getName();
} else {
categoryString = TARGET_LOG;
categoryDetail = event.getTarget().getName();
}
} else {
// It's a task - append the target
if (event.getTarget() != null) {
categoryString = categoryObject.getClass().getName();
categoryDetail = event.getTarget().getName();
} else {
categoryString = categoryObject.getClass().getName();
}
}
final Log log = getLog(categoryString, categoryDetail);
final int priority = event.getPriority();
final String message = event.getMessage();
realLog(log, message, priority, null);
}
}
示例11: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
String message = event.getMessage();
if (this.matcher.matches(message)) {
lastMatchGroups = this.matcher.getGroups(message);
}
super.messageLogged(event);
}
示例12: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public synchronized void messageLogged(BuildEvent event) {
if (sendException(event)) return;
int priority = event.getPriority();
String message = event.getMessage();
if (priority == Project.MSG_ERR)
myMessagePriority.sendMessage(ERROR, priority, message);
else
myMessagePriority.sendMessage(MESSAGE, priority, message);
}
示例13: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public @Override void messageLogged(BuildEvent ev) {
if (!running) { // #145722
return;
}
AntBridge.suspendDelegation();
try {
checkForStop();
AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, true));
LOG.log(Level.FINER, "messageLogged: {0}", e);
for (AntLogger l : getInterestedLoggersByEvent(e)) {
try {
l.messageLogged(e);
} catch (RuntimeException x) {
LOG.log(Level.WARNING, null, x);
}
}
// Let the hacks begin!
String msg = ev.getMessage();
if (msg.contains("ant.PropertyHelper") || /* #71816 */ msg.contains("ant.projectHelper")) { // NOI18N
// Only after this has been defined can we get any properties.
// Even trying earlier will give a recursion error since this pseudoprop
// is set lazily, which produces a new message logged event.
projectsWithProperties.add(ev.getProject());
}
if (targetGetLocation == null) {
// Try to figure out which imported targets belong to which actual scripts.
// XXX consider keeping a singleton Matcher for each pattern and reusing it
// or just doing string comparisons
Matcher matcher;
if ((matcher = PARSING_BUILDFILE_MESSAGE.matcher(msg)).matches()) {
if (currentlyParsedMainScript != null) {
currentlyParsedImportedScript = matcher.group(1);
}
LOG.log(Level.FINE, "Got PARSING_BUILDFILE_MESSAGE: {0}", currentlyParsedImportedScript);
setLastTask(null);
} else if ((matcher = IMPORTING_FILE_MESSAGE.matcher(msg)).matches()) {
currentlyParsedMainScript = matcher.group(1);
currentlyParsedImportedScript = null;
LOG.log(Level.FINE, "Got IMPORTING_FILE_MESSAGE: {0}", currentlyParsedMainScript);
setLastTask(null);
} else if ((matcher = PARSED_TARGET_MESSAGE.matcher(msg)).matches()) {
if (currentlyParsedMainScript != null && currentlyParsedImportedScript != null) {
Map<String,String> targetLocations = knownImportedTargets.get(currentlyParsedMainScript);
if (targetLocations == null) {
targetLocations = new HashMap<String,String>();
knownImportedTargets.put(currentlyParsedMainScript, targetLocations);
}
targetLocations.put(matcher.group(1), currentlyParsedImportedScript);
}
LOG.log(Level.FINE, "Got PARSED_TARGET_MESSAGE: {0}", matcher.group(1));
setLastTask(null);
}
}
} finally {
AntBridge.resumeDelegation();
}
}