예제 #1
0
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr  = ServiceManager.Instance.GetService <FdoConnectionManager>();
            _connMgr.ConnectionAdded     += new ConnectionEventHandler(OnConnectionAdded);
            _connMgr.ConnectionRenamed   += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _connMgr.ConnectionRemoved   += new ConnectionEventHandler(OnConnectionRemoved);
            _connMgr.ConnectionRefreshed += new ConnectionEventHandler(OnConnectionRefreshed);

            _explorer.RegisterImage(IMG_ASSOC_PROPERTY);
            _explorer.RegisterImage(IMG_FEATURE_CLASS);
            _explorer.RegisterImage(IMG_CLASS);
            _explorer.RegisterImage(IMG_CONNECTION);
            _explorer.RegisterImage(IMG_DATA_PROPERTY);
            _explorer.RegisterImage(IMG_GEOM_PROPERTY);
            _explorer.RegisterImage(IMG_ID_PROPERTY);
            _explorer.RegisterImage(IMG_OBJECT_PROPERTY);
            _explorer.RegisterImage(IMG_RASTER_PROPERTY);
            _explorer.RegisterImage(IMG_SCHEMA);

            _explorer.RegisterImage(IMG_DB_CONNECTION);
            _explorer.RegisterImage(IMG_SERVER_CONNECTION);
            _explorer.RegisterImage(IMG_FILE_CONNECTION);

            _explorer.RegisterRootNode(RootNodeName, "FDO Data Sources", "database_connect", "/ObjectExplorer/ContextMenus/FdoConnections");
            _explorer.RegisterContextMenu(NODE_CONNECTION, PATH_SELECTED_CONNECTION);
            _explorer.RegisterContextMenu(NODE_SCHEMA, PATH_SELECTED_SCHEMA);
            _explorer.RegisterContextMenu(NODE_CLASS, PATH_SELECTED_CLASS);

            _explorer.AfterExpansion += new TreeViewEventHandler(OnAfterNodeExpansion);
            //_explorer.RegisterContextMenu(NODE_PROPERTY, "/ObjectExplorer/ContextMenus/SelectedProperty");
        }
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
            _connMgr.ConnectionAdded += new ConnectionEventHandler(OnConnectionAdded);
            _connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _connMgr.ConnectionRemoved += new ConnectionEventHandler(OnConnectionRemoved);
            _connMgr.ConnectionRefreshed += new ConnectionEventHandler(OnConnectionRefreshed);

            _explorer.RegisterImage(IMG_ASSOC_PROPERTY);
            _explorer.RegisterImage(IMG_FEATURE_CLASS);
            _explorer.RegisterImage(IMG_CLASS);
            _explorer.RegisterImage(IMG_CONNECTION);
            _explorer.RegisterImage(IMG_DATA_PROPERTY);
            _explorer.RegisterImage(IMG_GEOM_PROPERTY);
            _explorer.RegisterImage(IMG_ID_PROPERTY);
            _explorer.RegisterImage(IMG_OBJECT_PROPERTY);
            _explorer.RegisterImage(IMG_RASTER_PROPERTY);
            _explorer.RegisterImage(IMG_SCHEMA);

            _explorer.RegisterImage(IMG_DB_CONNECTION);
            _explorer.RegisterImage(IMG_SERVER_CONNECTION);
            _explorer.RegisterImage(IMG_FILE_CONNECTION);

            _explorer.RegisterRootNode(RootNodeName, "FDO Data Sources", "database_connect", "/ObjectExplorer/ContextMenus/FdoConnections");
            _explorer.RegisterContextMenu(NODE_CONNECTION, PATH_SELECTED_CONNECTION);
            _explorer.RegisterContextMenu(NODE_SCHEMA, PATH_SELECTED_SCHEMA);
            _explorer.RegisterContextMenu(NODE_CLASS, PATH_SELECTED_CLASS);

            _explorer.AfterExpansion += new TreeViewEventHandler(OnAfterNodeExpansion);
            //_explorer.RegisterContextMenu(NODE_PROPERTY, "/ObjectExplorer/ContextMenus/SelectedProperty");
        }
