Skip to content

Commit

Permalink
create table: remove constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
drjokepu committed Feb 19, 2013
1 parent 39a4889 commit a4766b1
Show file tree
Hide file tree
Showing 2 changed files with 667 additions and 444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ @interface PGCreateTableWindowController ()

@property (nonatomic, strong) IBOutlet NSPopUpButton *addConstraintButton;
@property (nonatomic, strong) NSMenuItem *addPrimaryKeyMenuItem;
@property (strong) IBOutlet NSButton *removeConstraintButton;

-(IBAction)didClickCancel:(id)sender;
-(IBAction)didClickAddColumn:(id)sender;
-(IBAction)didClickRemoveColumn:(id)sender;
-(IBAction)didClickRemoveConstraint:(id)sender;

@end

Expand Down Expand Up @@ -489,6 +491,15 @@ -(void)didEndUniqueKeyEditorSheet:(NSWindow *)sheet returnCode:(NSInteger)return
self.uniqueKeyEditorSheet = nil;
}

-(void)didClickRemoveConstraint:(id)sender
{
const NSInteger selectedConstraintIndex = [self.constraintsTableView selectedRow];
if (selectedConstraintIndex == -1) return;

[self.tableConstraints removeObjectAtIndex:selectedConstraintIndex];
[self.constraintsTableView reloadData];
}

-(BOOL)hasPrimaryKey
{
for (PGConstraint *constraint in self.tableConstraints)
Expand Down
Loading

0 comments on commit a4766b1

Please sign in to comment.