コード例 #1
0
ファイル: ResourceTreePaneBase.cs プロジェクト: mo5h/omeo
        public override void UpdateSelection()
        {
            IResource res = _resourceTree.ActiveResource;

            if (res != null && !res.IsDeleted && Core.State != CoreState.ShuttingDown &&
                !_resourceTree.KeyNavigation)
            {
                IResourceUIHandler treeHandler = Core.PluginLoader.GetResourceUIHandler(res);
                if (treeHandler != null)
                {
                    treeHandler.ResourceNodeSelected(res);
                }
                else
                {
                    Core.ResourceBrowser.DisplayResourceList(null, Core.ResourceStore.EmptyResourceList,
                                                             res.DisplayName, null);
                }
            }
            else if (res == null && _resourceTree.VisibleItemCount == 0)
            {
                Core.ResourceBrowser.DisplayResourceList(null, Core.ResourceStore.EmptyResourceList,
                                                         "No resource selected", null);
            }
            Core.UserInterfaceAP.CancelJobs(new MethodInvoker(LazyUpdateSelection));
        }
コード例 #2
0
 private void HandleAfterItemEdit(object sender, JetItemEditEventArgs e)
 {
     if (e.Text != null)
     {
         IResource res = (IResource)e.Item;
         if (AfterItemEdit != null)
         {
             ResourceItemEditEventArgs args = new ResourceItemEditEventArgs(e.Text, res, e.Column);
             AfterItemEdit(this, args);
         }
         else if (BeforeItemEdit == null)
         {
             IResourceRenameHandler renameHandler = Core.PluginLoader.GetResourceRenameHandler(res);
             if (renameHandler != null)
             {
                 renameHandler.ResourceRenamed(res, e.Text);
             }
             else
             {
                 IResourceUIHandler uiHandler = Core.PluginLoader.GetResourceUIHandler(res);
                 if (uiHandler != null)
                 {
                     uiHandler.ResourceRenamed(res, e.Text);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Plugins.cs プロジェクト: mo5h/omeo
        public void RegisterResourceUIHandler(string resType, IResourceUIHandler handler)
        {
            #region Preconditions
            if (!Core.ResourceStore.ResourceTypes.Exist(resType))
            {
                throw new ArgumentException("Invalid resource type '" + resType + "'", "resType");
            }
            #endregion

            _resourceUIHandlerHash [resType] = handler;
        }
コード例 #4
0
        /// <summary>
        /// Checks if the text of the specified resource can be in-place edited.
        /// </summary>
        /// <param name="res">The resource to edit.</param>
        /// <param name="text">The text that will be displayed in the in-place edit box.</param>
        /// <returns>true if the resource can be edited, false otherwise.</returns>
        public bool CanEditResourceLabel(IResource res, ref string text)
        {
            IResourceRenameHandler renameHandler = Core.PluginLoader.GetResourceRenameHandler(res);

            if (renameHandler != null)
            {
                return(renameHandler.CanRenameResource(res, ref text));
            }

            IResourceUIHandler uiHandler = Core.PluginLoader.GetResourceUIHandler(res);

            if (uiHandler != null)
            {
                return(uiHandler.CanRenameResource(res));
            }

            return(false);
        }
コード例 #5
0
        //HACK! almost copy-pasted from ResourceTreePane.cs

        private void _categoryTree_ResourceDragOver(object sender, ResourceDragEventArgs e)
        {
            if (e.DroppedResources.Count == 0)
            {
                e.Effect = DragDropEffects.None;
                return;
            }

//            IResource res = (e.Target != null) ? e.Target : Core.CategoryManager.RootCategory;
            IResource res = e.Target ?? Core.CategoryManager.RootCategory;
            // we always need the handler for Category resource
            IResourceUIHandler treeHandler = Core.PluginLoader.GetResourceUIHandler(e.DroppedResources [0]);

            if (treeHandler != null && treeHandler.CanDropResources(res, e.DroppedResources))
            {
                e.Effect = DragDropEffects.Link;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
コード例 #6
0
        private void _categoryTree_ResourceDrop(object sender, ResourceDragEventArgs e)
        {
            if (e.DroppedResources.Count == 0)
            {
                return;
            }

//            IResource res = (e.Target != null) ? e.Target : Core.CategoryManager.RootCategory;
            IResource          res         = e.Target ?? Core.CategoryManager.RootCategory;
            IResourceUIHandler treeHandler = Core.PluginLoader.GetResourceUIHandler(e.DroppedResources[0]);

            if (treeHandler != null)
            {
                try
                {
                    treeHandler.ResourcesDropped(res, e.DroppedResources);
                }
                catch (Exception ex)
                {
                    Core.ReportException(ex, false);
                }
            }
        }
コード例 #7
0
ファイル: ResourceTreePaneBase.cs プロジェクト: mo5h/omeo
 public DragDropHandlerAdapter(IResourceUIHandler handler)
 {
     _handler = handler;
 }
コード例 #8
0
ファイル: ResourceTreePaneBase.cs プロジェクト: mo5h/omeo
 public void EnableDropOnEmpty(IResourceUIHandler emptyDropHandler)
 {
     _resourceTree.EmptyDropHandler = new DragDropHandlerAdapter(emptyDropHandler);
 }