<commit_before>"use strict";
/**
 * TrayIcon モジュール
 *
 * @module  {TrayIcon}  TrayIcon
 * @class   {TrayIcon}
 */
module.exports = new (function TrayIcon() {
    /**
     * 実行コンテキスト
     *
     * @type    {Function}
     */
    const self = this;

    /**
     * Vagrant
     *
     * @type    {Vagrant}
     */
    const Vagrant = $IF.get('./libs/Vagrant.js');

    /**
     * トレイ
     *
     * @type    {Tray}
     */
    let instance = null;

    /**
     * 更新タイミング(ミリ秒)
     *
     * @type    {Number}
     */
//     const UPDATE_INTERVAL = 300000;
    const UPDATE_INTERVAL = 10000;

    /**
     * インターバルタイマー識別子
     *
     * @type    {Number}
     */
    let idInterval = 0;

    // -------------------------------------------------------------------------
    /**
     * 初期化
     *
     * @type    {Function}
     * @method
     * @return  {Boolean}   true
     * @private
     */
    const _init = function _init() {
        instance      = new Electron.Tray(ICONS.VAGRANT);
        _update();
        instance.on('click', _showContextMenu);
        return true;
    };

    /**
     * メニュー更新
     *
     * @type    {Function}
     * @method
     * @return  {Boolean}   true
     * @private
     */
    const _updateMenu = function _updateMenu() {
        let   submenu    = [];
        const menu       = [];
        menu.push({
            icon:               ICONS.VAGRANT,
            label:              __PRODUCT__,
            enabled:            false,
        });
        // Vagrantインスタンス
        menu.push({ type: 'separator' });
        const ids        = Vagrant.list();
        let id           = '';
        let each         = null;
        let data         = {};
        let icon         = '';
        let has          = '';
        if ( ids.length > 0 ) {
            for ( let i=0 ; i<ids.length ; i++ ) {
                id       = ids[i];
                data     = Vagrant.getStatus(id);
                icon     = data.cwd + SEP + 'icon.png';
                has      = exists(icon);
                if ( has !== true ) {
                    icon = ICONS.VAGRANT;
                }
                submenu  = [];
                submenu.push({
                    icon:       ICONS.VAGRANTUP,
                    label:      'vagrant up ' + id,
                    click:      _runVagrant,
                });
                submenu.push({
                    icon:       ICONS.VAGRANTHALT,
                    label:      'vagrant halt ' + id,
                    click:      _runVagrant,
                });
                submenu.push({
                    icon:       ICONS.VAGRANTRELOAD,
                    label:      'vagrant reload ' + id,
                    click:      _runVagrant,
                });
                menu.push({
                    id:         id,
                    icon:       icon,
                    label:      id + ' : ' + data.name + ' is ' + data.state + '.',
                    sublabel:   '[' + data.cwd + '] by ' + data.provider,
                    submenu:    submenu,
                });
            }
        } else {
            menu.push({
                icon:           ICONS.DEV,
                label:          'no instances',
                enabled:        false,
            });
        }
        // 共通メニュー
        menu.push({ type: 'separator' });
        menu.push({
            icon:               ICONS.ABOUT,
            label:              'このアプリについて ...',
            click:              _showAboutWindow,
        });
        menu.push({ type: 'separator' });
        menu.push({
            icon:               ICONS.RESTART,
            label:              '再起動する',
            click:              _restartApp,
        });
        menu.push({
            icon:               ICONS.QUIT,
            label:              'アプリケーションを終了する',<commit_msg>メニューのテキストを修正．<commit_after>"use strict";
/**
 * TrayIcon モジュール
 *
 * @module  {TrayIcon}  TrayIcon
 * @class   {TrayIcon}
 */
module.exports = new (function TrayIcon() {
    /**
     * 実行コンテキスト
     *
     * @type    {Function}
     */
    const self = this;

    /**
     * Vagrant
     *
     * @type    {Vagrant}
     */
    const Vagrant = $IF.get('./libs/Vagrant.js');

    /**
     * トレイ
     *
     * @type    {Tray}
     */
    let instance = null;

    /**
     * 更新タイミング(ミリ秒)
     *
     * @type    {Number}
     */
//     const UPDATE_INTERVAL = 300000;
    const UPDATE_INTERVAL = 10000;

    /**
     * インターバルタイマー識別子
     *
     * @type    {Number}
     */
    let idInterval = 0;

    // -------------------------------------------------------------------------
    /**
     * 初期化
     *
     * @type    {Function}
     * @method
     * @return  {Boolean}   true
     * @private
     */
    const _init = function _init() {
        instance      = new Electron.Tray(ICONS.VAGRANT);
        _update();
        instance.on('click', _showContextMenu);
        return true;
    };

    /**
     * メニュー更新
     *
     * @type    {Function}
     * @method
     * @return  {Boolean}   true
     * @private
     */
    const _updateMenu = function _updateMenu() {
        let   submenu    = [];
        const menu       = [];
        menu.push({
            icon:               ICONS.VAGRANT,
            label:              __PRODUCT__,
            enabled:            false,
        });
        // Vagrantインスタンス
        menu.push({ type: 'separator' });
        const ids        = Vagrant.list();
        let id           = '';
        let each         = null;
        let data         = {};
        let icon         = '';
        let has          = '';
        if ( ids.length > 0 ) {
            for ( let i=0 ; i<ids.length ; i++ ) {
                id       = ids[i];
                data     = Vagrant.getStatus(id);
                icon     = data.cwd + SEP + 'icon.png';
                has      = exists(icon);
                if ( has !== true ) {
                    icon = ICONS.VAGRANT;
                }
                submenu  = [];
                submenu.push({
                    icon:       ICONS.VAGRANTUP,
                    label:      'vagrant up ' + id,
                    click:      _runVagrant,
                });
                submenu.push({
                    icon:       ICONS.VAGRANTHALT,
                    label:      'vagrant halt ' + id,
                    click:      _runVagrant,
                });
                submenu.push({
                    icon:       ICONS.VAGRANTRELOAD,
                    label:      'vagrant reload ' + id,
                    click:      _runVagrant,
                });
                menu.push({
                    id:         id,
                    icon:       icon,
                    label:      id + ' : ' + data.name + ' is ' + data.state + '.',
                    sublabel:   '[' + data.cwd + '] by ' + data.provider,
                    submenu:    submenu,
                });
            }
        } else {
            menu.push({
                icon:           ICONS.DEV,
                label:          'no instances',
                enabled:        false,
            });
        }
        // 共通メニュー
        menu.push({ type: 'separator' });
        menu.push({
            icon:               ICONS.ABOUT,
            label:              'About ...',
            click:              _showAboutWindow,
        });
        menu.push({ type: 'separator' });
        menu.push({
            icon:               ICONS.RESTART,
            label:              'Restart this application',
            click:              _restartApp,
        });
        menu.push({
            icon:               ICONS.QUIT,
            label:              'Quit this application',
{'fraction_non_alphanumeric': 0.13626345131596007, 'fraction_numerical': 0.0036302346687410864, 'mean_word_length': 0.8485502036903906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1030673', 'n_tokens_mistral': 2381, 'n_tokens_neox': 2234, 'n_words': 421}