GetCommand() public méthode

public GetCommand ( ) : DiagramCommand,
Résultat DiagramCommand,
    public override void DrawNode(DiagramNode node ,DiagramContext context)
    {
        bool selected = context.GetSelection().GetElements().Contains(node);
        GUI.Box (node.rect, "");

        if(selected){

            GUIStyle style = new GUIStyle (GUIStyle.none);
            style.normal.background = Config.TEX_ADD;

            TEMP =  DiagramUtil.TranslateRect(addAttributeToolRect , node.rect.x , node.rect.y );
            if (GUI.Button (TEMP, "", style)) {
                context.GetCommand().AddAttribute(node);
            }

        }

        TEMP =  DiagramUtil.TranslateRect(iconRect , node.rect.x , node.rect.y );

        if (node.iconPath != null) {
            node.texIcon = Config.loadTexture (node.iconPath);
        }
        if (node.texIcon == null) {
            node.texIcon = Config.TEX_NO_IMAGE;
        }

        node.iconStyle.normal.background = node.texIcon;
        if (GUI.Button (TEMP, "", node.iconStyle)) {
            string path = EditorUtility.OpenFilePanel ("Select Icon", "Assets", "");
            if (path != null) {
                if (Application.dataPath.Length < path.Length) {
                    path = path.Substring (Application.dataPath.Length);
                    char[] chTrims = {'/', '\\'};
                    path = path.TrimStart (chTrims);
                    node.iconPath = path;
                }
            }
        }

        TEMP = DiagramUtil.TranslateRect( new  Rect (iconRect.x + iconRect.width + 10, iconRect.y + 8, node.rect.width - (iconRect.x + iconRect.width + 8) - 20, 16) , node.rect.x , node.rect.y);
        if (selected) {
            node.name = GUI.TextField (TEMP, node.name);
        } else {
            GUI.Label (TEMP, node.name);
        }

        for (int index = 0; index < node.attributes.Count; index++) {
            Attribute attr = (Attribute)node.attributes[index];
            float nwidth = 50;
            float twidth = 90;
            float y = 60 + 18 * index;

            Rect irect =new Rect (12, y, 16, 16);
            Rect nrect = new Rect (irect.x + irect.width + 4, y, nwidth, 16);
            Rect crect = new Rect (nrect.x + nwidth, y, 8, 16);
            Rect trect = new Rect (crect.x + crect.width - 10, y, twidth, 16);

            Texture2D texIcon = null;
            string attrIconPath = attr.iconPath;
            if (attrIconPath != null) {
                texIcon = Config.loadTexture (attrIconPath);
            }
            if (texIcon == null) {
                texIcon = Config.TEX_NO_IMAGE_16;
            }
            GUIStyle attrIconStyle = new GUIStyle (GUIStyle.none);
            attrIconStyle.normal.background = texIcon;

            TEMP = DiagramUtil.TranslateRect( irect,node.rect.x , node.rect.y);
            if (GUI.Button (TEMP, "", attrIconStyle)) {
                string path = EditorUtility.OpenFilePanel ("Select Icon", "Assets", "");
                if (path != null) {
                    if (Application.dataPath.Length < path.Length) {
                        path = path.Substring (Application.dataPath.Length);
                        char[] chTrims = {'/', '\\'};
                        path = path.TrimStart (chTrims);
                        attr.iconPath = path;
                    }
                }
            }

            if (selected) {
                TEMP = DiagramUtil.TranslateRect( nrect,node.rect.x , node.rect.y);
                attr.name = GUI.TextField (TEMP, attr.name);
                TEMP = DiagramUtil.TranslateRect( crect,node.rect.x , node.rect.y);
                GUI.Label (TEMP, ":");
                TEMP = DiagramUtil.TranslateRect( trect,node.rect.x , node.rect.y);
                attr.type = DrawTypeField (TEMP, attr.type);
            } else {
                TEMP = DiagramUtil.TranslateRect( nrect,node.rect.x , node.rect.y);
                GUI.Label (TEMP, attr.name);
                TEMP = DiagramUtil.TranslateRect( crect,node.rect.x , node.rect.y);
                GUI.Label (TEMP, ":");
                TEMP = DiagramUtil.TranslateRect( trect,node.rect.x , node.rect.y);
                DrawTypeField (TEMP, attr.type);
                //GUI.Label (trect, attr.type);
            }

            if (selected) {

                GUIStyle style = new GUIStyle (GUIStyle.none);
                style.normal.background = Config.TEX_TOOL_REMOVE_MINI;
                TEMP = DiagramUtil.TranslateRect(new Rect (trect.x + trect.width - 4, y, 13, 16),node.rect.x , node.rect.y);
                if (GUI.Button (TEMP, "", style)) {
                    node.attributes.Remove (attr);
                }
            }

        }
    }
    public override bool OnGUI(DiagramContext context)
    {
        Event e = Event.current;
        switch (e.type) {

        case EventType.KeyDown:
            {
                log ("key down");
                break;
            }
        case EventType.KeyUp:
            {

                log ("key up typecode= " + e.keyCode);
            if(e.keyCode == KeyCode.Delete || e.keyCode == KeyCode.Backspace){
                foreach(DiagramElement element in  context.GetSelection().GetElements()){
                    if(element is DiagramNode){
                        context.GetCommand().DeleteNode((DiagramNode)element);
                    }
                }
            }
            context.editor.Repaint ();

                break;
            }
        case EventType.ContextClick:
            {
                log ("ContextClick");
                        //Draw Context menu
            log ("ContextClick");

            GenericMenu menu = new GenericMenu();
            //menu.AddItem( new GUIContent("item1") , true , this.Action ,"item1");
                break;
            }
        case EventType.DragExited:
            {
                log ("DragExited");
                break;
            }
        case EventType.DragPerform:
            {
                log ("DragPerform");
                break;
            }
        case EventType.DragUpdated:
            {
                log ("DragUpdated");
                break;
            }
        case EventType.ExecuteCommand:
            {
                log ("ExecuteCommand");
                break;
            }
        case EventType.Ignore:
            {
                log ("Ignore");
                break;
            }
        case EventType.Layout:
            {
                log ("Layout");
                break;
            }
        case EventType.MouseDown:
            {
                log ("MouseDown " + Event.current.mousePosition);
                context.DragStart (Event.current.mousePosition);
                Select (context, Event.current.mousePosition);
                context.editor.Repaint ();
                break;
            }
        case EventType.MouseDrag:
            {
                context.Drag (Event.current.mousePosition);
                log ("MouseDrag");
                if (dragTracker != null) {
                    dragTracker.OnDrag (context, Event.current.mousePosition);
                    context.editor.Repaint ();
                }
                break;
            }
        case EventType.MouseUp:
            {
                context.DragEnd (Event.current.mousePosition);
                if (dragTracker != null) {
                    dragTracker.OnDrop (context, Event.current.mousePosition);
                    context.editor.Repaint ();
                }
                dragTracker = null;
                log ("MouseUp");
                break;
            }
        case EventType.Repaint:
            {
                log ("Repaint");

                return true;
            }
        case EventType.ScrollWheel:
            {
                log ("ScrollWheel");
                break;
            }
        case EventType.Used:
            {
                log ("Used");
                break;
            }
        case EventType.ValidateCommand:
            {
                log ("ValidateCommand");
                break;
            }
        case EventType.MouseMove:
            {
                log ("MouseMove");
                //Repaint ();
                break;
            }
        }
        return true;

        //currentDiagramRoot.OnGUI();
    }