<commit_before>#include "NppJsonPlugin.h"
#include "resource.h"
#include "Profile.h"
#include <tchar.h>

NppJsonPlugin* NppJsonPlugin::Callback::m_pNppJsonPlugin = nullptr;

NppJsonPlugin::NppJsonPlugin() : m_shortcutCommands(nTotalCommandCount)
{
	NppJsonPlugin::Callback::m_pNppJsonPlugin = this;
}

void NppJsonPlugin::PluginInit(HMODULE hModule)
{
	m_hModule = hModule;
}

void NppJsonPlugin::PluginCleanup()
{
}

void NppJsonPlugin::SetInfo(const NppData& notpadPlusData)
{
	m_NppData = notpadPlusData;
	InitCommandMenu();
	InitToolbarIcon();
	InitConfigPath();
}

const TCHAR* NppJsonPlugin::GetPluginName() const
{
	return PLUGIN_NAME;
}

FuncItem* NppJsonPlugin::GetFuncsArray(int* nbF)
{
	*nbF = nTotalCommandCount;
	return m_shortcutCommands.GetFuncItem();
}

void NppJsonPlugin::ProcessNotification(const SCNotification* notifyCode)
{
	switch (notifyCode->nmhdr.code)
	{
	case NPPN_TBMODIFICATION:
	{
		SetMenuIcon();
		break;
	}

	case NPPN_SHUTDOWN:
	{
		PluginCleanup();
		break;
	}

	case NPPN_BUFFERACTIVATED:
	{
		if (m_pJsonViewDlg && !m_bAboutToClose)
		{
			m_pJsonViewDlg->HandleTabActivated();
		}
		break;
	}

	case NPPN_BEFORESHUTDOWN:
	{
		m_bAboutToClose = true;
	}

	default:
		return;
	}
}

LRESULT NppJsonPlugin::MessageProc(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	return TRUE;
}

BOOL NppJsonPlugin::IsUnicode()
{
#ifdef  _UNICODE
	return TRUE;
#else
	return FALSE;
#endif //  _UNICODE
}

void NppJsonPlugin::SetMenuIcon()<commit_msg>Show json tree on lauch as well<commit_after>#include "NppJsonPlugin.h"
#include "resource.h"
#include "Profile.h"
#include <tchar.h>

NppJsonPlugin* NppJsonPlugin::Callback::m_pNppJsonPlugin = nullptr;

NppJsonPlugin::NppJsonPlugin() : m_shortcutCommands(nTotalCommandCount)
{
	NppJsonPlugin::Callback::m_pNppJsonPlugin = this;
}

void NppJsonPlugin::PluginInit(HMODULE hModule)
{
	m_hModule = hModule;
}

void NppJsonPlugin::PluginCleanup()
{
}

void NppJsonPlugin::SetInfo(const NppData& notpadPlusData)
{
	m_NppData = notpadPlusData;
	InitCommandMenu();
	InitToolbarIcon();
	InitConfigPath();
}

const TCHAR* NppJsonPlugin::GetPluginName() const
{
	return PLUGIN_NAME;
}

FuncItem* NppJsonPlugin::GetFuncsArray(int* nbF)
{
	*nbF = nTotalCommandCount;
	return m_shortcutCommands.GetFuncItem();
}

void NppJsonPlugin::ProcessNotification(const SCNotification* notifyCode)
{
	switch (notifyCode->nmhdr.code)
	{
	case NPPN_TBMODIFICATION:
	{
		SetMenuIcon();
		break;
	}

	case NPPN_SHUTDOWN:
	{
		PluginCleanup();
		break;
	}

	case NPPN_BUFFERACTIVATED:
	{
		if (m_pJsonViewDlg && !m_bAboutToClose)
		{
			m_pJsonViewDlg->HandleTabActivated();
		}
		break;
	}

	case NPPN_BEFORESHUTDOWN:
	{
		m_bAboutToClose = true;
	}

	case NPPN_READY:
	{
		// This is work arround where dialog does not show tree on launch
		if (m_pJsonViewDlg && m_pJsonViewDlg->isVisible())
		{
			::SendMessage(m_pJsonViewDlg->getHSelf(), WM_COMMAND, IDC_BTN_REFRESH, 0);
		}
	}

	default:
		return;
	}
}

LRESULT NppJsonPlugin::MessageProc(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	return TRUE;
}

BOOL NppJsonPlugin::IsUnicode()
{
#ifdef  _UNICODE
	return TRUE;
#else
	return FALSE;
#endif //  _UNICODE
}

void NppJsonPlugin::SetMenuIcon()
{'fraction_non_alphanumeric': 0.12375311720698254, 'fraction_numerical': 0.0003117206982543641, 'mean_word_length': 5.6438923395445135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7049714', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1287, 'n_words': 212}