Search in sources :

Example 41 with Attachment

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;
}
Also used : LogMessageEx(com.intellij.diagnostic.LogMessageEx) Attachment(com.intellij.openapi.diagnostic.Attachment) List(java.util.List) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

Attachment (com.intellij.openapi.diagnostic.Attachment)41 VirtualFile (com.intellij.openapi.vfs.VirtualFile)12 NotNull (org.jetbrains.annotations.NotNull)10 Project (com.intellij.openapi.project.Project)6 ArrayList (java.util.ArrayList)6 Document (com.intellij.openapi.editor.Document)5 TextRange (com.intellij.openapi.util.TextRange)4 LogEventException (com.intellij.diagnostic.LogEventException)3 Logger (com.intellij.openapi.diagnostic.Logger)3 PsiElement (com.intellij.psi.PsiElement)3 PsiFile (com.intellij.psi.PsiFile)3 LogMessageEx (com.intellij.diagnostic.LogMessageEx)2 JSQualifiedNamedElement (com.intellij.lang.javascript.psi.ecmal4.JSQualifiedNamedElement)2 Pair (com.intellij.openapi.util.Pair)2 PsiDocumentManager (com.intellij.psi.PsiDocumentManager)2 List (java.util.List)2 NonNls (org.jetbrains.annotations.NonNls)2 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)1 TextEditorHighlightingPass (com.intellij.codeHighlighting.TextEditorHighlightingPass)1 DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)1