/** * Logs error to the {@code klass}'s {@link com.intellij.openapi.diagnostic.Logger} instance with the given * {@code userMessage} and the text of {@code element} as the details and containing file of {@code element} as an * attachment * * @param klass Class whose logger to use * @param userMessage User message for * {@link com.intellij.diagnostic.LogMessageEx#createEvent(String, String, Attachment...)} * @param element element responsible for the error */ public static void error(@NotNull Class klass, @NotNull String userMessage, PsiElement element) { error(com.intellij.openapi.diagnostic.Logger.getInstance(klass), userMessage, element); }
private static void error(@NotNull MacroNameArity macroNameArity) { com.intellij.openapi.diagnostic.Logger logger = com.intellij.openapi.diagnostic.Logger.getInstance( Decompiler.class ); String fullUserMessage = "No decompiler for MacroNameArity (" + macroNameArity + ")"; logger.error( LogMessageEx.createEvent( fullUserMessage, Joiner .on("\n") .join( new Throwable().getStackTrace() ), fullUserMessage, null, Collections.<Attachment>emptyList() ) ); }
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" +
public abstract class ModuleElementImpl extends PsiElementBase implements PsiCompiledElement { public static final Key<PsiCompiledElement> COMPILED_ELEMENT = Key.create("COMPILED_ELEMENT"); private static final Logger LOGGER = Logger.getInstance(ModuleElementImpl.class);
return ((GoNamedElement)element).getName() + typeText; Logger.getInstance(GoStructureViewFactory.class).error("Cannot get presentation for " + element.getClass().getName()); return null;
public boolean execute() { Logger.getInstance(getClass()).assertTrue(!ApplicationManager.getApplication().isDispatchThread(), "It's bad idea to run external tool on EDT"); Logger.getInstance(getClass()).assertTrue(myProcessHandler == null, "Process has already run with this executor instance"); Ref<Boolean> result = Ref.create(false); GeneralCommandLine commandLine = null;
public boolean execute() { Logger.getInstance(getClass()).assertTrue(!ApplicationManager.getApplication().isDispatchThread(), "It's bad idea to run external tool on EDT"); Logger.getInstance(getClass()).assertTrue(myProcessHandler == null, "Process has already run with this executor instance"); Ref<Boolean> result = Ref.create(false);
return img; } catch (Exception e) { Logger.getInstance(ImageUtils.class).error("resizeBorder", e);
@NotNull public static Logger getInstance(@NotNull Class cl) { return getInstance("#" + cl.getName()); }
@SuppressWarnings("UnusedDeclaration") public void callback(ID self, Pointer selector, ID event) { Logger.getInstance(MacScrollBarUI.class).debug("update scroll bar"); UIUtil.invokeLaterIfNeeded(this); }
public Native() { Logger.getInstance(MacScrollBarUI.class).debug("initialize scroll bar"); UIUtil.invokeLaterIfNeeded(this); }
@Nullable @Override public Style produce() { ID style = invoke(getObjcClass("NSScroller"), "preferredScrollerStyle"); Style value = 1 == style.intValue() ? Overlay : Legacy; Logger.getInstance(MacScrollBarUI.class).debug("scroll bar style ", value, " from ", style); return value; } };
default Set<NamedStubBase> getMembers() { final Set<NamedStubBase> res = new HashSet<>(); ((DlangFile) getContainingFile()).calcStubTree(); final StubElement greenStub = ((StubBasedPsiElementBase) this).getGreenStub(); if (greenStub == null) { Logger.getInstance(this.getClass()) .warn("Green stub was null for file:" + getContainingFile()); return Collections.emptySet(); } getMembersImpl(greenStub, res); return res; }
private static Annotation createAnnotation(@NotNull final AnnotationHolderImpl holder, @NotNull final HighlightSeverity severity, @NotNull final TextRange range, @Nullable final String message) { final String tooltip = message == null ? null : XmlStringUtil.wrapInHtml(escapeSpacesForHtml(XmlStringUtil.escapeString(message))); final Annotation annotation; try { annotation = new Annotation(range.getStartOffset(), range.getEndOffset(), severity, message, tooltip); } catch (final AssertionError e) { Logger.getInstance(DAnnotationHolder.class).warn( "Could not create annotation. Most likely caused by someone/typing/deleting the applicable range:" + e); return null; } holder.add(annotation); return annotation; }
@Nullable @Override public Behavior produce() { ID defaults = invoke("NSUserDefaults", "standardUserDefaults"); invoke(defaults, "synchronize"); ID behavior = invoke(defaults, "boolForKey:", nsString("AppleScrollerPagingBehavior")); Behavior value = 1 == behavior.intValue() ? JumpToSpot : NextPage; Logger.getInstance(MacScrollBarUI.class).debug("scroll bar behavior ", value, " from ", behavior); return value; } };
private static <T> T callMac(Producer<T> producer) { if (SystemInfo.isMac) { NSAutoreleasePool pool = new NSAutoreleasePool(); try { return producer.produce(); } catch (Throwable throwable) { Logger.getInstance(MacScrollBarUI.class).warn(throwable); } finally { pool.drain(); } } return null; }
private static void exportToSvg(UberTreeViewer parseTreeViewer, File file, boolean useTransparentBackground) { DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); Document document = domImpl.createDocument("http://www.w3.org/2000/svg", "svg", null); SVGGraphics2D svgGenerator = new SVGGraphics2D(document); if (!useTransparentBackground) { svgGenerator.setColor(JBColor.WHITE); svgGenerator.fillRect(0, 0, parseTreeViewer.getWidth(), parseTreeViewer.getHeight()); } parseTreeViewer.paint(svgGenerator); try { svgGenerator.stream(file.getAbsolutePath(), true); } catch (SVGGraphics2DIOException e) { Logger.getInstance(ParseTreeContextualMenu.class).error("Error while exporting parse tree to SVG file " + file.getAbsolutePath(), e); } } }
@NotNull @Override public String getImportedModuleName() { if (getGreenStub() != null) { return getGreenStub().getImportedModule(); } if (getIdentifierChain() == null) { return DReference.Companion.getNAME_NOT_FOUND_STRING(); } if (getIdentifierChain().getText().equals("")) { Logger.getInstance(getClass()) .warn("getIdentifier chain was: \"\". Complete text of symbol: " + getText()); return DReference.Companion.getNAME_NOT_FOUND_STRING(); } return getIdentifierChain().getText(); }
@Nullable @Override protected RunContentDescriptor doExecute(RunProfileState state, ExecutionEnvironment env) throws ExecutionException { if (env.getExecutor().getActionName().equals(DefaultDebugExecutor.EXECUTOR_ID)) { Project project = env.getProject(); Executor executor = env.getExecutor(); Logger logger = Logger.getInstance(this.getClass()); try { return RunUtil.startDebugger(this, state, env, project, executor, ((DlangRunAppState) state).getExecutableCommandLine(((DlangRunAppState) state).getConfig()).getExePath());//todo this is yucky } catch (ModuleNotFoundException e) { e.printStackTrace(); logger.error(e.toString()); } catch (NoValidDlangSdkFound NoValidDlangSdkFound) { NoValidDlangSdkFound.printStackTrace(); logger.error(NoValidDlangSdkFound.toString()); } } return super.doExecute(state, env); } }
private static String extractDescription(HighlightInfo.IntentionActionDescriptor descriptor) { try { if (!StringUtil.isEmpty(descriptor.getDisplayName())) { return descriptor.getDisplayName(); } else if (!StringUtil.isEmpty(safelyGetActionText(descriptor))) { return descriptor.getAction().getText(); } else if (!StringUtil.isEmpty(safelyGetFamilyName(descriptor))) { return descriptor.getAction().getFamilyName(); } else { return descriptor.getAction().getClass().getSimpleName(); } } catch (Exception e) { Logger.getInstance(QuickFixDescriptor.class).warn("Problem extracting description", e); return ""; } }