com.intellij.openapi.diagnostic.Logger.isDebugEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中com.intellij.openapi.diagnostic.Logger.isDebugEnabled()方法的一些代码示例,展示了Logger.isDebugEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isDebugEnabled()方法的具体详情如下:
包路径:com.intellij.openapi.diagnostic.Logger
类名称:Logger
方法名:isDebugEnabled

Logger.isDebugEnabled介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

/**
 * This is used to initialize each new editor that gets created.
 *
 * @param editor The editor to initialize
 */
public static void initializeEditor(Editor editor) {
 if (logger.isDebugEnabled()) logger.debug("editor created: " + editor);
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Store which register the user wishes to work with.
 *
 * @param reg The register name
 * @return true if a valid register name, false if not
 */
public boolean selectRegister(char reg) {
 if (VALID_REGISTERS.indexOf(reg) != -1) {
  lastRegister = reg;
  if (logger.isDebugEnabled()) logger.debug("register selected: " + lastRegister);
  return true;
 }
 else {
  return false;
 }
}

代码示例来源:origin: JetBrains/ideavim

@NotNull
private String processKey(String key, int start, int end) {
 if (logger.isDebugEnabled()) {
  logger.debug("process " + key + " " + start + "," + end);
 }
 StringBuilder res = new StringBuilder();
 res.append("      #  ").append(key).append(" ").append("history\n");
 String spaces = "       ";
 List<HistoryGroup.HistoryEntry> entries = VimPlugin.getHistory().getEntries(key, start, end);
 for (HistoryGroup.HistoryEntry entry : entries) {
  String num = Integer.toString(entry.getNumber());
  res.append(spaces.substring(num.length())).append(num).append("  ").append(entry.getEntry()).append("\n");
 }
 return res.toString();
}

代码示例来源:origin: JetBrains/ideavim

@NotNull
public String executeCommand(@NotNull String command, @Nullable CharSequence input) throws IOException {
 if (logger.isDebugEnabled()) {
  logger.debug("command=" + command);
 }
 final Process process = Runtime.getRuntime().exec(command);
 if (input != null) {
  final BufferedWriter outputWriter = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
  copy(new CharSequenceReader(input), outputWriter);
  outputWriter.close();
 }
 final BufferedReader inputReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 final StringWriter writer = new StringWriter();
 copy(inputReader, writer);
 writer.close();
 lastCommand = command;
 return writer.toString();
}

代码示例来源:origin: JetBrains/ideavim

public static void runWriteCommand(@Nullable Project project, @NotNull Runnable cmd, @Nullable String name, @Nullable Object groupId) {
 if (logger.isDebugEnabled()) {
  logger.debug("write command " + cmd);
 }
 CommandProcessor.getInstance().executeCommand(project, new WriteAction(cmd), name, groupId);
}

代码示例来源:origin: JetBrains/ideavim

public static void runReadCommand(@Nullable Project project, @NotNull Runnable cmd, @Nullable String name, @Nullable Object groupId) {
 if (logger.isDebugEnabled()) {
  logger.debug("read command " + cmd);
 }
 CommandProcessor.getInstance().executeCommand(project, new ReadAction(cmd), name, groupId);
}

代码示例来源:origin: JetBrains/ideavim

protected void processKeyEvent(KeyEvent e) {
 if (logger.isDebugEnabled()) logger.debug("key=" + e);
 super.processKeyEvent(e);
}

代码示例来源:origin: JetBrains/ideavim

public void addEntry(String key, @NotNull String text) {
 if (logger.isDebugEnabled()) {
  logger.debug("Add entry '" + text + "' to " + key);
 }
 HistoryBlock block = blocks(key);
 block.addEntry(text);
}

代码示例来源:origin: JetBrains/ideavim

public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull ExCommand cmd) throws ExException {
 String arg = cmd.getArgument();
 if (logger.isDebugEnabled()) {
  logger.debug("arg=" + arg);
 }
 return VimPlugin.getDigraph().parseCommandLine(editor, cmd.getArgument());
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Fetches the set of commands that can be used
 * on a text component that is using a model and
 * view produced by this kit.
 *
 * @return the set of actions
 */
public Action[] getActions() {
 Action[] res = TextAction.augmentList(super.getActions(), this.exActions);
 if (logger.isDebugEnabled()) logger.debug("res.length=" + res.length);
 return res;
}

代码示例来源:origin: JetBrains/ideavim

public void handleKey(@NotNull KeyStroke stroke) {
 if (logger.isDebugEnabled()) logger.debug("stroke=" + stroke);
 final char keyChar = stroke.getKeyChar();
 char c = keyChar;
 final int modifiers = stroke.getModifiers();
 final int keyCode = stroke.getKeyCode();
 if ((modifiers & KeyEvent.CTRL_MASK) != 0) {
  final int codePoint = keyCode - KeyEvent.VK_A + 1;
  if (codePoint > 0) {
   c = Character.toChars(codePoint)[0];
  }
 }
 KeyEvent event = new KeyEvent(this, keyChar != KeyEvent.CHAR_UNDEFINED ? KeyEvent.KEY_TYPED :
                   (stroke.isOnKeyRelease() ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED),
                (new Date()).getTime(), modifiers, keyCode, c);
 super.processKeyEvent(event);
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Each character in the supplied range gets replaced with the character ch
 *
 * @param editor The editor to change
 * @param range  The range to change
 * @param ch     The replacing character
 * @return true if able to change the range, false if not
 */
public boolean changeCharacterRange(@NotNull Editor editor, @NotNull TextRange range, char ch) {
 if (logger.isDebugEnabled()) {
  logger.debug("change range: " + range + " to " + ch);
 }
 CharSequence chars = editor.getDocument().getCharsSequence();
 int[] starts = range.getStartOffsets();
 int[] ends = range.getEndOffsets();
 for (int j = ends.length - 1; j >= 0; j--) {
  for (int i = starts[j]; i < ends[j]; i++) {
   if (i < chars.length() && '\n' != chars.charAt(i)) {
    replaceText(editor, i, i + 1, Character.toString(ch));
   }
  }
 }
 return true;
}

代码示例来源:origin: JetBrains/ideavim

public void postKey(@NotNull KeyStroke stroke, @NotNull Editor editor) {
 final Component component = SwingUtilities.getAncestorOfClass(Window.class, editor.getComponent());
 final KeyEvent event = createKeyEvent(stroke, component);
 ApplicationManager.getApplication().invokeLater(() -> {
  if (logger.isDebugEnabled()) {
   logger.debug("posting " + event);
  }
  Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event);
 });
}

代码示例来源:origin: JetBrains/ideavim

/**
 * This is used to clean up editors whenever they are closed.
 *
 * @param editor The editor to cleanup
 */
public static void unInitializeEditor(@NotNull Editor editor) {
 if (logger.isDebugEnabled()) logger.debug("editor closed: " + editor);
 editor.putUserData(COMMAND_STATE, null);
 editor.putUserData(LAST_HIGHLIGHTS, null);
 editor.putUserData(LAST_SELECTION_TYPE, null);
 editor.putUserData(LAST_VISUAL_RANGE, null);
 editor.putUserData(MORE_PANEL, null);
 editor.putUserData(EX_OUTPUT_MODEL, null);
}

代码示例来源:origin: JetBrains/ideavim

public void readData(@NotNull Element element) {
 logger.debug("readData");
 Element search = element.getChild("search");
 if (search == null) {
  return;
 }
 lastSearch = getSafeChildText(search, "last-search");
 lastOffset = getSafeChildText(search, "last-offset");
 lastPattern = getSafeChildText(search, "last-pattern");
 lastReplace = getSafeChildText(search, "last-replace");
 lastSubstitute = getSafeChildText(search, "last-substitute");
 Element dir = search.getChild("last-dir");
 lastDir = Integer.parseInt(dir.getText());
 Element show = search.getChild("show-last");
 final ListOption vimInfo = Options.getInstance().getListOption(Options.VIMINFO);
 final boolean disableHighlight = vimInfo != null && vimInfo.contains("h");
 showSearchHighlight = !disableHighlight && Boolean.valueOf(show.getText());
 if (logger.isDebugEnabled()) {
  logger.debug("show=" + show + "(" + show.getText() + ")");
  logger.debug("showSearchHighlight=" + showSearchHighlight);
 }
}

代码示例来源:origin: JetBrains/ideavim

public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull ExCommand cmd) throws ExException {
 LineRange range = cmd.getLineRange(editor, context);
 CharSequence chars = editor.getDocument().getCharsSequence();
 for (int l = range.getStartLine(); l <= range.getEndLine(); l++) {
  int start = editor.getDocument().getLineStartOffset(l);
  int end = editor.getDocument().getLineEndOffset(l);
  if (logger.isDebugEnabled()) {
   logger.debug("Line " + l + ", start offset=" + start + ", end offset=" + end);
   for (int i = start; i <= end; i++) {
    logger.debug("Offset " + i + ", char=" + chars.charAt(i) + ", lp=" + editor.offsetToLogicalPosition(i) +
           ", vp=" + editor.offsetToVisualPosition(i));
   }
  }
 }
 return true;
}

