Search in sources :

Example 16 with Attachment

use of com.intellij.openapi.diagnostic.Attachment in project intellij-plugins by JetBrains.

the class DocumentTask method processInitException.

protected static void processInitException(InitException e, Module module, boolean debug) {
    DesignerApplicationManager.notifyUser(debug, e.getMessage(), module);
    if (e.attachments == null) {
        LOG.error(e.getCause());
    } else {
        final Collection<Attachment> attachments = new ArrayList<>(e.attachments.length);
        for (Attachment attachment : e.attachments) {
            if (attachment != null) {
                attachments.add(attachment);
            } else {
                break;
            }
        }
        LOG.error(LogMessageEx.createEvent(e.getMessage(), e.technicalMessage + "\n" + ExceptionUtil.getThrowableText(e), e.getMessage(), null, attachments));
    }
}
Also used : ArrayList(java.util.ArrayList) Attachment(com.intellij.openapi.diagnostic.Attachment)

Example 17 with Attachment

use of com.intellij.openapi.diagnostic.Attachment in project intellij-elixir by KronicDeth.

the class CallDefinitionClause method renderObject.

private void renderObject(@NotNull LookupElement lookupElement) {
    Logger logger = Logger.getInstance(CallDefinitionClause.class);
    Object object = lookupElement.getObject();
    String userMessage = "CallDefinitionClause render called on LookupElement with null getPsiElement\n" + "## name\n" + "\n" + "```\n" + name + "\n" + "```\n" + "\n" + "## getObject()\n" + "\n" + "### toString()\n" + "\n" + "```\n" + object.toString() + "\n" + "```\n" + "\n" + "### getClass().getName()\n" + "\n" + "```\n" + object.getClass().getName() + "\n" + "```\n";
    String details = Joiner.on("\n").join(new Throwable().getStackTrace());
    String title = "CallDefinitionClause render called on LookupElement with null getPsiElement";
    logger.error(LogMessageEx.createEvent(userMessage, details, title, null, (Attachment) null));
}
Also used : Attachment(com.intellij.openapi.diagnostic.Attachment) Logger(com.intellij.openapi.diagnostic.Logger)

Example 18 with Attachment

use of com.intellij.openapi.diagnostic.Attachment in project intellij-community by JetBrains.

the class JavaCompilerElementRetriever method retrieveFunExpressionsByIndices.

@NotNull
static PsiFunctionalExpression[] retrieveFunExpressionsByIndices(@NotNull TIntHashSet indices, @NotNull PsiFileWithStubSupport psiFile) {
    StubTree tree = psiFile.getStubTree();
    boolean foreign = tree == null;
    if (foreign) {
        tree = ((PsiFileImpl) psiFile).calcStubTree();
    }
    PsiFunctionalExpression[] result = new PsiFunctionalExpression[indices.size()];
    int resIdx = 0;
    int funExprIdx = 0;
    for (StubElement<?> element : tree.getPlainList()) {
        if (FUN_EXPR.contains(element.getStubType()) && indices.contains(funExprIdx++)) {
            result[resIdx++] = (PsiFunctionalExpression) element.getPsi();
        }
    }
    if (result.length != resIdx) {
        final CompilerReferenceServiceImpl compilerReferenceService = (CompilerReferenceServiceImpl) CompilerReferenceService.getInstance(psiFile.getProject());
        final Set<Module> state = compilerReferenceService.getDirtyScopeHolder().getAllDirtyModules();
        final VirtualFile file = psiFile.getVirtualFile();
        final Module moduleForFile = ProjectFileIndex.getInstance(psiFile.getProject()).getModuleForFile(file);
        LOG.error("Compiler functional expression index doesn't match to stub index.\n" + "Functional expression indices: " + indices + "\n" + "Does the file belong to dirty scope?: " + state.contains(moduleForFile), new Attachment(psiFile.getName(), psiFile.getText()));
        return ContainerUtil.filter(result, Objects::nonNull).toArray(PsiFunctionalExpression.EMPTY_ARRAY);
    }
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) StubTree(com.intellij.psi.stubs.StubTree) PsiFunctionalExpression(com.intellij.psi.PsiFunctionalExpression) Attachment(com.intellij.openapi.diagnostic.Attachment) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 19 with Attachment

use of com.intellij.openapi.diagnostic.Attachment in project android by JetBrains.

the class IdeaITNProxy method getKeyValuePairs.