예제 #3
0
        private Workbench()
        {
            InitializeComponent();

            _toolstrips       = new Dictionary <string, ToolStrip>();
            _toolstripRegions = new Dictionary <string, ToolbarRegion>();

            this.Icon = ResourceService.GetIcon("FdoToolbox");

            contentPanel = new DockPanel();
            contentPanel.DocumentStyle     = DocumentStyle.DockingWindow;
            contentPanel.Dock              = DockStyle.Fill;
            contentPanel.DockLeftPortion   = 200;
            contentPanel.DockBottomPortion = 150;
            contentPanel.DockRightPortion  = 200;

            menu = new MenuStrip();
            MenuService.AddItemsToMenu(menu.Items, this, "/Workbench/MainMenu");

            toolStripContainer = new ToolStripContainer();
            toolStripContainer.ContentPanel.Controls.Add(contentPanel);
            toolStripContainer.Dock = DockStyle.Fill;

            this.Controls.Add(toolStripContainer);

            ctxToolbar = new ContextMenuStrip();
            toolStripContainer.TopToolStripPanel.ContextMenuStrip    = ctxToolbar;
            toolStripContainer.BottomToolStripPanel.ContextMenuStrip = ctxToolbar;
            toolStripContainer.LeftToolStripPanel.ContextMenuStrip   = ctxToolbar;
            toolStripContainer.RightToolStripPanel.ContextMenuStrip  = ctxToolbar;

            toolbar = ToolbarService.CreateToolStrip(this, "/Workbench/Toolbar");
            AddToolbar("Base", toolbar, ToolbarRegion.Top, false);

            status      = new StatusStrip();
            statusLabel = new ToolStripStatusLabel();
            status.Items.Add(statusLabel);

            this.Controls.Add(menu);
            this.Controls.Add(status);

            //this.IsMdiContainer = true;

            ObjectExplorer exp = new ObjectExplorer();

            objExplorer = exp;

            ConsolePane console = new ConsolePane();

            appConsole = console;

            ShowContent(console, ViewRegion.Bottom);
            ShowContent(exp, ViewRegion.Left);

            // Use the Idle event to update the status of menu and toolbar items.
            Application.Idle += OnApplicationIdle;
        }
        public bool IsValid(object caller, Condition condition)
        {
            IObjectExplorer objectExplorer = caller as IObjectExplorer;

            if (objectExplorer == null)
            {
                return(false);
            }

            TreeNode node = objectExplorer.GetSelectedNode();

            //Might be the one. Check it's root parent
            if (node.Level >= 1)
            {
                TreeNode root = node.Parent;
                while (root.Level > 0)
                {
                    root = root.Parent;
                }

                TreeNode rootCmp = objectExplorer.GetRootNode(FdoObjectExplorerExtender.RootNodeName);
                if (root == rootCmp)
                {
                    TreeNode connNode = node;
                    while (connNode.Level > 1)
                    {
                        connNode = connNode.Parent;
                    }
                    FdoConnectionManager connMgr = ServiceManager.Instance.GetService <FdoConnectionManager>();
                    FdoConnection        conn    = connMgr.GetConnection(connNode.Name);
                    if (conn != null)
                    {
                        try
                        {
                            var applicable                     = (Array.IndexOf <string>(applicableProviders, conn.Provider.ToUpper()) >= 0);
                            var supportsSchemaMappings         = conn.Capability.GetBooleanCapability(CapabilityType.FdoCapabilityType_SupportsSchemaOverrides);
                            var supportsDescribeSchemaMappings = conn.Capability.GetArrayCapability(CapabilityType.FdoCapabilityType_CommandList).Cast <CommandType>().Contains(CommandType.CommandType_DescribeSchemaMapping);

                            return(supportsSchemaMappings && supportsDescribeSchemaMappings);
                        }
                        catch
                        {
                            return(false);
                        }
                    }
                }
            }
            return(false);
        }
