1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
//
// MGRTSchemaEditor.mm
// MySQL GRT
//
// Created by Alfredo Kojima on 05/9/11.
// Copyright 2005 MySQL AB. All rights reserved.
//
#import "MGRTSchemaEditor.h"
#import <MySQLToolsCommon/mxUtils.h>
@implementation MGRTSchemaEditor
- (id)init
{
self= [super initWithWindowNibName: @"GRTSchemaEditor"];
if (self)
{
}
return self;
}
- (BOOL)commit
{
_schemaData->setName([[nameText stringValue] UTF8String]);
_schemaData->setComment([[[commentText textStorage] string] UTF8String]);
_schemaData->setCollation([[collationPop titleOfSelectedItem] UTF8String]);
_schemaData->commit();
return YES;
}
- (void)revert
{
_schemaData->revert();
}
- (void)showObject
{
[self fillCollationPopUp:collationPop];
[nameText setStringValue:NSStr(_schemaData->name())];
[collationPop selectItemWithTitle:NSStr(_schemaData->collation())];
[commentText setString:NSStr(_schemaData->comment())];
}
- (void)dealloc
{
delete _schemaData;
[super dealloc];
}
- (MYX_GRT_VALUE*)editedObject
{
return _schemaData->value().grtValue();
}
- (void)editObject:(MYX_GRT_VALUE*)value
{
_schemaData= new MGRTSchema([_grt grt], value);
[self showObject];
}
- (void)createNew
{
const char *schemaStruct= (*_catalogs)["schemata"].listContentStruct();
_schemaData= new MGRTSchema([_grt grt], MGRTValue::createObject([_grt grt], schemaStruct, "newSchema", *_catalogs).grtValue());
(*_catalogs)["schemata"].append(_schemaData->value().grtValue());
[self showObject];
}
@end
|