public static List<Pair<String, String>> getKeyValuePairs(@Nullable String login, @Nullable String password, ErrorBean error, String compilationTimestamp, Application application, ApplicationInfoEx appInfo, ApplicationNamesInfo namesInfo, UpdateSettings updateSettings) {
    List<Pair<String, String>> params = new ArrayList<>();
    params.add(Pair.create("protocol.version", "1"));
    if (login != null) {
        params.add(Pair.create("user.login", login));
        params.add(Pair.create("user.password", password));
    }
    params.add(Pair.create("os.name", SystemProperties.getOsName()));
    params.add(Pair.create("java.version", SystemProperties.getJavaVersion()));
    params.add(Pair.create("java.vm.vendor", SystemProperties.getJavaVmVendor()));
    params.add(Pair.create("app.name", namesInfo.getProductName()));
    params.add(Pair.create("app.name.full", namesInfo.getFullProductName()));
    params.add(Pair.create("app.name.version", appInfo.getVersionName()));
    params.add(Pair.create("app.eap", Boolean.toString(appInfo.isEAP())));
    params.add(Pair.create("app.internal", Boolean.toString(application.isInternal())));
    params.add(Pair.create("app.build", appInfo.getBuild().asString()));
    params.add(Pair.create("app.version.major", appInfo.getMajorVersion()));
    params.add(Pair.create("app.version.minor", appInfo.getMinorVersion()));
    params.add(Pair.create("app.build.date", format(appInfo.getBuildDate())));
    params.add(Pair.create("app.build.date.release", format(appInfo.getMajorReleaseBuildDate())));
    params.add(Pair.create("app.compilation.timestamp", compilationTimestamp));
    params.add(Pair.create("update.channel.status", updateSettings.getSelectedChannelStatus().getCode()));
    params.add(Pair.create("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ",")));
    params.add(Pair.create("plugin.name", error.getPluginName()));
    params.add(Pair.create("plugin.version", error.getPluginVersion()));
    params.add(Pair.create("last.action", error.getLastAction()));
    params.add(Pair.create("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException())));
    params.add(Pair.create("error.message", error.getMessage()));
    params.add(Pair.create("error.stacktrace", error.getStackTrace()));
    params.add(Pair.create("error.description", error.getDescription()));
    params.add(Pair.create("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId())));
    for (Attachment attachment : error.getAttachments()) {
        params.add(Pair.create("attachment.name", attachment.getName()));
        params.add(Pair.create("attachment.value", attachment.getEncodedBytes()));
    }
    Project[] projects = ProjectManager.getInstance().getOpenProjects();
    for (int i = 0; i < projects.length; i++) {
        params.add(Pair.create("is.gradle.project." + i, Boolean.toString(AndroidProjectInfo.getInstance(projects[i]).requiresAndroidModel())));
    }
    return params;
}
Also used : Project(com.intellij.openapi.project.Project) ArrayList(java.util.ArrayList) Attachment(com.intellij.openapi.diagnostic.Attachment) Pair(com.intellij.openapi.util.Pair)

Example 20 with Attachment

use of com.intellij.openapi.diagnostic.Attachment in project intellij-plugins by JetBrains.

the class SwfProjectViewStructureProvider method modify.

@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
    if (!(parent instanceof PsiFileNode)) {
        return children;
    }
    final PsiFile psiFile = ((PsiFileNode) parent).getValue();
    if (!(psiFile instanceof PsiCompiledFile) || !(psiFile instanceof JSFile)) {
        return children;
    }
    final VirtualFile vFile = psiFile.getVirtualFile();
    if (vFile == null || vFile.getFileType() != FlexApplicationComponent.SWF_FILE_TYPE) {
        return children;
    }
    if (isTooManySWFs(vFile.getParent())) {
        return children;
    }
    List<JSQualifiedNamedElement> elements = new ArrayList<>();
    for (JSSourceElement e : ((JSFile) psiFile).getStatements()) {
        if (e instanceof JSQualifiedNamedElement) {
            String qName = ((JSQualifiedNamedElement) e).getQualifiedName();
            if (qName == null) {
                final Attachment attachment = e.getParent() != null ? new Attachment("Parent element.txt", e.getParent().getText()) : new Attachment("Element text.txt", e.getText());
                LOG.error(LogMessageEx.createEvent("Null qname: '" + e.getClass().getName() + "'", DebugUtil.currentStackTrace(), attachment));
                continue;
            }
            elements.add((JSQualifiedNamedElement) e);
        } else if (e instanceof JSVarStatement) {
            Collections.addAll(elements, ((JSVarStatement) e).getVariables());
        }
    }
    Collections.sort(elements, QNAME_COMPARATOR);
    return getChildrenForPackage("", elements, 0, elements.size(), psiFile.getProject(), ((PsiFileNode) parent).getSettings());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) PsiCompiledFile(com.intellij.psi.PsiCompiledFile) JSQualifiedNamedElement(com.intellij.lang.javascript.psi.ecmal4.JSQualifiedNamedElement) PsiFile(com.intellij.psi.PsiFile) Attachment(com.intellij.openapi.diagnostic.Attachment) NotNull(org.jetbrains.annotations.NotNull)

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