예제 #5
0
        public bool IsValid(object caller, Condition condition)
        {
            IObjectExplorer objectExplorer = caller as IObjectExplorer;

            if (objectExplorer == null)
            {
                return(false);
            }

            TreeNode node = objectExplorer.GetSelectedNode();

            //Might be the one. Check it's root parent
            if (node.Level >= 1)
            {
                TreeNode root = node.Parent;
                while (root.Level > 0)
                {
                    root = root.Parent;
                }

                TreeNode rootCmp = objectExplorer.GetRootNode(FdoObjectExplorerExtender.RootNodeName);
                if (root == rootCmp)
                {
                    TreeNode connNode = node;
                    while (connNode.Level > 1)
                    {
                        connNode = connNode.Parent;
                    }
                    FdoConnection conn = connMgr.GetConnection(connNode.Name);
                    if (conn != null)
                    {
                        string cmd = "CommandType_" + condition.Properties["command"];
                        try
                        {
                            OSGeo.FDO.Commands.CommandType ctype = (OSGeo.FDO.Commands.CommandType)Enum.Parse(typeof(OSGeo.FDO.Commands.CommandType), cmd);
                            Array commands = conn.Capability.GetArrayCapability(CapabilityType.FdoCapabilityType_CommandList);
                            return(Array.IndexOf(commands, ctype) >= 0);
                        }
                        catch
                        {
                            return(false);
                        }
                    }
                }
            }
            return(false);
        }
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
            _connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeConnectionRemove);
            _connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _taskMgr = ServiceManager.Instance.GetService<TaskManager>();
            _taskMgr.TaskAdded += new TaskEventHandler(OnTaskAdded);
            _taskMgr.TaskRemoved += new TaskEventHandler(OnTaskRemoved);
            _taskMgr.TaskRenamed += new TaskRenameEventHandler(OnTaskRenamed);

            _explorer.RegisterImage(IMG_TASK);
            _explorer.RegisterImage(IMG_JOIN);
            _explorer.RegisterImage(IMG_SEQPROC);

            _explorer.RegisterRootNode(RootNodeName, "Tasks", IMG_TASK, PATH_TASKS);
            _explorer.RegisterContextMenu(NODE_TASK, PATH_SELECTED_TASK);
        }
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr  = ServiceManager.Instance.GetService <FdoConnectionManager>();
            _connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeConnectionRemove);
            _connMgr.ConnectionRenamed      += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _taskMgr              = ServiceManager.Instance.GetService <TaskManager>();
            _taskMgr.TaskAdded   += new TaskEventHandler(OnTaskAdded);
            _taskMgr.TaskRemoved += new TaskEventHandler(OnTaskRemoved);
            _taskMgr.TaskRenamed += new TaskRenameEventHandler(OnTaskRenamed);

            _explorer.RegisterImage(IMG_TASK);
            _explorer.RegisterImage(IMG_JOIN);
            _explorer.RegisterImage(IMG_SEQPROC);

            _explorer.RegisterRootNode(RootNodeName, "Tasks", IMG_TASK, PATH_TASKS);
            _explorer.RegisterContextMenu(NODE_TASK, PATH_SELECTED_TASK);
        }
예제 #8
0
        private Workbench()
        {
            InitializeComponent();

            _toolstrips = new Dictionary<string, ToolStrip>();
            _toolstripRegions = new Dictionary<string, ToolbarRegion>();

            this.Icon = ResourceService.GetIcon("FdoToolbox");

            contentPanel = new DockPanel();
            contentPanel.DocumentStyle = DocumentStyle.DockingWindow;
            contentPanel.Dock = DockStyle.Fill;
            contentPanel.DockLeftPortion = 200;
            contentPanel.DockBottomPortion = 150;
            contentPanel.DockRightPortion = 200;
            
            menu = new MenuStrip();
            MenuService.AddItemsToMenu(menu.Items, this, "/Workbench/MainMenu");

            toolStripContainer = new ToolStripContainer();
            toolStripContainer.ContentPanel.Controls.Add(contentPanel);
            toolStripContainer.Dock = DockStyle.Fill;

            this.Controls.Add(toolStripContainer);

            ctxToolbar = new ContextMenuStrip();
            toolStripContainer.TopToolStripPanel.ContextMenuStrip = ctxToolbar;
            toolStripContainer.BottomToolStripPanel.ContextMenuStrip = ctxToolbar;
            toolStripContainer.LeftToolStripPanel.ContextMenuStrip = ctxToolbar;
            toolStripContainer.RightToolStripPanel.ContextMenuStrip = ctxToolbar;

            toolbar = ToolbarService.CreateToolStrip(this, "/Workbench/Toolbar");
            AddToolbar("Base", toolbar, ToolbarRegion.Top, false);

            status = new StatusStrip();
            statusLabel = new ToolStripStatusLabel();
            status.Items.Add(statusLabel);

            this.Controls.Add(menu);
            this.Controls.Add(status);

            //this.IsMdiContainer = true;

            ObjectExplorer exp = new ObjectExplorer();
            objExplorer = exp;

            ConsolePane console = new ConsolePane();
            appConsole = console;

            ShowContent(console, ViewRegion.Bottom);
            ShowContent(exp, ViewRegion.Left);
            
            // Use the Idle event to update the status of menu and toolbar items.
            Application.Idle += OnApplicationIdle;
        }