Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / utils / NamingViewer / BindDialog.cpp
blob77eb1f35f3179fdcc73075b94d9ab570c479319e
1 #include "stdafx.h"
2 #include "NamingViewer.h"
3 #include "BindDialog.h"
4 #include "ViewIORDialog.h"
6 #ifdef _DEBUG
7 #define new DEBUG_NEW
8 #undef THIS_FILE
9 static char THIS_FILE[] = __FILE__;
10 #endif
12 /////////////////////////////////////////////////////////////////////////////
13 // CBindDialog dialog
16 CBindDialog::CBindDialog(bool Context, CORBA::ORB_ptr pORB, CWnd* pParent /*=NULL*/)
17 : CDialog(CBindDialog::IDD, pParent)
19 //{{AFX_DATA_INIT(CBindDialog)
20 m_IOR = _T("");
21 m_ID = _T("");
22 m_Kind = _T("");
23 //}}AFX_DATA_INIT
24 m_pORB = pORB;
25 m_Context = Context;
29 void CBindDialog::DoDataExchange(CDataExchange* pDX)
31 CDialog::DoDataExchange(pDX);
32 //{{AFX_DATA_MAP(CBindDialog)
33 DDX_Text(pDX, IDC_IOR, m_IOR);
34 DDX_Text(pDX, IDC_ID, m_ID);
35 DDX_Text(pDX, IDC_KIND, m_Kind);
36 //}}AFX_DATA_MAP
40 BEGIN_MESSAGE_MAP(CBindDialog, CDialog)
41 //{{AFX_MSG_MAP(CBindDialog)
42 ON_BN_CLICKED(IDC_VIEWIOR, OnViewior)
43 //}}AFX_MSG_MAP
44 END_MESSAGE_MAP()
46 /////////////////////////////////////////////////////////////////////////////
47 // CBindDialog message handlers
49 void CBindDialog::OnViewior()
51 // TODO: Add your control notification handler code here
52 try
54 UpdateData();
55 m_Object = m_pORB->string_to_object(m_IOR);
57 catch(CORBA::Exception& ex)
59 MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception"));
60 return;
62 ViewIORDialog Dialog(m_pORB, m_Object);
63 Dialog.DoModal();
66 BOOL CBindDialog::OnInitDialog()
68 CDialog::OnInitDialog();
70 // TODO: Add extra initialization here
71 if(m_Context)
73 SetWindowText(ACE_TEXT ("Bind Context"));
75 else
77 SetWindowText(ACE_TEXT ("Bind Object"));
79 return TRUE; // return TRUE unless you set the focus to a control
80 // EXCEPTION: OCX Property Pages should return FALSE
83 void CBindDialog::OnOK()
85 // TODO: Add extra validation here
86 UpdateData();
87 m_Name.length(1);
88 m_Name[0].id = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (m_ID));
89 m_Name[0].kind = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (m_Kind));
90 try
92 m_Object = m_pORB->string_to_object(m_IOR);
94 catch(CORBA::Exception& ex)
96 MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("Invalid IOR"));
97 return;
99 CDialog::OnOK();