/*
Copyright (C) 2002-2003, Jeffrey D. Argast.
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
Permission is hereby granted to use, copy, modify, and distribute this
software or portions thereof for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code is distributed, then this
statement must be included, with this copyright and no-warranty notice
unaltered.
(2) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
*/
#import "PerforceBranch.h"
#import "PerforceActionBranch.h"
#import "AppController.h"
#import "ReadOnlyEditorController.h"
@implementation PerforceBranch
- (id) initWithName: (NSString*) branchName
withDate: (NSString*) branchDate
withDesc: (NSString*) branchDesc;
{
self = [super init];
fName = [branchName copy];
fDate = [branchDate copy];
fDescription = [branchDesc copy];
return self;
}
- (void) dealloc
{
[fName release];
[fDate release];
[fDescription release];
[super dealloc];
}
- (NSString*) getBranchName
{
return fName;
}
- (NSString*) getBranchDate
{
return fDate;
}
- (NSString*) getBranchDescription
{
return fDescription;
}
- (NSComparisonResult) comparegetBranchNameAscending: (PerforceBranch*) rhs
{
return [fName compare:rhs->fName];
}
- (NSComparisonResult) comparegetBranchNameDescending: (PerforceBranch*) rhs
{
return [rhs->fName compare:fName];
}
- (NSComparisonResult) comparegetBranchDateAscending: (PerforceBranch*) rhs
{
return [fDate compare:rhs->fDate];
}
- (NSComparisonResult) comparegetBranchDateDescending: (PerforceBranch*) rhs
{
return [rhs->fDate compare:fDate];
}
- (NSComparisonResult) comparegetBranchDescriptionAscending: (PerforceBranch*) rhs
{
return [fDescription compare:rhs->fDescription];
}
- (NSComparisonResult) comparegetBranchDescriptionDescending: (PerforceBranch*) rhs
{
return [rhs->fDescription compare:fDescription];
}
// The enablement
- (BOOL) canEdit
{
return YES;
}
- (BOOL) canDescribe
{
return YES;
}
- (BOOL) canDelete
{
return YES;
}
// The actions
- (void) doEdit
{
[PerforceActionBranchGet defaultRunFor:[NSApp delegate] selector:@selector(resultFromPerforceBranchOut:) identifier:fName];
}
- (void) doDescribe
{
[PerforceActionBranchGet defaultRunFor:self selector:@selector(resultFromDescribe:) identifier:fName];
}
- (void) doDelete
{
int isOK = NSRunAlertPanel (@"Delete",
@"Are you sure you want to delete branch %s?",
@"OK",
@"Cancel",
nil,
[fName cString]);
if ( isOK )
{
[PerforceActionBranchDelete defaultRunFor:nil selector:nil identifier:fName];
}
}
- (void) resultFromDescribe:(PerforceActionBranchGet*)action
{
if ( [action wasSuccess] )
{
NSMutableString* titleString = [NSMutableString stringWithString:@"Description of Branch "];
[titleString appendString:[action getIdentifier]];
[ReadOnlyEditorController showWindowWith:[action getOutput] title:titleString];
}
}
@end
# |
Change |
User |
Description |
Committed |
|
#1
|
3210 |
Paul Ferguson |
Initial branch |
|
|
//guest/jeff_argast/P4Cocoa/source/Perforce/PerforceBranch.m |
#1
|
2732 |
Jeff Argast |
Initial submission of P4Cocoa |
|
|