代码示例来源:origin: JetBrains/ideavim

private static void resetCursor(@NotNull VirtualFile virtualFile, Project proj, boolean insert) {
 logger.debug("resetCursor");
 Document doc = FileDocumentManager.getInstance().getDocument(virtualFile);
 if (doc == null) return; // Must be no text editor (such as image)
 Editor[] editors = EditorFactory.getInstance().getEditors(doc, proj);
 if (logger.isDebugEnabled()) {
  logger.debug("There are " + editors.length + " editors for virtual file " + virtualFile.getName());
 }
 for (Editor editor : editors) {
  editor.getSettings().setBlockCursor(!insert);
 }
}

代码示例来源:origin: JetBrains/ideavim

/**
 * This event indicates that a document was just changed. We use this event to update all the editor's
 * marks if text was just added.
 *
 * @param event The change event
 */
public void documentChanged(@NotNull DocumentEvent event) {
 if (!VimPlugin.isEnabled()) return;
 if (logger.isDebugEnabled()) logger.debug("MarkUpdater after, event = " + event);
 if (event.getNewLength() == 0 || (event.getNewLength() == 1 && event.getNewFragment().charAt(0) != '\n')) return;
 Document doc = event.getDocument();
 updateMarkFromInsert(getAnEditor(doc), VimPlugin.getMark().getAllFileMarks(doc), event.getOffset(),
            event.getNewLength());
 // TODO - update jumps
}

