<commit_before>package com.codeaffine.extras.jdt.internal.junitstatus;

import static com.codeaffine.extras.jdt.internal.prefs.WorkspaceScopePreferences.PREF_SHOW_JUNIT_STATUS_BAR;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.services.IEvaluationService;

import com.codeaffine.extras.jdt.internal.JDTExtrasPlugin;
import com.codeaffine.extras.jdt.internal.prefs.PreferencePropertyTester;


public class JUnitStatusBarPreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage
{

  public static final String ID = "com.codeaffine.extras.jdt.internal.JUnitStatusBarPreferencePage";

  private IWorkbench workbench;

  public JUnitStatusBarPreferencePage() {
    super( "JUnit Status Bar", FieldEditorPreferencePage.GRID );
  }

  @Override
  public void init( IWorkbench workbench ) {
    this.workbench = workbench;
  }

  @Override
  public boolean performOk() {
    boolean result = super.performOk();
    IEvaluationService evaluationService = getEvaluationService();
    if( evaluationService != null ) {
      evaluationService.requestEvaluation( PreferencePropertyTester.PROP_IS_TRUE );
    }
    return result;
  }

  @Override
  protected IPreferenceStore doGetPreferenceStore() {
    return JDTExtrasPlugin.getInstance().getPreferenceStore();
  }

  @Override
  protected void createFieldEditors() {
    String label = "&Show JUnit progress in the status bar";
    createBooleanFieldEditor( getFieldEditorParent(), label, PREF_SHOW_JUNIT_STATUS_BAR );
  }

  private void createBooleanFieldEditor( Composite parent, String label, String preferenceName ) {
    FieldEditor editor = new BooleanFieldEditor( preferenceName, label, parent );
    addField( editor );<commit_msg>Hide 'Restore Defaults' and 'Apply' buttons<commit_after>package com.codeaffine.extras.jdt.internal.junitstatus;

import static com.codeaffine.extras.jdt.internal.prefs.WorkspaceScopePreferences.PREF_SHOW_JUNIT_STATUS_BAR;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.services.IEvaluationService;

import com.codeaffine.extras.jdt.internal.JDTExtrasPlugin;
import com.codeaffine.extras.jdt.internal.prefs.PreferencePropertyTester;


public class JUnitStatusBarPreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage
{

  public static final String ID = "com.codeaffine.extras.jdt.internal.JUnitStatusBarPreferencePage";

  private IWorkbench workbench;

  public JUnitStatusBarPreferencePage() {
    super( "JUnit Status Bar", FieldEditorPreferencePage.GRID );
    noDefaultAndApplyButton();
  }

  @Override
  public void init( IWorkbench workbench ) {
    this.workbench = workbench;
  }

  @Override
  public boolean performOk() {
    boolean result = super.performOk();
    IEvaluationService evaluationService = getEvaluationService();
    if( evaluationService != null ) {
      evaluationService.requestEvaluation( PreferencePropertyTester.PROP_IS_TRUE );
    }
    return result;
  }

  @Override
  protected IPreferenceStore doGetPreferenceStore() {
    return JDTExtrasPlugin.getInstance().getPreferenceStore();
  }

  @Override
  protected void createFieldEditors() {
    String label = "&Show JUnit progress in the status bar";
    createBooleanFieldEditor( getFieldEditorParent(), label, PREF_SHOW_JUNIT_STATUS_BAR );
  }

  private void createBooleanFieldEditor( Composite parent, String label, String preferenceName ) {
    FieldEditor editor = new BooleanFieldEditor( preferenceName, label, parent );
    addField( editor );
{'fraction_non_alphanumeric': 0.0825066537624002, 'fraction_numerical': 0.0, 'mean_word_length': 5.510236220472441, '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': '7666222', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1201, 'n_words': 234}