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); } } } } }
public void RegisterResourceRenameHandler(string resType, IResourceRenameHandler handler) { #region Preconditions if (!Core.ResourceStore.ResourceTypes.Exist(resType)) { throw new ArgumentException("Invalid resource type '" + resType + "'", "resType"); } #endregion Preconditions _resourceRenameHandlerHash [resType] = handler; }
/// <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); }