代码示例来源:origin: JetBrains/ideavim

/**
 * This event indicates that a document is about to be changed. We use this event to update all the
 * editor's marks if text is about to be deleted.
 *
 * @param event The change event
 */
public void beforeDocumentChange(@NotNull DocumentEvent event) {
 if (!VimPlugin.isEnabled()) return;
 if (logger.isDebugEnabled()) logger.debug("MarkUpdater before, event = " + event);
 if (event.getOldLength() == 0) return;
 Document doc = event.getDocument();
 updateMarkFromDelete(getAnEditor(doc), VimPlugin.getMark().getAllFileMarks(doc), event.getOffset(),
            event.getOldLength());
 // TODO - update jumps
}

代码示例来源:origin: JetBrains/ideavim

/**
  * Invoked when an action occurs.
  */
 public void actionPerformed(ActionEvent e) {
  ExTextField target = (ExTextField)getTextComponent(e);
  target.saveLastEntry();
  Document doc = target.getDocument();
  Caret caret = target.getCaret();
  int offset = SearchHelper.findNextWord(target.getText(), caret.getDot(), target.getText().length(),
                      -1, false, false);
  if (logger.isDebugEnabled()) logger.debug("offset=" + offset);
  try {
   int pos = caret.getDot();
   doc.remove(offset, pos - offset);
  }
  catch (BadLocationException ex) {
   // ignore
  }
 }
}

相关文章