summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2000-08-26 23:13:30 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2000-08-26 23:13:30 +0000
commitac5745535942fed5c6c518e7a39b304415001fee (patch)
tree4ed49af5acb117d5903f117ccc2642d57fd45d31
parent0e8fbf0c34348ca601d4770e8941209527be1b8d (diff)
downloadATCD-ac5745535942fed5c6c518e7a39b304415001fee.tar.gz
ChangeLogTag:Sat Aug 26 17:39:53 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a5
-rw-r--r--TAO/utils/README2
-rw-r--r--TAO/utils/wxNamingViewer/README50
-rw-r--r--TAO/utils/wxNamingViewer/makefile.b3226
-rw-r--r--TAO/utils/wxNamingViewer/mondrian.icobin0 -> 766 bytes
-rw-r--r--TAO/utils/wxNamingViewer/pch.h21
-rw-r--r--TAO/utils/wxNamingViewer/wxAddNameServerDlg.cpp38
-rw-r--r--TAO/utils/wxNamingViewer/wxAddNameServerDlg.h27
-rw-r--r--TAO/utils/wxNamingViewer/wxAutoDialog.h26
-rw-r--r--TAO/utils/wxNamingViewer/wxBindDialog.cpp84
-rw-r--r--TAO/utils/wxNamingViewer/wxBindDialog.h37
-rw-r--r--TAO/utils/wxNamingViewer/wxBindNewContext.cpp33
-rw-r--r--TAO/utils/wxNamingViewer/wxBindNewContext.h23
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingObject.cpp47
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingObject.h37
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingTree.cpp567
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingTree.h79
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewer.bpr246
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewer.cpp73
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewer.h25
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewer.rc4
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewer.wxr116
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewerFrame.cpp230
-rw-r--r--TAO/utils/wxNamingViewer/wxNamingViewerFrame.h41
-rw-r--r--TAO/utils/wxNamingViewer/wxSelectNSDialog.cpp152
-rw-r--r--TAO/utils/wxNamingViewer/wxSelectNSDialog.h35
-rw-r--r--TAO/utils/wxNamingViewer/wxViewIORDialog.cpp147
-rw-r--r--TAO/utils/wxNamingViewer/wxViewIORDialog.h38
28 files changed, 2209 insertions, 0 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 9efdbf6a874..fd820d7d6f6 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,8 @@
+Sat Aug 26 18:10:13 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
+
+ * utils: Added the new wxNAmingViewer utility. Thanks to
+ Charlie Frasch <cfrasch@spawar.navy.mil> for contributing this.
+
Sat Aug 26 16:02:45 2000 Balachandran Natarajan <bala@cs.wustl.edu>
* Updated dependencies of the Makefiles in $TAO_ROOT/tests.
diff --git a/TAO/utils/README b/TAO/utils/README
index 2660043e9d9..712cfaf67a9 100644
--- a/TAO/utils/README
+++ b/TAO/utils/README
@@ -16,3 +16,5 @@ with TAO.
viewer that allows users to manipulate a Naming Context
visually.
+ . wxNamingViewer -- This is a wxWindows implementation of the
+ NamingViewer.
diff --git a/TAO/utils/wxNamingViewer/README b/TAO/utils/wxNamingViewer/README
new file mode 100644
index 00000000000..d70c5072a99
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/README
@@ -0,0 +1,50 @@
+wxNamingViewer - a wxWindows implementation of NamingViewer
+Author: Charlie Frasch (cfrasch@spawar.navy.mil)
+
+Based on NamingViewer by Chris Hafey (chris@stentorsoft.com)
+
+
+1. This is an (almost) exact port of NamingViewer to wxWindows. There are some
+differences and a few minor improvements. The port was done with
+ACE 5.1.4/TAO 1.1.4 and wxWindows 2.1.5 on Borland C++ Builder 4. Chris Hafey
+contributed changes for MSVC.
+
+*) put <null> as the "root" of the naming context if a naming service cannot be
+found
+
+*) allows definition of objects with no valid IOR, uses CORBA::Object::_nil().
+
+*) uses Profile::to_string() to generate the profile(s) in the View IOR dialog
+
+*) minor changes to dialogs to enable and disable controls as appropriate
+
+*) added Edit menu with Copy item
+
+
+2. Limitations.
+
+*) (still) does not support circularly defined naming contexts.
+
+
+3. To build.
+
+For Borland C++ Builder:
+
+*) Obtain, make and install wxWindows. See http://www.wxwindows.org.
+
+*) Obtain ACE/TAO. See http://www.cs.wustl.edu/~schmidt/ACE.html.
+
+*) Build the the dynamically linked release version of ACE and TAO. See
+http://www.tenermerx.com/programming/corba/tao_bcb/index.html.
+
+*) Make the wxNamingViewer using either the command line compiler with
+make -f makefile.b32 (set ACE_ROOT as usual; set BCCDIR to your C++ Builder
+install directory) or use the C++ Builder IDE (double-click on
+wxNamingViewer.bpr. You may need to modify the include and library paths to
+suit your particular installation.
+
+
+For others: (TBD)
+
+
+
diff --git a/TAO/utils/wxNamingViewer/makefile.b32 b/TAO/utils/wxNamingViewer/makefile.b32
new file mode 100644
index 00000000000..953c4caf4a3
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/makefile.b32
@@ -0,0 +1,26 @@
+# makefile.b32 (for wxNamingViewer)
+
+WXDIR = $(WXWIN)
+
+EXTRACPPFLAGS = $(EXTRADEFINES) $(EXTRAINCLUDES) $(EXTRAFLAGS)
+EXTRADEFINES = -DACE_HAS_DLL=1 -DTAO_HAS_DLL=1 -DTAO_ORBSVCS_HAS_DLL=1 -DACE_USE_RCSID=0 -D__ACE_INLINE__=1
+EXTRAINCLUDES = -I$(ACE_ROOT) -I$(ACE_ROOT)\tao -I$(ACE_ROOT)\tao\orbsvcs
+EXTRAFLAGS = -w-rvl -w-par -w-rch -H=wxNamingViewer.csm -Hh=pch.h
+
+EXTRALINKFLAGS = -L$(ACE_ROOT)\bin\Dynamic\Release
+EXTRALIBS = ace_b.lib tao_b.lib TAO_CosNaming_b.lib
+
+TARGET = wxNamingViewer
+
+OBJECTS = wxAddNameServerDlg.obj \
+ wxBindDialog.obj\
+ wxBindNewContext.obj \
+ wxNamingObject.obj \
+ wxNamingTree.obj \
+ wxNamingViewer.obj \
+ wxNamingViewerFrame.obj \
+ wxSelectNSDialog.obj \
+ wxViewIORDialog.obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/TAO/utils/wxNamingViewer/mondrian.ico b/TAO/utils/wxNamingViewer/mondrian.ico
new file mode 100644
index 00000000000..2310c5d275a
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/mondrian.ico
Binary files differ
diff --git a/TAO/utils/wxNamingViewer/pch.h b/TAO/utils/wxNamingViewer/pch.h
new file mode 100644
index 00000000000..1f4ef2d82d5
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/pch.h
@@ -0,0 +1,21 @@
+// $Id$
+// pch.h
+
+#ifndef i_pch_h
+#define i_pch_h
+
+#include "wx/wxprec.h"
+
+#ifdef WX_PRECOMP
+#include "tao/corba.h"
+#endif
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+ #include "tao/corba.h"
+#endif
+
+#endif
diff --git a/TAO/utils/wxNamingViewer/wxAddNameServerDlg.cpp b/TAO/utils/wxNamingViewer/wxAddNameServerDlg.cpp
new file mode 100644
index 00000000000..78ada2b5192
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxAddNameServerDlg.cpp
@@ -0,0 +1,38 @@
+// $Id$
+// AddNameServerDlg.cpp
+
+#include "pch.h"
+#include "wxAddNameServerDlg.h"
+
+
+WxAddNameServerDlg::WxAddNameServerDlg( wxWindow* parent):
+ wxDialog(),
+ ior(""),
+ serverName("")
+{
+ LoadFromResource( parent, "addNameServer");
+
+ wxButton* ctrl = static_cast<wxButton*>( wxFindWindowByName(
+ "okButton",
+ this));
+ assert( ctrl);
+ ctrl->SetDefault();
+}
+
+
+bool WxAddNameServerDlg::TransferDataFromWindow()
+{
+ wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "iorText",
+ this));
+ assert( ctrl);
+ ior = ctrl->GetValue();
+
+ ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "nameText",
+ this));
+ assert( ctrl);
+ serverName = ctrl->GetValue();
+ return true;
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxAddNameServerDlg.h b/TAO/utils/wxNamingViewer/wxAddNameServerDlg.h
new file mode 100644
index 00000000000..9269c997b4b
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxAddNameServerDlg.h
@@ -0,0 +1,27 @@
+// $Id$
+// wxAddNameServerDlg.h
+
+#ifndef i_wxAddNameServerDlg_h
+#define i_wxAddNameServerDlg_h
+
+
+class WxAddNameServerDlg:
+ public wxDialog
+{
+public:
+ WxAddNameServerDlg( wxWindow* parent);
+
+ const wxString& getIor() const
+ { return ior; }
+ const wxString& getServerName() const
+ { return serverName; }
+
+private:
+ wxString ior;
+ wxString serverName;
+
+ virtual bool TransferDataFromWindow();
+};
+
+#endif
+
diff --git a/TAO/utils/wxNamingViewer/wxAutoDialog.h b/TAO/utils/wxNamingViewer/wxAutoDialog.h
new file mode 100644
index 00000000000..a649c19172d
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxAutoDialog.h
@@ -0,0 +1,26 @@
+// $Id$
+// wxAutoDialog.h
+
+#ifndef i_wxAutoDialog_h
+#define i_wxAutoDialog_h
+
+
+template <class D>
+class WxAutoDialog
+{
+public:
+ explicit WxAutoDialog( D* dialog) throw():dialog( dialog) {}
+ ~WxAutoDialog() throw() { dialog->Destroy(); }
+
+ D* operator->() const throw() { return dialog; }
+
+protected:
+ D* dialog;
+
+private:
+ // Unimplemented
+ WxAutoDialog( const WxAutoDialog<D>&);
+ WxAutoDialog<D>& operator=( const WxAutoDialog<D>&);
+};
+
+#endif
diff --git a/TAO/utils/wxNamingViewer/wxBindDialog.cpp b/TAO/utils/wxNamingViewer/wxBindDialog.cpp
new file mode 100644
index 00000000000..c7d9cdb5b30
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxBindDialog.cpp
@@ -0,0 +1,84 @@
+// $Id$
+// wxBindDialog.cpp
+
+#include "pch.h"
+#include "wxBindDialog.h"
+
+#include "wxAutoDialog.h"
+#include "wxNamingViewer.h"
+#include "wxViewIORDialog.h"
+
+
+BEGIN_EVENT_TABLE( WxBindDialog, wxDialog)
+ EVT_BUTTON( IDC_VIEWIOR, WxBindDialog::onViewIOR)
+END_EVENT_TABLE()
+
+
+WxBindDialog::WxBindDialog(
+ bool isContext,
+ CORBA::ORB_ptr orb,
+ wxWindow* parent):
+ wxDialog(),
+ isContext( isContext),
+ orb( orb)
+{
+ LoadFromResource( parent, "bindObject");
+ if (isContext) {
+
+ SetTitle( "Bind Context");
+
+ } else {
+
+ SetTitle( "Bind Object");
+ }
+ wxButton* ctrl = static_cast<wxButton*>( wxFindWindowByName(
+ "okButton",
+ this));
+ assert( ctrl);
+ ctrl->SetDefault();
+}
+
+
+void WxBindDialog::onViewIOR( wxCommandEvent& WXUNUSED(event))
+{
+ TransferDataFromWindow();
+ WxAutoDialog<WxViewIORDialog> dialog( new WxViewIORDialog( orb, object, 0));
+ dialog->ShowModal();
+}
+
+
+bool WxBindDialog::TransferDataFromWindow()
+{
+ wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "iorTextCtrl",
+ this));
+ assert( ctrl);
+ ior = ctrl->GetValue();
+
+ ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "idTextCtrl",
+ this));
+ assert( ctrl);
+ id = ctrl->GetValue();
+
+ ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "kindTextCtrl",
+ this));
+ assert( ctrl);
+ kind = ctrl->GetValue();
+
+ name.length( 1);
+ name[0].id = CORBA::string_dup( id);
+ name[0].kind = CORBA::string_dup( kind);
+ try {
+
+ object = orb->string_to_object( ior);
+
+ } catch(CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "Invalid IOR");
+ object = CORBA::Object::_nil();
+
+ }
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxBindDialog.h b/TAO/utils/wxNamingViewer/wxBindDialog.h
new file mode 100644
index 00000000000..c0b4c37250d
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxBindDialog.h
@@ -0,0 +1,37 @@
+// $Id$
+// wxBindDialog.h
+
+#ifndef i_wxBindDialog_h
+#define i_wxBindDialog_h
+
+#include "orbsvcs/CosNamingC.h"
+
+
+class WxBindDialog:
+ public wxDialog
+{
+public:
+ WxBindDialog( bool isContext, CORBA::ORB_ptr orb, wxWindow* parent);
+
+ CORBA::Object_ptr getObject() {return object;};
+ CosNaming::Name& getName() {return name;};
+
+private:
+ wxString ior;
+ wxString id;
+ wxString kind;
+
+ virtual bool TransferDataFromWindow();
+
+ void onViewIOR( wxCommandEvent& event);
+
+ CORBA::Object_var object;
+ CORBA::ORB_ptr orb;
+ CosNaming::Name name;
+ bool isContext;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+
diff --git a/TAO/utils/wxNamingViewer/wxBindNewContext.cpp b/TAO/utils/wxNamingViewer/wxBindNewContext.cpp
new file mode 100644
index 00000000000..af0fa41e75f
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxBindNewContext.cpp
@@ -0,0 +1,33 @@
+// $Id$
+// wxBindNewContext.cpp
+
+
+#include "pch.h"
+#include "wxBindNewContext.h"
+
+
+WxBindNewContext::WxBindNewContext( wxWindow* parent):
+ wxDialog()
+{
+ LoadFromResource( parent, "bindNewContext");
+}
+
+
+bool WxBindNewContext::TransferDataFromWindow()
+{
+ name.length(1);
+ wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "idText",
+ this));
+ assert( ctrl);
+ name[0].id = CORBA::string_dup( ctrl->GetValue());
+
+ ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "kindText",
+ this));
+ assert( ctrl);
+ name[0].kind = CORBA::string_dup( ctrl->GetValue());
+
+ return true;
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxBindNewContext.h b/TAO/utils/wxNamingViewer/wxBindNewContext.h
new file mode 100644
index 00000000000..f74a38e131f
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxBindNewContext.h
@@ -0,0 +1,23 @@
+// $Id$
+// wxBindNewContext.h
+
+#ifndef i_wxBindNewContext_h
+#define i_wxBindNewContext_h
+
+#include "orbsvcs/CosNamingC.h"
+
+class WxBindNewContext:
+ public wxDialog
+{
+public:
+ WxBindNewContext( wxWindow* parent);
+
+ CosNaming::Name& getName() { return name;}
+
+private:
+ virtual bool TransferDataFromWindow();
+ CosNaming::Name name;
+};
+
+#endif
+
diff --git a/TAO/utils/wxNamingViewer/wxNamingObject.cpp b/TAO/utils/wxNamingViewer/wxNamingObject.cpp
new file mode 100644
index 00000000000..841e991754d
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingObject.cpp
@@ -0,0 +1,47 @@
+// $Id$
+// wxNamingObject.cpp
+
+#include "pch.h"
+#include "WxNamingObject.h"
+
+
+WxNamingObject::WxNamingObject(
+ CosNaming::Name& Name,
+ CORBA::Object_ptr pObject,
+ bool Context):
+ m_Name(Name),
+ m_Object(CORBA::Object::_duplicate(pObject)),
+ m_Context(Context)
+{
+ // Empty
+}
+
+
+WxNamingObject::WxNamingObject( CORBA::Object_ptr pObject):
+ m_Object(CORBA::Object::_duplicate(pObject))
+{
+ // Empty
+}
+
+WxNamingObject::~WxNamingObject()
+{
+ // Empty
+}
+
+
+CosNaming::NamingContext_ptr WxNamingObject::NamingContext()
+{
+ return CosNaming::NamingContext::_narrow(m_Object);
+}
+
+
+CORBA::Object_ptr WxNamingObject::Object()
+{
+ return m_Object;
+}
+
+
+CosNaming::Name& WxNamingObject::Name()
+{
+ return m_Name;
+}
diff --git a/TAO/utils/wxNamingViewer/wxNamingObject.h b/TAO/utils/wxNamingViewer/wxNamingObject.h
new file mode 100644
index 00000000000..3daee322c6f
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingObject.h
@@ -0,0 +1,37 @@
+// $Id$
+// wxNamingObject.h
+
+#ifndef i_wxNamingObject_h
+#define i_wxNamingObject_h
+
+#include "orbsvcs/CosNamingC.h"
+#include "wx/treectrl.h"
+
+class WxNamingObject:
+ public wxTreeItemData
+{
+public:
+ WxNamingObject(
+ CosNaming::Name& Name,
+ CORBA::Object_ptr pObject,
+ bool Context);
+ WxNamingObject( CORBA::Object_ptr pObject);
+ ~WxNamingObject();
+
+ CosNaming::NamingContext_ptr NamingContext();
+ // Returns a duplicated naming context ptr if this is a context or nil if its not
+ CORBA::Object_ptr Object();
+ // returns a non duplicated object reference
+ CosNaming::Name& Name();
+ // returns the name of the object
+ bool IsContext() {return m_Context;};
+ // Returns true if this is a context
+
+private:
+ CORBA::Object_var m_Object;
+ CosNaming::Name m_Name;
+ bool m_Context;
+};
+
+#endif
+
diff --git a/TAO/utils/wxNamingViewer/wxNamingTree.cpp b/TAO/utils/wxNamingViewer/wxNamingTree.cpp
new file mode 100644
index 00000000000..f22e1fbdca7
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingTree.cpp
@@ -0,0 +1,567 @@
+// $Id$
+// wxNamingTree.cpp
+
+
+#include "pch.h"
+#include "wxNamingTree.h"
+
+#include "wx/clipbrd.h"
+#include "wxAutoDialog.h"
+#include "wxBindNewContext.h"
+#include "wxNamingObject.h"
+#include "wxBindDialog.h"
+#include "wxViewIORDialog.h"
+
+
+BEGIN_EVENT_TABLE( WxNamingTree, wxTreeCtrl)
+ EVT_MENU(
+ contextPopupBindContext,
+ WxNamingTree::onContextPopupBindContext)
+ EVT_MENU(
+ contextPopupBindNewContext,
+ WxNamingTree::onContextPopupBindNewContext)
+ EVT_MENU(
+ contextPopupBindObject,
+ WxNamingTree::onContextPopupBindObject)
+ EVT_MENU(
+ contextPopupDestroy,
+ WxNamingTree::onContextPopupDestroy)
+ EVT_MENU(
+ contextPopupRefresh,
+ WxNamingTree::onContextPopupRefresh)
+ EVT_MENU(
+ contextPopupUnbind,
+ WxNamingTree::onContextPopupUnbind)
+ EVT_MENU(
+ contextPopupViewReference,
+ WxNamingTree::onPopupViewReference)
+ EVT_MENU(
+ objectPopupUnbind,
+ WxNamingTree::onObjectPopupUnbind)
+ EVT_MENU(
+ objectPopupViewReference,
+ WxNamingTree::onPopupViewReference)
+ EVT_TREE_ITEM_EXPANDING(
+ WxNamingTree::treeCtrl,
+ WxNamingTree::onItemExpanding)
+ // For some reason RIGHT_UP doesn't work
+ EVT_RIGHT_DOWN( WxNamingTree::onRMouseUClick)
+ EVT_LEFT_DCLICK( WxNamingTree::onLeftDClick)
+END_EVENT_TABLE()
+
+
+WxNamingTree::WxNamingTree(
+ wxWindow* parent,
+ const wxWindowID id):
+ wxTreeCtrl(
+ parent,
+ id,
+ wxDefaultPosition,
+ wxSize( 234, 149)),
+ orb( 0)
+{
+ contextPopup = new wxMenu();
+ contextPopup->Append( contextPopupBindContext, "Bind context");
+ contextPopup->Append( contextPopupBindNewContext, "Bind new context");
+ contextPopup->Append( contextPopupBindObject, "Bind object");
+ contextPopup->Append( contextPopupUnbind, "Unbind");
+ contextPopup->Append( contextPopupDestroy, "Destroy");
+ contextPopup->Append( contextPopupViewReference, "View reference");
+ contextPopup->Append( contextPopupRefresh, "Refresh");
+
+ objectPopup = new wxMenu();
+ objectPopup->Append( objectPopupUnbind, "Unbind");
+ objectPopup->Append( objectPopupViewReference, "View reference");
+}
+
+
+WxNamingTree::~WxNamingTree()
+{
+ clearChildren();
+}
+
+
+void WxNamingTree::clearChildren( wxTreeItemId& item)
+{
+ if (item == wxTreeItemId( 0)) {
+
+ wxTreeItemId item = GetRootItem();
+ if (item) {
+
+ clearChildren( item);
+ Delete( item);
+
+ }
+ return;
+
+ }
+ long cookie;
+ wxTreeItemId child = GetFirstChild( item, cookie);
+ while( child) {
+
+ clearChildren( child);
+ Delete( child);
+ child = GetFirstChild( item, cookie);
+
+ }
+}
+
+
+void WxNamingTree::copySelectedToClipboard()
+{
+ WxNamingObject* object = getTreeObject();
+ try {
+
+ wxString ior = orb->object_to_string( object->Object());
+ if (wxTheClipboard->Open()) {
+
+ wxTheClipboard->SetData( new wxTextDataObject( ior));
+ wxTheClipboard->Close();
+
+ }
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+}
+
+
+WxNamingObject* WxNamingTree::getTreeObject( wxTreeItemId& item) const
+{
+ if (item == wxTreeItemId( 0)) {
+
+ item = GetSelection();
+ if (item == wxTreeItemId( 0)) {
+
+ return 0;
+
+ }
+
+ }
+ WxNamingObject* object = static_cast<WxNamingObject*>(
+ GetItemData( item));
+ return object;
+}
+
+
+void WxNamingTree::listBindingList(
+ wxTreeItemId& item,
+ CosNaming::NamingContext_ptr context,
+ CosNaming::BindingList_var& bl)
+{
+ try {
+
+ for( unsigned int i=0; i < bl->length(); i++) {
+
+ // Add each entry into the tree control
+ CORBA::Object_var object = context->resolve( bl[i].binding_name);
+ bool isContext =(bl[i].binding_type == CosNaming::ncontext);
+ WxNamingObject* newObject = new WxNamingObject(
+ bl[i].binding_name,
+ object,
+ isContext);
+ wxString name = static_cast<const char*>( (bl[i].binding_name[0]).id);
+ const wxString kind = static_cast<const char*>( (bl[i].binding_name[0]).kind);
+ if (!kind.IsNull()) {
+
+ name << " | " << kind;
+
+ }
+ wxTreeItemId contextItem = AppendItem( item, name);
+ SetItemData( contextItem, newObject);
+ switch( bl[i].binding_type) {
+
+ case CosNaming::ncontext: {
+
+ // TODO: set a different icon for contexts
+ // TODO: set only if there are children
+ SetItemHasChildren( contextItem);
+
+ }
+ break;
+
+ case CosNaming::nobject:
+ break;
+
+ }
+
+ }
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::listContext( wxTreeItemId& item)
+{
+// TODO: use hourglass
+// SetCursor( *wxHOURGLASS_CURSOR);
+ try {
+
+ // Get the item's object and make sure we have a context
+ WxNamingObject* namingObject = getTreeObject( item);
+ CosNaming::NamingContext_var context = namingObject->NamingContext();
+ if (CORBA::is_nil( context)) {
+
+ return;
+
+ }
+
+ // List the context's entries
+ CosNaming::BindingList_var bl;
+ CosNaming::BindingIterator_var bi;
+ context->list( listQuantum, bl, bi);
+ listBindingList( item, context, bl);
+ if (!CORBA::is_nil( bi)) {
+
+ while( bl->length()) {
+
+ wxString text;
+ text << "This context contains more than " << listQuantum <<
+ " entries, list the next " << listQuantum << "?";
+ if (wxMessageBox(
+ text,
+ "Question",
+ wxYES_NO | wxICON_QUESTION) == wxYES) {
+
+ bi->next_n( listQuantum, bl);
+ listBindingList( item, context, bl);
+
+ }
+
+ }
+ bi->destroy();
+
+ }
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+
+}
+
+
+void WxNamingTree::onContextPopupBindContext( wxCommandEvent& event)
+{
+ WxAutoDialog<WxBindDialog> dialog( new WxBindDialog(
+ true,
+ orb,
+ this));
+ if (dialog->ShowModal() != wxID_OK) {
+
+ return;
+
+ }
+ try {
+
+ WxNamingObject* object = getTreeObject();
+ CosNaming::NamingContext_var context = object->NamingContext();
+ if (CORBA::is_nil( context)) {
+
+ return;
+
+ }
+ CosNaming::NamingContext_var newContext =
+ CosNaming::NamingContext::_narrow( dialog->getObject());
+ if (CORBA::is_nil( newContext)) {
+
+ wxMessageBox(
+ "Object is not a CosNaming::NamingContext",
+ "Error",
+ wxOK | wxICON_EXCLAMATION,
+ this);
+ return;
+
+ }
+ context->bind_context(
+ dialog->getName(),
+ newContext);
+ onContextPopupRefresh( event);
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox(
+ ex._id(),
+ "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onContextPopupBindObject( wxCommandEvent& event)
+{
+ WxAutoDialog<WxBindDialog> dialog( new WxBindDialog(
+ false,
+ orb,
+ this));
+ if (dialog->ShowModal() != wxID_OK) {
+
+ return;
+
+ }
+ try {
+
+ wxTreeItemId item = GetSelection();
+ WxNamingObject* object = getTreeObject( item);
+ CosNaming::NamingContext_var context = object->NamingContext();
+ if (CORBA::is_nil( context)) {
+
+ return;
+
+ }
+ context->bind( dialog->getName(), dialog->getObject());
+ onContextPopupRefresh( event);
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox(
+ ex._id(),
+ "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onContextPopupBindNewContext( wxCommandEvent& event)
+{
+ wxTreeItemId item = GetSelection();
+ WxNamingObject* object = getTreeObject( item);
+ CosNaming::NamingContext_var context = object->NamingContext();
+ if (CORBA::is_nil( context)) {
+
+ return;
+
+ }
+ WxAutoDialog<WxBindNewContext> dialog( new WxBindNewContext( this));
+ if (dialog->ShowModal() != wxID_OK) {
+
+ return;
+
+ }
+ try {
+
+ CosNaming::NamingContext_var newContext = context->new_context();
+ context->bind_context( dialog->getName(), newContext);
+ onContextPopupRefresh( event);
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox(
+ ex._id(),
+ "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onContextPopupDestroy( wxCommandEvent& event)
+{
+ if (wxMessageBox(
+ "Are you sure you want to destroy this object?",
+ "Confirm",
+ wxYES_NO | wxICON_QUESTION) != wxYES) {
+
+ return;
+
+ }
+ wxTreeItemId item = GetSelection();
+ wxTreeItemId parentItem = GetParent( item);
+ if (parentItem == 0) {
+
+ return;
+
+ }
+ WxNamingObject* object = getTreeObject( item);
+ WxNamingObject* parentObject = getTreeObject( parentItem);
+ CosNaming::NamingContext_var parentNaming = parentObject->NamingContext();
+ try {
+
+ // First try to destroy, it will raise an exception if it's not empty
+ CosNaming::NamingContext_var context = object->NamingContext();
+ context->destroy();
+ // OK it's destroyed, cleanup any children we might have lying aroung
+ clearChildren( item);
+ Delete( item);
+ // Do the unbind
+ parentNaming->unbind( object->Name());
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onContextPopupRefresh( wxCommandEvent& event)
+{
+ wxTreeItemId item = GetSelection();
+ clearChildren( item);
+ listContext( item);
+}
+
+
+void WxNamingTree::onContextPopupUnbind( wxCommandEvent& event)
+{
+ if (wxMessageBox(
+ "Are you sure you want to unbind this context?",
+ "Confirm",
+ wxYES_NO | wxICON_QUESTION) != wxYES) {
+
+ return;
+
+ }
+ wxTreeItemId item = GetSelection();
+ wxTreeItemId parentItem = GetParent( item);
+ if (parentItem == 0) {
+
+ return;
+
+ }
+ WxNamingObject* object = getTreeObject( item);
+ WxNamingObject* parent = getTreeObject( parentItem);
+ CosNaming::NamingContext_var context = parent->NamingContext();
+ try {
+
+ context->unbind( object->Name());
+ clearChildren( item);
+ Delete( item);
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onItemExpanding( wxTreeEvent& event)
+{
+
+ wxTreeItemId item = event.GetItem();
+ // If this item has a child it has already been listed so nothing to do.
+ if (GetLastChild( item) != wxTreeItemId( 0)) {
+
+ return;
+
+ }
+ listContext( item);
+}
+
+
+void WxNamingTree::onLeftDClick( wxMouseEvent& event)
+{
+ wxTreeItemId item = HitTest( event.GetPosition());
+ if (!item) {
+
+ return;
+ }
+ WxAutoDialog<WxViewIORDialog> dialog( new WxViewIORDialog(
+ orb,
+ getTreeObject( item)->Object(),
+ this));
+
+ dialog->ShowModal();
+}
+
+
+void WxNamingTree::onObjectPopupUnbind( wxCommandEvent& event)
+{
+ if (wxMessageBox(
+ "Are you sure you want to unbind this object?",
+ "Confirm",
+ wxYES_NO | wxICON_QUESTION) != wxYES) {
+
+ return;
+
+ }
+ wxTreeItemId item = GetSelection();
+
+ // Make sure we don't unbind "Root"
+ wxTreeItemId parentItem = GetParent( item);
+ if (parentItem == 0) {
+
+ return;
+
+ }
+ WxNamingObject* object = getTreeObject( item);
+ WxNamingObject* parent = getTreeObject( parentItem);
+ CosNaming::NamingContext_var context = parent->NamingContext();
+ try {
+
+ context->unbind( object->Name());
+ clearChildren( item);
+ Delete( item);
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ }
+}
+
+
+void WxNamingTree::onPopupViewReference( wxCommandEvent& event)
+{
+ WxAutoDialog<WxViewIORDialog> dialog( new WxViewIORDialog(
+ orb,
+ getTreeObject()->Object(),
+ this));
+
+ dialog->ShowModal();
+}
+
+
+void WxNamingTree::onRMouseUClick( wxMouseEvent& event)
+{
+ wxTreeItemId item = HitTest( event.GetPosition());
+ if (!item) {
+
+ return;
+ }
+ // First select the item, then popup the appropriate menu
+ SelectItem( item);
+ WxNamingObject* object = getTreeObject( item);
+ CosNaming::NamingContext_var context = object->NamingContext();
+ if (CORBA::is_nil( context)) {
+
+ PopupMenu( objectPopup, event.m_x, event.m_y);
+
+ } else {
+
+ contextPopup->Enable( contextPopupDestroy, item != GetRootItem());
+ contextPopup->Enable( contextPopupUnbind, item != GetRootItem());
+ PopupMenu( contextPopup, event.m_x, event.m_y);
+
+ }
+}
+
+void WxNamingTree::resolve( CosNaming::NamingContext_ptr pRootContext)
+{
+ clearChildren();
+ if (!CORBA::is_nil( pRootContext)) {
+
+ wxTreeItemId item = AddRoot( "Root");
+ SetItemData( item, new WxNamingObject( pRootContext));
+ listContext( item);
+
+ } else {
+
+ AddRoot( "<null>");
+
+ }
+}
+
+void WxNamingTree::setOrb( CORBA::ORB_ptr pOrb)
+{
+ // This can only be called once!
+ assert( orb == 0);
+ orb = pOrb;
+}
diff --git a/TAO/utils/wxNamingViewer/wxNamingTree.h b/TAO/utils/wxNamingViewer/wxNamingTree.h
new file mode 100644
index 00000000000..bf1b59d0250
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingTree.h
@@ -0,0 +1,79 @@
+// $Id$
+// wxNamingTree.h
+
+#ifndef i_wxNamingTree_h
+#define i_wxNamingTree_h
+
+#include "wx/treectrl.h"
+#include "orbsvcs/CosNamingC.h"
+
+class wxMenu;
+class WxNamingObject;
+
+class WxNamingTree:
+ public wxTreeCtrl
+{
+public:
+ WxNamingTree(
+ wxWindow* parent,
+ const wxWindowID id = -1);
+ virtual ~WxNamingTree();
+
+ bool isNodeSelected() const
+ { return GetSelection() != 0; }
+ void copySelectedToClipboard();
+ void resolve( CosNaming::NamingContext_ptr pRootContext);
+ void setOrb( CORBA::ORB_ptr pOrb);
+
+ enum {
+ treeCtrl = 1000
+ };
+
+private:
+ CORBA::ORB_ptr orb;
+
+ enum {
+ listQuantum = 40,
+ };
+ void clearChildren( wxTreeItemId& item = wxTreeItemId( 0));
+ WxNamingObject* getTreeObject(
+ wxTreeItemId& item = wxTreeItemId( 0)) const;
+ void listBindingList(
+ wxTreeItemId& item,
+ CosNaming::NamingContext_ptr context,
+ CosNaming::BindingList_var& bl);
+ void listContext( wxTreeItemId& item);
+ void refresh( wxTreeItemId& item);
+ wxMenu* contextPopup;
+ wxMenu* objectPopup;
+ enum {
+ contextPopupBindContext,
+ contextPopupBindNewContext,
+ contextPopupBindObject,
+ contextPopupUnbind,
+ contextPopupDestroy,
+ contextPopupViewReference,
+ contextPopupRefresh,
+
+ objectPopupUnbind,
+ objectPopupViewReference,
+ };
+ void onContextPopupBindContext( wxCommandEvent& event);
+ void onContextPopupBindNewContext( wxCommandEvent& event);
+ void onContextPopupBindObject( wxCommandEvent& event);
+ void onContextPopupDestroy( wxCommandEvent& event);
+ void onContextPopupRefresh( wxCommandEvent& event);
+ void onContextPopupUnbind( wxCommandEvent& event);
+ void onPopupViewReference( wxCommandEvent& event);
+
+ void onObjectPopupUnbind( wxCommandEvent& event);
+ void onObjectPopupViewReference( wxCommandEvent& event);
+
+ void onItemExpanding( wxTreeEvent& event);
+ void onRMouseUClick( wxMouseEvent& event);
+ void onLeftDClick( wxMouseEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewer.bpr b/TAO/utils/wxNamingViewer/wxNamingViewer.bpr
new file mode 100644
index 00000000000..94064c85c29
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewer.bpr
@@ -0,0 +1,246 @@
+# ---------------------------------------------------------------------------
+!if !$d(BCB)
+BCB = $(MAKEDIR)\..
+!endif
+
+# ---------------------------------------------------------------------------
+# IDE SECTION
+# ---------------------------------------------------------------------------
+# The following section of the project makefile is managed by the BCB IDE.
+# It is recommended to use the IDE to change any of the values in this
+# section.
+# ---------------------------------------------------------------------------
+
+VERSION = BCB.04.04
+# ---------------------------------------------------------------------------
+PROJECT = wxNamingViewer.exe
+OBJFILES = wxNamingViewer.obj wxNamingViewerFrame.obj wxNamingTree.obj wxNamingObject.obj \
+ wxSelectNSDialog.obj wxBindNewContext.obj wxAddNameServerDlg.obj \
+ wxBindDialog.obj wxViewIORDialog.obj
+RESFILES = wxNamingViewer.res
+RESDEPEN = $(RESFILES)
+LIBFILES =
+IDLFILES =
+IDLGENFILES =
+LIBRARIES = Vcl40.lib
+SPARELIBS = Vcl40.lib
+PACKAGES = Vcl40.bpi Vclx40.bpi bcbsmp40.bpi Vcldb40.bpi ibsmp40.bpi vcldbx40.bpi \
+ Qrpt40.bpi TeeUI40.bpi teedb40.bpi tee40.bpi Dss40.bpi Vclmid40.bpi \
+ NMFast40.bpi Inetdb40.bpi Inet40.bpi dclocx40.bpi
+PACKAGES = Vcl40.bpi Vclx40.bpi bcbsmp40.bpi Vcldb40.bpi ibsmp40.bpi vcldbx40.bpi \
+ Qrpt40.bpi TeeUI40.bpi teedb40.bpi tee40.bpi Dss40.bpi Vclmid40.bpi \
+ NMFast40.bpi Inetdb40.bpi Inet40.bpi dclocx40.bpi
+DEFFILE =
+# ---------------------------------------------------------------------------
+PATHCPP = .;
+PATHASM = .;
+PATHPAS = .;
+PATHRC = .;
+DEBUGLIBPATH = $(BCB)\lib\debug
+RELEASELIBPATH = $(BCB)\lib\release
+SYSDEFINES = _NO_VCL;_RTLDLL
+USERDEFINES = __WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0;NDEBUG
+# ---------------------------------------------------------------------------
+CFLAG1 = -I"..\..\Program Files\wx2\include";..\..\ACE_wrappers;..\..\ACE_wrappers\Tao;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include \
+ -O2 -H=d:\cfrasch\wxNamingViewer\wxNamingViewer.csm -Hh=pch.h -w-rvl -w-rch \
+ -w-par -w-hid -w-aus -Tkh30000 -X- -a1 -d -k- -vi -c -tWM -tW \
+ -D$(SYSDEFINES);$(USERDEFINES)
+IDLCFLAGS = -I"..\..\Program Files\wx2\include" -I..\..\ACE_wrappers \
+ -I..\..\ACE_wrappers\Tao -I..\..\ACE_wrappers\TAO\orbsvcs -I$(BCB)\include \
+ -src_suffixcpp -D__WXWIN__ -D__WXMSW__ -D__WINDOWS__ -DWIN32 -DUSE_DEFINE \
+ -D__WIN95__ -DACE_HAS_DLL=1 -DTAO_HAS_DLL=1 -DTAO_ORBSVCS_HAS_DLL=1 \
+ -DACE_USE_RCSID=0 -DNDEBUG
+PFLAGS = -U"..\..\Program Files\wx2\lib";..\..\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib;$(DEBUGLIBPATH) \
+ -I"..\..\Program Files\wx2\include";..\..\ACE_wrappers;..\..\ACE_wrappers\Tao;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include \
+ -D__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0;NDEBUG \
+ -$Y- -$L- -$D-
+IIDLCFLAGS = -src_suffixcpp -I$(BCB)\include -I"..\..\Program Files\wx2\include" -D__WXWIN__ \
+ -D__WXMSW__ -D__WINDOWS__ -DWIN32 -DUSE_DEFINE -D__WIN95__
+FLAGS = -U$(BCB)\lib;$(DEBUGLIBPATH) -I$(BCB)\include;"..\..\Program Files\wx2\include" \
+ -D__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__ -$YD -$W -$O- -v \
+ -JPHN -M
+RFLAGS = -i"..\..\Program Files\wx2\include";..\..\ACE_wrappers;..\..\ACE_wrappers\Tao;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include \
+ -D__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0;NDEBUG
+AFLAGS = /i"..\..\Program Files\wx2\include" /id:\ACE_wrappers /i..\..\ACE_wrappers\Tao \
+ /id:\ACE_wrappers\TAO\orbsvcs /i$(BCB)\include /d__WXWIN__ /d__WXMSW__ \
+ /d__WINDOWS__ /dWIN32 /dUSE_DEFINE /d__WIN95__ /dACE_HAS_DLL=1 /dTAO_HAS_DLL=1 \
+ /dTAO_ORBSVCS_HAS_DLL=1 /dACE_USE_RCSID=0 /dNDEBUG /mx /w2 /zn
+LFLAGS = -L"..\..\Program Files\wx2\lib";..\..\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib;$(DEBUGLIBPATH) \
+ -aa -Tpe -x -Gn
+# ---------------------------------------------------------------------------
+ALLOBJ = c0w32.obj $(OBJFILES)
+ALLRES = $(RESFILES)
+ALLLIB = $(LIBFILES) wx32.lib import32.lib cw32mti.lib xpm.lib tao_b.lib ace_b.lib TAO_CosNaming_b.lib
+# ---------------------------------------------------------------------------
+!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=Executable (GUI)
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=20
+Item0=..\..\Program Files\wx2\include;d:\ACE_wrappers;..\..\ACE_wrappers\Tao;d:\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item1=..\..\Program Files\wx2\include;$(ACE_ROOT);d:\ACE_wrappers\Tao;$(ACE_ROOT)\TAO\orbsvcs;$(BCB)\include
+Item2=..\..\Program Files\wx2\include;$(ACE_ROOT);$(ACE_ROOT)\TAO;$(ACE_ROOT)\TAO\orbsvcs;$(BCB)\include
+Item3=..\..\Program Files\wx2\include;$(ACE_ROOT);$(ACE_ROOT\TAO;$(ACE_ROOT)\TAO\orbsvcs;$(BCB)\include
+Item4=..\..\Program Files\wx2\include;$(ACE_ROOT);..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item5=..\..\Program Files\wx2\include;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item6=D:\Program Files\wx2\include;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item7=..\..\Program Files\wx2;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item8=..\..\Program Files\wx2;D:\ACE_wrappers;D:\ACE_wrappers\TAO;D:\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item9=D:\Program Files\wx2;$(ACE_ROOT);$(ACE_ROOT\tao;$(ACE_ROOT\tao\orbsvcs;$(BCB)\include
+Item10=$(WXWIN)\include;$(ACE_ROOT);$(ACE_ROOT\tao;$(ACE_ROOT\tao\orbsvcs;$(BCB)\include
+Item11=..\..\Program Files\wx2\include;$(ACE_ROOT);$(ACE_ROOT\tao;$(ACE_ROOT\tao\orbsvcs;$(BCB)\include
+Item12=..\..\ACE_wrappers\TAO\utils\NamingViewer;..\..\PROGRAM FILES\CBUILDER4\OBJREPOS;..\..\Program Files\wx2\include;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item13=..\..\ACE_wrappers\TAO\utils\NamingViewer;..\..\Program Files\wx2\samples\resource;..\..\PROGRAM FILES\CBUILDER4\OBJREPOS;..\..\Program Files\wx2\include;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;..\..\ACE_wrappers\TAO\orbsvcs;$(BCB)\include
+Item14=..\..\Program Files\wx2\include;..\..\ACE_wrappers;..\..\ACE_wrappers\TAO;$(BCB)\include
+Item15=D:\Program Files\wx2\include;D:\ACE_wrappers;D:\ACE_wrappers\TAO
+Item16=$(BCB)\include;..\..\Program Files\wx2\include;..\..\ACE_wrappers
+Item17=$(BCB)\include;..\..\Program Files\wx2\include;D:\ACE_wrappers
+Item18=$(BCB)\include;..\..\Program Files\wx2\include
+Item19=$(BCB)\include;D:\Program Files\wx2\include
+
+[HistoryLists\hlLibraryPath]
+Count=9
+Item0=..\..\Program Files\wx2\lib;..\..\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib
+Item1=..\..\Program Files\wx2\lib;D:\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib
+Item2=..\..\Program Files\wx2\lib;..\..\bin\Dynamic\Release;$(BCB)\lib
+Item3=..\..\Program Files\wx2\lib;$(ACE_ROOT)\bin\Dynamic\Release;$(BCB)\lib
+Item4=..\..\ACE_wrappers\TAO\utils\NamingViewer;..\..\PROGRAM FILES\CBUILDER4\OBJREPOS;..\..\Program Files\wx2\lib;..\..\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib
+Item5=..\..\ACE_wrappers\TAO\utils\NamingViewer;..\..\Program Files\wx2\samples\resource;..\..\PROGRAM FILES\CBUILDER4\OBJREPOS;..\..\Program Files\wx2\lib;..\..\ACE_wrappers\bin\Dynamic\Release;$(BCB)\lib
+Item6=..\..\Program Files\wx2\lib;$(BCB)\lib
+Item7=D:\Program Files\wx2\lib;$(BCB)\lib
+Item8=$(BCB)\lib
+
+[HistoryLists\hlConditionals]
+Count=5
+Item0=__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0;NDEBUG
+Item1=__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0
+Item2=__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;TAO_HAS_DLL=1;TAO_ORBSVCS_HAS_DLL=1;ACE_USE_RCSID=0;USEUNIT(x)
+Item3=__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__;ACE_HAS_DLL=1;ACE_USE_RCSID=0
+Item4=__WXWIN__;__WXMSW__;__WINDOWS__;WIN32;USE_DEFINE;__WIN95__
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+InMemoryExe=0
+ShowInfoMsgs=0
+
+[CORBA]
+AddServerUnit=1
+AddClientUnit=1
+PrecompiledHeaders=1
+
+!endif
+
+# ---------------------------------------------------------------------------
+# MAKE SECTION
+# ---------------------------------------------------------------------------
+# This section of the project file is not used by the BCB IDE. It is for
+# the benefit of building from the command-line using the MAKE utility.
+# ---------------------------------------------------------------------------
+
+.autodepend
+# ---------------------------------------------------------------------------
+!if !$d(BCC32)
+BCC32 = bcc32
+!endif
+
+!if !$d(DCC32)
+DCC32 = dcc32
+!endif
+
+!if !$d(TASM32)
+TASM32 = tasm32
+!endif
+
+!if !$d(LINKER)
+LINKER = ilink32
+!endif
+
+!if !$d(BRCC32)
+BRCC32 = brcc32
+!endif
+
+!if !$d(IDL2CPP)
+IDL2CPP = idl2cpp
+!endif
+
+# ---------------------------------------------------------------------------
+!if $d(PATHCPP)
+.PATH.CPP = $(PATHCPP)
+.PATH.C = $(PATHCPP)
+!endif
+
+!if $d(PATHPAS)
+.PATH.PAS = $(PATHPAS)
+!endif
+
+!if $d(PATHASM)
+.PATH.ASM = $(PATHASM)
+!endif
+
+!if $d(PATHRC)
+.PATH.RC = $(PATHRC)
+!endif
+# ---------------------------------------------------------------------------
+$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
+ $(BCB)\BIN\$(LINKER) @&&!
+ $(LFLAGS) +
+ $(ALLOBJ), +
+ $(PROJECT),, +
+ $(ALLLIB), +
+ $(DEFFILE), +
+ $(ALLRES)
+!
+# ---------------------------------------------------------------------------
+.pas.hpp:
+ $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.pas.obj:
+ $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.cpp.obj:
+ $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
+
+.c.obj:
+ $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
+
+.asm.obj:
+ $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
+
+.rc.res:
+ $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
+# ---------------------------------------------------------------------------
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewer.cpp b/TAO/utils/wxNamingViewer/wxNamingViewer.cpp
new file mode 100644
index 00000000000..2b59337092b
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewer.cpp
@@ -0,0 +1,73 @@
+// $Id$
+// wxNamingViewer.cpp - wxWindows-based CORBA naming viewer
+// Author: Charlie Frasch (cfrasch@spawar.navy.mil)
+//
+// Based on NamingViewer Version 1.0 by Chris Hafey (chris@stentorsoft.com)
+
+#include "pch.h"
+#include "wx/resource.h"
+#include "wxNamingViewerFrame.h"
+#include "wxNamingViewer.wxr"
+
+// Stuff for the C++Builder IDE
+#define USEUNIT(x)
+#define USERC(x)
+#define USEFILE(x)
+USEFILE("Readme");
+USEUNIT("wxNamingViewerFrame.cpp");
+USEUNIT("wxNamingTree.cpp");
+USEUNIT("wxNamingObject.cpp");
+USEFILE("wxNamingViewer.wxr");
+USEUNIT("wxSelectNSDialog.cpp");
+USEUNIT("wxBindNewContext.cpp");
+USEUNIT("wxAddNameServerDlg.cpp");
+USEUNIT("wxBindDialog.cpp");
+USEUNIT("wxViewIORDialog.cpp");
+USERC("wxNamingViewer.rc");
+//---------------------------------------------------------------------------
+class WxNamingViewer:
+ public wxApp
+{
+public:
+ virtual bool OnInit();
+ virtual int OnExit();
+};
+
+
+IMPLEMENT_APP(WxNamingViewer)
+
+// Need this to keep C++Builder 4 happy
+#ifdef __BORLANDC__
+extern WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int);
+#endif
+
+
+int WxNamingViewer::OnExit()
+{
+ ACE::fini();
+ return 0;
+}
+
+
+bool WxNamingViewer::OnInit()
+{
+ ACE::init();
+ CORBA::ORB_var orb = CORBA::ORB_init(
+ argc,
+ argv);
+
+ wxResourceParseData( bindObject);
+ wxResourceParseData( selectNS);
+ wxResourceParseData( addNameServer);
+ wxResourceParseData( bindNewContext);
+ wxResourceParseData( viewIOR);
+
+ WxNamingViewerFrame* frame = new WxNamingViewerFrame(
+ "wxNamingViewer",
+ wxDefaultPosition,
+ wxSize( 248, 198),
+ orb);
+ frame->Show( TRUE);
+ return TRUE;
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewer.h b/TAO/utils/wxNamingViewer/wxNamingViewer.h
new file mode 100644
index 00000000000..dc39dc2cb03
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewer.h
@@ -0,0 +1,25 @@
+// $Id$
+/*
+ * wxNamingViewer.h
+ * Window identifiers file written by Dialog Editor
+ */
+
+#define IDC_SELECT_NS 1013
+#define IDD_SELECT_NS 135
+#define IDC_ID 1015
+#define IDD_ADD_NAME_SERVER 136
+#define IDC_NS 1027
+#define IDC_ADD 1022
+#define IDC_IOR 1002
+#define IDD_BIND_NEW_CONTEXT 134
+#define IDD_BIND 133
+#define IDC_NAME 1025
+#define IDC_KIND 1017
+#define IDD_NAMINGVIEWER_DIALOG 102
+#define IDC_REMOVE 1023
+#define IDC_SERVER 1014
+#define IDC_DEFAULT 1028
+#define IDC_VIEWIOR 1018
+#define IDC_SERVERS 1024
+#define IDC_TYPE_ID 1007
+#define IDC_PROFILES 1012
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewer.rc b/TAO/utils/wxNamingViewer/wxNamingViewer.rc
new file mode 100644
index 00000000000..4e1acde7357
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewer.rc
@@ -0,0 +1,4 @@
+#include "wx/msw/wx.rc"
+mondrian ICON "mondrian.ico"
+
+wxNamingViewerResources WXRDATA "wxNamingViewer.wxr"
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewer.wxr b/TAO/utils/wxNamingViewer/wxNamingViewer.wxr
new file mode 100644
index 00000000000..48a9e15cc2d
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewer.wxr
@@ -0,0 +1,116 @@
+static char *bindObject = "dialog(name = 'bindObject',\
+ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
+ title = 'Bind Object/Context',\
+ id = 133,\
+ x = -1, y = -1, width = 274, height = 66,\
+ background_colour = 'C0C0C0',\
+ use_dialog_units = 1,\
+ use_system_defaults = 0,\
+ font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
+ control = [5100, wxButton, 'OK', 'wxNO_BORDER', 'okButton', 77, 45, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5101, wxButton, 'Cancel', '0', 'cancelPButton', 152, 45, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Id:', '0', 'statictext10', 7, 9, 6, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1015, wxTextCtrl, '', '0', 'idTextCtrl', 35, 7, 115, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Kind:', '0', 'statictext12', 163, 9, 17, 8, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'IOR:', '0', 'statictext14', 7, 28, 22, 8, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1017, wxTextCtrl, '', '0', 'kindTextCtrl', 185, 7, 87, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1002, wxTextCtrl, '', '0', 'iorTextCtrl', 35, 26, 174, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1018, wxButton, 'View IOR', '0', 'viewIORButton', 222, 26, 50, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
+
+static char *addNameServer = "dialog(name = 'addNameServer',\
+ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
+ title = 'Add Name Server',\
+ id = 136,\
+ x = -1, y = -1, width = 186, height = 69,\
+ background_colour = 'C0C0C0',\
+ use_dialog_units = 1,\
+ use_system_defaults = 0,\
+ font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
+ control = [1025, wxTextCtrl, '', '0', 'nameText', 36, 7, 143, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1002, wxTextCtrl, '', '0', 'iorText', 37, 27, 142, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5100, wxButton, 'OK', '0', 'okButton', 26, 48, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5101, wxButton, 'Cancel', '0', 'button5', 109, 48, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Name:', '0', 'statictext6', 7, 10, 22, 8, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'IOR:', '0', 'statictext7', 7, 30, 24, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
+
+static char *bindNewContext = "dialog(name = 'bindNewContext',\
+ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
+ title = 'Bind New Context',\
+ id = 134,\
+ x = -1, y = -1, width = 154, height = 76,\
+ background_colour = 'C0C0C0',\
+ use_dialog_units = 1,\
+ use_system_defaults = 0,\
+ font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
+ control = [1015, wxTextCtrl, '', '0', 'idText', 16, 7, 135, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1017, wxTextCtrl, '', '0', 'kindText', 27, 31, 125, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5100, wxButton, 'OK', '0', 'button4', 18, 55, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5101, wxButton, 'Cancel', '0', 'button5', 91, 55, 50, 14, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Id:', '0', 'statictext6', 7, 10, 8, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Kind:', '0', 'statictext7', 7, 34, 15, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
+
+static char *viewIOR = "dialog(name = 'viewIOR',\
+ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
+ title = 'View IOR',\
+ id = 102,\
+ x = -1, y = -1, width = 394, height = 127,\
+ background_colour = 'C0C0C0',\
+ use_dialog_units = 1,\
+ use_system_defaults = 0,\
+ font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
+ control = [5100, wxButton, 'OK', '0', 'okButton', 342, 26, 42, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5102, wxButton, 'Apply', '0', 'applyButton', 342, 7, 42, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'IOR:', '0', 'statictext4', 7, 9, 12, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1002, wxTextCtrl, '', '0', 'iorText', 27, 7, 304, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5105, wxStaticText, 'Repository ID:', '0', 'statictext6', 7, 30, 46, 6, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1007, wxTextCtrl, '', 'wxTE_READONLY', 'typeIDText', 57, 27, 274, 12, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
+
+static char *selectNS = "dialog(name = 'selectNS',\
+ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
+ title = 'Select Naming Service',\
+ id = 135,\
+ x = -1, y = -1, width = 181, height = 94,\
+ background_colour = 'C0C0C0',\
+ use_dialog_units = 1,\
+ use_system_defaults = 0,\
+ font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
+ control = [1024, wxListBox, '', 'wxLB_SINGLE', 'serversList', 7, 7, 107, 80, [],\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5100, wxButton, 'OK', '0', 'okButton', 128, 7, 41, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1028, wxButton, 'Default', '0', 'button1', 128, 24, 42, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1022, wxButton, 'Add', '0', 'button4', 128, 41, 41, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [1023, wxButton, 'Remove', '0', 'button5', 128, 58, 41, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
+ control = [5101, wxButton, 'Cancel', '0', 'button6', 128, 76, 41, 11, '',\
+ [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
+
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewerFrame.cpp b/TAO/utils/wxNamingViewer/wxNamingViewerFrame.cpp
new file mode 100644
index 00000000000..7c5a162618f
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewerFrame.cpp
@@ -0,0 +1,230 @@
+// $Id$
+// wxNamingViewerFrame.cpp
+
+#include "pch.h"
+#include "wxNamingViewerFrame.h"
+
+#include "wx/clipbrd.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
+#include "wxNamingViewer.h"
+#include "wxSelectNSDialog.h"
+
+
+enum {
+ menuQuit = 1,
+ menuAbout,
+ menuCopy,
+ buttonSelectNS = IDC_SELECT_NS
+};
+
+
+BEGIN_EVENT_TABLE( WxNamingViewerFrame, wxFrame)
+ EVT_MENU( menuQuit, WxNamingViewerFrame::OnQuit)
+ EVT_MENU( menuAbout, WxNamingViewerFrame::OnAbout)
+ EVT_MENU( menuCopy, WxNamingViewerFrame::onMenuCopy)
+ EVT_UPDATE_UI( menuCopy, WxNamingViewerFrame::onUpdateUICopy)
+ EVT_BUTTON( buttonSelectNS, WxNamingViewerFrame::onSelectNS)
+END_EVENT_TABLE()
+
+
+WxNamingViewerFrame::WxNamingViewerFrame(
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ CORBA::ORB_ptr pOrb):
+ wxFrame(
+ (wxFrame *)NULL,
+ -1, title,
+ pos,
+ size),
+ pOrb( pOrb),
+ tree( 0),
+ server( "")
+{
+ SetIcon( wxICON( mondrian));
+
+ wxMenu* fileMenu = new wxMenu( "", wxMENU_TEAROFF);
+ fileMenu->Append( menuQuit, "E&xit", "Quit this program");
+
+ wxMenu* editMenu = new wxMenu( "", wxMENU_TEAROFF);
+ editMenu->Append( menuCopy, "&Copy\tCtrl+C");
+
+ wxMenu* helpMenu = new wxMenu();
+ helpMenu->Append( menuAbout, "&About...", "Show about dialog");
+
+ wxMenuBar* menuBar = new wxMenuBar();
+ menuBar->Append( fileMenu, "&File");
+ menuBar->Append( editMenu, "&Edit");
+ menuBar->Append( helpMenu, "&Help");
+ SetMenuBar( menuBar);
+
+ wxPanel* panel = new wxPanel(
+ this,
+ -1);
+ wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL);
+ topSizer->Add( panel, 1, wxGROW);
+
+ wxBoxSizer* nsSizer = new wxStaticBoxSizer(
+ new wxStaticBox(
+ panel,
+ IDC_NS,
+ "Name Server"),
+ wxHORIZONTAL);
+ serverText = new wxTextCtrl(
+ panel,
+ IDC_SERVER,
+ "",
+ wxDefaultPosition,
+ wxSize( 158, 20),
+ wxTE_READONLY);
+ wxButton* selectNSButton = new wxButton(
+ panel,
+ IDC_SELECT_NS,
+ "Select",
+ wxDefaultPosition,
+ wxSize( 50, 20));
+ nsSizer->Add( serverText, 1, wxGROW);
+ nsSizer->Add( selectNSButton, 0, wxALIGN_LEFT | wxLEFT, 10);
+
+ wxBoxSizer* treeSizer = new wxBoxSizer( wxVERTICAL);
+ treeSizer->Add( nsSizer, 0, wxGROW);
+ tree = new WxNamingTree(
+ panel,
+ WxNamingTree::treeCtrl);
+ treeSizer->Add( tree, 1, wxGROW);
+
+ panel->SetAutoLayout( TRUE );
+ panel->SetSizer( treeSizer );
+ treeSizer->Fit( this);
+ treeSizer->SetSizeHints( this);
+
+ selectNS = new WxSelectNSDialog( this);
+
+ tree->setOrb( pOrb);
+ setDefaultNS();
+ resolve();
+}
+
+
+WxNamingViewerFrame::~WxNamingViewerFrame()
+{
+ selectNS->Destroy();
+}
+
+
+void WxNamingViewerFrame::OnQuit( wxCommandEvent& WXUNUSED(event))
+{
+ Close( TRUE);
+}
+
+
+void WxNamingViewerFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ wxString msg( "wxNamingViewer Version 1.0\n"
+ "Copyright (C) 2000\n"
+ " Author: Charlie Frasch (cfrasch@spawar.navy.mil)");
+
+ wxMessageBox(
+ msg.c_str(),
+ "About wxNamingViewer",
+ wxOK | wxICON_INFORMATION,
+ this);
+}
+
+
+void WxNamingViewerFrame::onMenuCopy( wxCommandEvent& WXUNUSED( event))
+{
+ tree->copySelectedToClipboard();
+}
+
+
+void WxNamingViewerFrame::onSelectNS( wxCommandEvent& WXUNUSED( event))
+{
+ switch( selectNS->ShowModal()) {
+
+ case wxID_OK:
+ try {
+
+// TODO: need hourglass
+ CORBA::Object_var object = pOrb->string_to_object(
+ selectNS->getIOR().c_str());
+ rootContext = CosNaming::NamingContext::_narrow( object);
+ server = selectNS->getServerName();
+ serverText->SetValue( server);
+ resolve();
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox(
+ ex._id(),
+ "CORBA::Exception");
+
+ }
+ break;
+
+ case IDC_DEFAULT:
+// TODO: need hourglass
+ setDefaultNS();
+ resolve();
+ break;
+
+ }
+}
+
+
+void WxNamingViewerFrame::onUpdateUICopy( wxUpdateUIEvent& event)
+{
+ event.Enable( tree->isNodeSelected());
+}
+
+
+void WxNamingViewerFrame::resolve()
+{
+ tree->resolve( rootContext);
+}
+
+
+void WxNamingViewerFrame::setDefaultNS()
+{
+ server = "Default";
+ serverText->SetValue( server);
+
+ TAO_Naming_Client client;
+ if (client.init( pOrb) == 0) {
+
+ rootContext = client.get_context();
+
+ // For debugging, sets up some initial contexts in the NS
+/*
+ CosNaming::NamingContext_var app2;
+ app2 = rootContext->new_context();
+
+ CosNaming::Name name;
+ name.length( 1);
+ name[0].id = CORBA::string_dup( "app2");
+ rootContext->rebind_context( name, app2);
+
+ CosNaming::NamingContext_var devices;
+ devices = app2->new_context();
+ name[0].id = CORBA::string_dup( "devices");
+ app2->rebind_context( name, devices);
+
+ CosNaming::NamingContext_var collections;
+ collections = app2->new_context();
+ name[0].id = CORBA::string_dup( "collections");
+ app2->rebind_context( name, collections);
+
+ name[0].id = CORBA::string_dup( "my app");
+ CORBA::Object_var myApp = CORBA::Object::_nil();
+ app2->rebind( name, myApp);
+
+ name[0].id = CORBA::string_dup( "dev1");
+ CORBA::Object_var dev1 = CORBA::Object::_nil();
+ devices->rebind( name, myApp);
+
+ name[0].id = CORBA::string_dup( "dev2");
+ CORBA::Object_var dev2 = CORBA::Object::_nil();
+ devices->rebind( name, myApp);
+*/
+ }
+}
diff --git a/TAO/utils/wxNamingViewer/wxNamingViewerFrame.h b/TAO/utils/wxNamingViewer/wxNamingViewerFrame.h
new file mode 100644
index 00000000000..f3c316a8252
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxNamingViewerFrame.h
@@ -0,0 +1,41 @@
+// $Id$
+// wxNamingViewerFrame.h
+
+#ifndef i_wxNamingViewerFrame_h
+#define i_wxNamingViewerFrame_h
+
+#include "orbsvcs/CosNamingC.h"
+#include "wxNamingTree.h"
+
+class WxNamingViewerFrame:
+ public wxFrame
+{
+public:
+ WxNamingViewerFrame(
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ CORBA::ORB_ptr pOrb);
+ virtual ~WxNamingViewerFrame();
+
+ void OnQuit( wxCommandEvent& event);
+ void OnAbout( wxCommandEvent& event);
+ void onSelectNS( wxCommandEvent& event);
+
+private:
+ CORBA::ORB_ptr pOrb;
+ CosNaming::NamingContext_var rootContext;
+ WxNamingTree* tree;
+ wxTextCtrl* serverText;
+ wxString server;
+ class WxSelectNSDialog* selectNS;
+ void resolve();
+ void setDefaultNS();
+
+ void onMenuCopy( wxCommandEvent& event);
+ void onUpdateUICopy( wxUpdateUIEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
diff --git a/TAO/utils/wxNamingViewer/wxSelectNSDialog.cpp b/TAO/utils/wxNamingViewer/wxSelectNSDialog.cpp
new file mode 100644
index 00000000000..0601ca662f4
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxSelectNSDialog.cpp
@@ -0,0 +1,152 @@
+// $Id$
+// wxSelectNSDialog.cpp
+
+#include "pch.h"
+#include "wxSelectNSDialog.h"
+
+#include "ace/Configuration.h"
+#include "wxAddNameServerDlg.h"
+#include "wxAutoDialog.h"
+#include "wxNamingViewer.h"
+
+
+
+BEGIN_EVENT_TABLE( WxSelectNSDialog, wxDialog)
+ EVT_BUTTON( IDC_ADD, WxSelectNSDialog::onAdd)
+ EVT_BUTTON( IDC_DEFAULT, WxSelectNSDialog::onDefault)
+ EVT_BUTTON( wxID_OK, WxSelectNSDialog::onOK)
+ EVT_BUTTON( IDC_REMOVE, WxSelectNSDialog::onRemove)
+ EVT_INIT_DIALOG( WxSelectNSDialog::onInitDialog)
+ EVT_LISTBOX_DCLICK( IDC_SERVERS, WxSelectNSDialog::onLeftDClick)
+END_EVENT_TABLE()
+
+
+WxSelectNSDialog::WxSelectNSDialog( wxWindow* parent):
+ wxDialog(),
+ config( 0)
+{
+ LoadFromResource( parent, "selectNS");
+ servers = static_cast<wxListBox*>( wxFindWindowByName(
+ "serversList",
+ this));
+ assert( servers);
+
+#if defined (ACE_WIN32)
+ HKEY hKey = ACE_Configuration_Win32Registry::resolve_key(
+ HKEY_LOCAL_MACHINE,
+ "Software\\TAO\\NamingViewer\\Servers");
+ config = new ACE_Configuration_Win32Registry( hKey);
+#else
+ // TODO: non-windoz
+ assert( config);
+#endif
+ ACE_Configuration_Section_Key section = config->root_section();
+ int index = 0;
+ ACE_TString name;
+ ACE_Configuration::VALUETYPE type;
+ while(config->enumerate_values( section, index, name, type) == 0) {
+
+ ACE_TString value;
+ if(config->get_string_value( section, name.c_str(), value) == 0) {
+
+ servers->Append(
+ name.c_str(),
+ new wxString( value.c_str()));
+
+ }
+ index++;
+
+ }
+}
+
+
+WxSelectNSDialog::~WxSelectNSDialog()
+{
+ int count = servers->Number();
+ for (int i = 0; i < count; i++) {
+
+ delete static_cast<wxString*>( servers->GetClientData( i));
+
+ }
+}
+
+
+void WxSelectNSDialog::onAdd( wxCommandEvent& WXUNUSED(event))
+{
+ WxAutoDialog<WxAddNameServerDlg> dialog( new WxAddNameServerDlg( this));
+ if (dialog->ShowModal() == wxID_OK) {
+
+ servers->Append(
+ dialog->getServerName(),
+ new wxString( dialog->getIor()));
+ ACE_Configuration_Section_Key section = config->root_section();
+ ACE_TString value = dialog->getIor().c_str();
+ config->set_string_value(
+ section,
+ dialog->getServerName().c_str(),
+ value);
+
+ }
+}
+
+
+void WxSelectNSDialog::onDefault( wxCommandEvent& WXUNUSED(event))
+{
+ EndModal( IDC_DEFAULT);
+}
+
+
+void WxSelectNSDialog::onInitDialog( wxInitDialogEvent& event)
+{
+ wxButton* ctrl = static_cast<wxButton*>( wxFindWindowByName(
+ "okButton",
+ this));
+ assert( ctrl);
+ ctrl->SetDefault();
+ servers->SetFocus();
+}
+
+
+void WxSelectNSDialog::onLeftDClick( wxMouseEvent& event)
+{
+ int index = servers->GetSelection();
+ // I don't think index will ever be -1!
+ assert( index != -1);
+ ior = *static_cast<wxString*>( servers->GetClientData( index));
+ serverName = servers->GetString( index);
+ EndModal( wxID_OK);
+}
+
+
+void WxSelectNSDialog::onOK( wxCommandEvent& WXUNUSED(event))
+{
+ int index = servers->GetSelection();
+ if (index == -1) {
+
+ wxMessageBox(
+ "You must select a server or cancel",
+ "Error",
+ wxOK | wxICON_EXCLAMATION);
+ return;
+ }
+ ior = *static_cast<wxString*>( servers->GetClientData( index));
+ serverName = servers->GetString( index);
+ EndModal( wxID_OK);
+}
+
+
+void WxSelectNSDialog::onRemove( wxCommandEvent& WXUNUSED(event))
+{
+ int index = servers->GetSelection();
+ if (index != -1) {
+
+ wxString name = servers->GetString( index);
+ delete static_cast<wxString*>( servers->GetClientData( index));
+ servers->Delete( index);
+
+ ACE_Configuration_Section_Key section = config->root_section();;
+ config->remove_value( section, name);
+
+ }
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxSelectNSDialog.h b/TAO/utils/wxNamingViewer/wxSelectNSDialog.h
new file mode 100644
index 00000000000..b4e2eea2f47
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxSelectNSDialog.h
@@ -0,0 +1,35 @@
+// $Id$
+// wxSelectNSDialog.h
+
+#ifndef i_WxSelectNSDialog_h
+#define i_WxSelectNSDialog_h
+
+class WxSelectNSDialog : public
+ wxDialog
+{
+public:
+ WxSelectNSDialog( wxWindow* parent);
+ virtual ~WxSelectNSDialog();
+
+ const wxString& getIOR() const {return ior;};
+ const wxString& getServerName() const {return serverName;};
+
+private:
+ void onAdd( wxCommandEvent& event);
+ void onDefault( wxCommandEvent& event);
+ void onInitDialog( wxInitDialogEvent& event);
+ void onOK( wxCommandEvent& event);
+ void onRemove( wxCommandEvent& event);
+ void onLeftDClick( wxMouseEvent& event);
+
+ class ACE_Configuration* config;
+
+ wxListBox* servers;
+ wxString ior;
+ wxString serverName;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+
diff --git a/TAO/utils/wxNamingViewer/wxViewIORDialog.cpp b/TAO/utils/wxNamingViewer/wxViewIORDialog.cpp
new file mode 100644
index 00000000000..a41f2f228f7
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxViewIORDialog.cpp
@@ -0,0 +1,147 @@
+// $Id$
+// wxViewIORDialog.cpp
+
+#include "pch.h"
+#include "wxViewIORDialog.h"
+
+#include "tao/Profile.h"
+#include "wx/treectrl.h"
+#include "wxNamingViewer.h"
+
+
+BEGIN_EVENT_TABLE( WxViewIORDialog, wxDialog)
+ EVT_BUTTON( wxID_APPLY, WxViewIORDialog::OnApply)
+ EVT_TEXT( IDC_IOR, WxViewIORDialog::onIORText)
+END_EVENT_TABLE()
+
+
+WxViewIORDialog::WxViewIORDialog(
+ CORBA::ORB_ptr orb,
+ CORBA::Object_ptr object,
+ wxWindow* parent):
+ wxDialog(),
+ orb( orb)
+{
+ LoadFromResource( parent, "viewIOR");
+ iorText = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "iorText",
+ this));
+ assert( iorText);
+ typeIDText = static_cast<wxTextCtrl*>( wxFindWindowByName(
+ "typeIDText",
+ this));
+ assert( typeIDText);
+ profiles = new wxTreeCtrl(
+ this,
+ IDC_PROFILES,
+ wxPoint( 7, 99),
+ wxSize( 675, 140));
+ wxButton* ctrl = static_cast<wxButton*>( wxFindWindowByName(
+ "okButton",
+ this));
+ assert( ctrl);
+ ctrl->SetDefault();
+ applyButton = static_cast<wxButton*>( wxFindWindowByName(
+ "applyButton",
+ this));
+ assert( applyButton);
+ applyButton->Enable( false);
+
+ if (object != CORBA::Object::_nil()) {
+
+ WxViewIORDialog::object = CORBA::Object::_duplicate( object);
+
+ }
+ CORBA::String_var ior = orb->object_to_string( object);
+ WxViewIORDialog::ior = ior;
+ decodeIOR();
+}
+
+
+void WxViewIORDialog::decodeIOR()
+{
+ profiles->DeleteAllItems();
+
+ // if object is nil, return out
+ if(CORBA::is_nil( object)) {
+
+ typeID = "";
+ TransferDataToWindow();
+ return;
+
+ }
+
+ // Get the stub
+ TAO_Stub* stub = object->_stubobj();
+ const char* type = stub->type_id;
+ typeID = type ? type : ""; // special case for INS objects, tao doesn't get the type id
+ TransferDataToWindow();
+
+ // Iterate through each profile and add an entry to the tree control
+ const TAO_MProfile& baseProfiles = stub->base_profiles();
+ CORBA::ULong count = baseProfiles.profile_count();
+ wxTreeItemId rootItem = profiles->AddRoot( "Profiles");
+ for( CORBA::ULong slot = 0; slot < count; slot++) {
+
+ const TAO_Profile* profile = baseProfiles.get_profile( slot);
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY {
+
+ // The need to const_cast should disappear in TAO 1.1.2
+ char* profileString =
+ const_cast<TAO_Profile*>( profile)->to_string( ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ profiles->AppendItem( rootItem, profileString);
+ delete [] profileString;
+
+ } ACE_CATCH( CORBA::Exception, ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+
+ } ACE_ENDTRY;
+
+ }
+ profiles->Expand( rootItem);
+}
+
+
+void WxViewIORDialog::OnApply( wxCommandEvent& event)
+{
+ wxDialog::OnApply( event);
+ try {
+
+ object = orb->string_to_object( ior);
+ decodeIOR();
+
+ } catch( CORBA::Exception& ex) {
+
+ wxMessageBox( ex._id(), "CORBA::Exception");
+ }
+}
+
+
+void WxViewIORDialog::onIORText( wxCommandEvent& event)
+{
+ // Enable the Apply button if the IOR has changed
+ if (event.GetString() != ior) {
+
+ applyButton->Enable( true);
+
+ }
+}
+
+
+bool WxViewIORDialog::TransferDataFromWindow()
+{
+ ior = iorText->GetValue();
+ return true;
+}
+
+
+bool WxViewIORDialog::TransferDataToWindow()
+{
+ iorText->SetValue( ior);
+ typeIDText->SetValue( typeID);
+ return true;
+}
+
diff --git a/TAO/utils/wxNamingViewer/wxViewIORDialog.h b/TAO/utils/wxNamingViewer/wxViewIORDialog.h
new file mode 100644
index 00000000000..facd56e2efa
--- /dev/null
+++ b/TAO/utils/wxNamingViewer/wxViewIORDialog.h
@@ -0,0 +1,38 @@
+// $Id$
+// wxViewIORDialog.h
+
+#ifndef i_wxViewIORDialog_h
+#define i_wxViewIORDialog_h
+
+
+class WxViewIORDialog:
+ public wxDialog
+{
+public:
+ WxViewIORDialog(
+ CORBA::ORB_ptr orb,
+ CORBA::Object_ptr object,
+ wxWindow* parent);
+
+private:
+ void OnApply( wxCommandEvent& event);
+ void onIORText( wxCommandEvent& event);
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+ void decodeIOR();
+
+ wxString typeID;
+ wxString ior;
+ class wxTextCtrl* typeIDText;
+ class wxTextCtrl* iorText;
+ class wxTreeCtrl* profiles;
+ class wxButton* applyButton;
+
+ CORBA::Object_var object;
+ CORBA::ORB_ptr orb;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+