~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to plugins/wb.model.editors/backend/wb_editor_layer.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License as
 
6
 * published by the Free Software Foundation; version 2 of the
 
7
 * License.
 
8
 * 
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
 * GNU General Public License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
17
 * 02110-1301  USA
 
18
 */
 
19
 
 
20
#include "stdafx.h"
 
21
#include "wb_editor_layer.h"
 
22
#include "base/string_utilities.h"
 
23
 
 
24
LayerEditorBE::LayerEditorBE(bec::GRTManager *grtm, const workbench_physical_LayerRef &layer)
 
25
: BaseEditor(grtm, layer), _layer(layer)
 
26
{
 
27
}
 
28
 
 
29
 
 
30
bool LayerEditorBE::should_close_on_delete_of(const std::string &oid)
 
31
{
 
32
  if (_layer.id() == oid || _layer->owner().id() == oid)
 
33
    return true;
 
34
  
 
35
  return false;
 
36
}
 
37
 
 
38
 
 
39
void LayerEditorBE::set_color(const std::string &color)
 
40
{
 
41
  if (_layer->color() != color)
 
42
  {
 
43
    bec::AutoUndoEdit undo(this, _layer, "color");
 
44
    _layer->color(color);
 
45
    undo.end(_("Change Layer Color"));
 
46
  }
 
47
}
 
48
 
 
49
 
 
50
std::string LayerEditorBE::get_color()
 
51
{
 
52
  return _layer->color();
 
53
}
 
54
 
 
55
void LayerEditorBE::set_name(const std::string &name)
 
56
{
 
57
  if (_layer->name() != name)
 
58
  {
 
59
    bec::AutoUndoEdit undo(this, _layer, "name");
 
60
    _layer->name(name);
 
61
    undo.end(_("Change Layer Name"));  
 
62
  }
 
63
}
 
64
 
 
65
 
 
66
std::string LayerEditorBE::get_name()
 
67
{
 
68
  return _layer->name();
 
69
}
 
70