use of com.intellij.openapi.diagnostic.Attachment in project intellij-elixir by KronicDeth.
the class Submitter method includedAttachments.
/**
* Gets the attachment the user has marked to be included. Tries to use
* {@link LogMessageEx#getIncludedAttachments()}, and then {@link LogMessageEx#getAttachments()}.
*
* @param logMessageEx with attachments
* @return the attachments
*/
private static List<Attachment> includedAttachments(LogMessageEx logMessageEx) {
Class<LogMessageEx> klass = LogMessageEx.class;
List<Attachment> attachmentList = Collections.emptyList();
try {
Method getIncludedAttachments = klass.getDeclaredMethod("getIncludedAttachments", LogMessageEx.class);
try {
attachmentList = (List<Attachment>) getIncludedAttachments.invoke(logMessageEx);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (NoSuchMethodException noSuchGetIncludedAttachmentsMethod) {
try {
Method getAttachments = klass.getDeclaredMethod("getAttachments", LogMessageEx.class);
try {
attachmentList = (List<Attachment>) getAttachments.invoke(logMessageEx);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (NoSuchMethodException noSuchGetAttachmentsMethod) {
noSuchGetAttachmentsMethod.printStackTrace();
}
}
return attachmentList;
}
Aggregations