Common Custom EditorTask
Common_CustomEditorTask_CSharp\CustomEditorTask_CSharp\CustomEditExistingFeatureEditor.cs
// Copyright 2007 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.ADF.ArcGISServer.Editor;
using ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools;
using System.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;

namespace CustomEditorTask_CSharp
{
    public class CustomEditExistingFeatureEditor : EditExistingFeaturePanel
    {
        public CustomEditExistingFeatureEditor(EditorTask task) : base(task) { }

        protected override List<ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar> CreateToolbars()
        {
            List<ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar> toolbars = base.CreateToolbars();

                // add clip tool to the standard toolbar in the editorpanel
                EditorTool clip = new EditorTool("Clip", this.ParentEditor.MapID, false, ToolGeometry.Line | ToolGeometry.Polygon, 1);
                clip.ClientAction = ESRI.ArcGIS.ADF.Web.UI.WebControls.Constants.HTML_DRAG_RECTANGLE;
                clip.DefaultImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip.png");
                clip.SelectedImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip_ON.png");
                clip.HoverImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip_OVER.png");
                clip.ToolTip = "Clip feature(s)";
                clip.ServerActionAssembly = "CustomEditorTask_CSharp";
                clip.ServerActionClass = "CustomEditorTask_CSharp.ClipFeatures";

                toolbars[0].ToolbarItems.Add(clip);
                
                // add polygon to line command to the standard toolbar in the editorpanel
                EditorCommand ptl = new EditorCommand("PolygonToLine", ToolGeometry.Polygon, 1);
                ptl.DefaultImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line.png");
                ptl.SelectedImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line_ON.png");
                ptl.HoverImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line_OVER.png");
                ptl.ToolTip = "Convert polygon feature(s) to polylines";
                ptl.ServerActionAssembly = "CustomEditorTask_CSharp";
                ptl.ServerActionClass = "CustomEditorTask_CSharp.PolygonToLine";

                toolbars[0].ToolbarItems.Add(ptl);

                double oldwidth = toolbars[0].Width.Value;
                toolbars[0].Width = new Unit(oldwidth + 70, UnitType.Pixel);

                return toolbars;
        }
    }
}