Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/UngroupTool.cs

    r2868 r4068  
    1 using System;
    2 using System.Diagnostics;
    3 using System.Collections;
    4 using System.Drawing;
    51using System.Windows.Forms;
    62
    7 namespace Netron.Diagramming.Core
    8 {
     3namespace Netron.Diagramming.Core {
     4  /// <summary>
     5  /// Group tool
     6  /// </summary>
     7  class UngroupTool : AbstractTool, IMouseListener {
     8
     9    #region Fields
     10
     11    #endregion
     12
     13    #region Constructor
    914    /// <summary>
    10     /// Group tool
     15    /// Initializes a new instance of the <see cref="T:UngroupTool"/> class.
    1116    /// </summary>
    12     class UngroupTool : AbstractTool, IMouseListener
    13     {
     17    /// <param name="name">The name of the tool.</param>
     18    public UngroupTool(string name)
     19      : base(name) {
     20    }
     21    #endregion
    1422
    15         #region Fields
    16        
    17         #endregion
     23    #region Methods
    1824
    19         #region Constructor
    20         /// <summary>
    21         /// Initializes a new instance of the <see cref="T:UngroupTool"/> class.
    22         /// </summary>
    23         /// <param name="name">The name of the tool.</param>
    24         public UngroupTool(string name) : base(name)
    25         {
    26         }
    27         #endregion
     25    /// <summary>
     26    /// Called when the tool is activated.
     27    /// </summary>
     28    protected override void OnActivateTool() {
     29      bool valid = true;
    2830
    29         #region Methods
     31      #region Validation of the selection
    3032
    31         /// <summary>
    32         /// Called when the tool is activated.
    33         /// </summary>
    34         protected override void OnActivateTool()
    35         {
    36             bool valid = true;
    37            
    38             #region Validation of the selection
    39            
    40             //make sure we have the correct stuff on the table
    41             if (this.Controller.Model.Selection.SelectedItems == null || this.Controller.Model.Selection.SelectedItems.Count == 0)
    42             {
    43                 MessageBox.Show("Nothing is selected, you need to select an existing group.", "Nothing selected.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    44                 valid = false;               
    45             } else if (this.Controller.Model.Selection.SelectedItems.Count != 1)
    46             {
    47                 MessageBox.Show("Multiple items are selected, select only one group.", "Multiple items", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    48                 valid = false;
    49             } else if (!(this.Controller.Model.Selection.SelectedItems[0] is IGroup))
    50             {
    51                 MessageBox.Show("The selected item is not a group.", "Not a group.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    52                 valid = false;
    53             }
    54             #endregion
     33      //make sure we have the correct stuff on the table
     34      if (this.Controller.Model.Selection.SelectedItems == null || this.Controller.Model.Selection.SelectedItems.Count == 0) {
     35        MessageBox.Show("Nothing is selected, you need to select an existing group.", "Nothing selected.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     36        valid = false;
     37      } else if (this.Controller.Model.Selection.SelectedItems.Count != 1) {
     38        MessageBox.Show("Multiple items are selected, select only one group.", "Multiple items", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     39        valid = false;
     40      } else if (!(this.Controller.Model.Selection.SelectedItems[0] is IGroup)) {
     41        MessageBox.Show("The selected item is not a group.", "Not a group.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     42        valid = false;
     43      }
     44      #endregion
    5545
    56             if (valid)
    57             {
    58               UngroupCommand cmd = new UngroupCommand(this.Controller, this.Controller.Model.Selection.SelectedItems[0] as IGroup);
    59                 this.Controller.UndoManager.AddUndoCommand(cmd);
    60                 cmd.Redo();
    61             }
    62              DeactivateTool();
    63              return;
    64         }
    65 
    66         /// <summary>
    67         /// Handles the mouse down event
    68         /// </summary>
    69         /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
    70         public bool MouseDown(MouseEventArgs e)
    71         {
    72             return false;
    73         }
    74 
    75         /// <summary>
    76         /// Handles the mouse move event
    77         /// </summary>
    78         /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
    79         public void MouseMove(MouseEventArgs e)
    80         {
    81            
    82         }
    83         public void MouseUp(MouseEventArgs e)
    84         {
    85            
    86         }
    87         #endregion
    88 
    89      
     46      if (valid) {
     47        UngroupCommand cmd = new UngroupCommand(this.Controller, this.Controller.Model.Selection.SelectedItems[0] as IGroup);
     48        this.Controller.UndoManager.AddUndoCommand(cmd);
     49        cmd.Redo();
     50      }
     51      DeactivateTool();
     52      return;
    9053    }
    9154
     55    /// <summary>
     56    /// Handles the mouse down event
     57    /// </summary>
     58    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
     59    public bool MouseDown(MouseEventArgs e) {
     60      return false;
     61    }
     62
     63    /// <summary>
     64    /// Handles the mouse move event
     65    /// </summary>
     66    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
     67    public void MouseMove(MouseEventArgs e) {
     68
     69    }
     70    public void MouseUp(MouseEventArgs e) {
     71
     72    }
     73    #endregion
     74
     75
     76  }
     77
    9278}
Note: See TracChangeset for help on using the changeset viewer.