<commit_before>package com.intellij.diagnostic.logging;

import com.intellij.diagnostic.DiagnosticBundle;
import com.intellij.execution.filters.TextConsoleBuidlerFactory;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.impl.ConsoleViewImpl;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.FilterComponent;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.io.*;

/**
 * User: anna
 * Date: Apr 19, 2005
 */
public abstract class LogConsole extends JPanel implements Disposable{
  private final ConsoleView myConsole;
  private final LightProcessHandler myProcessHandler = new LightProcessHandler();
  private ReaderThread myReaderThread;
  private final boolean mySkipContents;

  @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
  private Document myOriginalDocument = null;

  @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
  private String myPrevType = null;

  private FilterComponent myFilter = new FilterComponent("LOG_FILTER_HISTORY", 5) {
    protected void filter() {
      LogConsolePreferences.getInstance().updateCustomFilter(getFilter());
      filterConsoleOutput();
    }
  };

  private static final long PROCESS_IDLE_TIMEOUT = 200;
  public LogConsole(Project project, File file, boolean skipContents) {
    super(new BorderLayout());
    mySkipContents = skipContents;
    myReaderThread = new ReaderThread(file);
    TextConsoleBuilder builder = TextConsoleBuidlerFactory.getInstance().createBuilder(project);
    myConsole = builder.getConsole();
    myConsole.attachToProcess(myProcessHandler);
    add(myConsole.getComponent(), BorderLayout.CENTER);
    add(createToolbar(), BorderLayout.NORTH);
    myReaderThread.start();
  }

  private JComponent createToolbar(){
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new FilterAction(LogConsolePreferences.INFO, IconLoader.getIcon("/ant/filterInfo.png.png")));
    group.add(new FilterAction(LogConsolePreferences.WARNING, IconLoader.getIcon("/ant/filterWarning.png.png")));
    group.add(new FilterAction(LogConsolePreferences.ERROR, IconLoader.getIcon("/ant/filterError.png.png")));
    final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
    myFilter.reset();
    panel.add(myFilter, BorderLayout.EAST);
    return panel;
  }

  public abstract boolean isActive();

  public void dispose() {
    myConsole.dispose();
    myReaderThread.stopRunning(false);<commit_msg>[anna] correct log console icons<commit_after>package com.intellij.diagnostic.logging;

import com.intellij.diagnostic.DiagnosticBundle;
import com.intellij.execution.filters.TextConsoleBuidlerFactory;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.impl.ConsoleViewImpl;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.FilterComponent;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.io.*;

/**
 * User: anna
 * Date: Apr 19, 2005
 */
public abstract class LogConsole extends JPanel implements Disposable{
  private final ConsoleView myConsole;
  private final LightProcessHandler myProcessHandler = new LightProcessHandler();
  private ReaderThread myReaderThread;
  private final boolean mySkipContents;

  @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
  private Document myOriginalDocument = null;

  @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
  private String myPrevType = null;

  private FilterComponent myFilter = new FilterComponent("LOG_FILTER_HISTORY", 5) {
    protected void filter() {
      LogConsolePreferences.getInstance().updateCustomFilter(getFilter());
      filterConsoleOutput();
    }
  };

  private static final long PROCESS_IDLE_TIMEOUT = 200;
  public LogConsole(Project project, File file, boolean skipContents) {
    super(new BorderLayout());
    mySkipContents = skipContents;
    myReaderThread = new ReaderThread(file);
    TextConsoleBuilder builder = TextConsoleBuidlerFactory.getInstance().createBuilder(project);
    myConsole = builder.getConsole();
    myConsole.attachToProcess(myProcessHandler);
    add(myConsole.getComponent(), BorderLayout.CENTER);
    add(createToolbar(), BorderLayout.NORTH);
    myReaderThread.start();
  }

  private JComponent createToolbar(){
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new FilterAction(LogConsolePreferences.INFO, IconLoader.getIcon("/ant/filterInfo.png")));
    group.add(new FilterAction(LogConsolePreferences.WARNING, IconLoader.getIcon("/ant/filterWarning.png")));
    group.add(new FilterAction(LogConsolePreferences.ERROR, IconLoader.getIcon("/ant/filterError.png")));
    final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
    myFilter.reset();
    panel.add(myFilter, BorderLayout.EAST);
    return panel;
  }

  public abstract boolean isActive();

  public void dispose() {
    myConsole.dispose();
    myReaderThread.stopRunning(false);
{'fraction_non_alphanumeric': 0.10264853256979241, 'fraction_numerical': 0.002863278453829635, 'mean_word_length': 6.014056224899599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6267709', 'n_tokens_mistral': 2022, 'n_tokens_neox': 1963, 'n_words': 363}