HRESULT CNewTreeConflictEditorDlg::OnButtonClicked(HWND hWnd, int id)
{
    for (SVNConflictOptions::const_iterator it = m_options.begin(); it != m_options.end(); ++it)
    {
        svn_client_conflict_option_id_t optionId = (*it)->GetId();
        if (optionId + 100 == id)
        {
            if (m_svn)
            {
                if (!m_svn->ResolveTreeConflict(*m_conflictInfo, *it->get()))
                {
                    m_svn->ShowErrorDialog(hWnd);
                    return S_FALSE;
                }
            }
            else
            {
                SVN svn;
                if (!svn.ResolveTreeConflict(*m_conflictInfo, *it->get()))
                {
                    svn.ShowErrorDialog(hWnd);
                    return S_FALSE;
                }
            }
            m_choice = optionId;
            return S_OK;
        }
    }

    return S_OK;
}
HRESULT CTextConflictEditorDlg::OnButtonClicked(HWND hWnd, int id)
{
    if (id == 1000)
    {
        // Edit conflicts
        CTSVNPath theirs, mine, base;
        m_merged = m_conflictInfo->GetPath();
        m_conflictInfo->GetTextContentFiles(base, theirs, mine);
        m_mergedCreationTime = m_merged.GetLastWriteTime();
        ::SendMessage(hWnd, TDM_ENABLE_BUTTON, 100 + svn_client_conflict_option_merged_text, 0);

        CString filename, n1, n2, n3, n4;
        filename = m_merged.GetUIFileOrDirectoryName();
        n1.Format(IDS_DIFF_WCNAME, (LPCTSTR)filename);
        n2.Format(IDS_DIFF_BASENAME, (LPCTSTR)filename);
        n3.Format(IDS_DIFF_REMOTENAME, (LPCTSTR)filename);
        n4.Format(IDS_DIFF_MERGEDNAME, (LPCTSTR)filename);

        CAppUtils::MergeFlags flags;
        flags.AlternativeTool((GetKeyState(VK_SHIFT) & 0x8000) != 0);
        flags.PreventSVNResolve(true);
        CAppUtils::StartExtMerge(flags,
                                 base, theirs, mine, m_merged, true, n1, n1, n3, n4, filename);
        return S_FALSE;
    }
    for (SVNConflictOptions::const_iterator it = m_options.begin(); it != m_options.end(); ++it)
    {
        svn_client_conflict_option_id_t optionId = (*it)->GetId();
        int buttonID = 100 + optionId;

        if (buttonID == id)
        {
            if (m_svn)
            {
                if (!m_svn->ResolveTextConflict(*m_conflictInfo, *it->get()))
                {
                    m_svn->ShowErrorDialog(hWnd);
                    return S_FALSE;
                }
            }
            else
            {
                SVN svn;
                if (!svn.ResolveTextConflict(*m_conflictInfo, *it->get()))
                {
                    svn.ShowErrorDialog(hWnd);
                    return S_FALSE;
                }
            }
            m_choice = optionId;
            return S_OK;
        }
    }

    return S_OK;
}