本文整理了Java中com.intellij.openapi.diagnostic.Logger.error()
方法的一些代码示例,展示了Logger.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()
方法的具体详情如下:
包路径:com.intellij.openapi.diagnostic.Logger
类名称:Logger
方法名:error
暂无
代码示例来源:origin: KronicDeth/intellij-elixir
private void superProcessConsistentText(@NotNull String text, @NotNull Key outputType, boolean tcLikeFakeOutput) {
try {
SUPER_PROCESS_CONSISTENT_TEXT_METHOD.invoke(this, text, outputType, tcLikeFakeOutput);
} catch (IllegalAccessException | InvocationTargetException e) {
LOGGER.error(e);
}
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@NotNull
private static Type getResultType(@NotNull String method) {
for (Class<?> c : DlvRequest.class.getDeclaredClasses()) {
if (method.equals(c.getSimpleName())) {
Type s = c.getGenericSuperclass();
assert s instanceof ParameterizedType : c.getCanonicalName() + " should have a generic parameter for correct callback processing";
Type[] arguments = ((ParameterizedType)s).getActualTypeArguments();
assert arguments.length == 1 : c.getCanonicalName() + " should have only one generic argument for correct callback processing";
return arguments[0];
}
}
CommandProcessorKt.getLOG().error("Unknown response " + method + ", please register an appropriate request into com.goide.dlv.protocol.DlvRequest");
return Object.class;
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
@Nullable
public static String typeID(@NotNull DataInputStream dataInputStream, @NotNull String path) throws IOException {
byte[] bytes = new byte[4];
int bytesRead = dataInputStream.read(bytes, 0, bytes.length);
String typeID = null;
if (bytesRead == bytes.length) {
typeID = new String(bytes);
} else if (bytesRead > 0) {
LOGGER.error(
"Could not read typeID: read only " + bytesRead + " of " + bytes.length + " bytes from " + path
);
}
return typeID;
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
public GoDeleteRangeQuickFix(@NotNull PsiElement startElement, @NotNull PsiElement endElement, @NotNull String name) {
super(startElement, endElement);
if (!startElement.getParent().equals(endElement.getParent())) {
LOG.error("Cannot delete range of elements with different parents");
}
myName = name;
}
代码示例来源:origin: KronicDeth/intellij-elixir
public static Optional<Stub> buildFileStub(@NotNull byte[] bytes, @NotNull String path) {
Optional<Beam> beamOptional;
try {
beamOptional = Optional.ofNullable(Beam.Companion.from(bytes, path));
} catch (IOException e) {
LOGGER.error("IOException during BeamFileImpl.buildFileStub(bytes, " + path + ")", e);
beamOptional = Optional.empty();
} catch (OtpErlangDecodeException e) {
LOGGER.error("OtpErlangDecodeException during BeamFileImpl.buildFileStub(bytes, " + path + ")", e);
beamOptional = Optional.empty();
}
return beamOptional.flatMap(BeamFileImpl::buildModuleStub).map(StubElement::getParentStub);
}
代码示例来源:origin: KronicDeth/intellij-elixir
public void saveAdditionalData(@NotNull SdkAdditionalData additionalData, @NotNull Element additional) {
if (additionalData instanceof org.elixir_lang.sdk.erlang_dependent.SdkAdditionalData) {
try {
((org.elixir_lang.sdk.erlang_dependent.SdkAdditionalData) additionalData).writeExternal(additional);
} catch (WriteExternalException e) {
LOG.error(e);
}
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
@Override
public ParamsGroup clone() {
try {
final ParamsGroup clone = (ParamsGroup)super.clone();
clone.myGroupId = myGroupId;
clone.myGroupParams = myGroupParams.clone();
return clone;
}
catch (CloneNotSupportedException e) {
LOG.error(e);
return null;
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
@Override
public ParametersList clone() {
try {
final ParametersList clone = (ParametersList)super.clone();
clone.myParameters = new ArrayList<String>(myParameters);
clone.myGroups = new ArrayList<ParamsGroup>(myGroups.size() + 1);
for (ParamsGroup group : myGroups) {
clone.myGroups.add(group.clone());
}
return clone;
}
catch (CloneNotSupportedException e) {
LOG.error(e);
return null;
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
@Override
public String put(String key, String value) {
if (key == null || value == null) {
LOG.error(new Exception("Nulls are not allowed"));
return null;
}
if (key.isEmpty()) {
// Windows: passing an environment variable with empty name causes "CreateProcess error=87, The parameter is incorrect"
LOG.warn("Skipping environment variable with empty name, value: " + value);
return null;
}
return super.put(key, value);
}
代码示例来源:origin: KronicDeth/intellij-elixir
public SdkAdditionalData loadAdditionalData(@NotNull Sdk elixirSdk, Element additional) {
org.elixir_lang.sdk.erlang_dependent.SdkAdditionalData sdkAdditionalData = new org.elixir_lang.sdk.erlang_dependent.SdkAdditionalData(elixirSdk);
try {
sdkAdditionalData.readExternal(additional);
} catch (InvalidDataException e) {
LOG.error(e);
}
return sdkAdditionalData;
}
代码示例来源:origin: JetBrains/ideavim
@Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) {
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
else {
origHandler.execute(editor, charTyped, context);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
public static void assertGuard(@NotNull StubInputStream stubInputStream, byte[] expectedGuard) {
try {
byte[] actualGuard = new byte[expectedGuard.length];
//noinspection ResultOfMethodCallIgnored
stubInputStream.read(actualGuard);
assert Arrays.equals(actualGuard, expectedGuard) :
"Expected `" + hexString(expectedGuard) + "` tag in StubInputSteam, but got `" +
hexString(actualGuard) + "`";
} catch (IOException e) {
LOGGER.error(e);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
public static void report_error_(PsiBuilder builder, ErrorState state, boolean advance) {
Frame frame = state.currentFrame;
if (frame == null) {
LOG.error("unbalanced enter/exit section call: got null");
return;
}
int position = builder.rawTokenIndex();
if (frame.errorReportedAt < position && getLastVariantPos(state, position + 1) <= position) {
reportError(builder, state, frame, null, true, advance);
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Nullable
public static GoExpression getValue(@NotNull GoVarDefinition definition) {
PsiElement parent = definition.getParent();
if (parent instanceof GoVarSpec) {
int index = ((GoVarSpec)parent).getVarDefinitionList().indexOf(definition);
return getByIndex(((GoVarSpec)parent).getRightExpressionsList(), index);
}
if (parent instanceof GoTypeSwitchGuard) {
return ((GoTypeSwitchGuard)parent).getExpression();
}
LOG.error("Cannot find value for variable definition: " + definition.getText(),
AttachmentFactory.createAttachment(definition.getContainingFile().getVirtualFile()));
return null;
}
代码示例来源:origin: ballerina-platform/ballerina-lang
public void addServerDefinition(final UserConfigurableServerDefinition serverDefinition) {
if (serverDefinition != null) {
serverDefinitions.put(serverDefinition.ext(), serverDefinition);
if (serverDefinition.getClass().equals(ArtifactLanguageServerDefinition.class)) {
final ArtifactLanguageServerDefinition def = (ArtifactLanguageServerDefinition) serverDefinition;
rootPanel.add(createArtifactRow(def.ext(), def.packge(), def.mainClass(), Utils.arrayToString(def.args(), " ")));
} else if (serverDefinition.getClass().equals(ExeLanguageServerDefinition.class)) {
final ExeLanguageServerDefinition def = (ExeLanguageServerDefinition) serverDefinition;
rootPanel.add(createExeRow(def.ext(), def.path(), Utils.arrayToString(def.args(), " ")));
} else if (serverDefinition.getClass().equals(RawCommandServerDefinition.class)) {
final RawCommandServerDefinition def = (RawCommandServerDefinition) serverDefinition;
rootPanel.add(createCommandRow(def.ext(), Utils.arrayToString(def.command(), " ")));
} else {
LOG.error("Unknown UserConfigurableServerDefinition : " + serverDefinition);
}
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Editor editor = getEditor(e);
final KeyStroke keyStroke = getKeyStroke(e);
if (editor != null && keyStroke != null) {
final ShortcutOwner owner = VimPlugin.getKey().getSavedShortcutConflicts().get(keyStroke);
if (owner == ShortcutOwner.UNDEFINED) {
notifyAboutShortcutConflict(keyStroke);
}
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
@Nullable("is null when called from inspection") Editor editor,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
if (editor == null) {
LOG.error("Cannot run quick fix without editor: " + getClass().getSimpleName(),
AttachmentFactory.createAttachment(file.getVirtualFile()));
return;
}
PsiElement reference = PsiTreeUtil.getNonStrictParentOfType(startElement, GoReferenceExpressionBase.class);
PsiElement anchor = reference != null ? findAnchor(reference) : null;
if (anchor == null) {
LOG.error("Cannot find anchor for " + myWhat + " (GoUnresolvedFixBase), offset: " + editor.getCaretModel().getOffset(),
AttachmentFactory.createAttachment(file.getVirtualFile()));
return;
}
Template template = TemplateSettings.getInstance().getTemplateById(myTemplateId);
if (template == null) {
LOG.error("Cannot find anchor for " + myWhat + " (GoUnresolvedFixBase), offset: " + editor.getCaretModel().getOffset(),
AttachmentFactory.createAttachment(file.getVirtualFile()));
return;
}
int start = anchor.getTextRange().getStartOffset();
editor.getCaretModel().moveToOffset(start);
template.setToReformat(true);
TemplateManager.getInstance(project).startTemplate(editor, template, true, ContainerUtil.stringMap("NAME", myName), null);
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
VirtualFile file = e.getRequiredData(CommonDataKeys.VIRTUAL_FILE);
assert project != null;
String title = StringUtil.notNullize(e.getPresentation().getText());
Module module = ModuleUtilCore.findModuleForFile(file, project);
try {
doSomething(file, module, project, title);
}
catch (ExecutionException ex) {
error(title, project, ex);
LOG.error(ex);
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
@Nullable("is null when called from inspection") Editor editor,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
if (editor == null) {
LOG.error("Cannot run quick fix without editor: " + getClass().getSimpleName(),
AttachmentFactory.createAttachment(file.getVirtualFile()));
return;
}
if (!(startElement instanceof GoCallExpr)) return;
GoCallExpr call = (GoCallExpr)startElement;
List<GoExpression> args = call.getArgumentList().getExpressionList();
GoType resultType = ContainerUtil.getFirstItem(GoTypeUtil.getExpectedTypes(call));
PsiElement anchor = PsiTreeUtil.findPrevParent(file, call);
Template template = TemplateManager.getInstance(project).createTemplate("", "");
template.addTextSegment("\nfunc " + myName);
setupFunctionParameters(template, args, file);
setupFunctionResult(template, resultType);
template.addTextSegment(" {\n\t");
template.addEndVariable();
template.addTextSegment("\n}");
int offset = anchor.getTextRange().getEndOffset();
editor.getCaretModel().moveToOffset(offset);
startTemplate(editor, template, project);
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
@Nullable("is null when called from inspection") Editor editor,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
if (editor == null) {
LOG.error("Cannot run quick fix without editor: " + getClass().getSimpleName(),
AttachmentFactory.createAttachment(file.getVirtualFile()));
return;
}
if (!(startElement instanceof GoType)) return;
GoType type = (GoType)startElement;
PsiElement anchor = PsiTreeUtil.findPrevParent(file, type);
String name = "TypeName";
GoTypeDeclaration decl = (GoTypeDeclaration)file.addBefore(GoElementFactory.createTypeDeclaration(project, name, type), anchor);
if (decl == null) return;
decl = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(decl);
if (decl == null) return;
GoTypeSpec spec = ContainerUtil.getFirstItem(decl.getTypeSpecList());
if (spec == null) return;
TemplateBuilderImpl builder = new TemplateBuilderImpl(file);
builder.replaceElement(type, OTHER_NAME, INPUT_NAME, false);
builder.replaceElement(spec.getIdentifier(), INPUT_NAME, new ConstantNode(name), true);
editor.getCaretModel().moveToOffset(file.getTextRange().getStartOffset());
Template template = builder.buildInlineTemplate();
editor.getCaretModel().moveToOffset(file.getTextRange().getStartOffset());
TemplateManager.getInstance(project).startTemplate(editor, template);
}
内容来源于网络,如有侵权,请联系作者删除!