1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 23:55:26 +02:00

[220547] allow SimpleSystemMessage without message ID

This commit is contained in:
David McKnight 2008-02-29 18:38:45 +00:00
parent 18afbe38d7
commit 61fab46170

View file

@ -55,7 +55,7 @@ public class SimpleSystemMessage extends SystemMessage {
super("RSE", "G", "-", severityToIndicator(severity), msg, msgDetails); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
_pluginId = pluginId;
_messageId = pluginId;
_messageId = messageId;
}
/**
@ -75,6 +75,58 @@ public class SimpleSystemMessage extends SystemMessage {
_messageId = messageId;
}
/**
* Constructor for messages that use explicit strings and severities rather than
* parsing a message file. This is part of the work to migrate away from the message
* file stuff.
*
* This constructor does not supply a message id. It is preferred that a message id is used since
* it allows easier identification of a unique message.
*
* @param pluginId the id of the originating plugin
* @param severity using IStatus severities
* @param msg the message text
*/
public SimpleSystemMessage(String pluginId, int severity, String msg) {
this(pluginId, severity, msg, (String)null);
}
/**
* Constructor for messages that use explicit strings and severities rather than
* parsing a message file. This is part of the work to migrate away from the message
* file stuff.
*
* This constructor does not supply a message id. It is preferred that a message id is used since
* it allows easier identification of a unique message.
*
* @param pluginId the id of the originating plugin
* @param severity using IStatus severities
* @param msg the message text
* @param msgDetails the message details
*/
public SimpleSystemMessage(String pluginId, int severity, String msg, String msgDetails) {
super("RSE", "G", "-", severityToIndicator(severity), msg, msgDetails); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
_pluginId = pluginId;
}
/**
* Constructor for messages that use explicit strings and severities rather than
* parsing a message file. This is part of the work to migrate away from the message
* file stuff.
*
* This constructor does not supply a message id. It is preferred that a message id is used since
* it allows easier identification of a unique message.
*
* @param pluginId the id of the originating plugin
* @param severity using IStatus severities
* @param msg the message text
* @param e an exception to convert into details
*/
public SimpleSystemMessage(String pluginId, int severity, String msg, Throwable e) {
super("RSE", "G", "-", severityToIndicator(severity), msg, throwableToDetails(e)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
_pluginId = pluginId;
}
private static String throwableToDetails(Throwable e){
// transform exception stack into a string
StringWriter excWriter = new StringWriter();
@ -106,7 +158,12 @@ public class SimpleSystemMessage extends SystemMessage {
}
public String getFullMessageID() {
return _messageId;
if (_messageId != null){
return _messageId;
}
else {
return _pluginId + ":" + getIndicator(); //$NON-NLS-1$
}
}
}