|
// CommandHandler.cpp : Implementation of CommandHandler
#include "stdafx.h"
#include "IESBDSAddin.h"
#include "CommandHandler.h"
#include "DSAddIn.h"
#include "ComHelper.h"
using namespace std;
/////////////////////////////////////////////////////////////////////////////
// CommandHandler
void CommandHandler::showBrowser(const string &browser)
{
getAddIn()->getESBServer()->showBrowser(CComBSTR(browser.c_str()));
}
HRESULT CommandHandler::setProperties()
{
const static string function = "CommandHandler::setProperties(): ";
try {
bool isEnabled = getAddIn()->isEnabled();
string yesMsg = "Yes: reload workspace";
string noMsg = string("No: ") + (isEnabled ? "Disable" : "Enable") + string(" Eclipse Style Browsers");
string cancelMsg = "Cancel: do nothing";
switch(::MessageBox(NULL, (yesMsg + "\n" + noMsg + "\n" + cancelMsg).c_str(), "Reload Workspace", MB_YESNOCANCEL | MB_ICONQUESTION)) {
case IDNO:
{
getAddIn()->enable(!isEnabled);
// if(isEnabled) {
// getApplication()->SetAddInInfo((long) AfxGetInstanceHandle(),
// (LPDISPATCH) this, IDR_TOOLBAR_MEDIUM_A, IDR_TOOLBAR_LARGE_A, /*m_dwCookie*/-1);
// } else {
// getApplication()->SetAddInInfo((long) AfxGetInstanceHandle(),
// (LPDISPATCH) this, IDR_TOOLBAR_MEDIUM_I, IDR_TOOLBAR_LARGE_I, /*m_dwCookie*/-1);
// }
}
case IDYES:
{
getAddIn()->getEventHandler()->WorkspaceOpen();
}
}
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
HRESULT CommandHandler::showOutlineBrowser()
{
const static string function = "CommandHandler::showOutlineBrowser(): ";
try {
showBrowser("outline");
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
HRESULT CommandHandler::showHierarchyBrowser()
{
const static string function = "CommandHandler::showHierarchyBrowser(): ";
try {
showBrowser("hierarchy");
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
HRESULT CommandHandler::showTypeBrowser()
{
const static string function = "CommandHandler::showTypeBrowser(): ";
try {
showBrowser("types");
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
HRESULT CommandHandler::showMethodBrowser()
{
const static string function = "CommandHandler::showMethodBrowser(): ";
try {
showBrowser("methods");
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
HRESULT CommandHandler::showWorkspaceBrowser()
{
const static string function = "CommandHandler::showWorkspaceBrowser(): ";
try {
showBrowser("workspace");
return S_OK;
} catch(exception &e) {
DebugBox(function + e.what());
} catch(_com_error &e) {
DebugBox(function + asString(e));
} catch(...) {
DebugBox(function + " unknown error");
}
return E_FAIL;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.