Last change
on this file since 6133 was
6133,
checked in by gkronber, 14 years ago
|
#1471: imported generic parts of DataImporter from private code base
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Xml;
|
---|
6 | using HeuristicLab.DataImporter.Data.Model;
|
---|
7 | using HeuristicLab.DataImporter.Data.CommandBase;
|
---|
8 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.DataImporter.Data.Command {
|
---|
11 | [StorableClass]
|
---|
12 | public class RenameColumnGroupCommand : ColumnGroupCommandBase {
|
---|
13 | [Storable]
|
---|
14 | private string newName;
|
---|
15 |
|
---|
16 | private string oldName;
|
---|
17 |
|
---|
18 | private RenameColumnGroupCommand()
|
---|
19 | : base(null, string.Empty) {
|
---|
20 | }
|
---|
21 |
|
---|
22 | public RenameColumnGroupCommand(DataSet dataSet, string columnGroupName, string newName)
|
---|
23 | : base(dataSet, columnGroupName) {
|
---|
24 | this.newName = newName;
|
---|
25 | }
|
---|
26 |
|
---|
27 | public override string Description {
|
---|
28 | get { return "Rename ColumnGroup"; }
|
---|
29 | }
|
---|
30 |
|
---|
31 | public override void Execute() {
|
---|
32 | base.Execute();
|
---|
33 | oldName = ColumnGroup.Name;
|
---|
34 | ColumnGroup.Name = newName;
|
---|
35 | ColumnGroup.FireChanged();
|
---|
36 | this.ColumnGroup = null;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public override void UndoExecute() {
|
---|
40 | base.UndoExecute();
|
---|
41 | ColumnGroup ColumnGroup = this.DataSet.ColumnGroups.Where(cg => cg.Name == newName).First();
|
---|
42 | ColumnGroup.Name = oldName;
|
---|
43 | oldName = null;
|
---|
44 | ColumnGroup.FireChanged();
|
---|
45 | this.ColumnGroup = null;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.