<commit_before>/*******************************************************************************
 * Copyright (c) 2006-2008 VecTrace (<NAME>) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     <NAME>            - implementation
 *     VecTrace (Zingo Andersen) - updateing it
 *     <NAME>              - adding label decorator section 
 *     <NAME>                  - Code cleanup
 *******************************************************************************/

package com.vectrace.MercurialEclipse.preferences;


import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FileFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.vectrace.MercurialEclipse.MercurialEclipsePlugin;
import com.vectrace.MercurialEclipse.team.ResourceDecorator;

/**
 * This class represents a preference page that
 * is contributed to the Preferences dialog. By 
 * sub classing <samp>FieldEditorPreferencePage</samp>, we
 * can use the field support built into JFace that allows
 * us to create a page that is small and knows how to 
 * save, restore and apply itself.
 * <p>
 * This page is used to modify preferences only. They
 * are stored in the preference store that belongs to
 * the main plug-in class. That way, preferences can
 * be accessed directly via the preference store.
 */


public class MercurialPreferencePage    extends FieldEditorPreferencePage 
                                     implements IWorkbenchPreferencePage
{
  public MercurialPreferencePage()
  {
    super(GRID);
    setPreferenceStore(MercurialEclipsePlugin.getDefault().getPreferenceStore());
    setDescription("MercurialEclipse plugin for Mercurial(Hg) version control system");
  }

  
  /**
   * Creates the field editors. Field editors are abstractions of
   * the common GUI blocks needed to manipulate various types
   * of preferences. Each field editor knows how to save and
   * restore itself.
   */
  @Override
public void createFieldEditors() 
  {
    addField(new FileFieldEditor( MercurialPreferenceConstants.MERCURIAL_EXECUTABLE, "Mercurial &Executable:",getFieldEditorParent()));
    addField(new StringFieldEditor( MercurialPreferenceConstants.MERCURIAL_USERNAME, "Mercurial &Username:",getFieldEditorParent()));
    addField(new RadioGroupFieldEditor(
    		MercurialPreferenceConstants.LABELDECORATOR_LOGIC,
    		"When a folders contains files with different statuses, flag the folder:",
    		1,
    		new String[][]{
    				{"as Modified",MercurialPreferenceConstants.LABELDECORATOR_LOGIC_2MM},
    				{"with the most important status",MercurialPreferenceConstants.LABELDECORATOR_LOGIC_HB}
    		},
    		getFieldEditorParent(),
    		true
    		) {
    	@Override
    	protected void doStore() {
    		super.doStore();
    		ResourceDecorator.onConfigurationChanged();
    	}
    });
  }

  /* (non-Javadoc)
   * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
   */
  public void init(IWorkbench workbench) 
  {
  }
  
}<commit_msg>#173 - Fixed annoying validation of executable path<commit_after>/*******************************************************************************
 * Copyright (c) 2006-2008 VecTrace (Zingo Andersen) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     <NAME>            - implementation
 *     VecTrace (Zingo Andersen) - updateing it
 *     <NAME>              - adding label decorator section 
 *     <NAME>                  - Code cleanup
 *******************************************************************************/

package com.vectrace.MercurialEclipse.preferences;


import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FileFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.vectrace.MercurialEclipse.MercurialEclipsePlugin;
import com.vectrace.MercurialEclipse.team.ResourceDecorator;

/**
 * This class represents a preference page that
 * is contributed to the Preferences dialog. By 
 * sub classing <samp>FieldEditorPreferencePage</samp>, we
 * can use the field support built into JFace that allows
 * us to create a page that is small and knows how to 
 * save, restore and apply itself.
 * <p>
 * This page is used to modify preferences only. They
 * are stored in the preference store that belongs to
 * the main plug-in class. That way, preferences can
 * be accessed directly via the preference store.
 */


public class MercurialPreferencePage    extends FieldEditorPreferencePage 
                                     implements IWorkbenchPreferencePage
{
  public MercurialPreferencePage()
  {
    super(GRID);
    setPreferenceStore(MercurialEclipsePlugin.getDefault().getPreferenceStore());
    setDescription("MercurialEclipse plugin for Mercurial(Hg) version control system");
  }

  
  /**
   * Creates the field editors. Field editors are abstractions of
   * the common GUI blocks needed to manipulate various types
   * of preferences. Each field editor knows how to save and
   * restore itself.
   */
  @Override
public void createFieldEditors() 
  {
    addField(new FileFieldEditor( MercurialPreferenceConstants.MERCURIAL_EXECUTABLE, "Mercurial &Executable:", getFieldEditorParent())
    {
      @Override
      protected boolean checkState()
      {
        // There are other ways of doing this properly but this is better than the default behaviour
        return MercurialPreferenceConstants.MERCURIAL_EXECUTABLE.equals(getTextControl().getText()) || super.checkState();
      }
    });
    addField(new StringFieldEditor( MercurialPreferenceConstants.MERCURIAL_USERNAME, "Mercurial &Username:", getFieldEditorParent()));
    addField(new RadioGroupFieldEditor(
    		MercurialPreferenceConstants.LABELDECORATOR_LOGIC,
    		"When a folders contains files with different statuses, flag the folder:",
    		1,
    		new String[][]{
    				{"as Modified",MercurialPreferenceConstants.LABELDECORATOR_LOGIC_2MM},
    				{"with the most important status",MercurialPreferenceConstants.LABELDECORATOR_LOGIC_HB}
    		},
    		getFieldEditorParent(),
    		true
    		) {
    	@Override
    	protected void doStore() {
    		super.doStore();
    		ResourceDecorator.onConfigurationChanged();
    	}
    });
  }

  /* (non-Javadoc)
   * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
   */
  public void init(IWorkbench workbench) 
  {
  }
  
}
{'fraction_non_alphanumeric': 0.12152535270289147, 'fraction_numerical': 0.004330213716999581, 'mean_word_length': 3.860828241683639, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7323180', 'n_tokens_mistral': 2029, 'n_tokens_neox': 1945, 'n_words': 536}