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));
}
}
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));
}
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;
}
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;
}
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());
}
Aggregations