/* 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 "DepotViewSelection.h" #import "PerforceActionRevert.h" #import "PerforceActionEdit.h" #import "PerforceActionSync.h" #import "PerforceActionDelete.h" #import "PerforceFile.h" #import "PerforceActionAdd.h" #import "PerforceActionResolve.h" @implementation DepotViewSelection - (id) initWithItems: (NSArray*) selectedItems { self = [super init]; fSelectedItems = [selectedItems retain]; return self; } - (void) dealloc { [fSelectedItems release]; [super dealloc]; } - (BOOL) canDoSelector: (SEL) selector { int numItems = [fSelectedItems count]; int n; BOOL canDo = YES; for ( n = 0; (n < numItems) && canDo; n++ ) { id<NSObject> item = [fSelectedItems objectAtIndex:n]; if ( ![item performSelector:selector] ) { canDo = NO; } } return canDo; } - (BOOL) canAdd { return [self canDoSelector:@selector(canAdd)]; } - (BOOL) canSyncToRevision { return [self canDoSelector:@selector(canSyncToRevision)]; } - (BOOL) canSyncToHead { return [self canDoSelector:@selector(canSyncToHead)]; } - (BOOL) canSyncToNone { return [self canDoSelector:@selector(canSyncToNone)]; } - (BOOL) canEdit { return [self canDoSelector:@selector(canEdit)]; } - (BOOL) canDelete { return [self canDoSelector:@selector(canDelete)]; } - (BOOL) canResolve { return [self canDoSelector:@selector(canResolve)]; } - (BOOL) canRevert { return [self canDoSelector:@selector(canRevert)]; } - (BOOL) canDiff { return [self canDoSelector:@selector(canDiff)]; } - (BOOL) canGetRevisions { return [self canDoSelector:@selector(canGetRevisions)]; } - (BOOL) canRevealInFinder { return [self canDoSelector:@selector(canRevealInFinder)]; } - (BOOL) canViewInEditor { return [self canDoSelector:@selector(canViewInEditor)]; } // // Actions // - (NSArray*) selectedAddPaths { NSMutableArray* depotArray = [NSMutableArray array]; int numItems = [fSelectedItems count]; int n; for ( n = 0; n < numItems; n++ ) { id<DepotViewProtocol> item = [fSelectedItems objectAtIndex:n]; if ( [item canAdd] ) { [depotArray addObject:[item getAddPath]]; } } return depotArray; } - (NSArray*) selectedDepotPaths { NSMutableArray* depotArray = [NSMutableArray array]; int numItems = [fSelectedItems count]; int n; for ( n = 0; n < numItems; n++ ) { id<DepotViewProtocol> item = [fSelectedItems objectAtIndex:n]; [depotArray addObject:[item getPerforceActionPath]]; } return depotArray; } - (void) doSelector: (SEL) selector { int numItems = [fSelectedItems count]; int n; for ( n = 0; n < numItems; n++ ) { id<NSObject> item = [fSelectedItems objectAtIndex:n]; [item performSelector:selector]; } } - (void) addFile { [PerforceActionAdd defaultAddFiles:[self selectedAddPaths]]; } - (void) syncToHead { [PerforceActionSync defaultRun:[self selectedDepotPaths] revision:nil]; } - (void) syncToNone { [PerforceActionSync defaultRun:[self selectedDepotPaths] revision:@"#none"]; } - (void) syncTo: (NSString*) target { [PerforceActionSync defaultRun:[self selectedDepotPaths] revision:target]; } - (void) showRevisionHistory { [self doSelector:@selector(showRevisionHistory)]; } - (void) edit { [PerforceActionEdit defaultRun:[self selectedDepotPaths]]; } - (void) delete { [PerforceActionDelete defaultRun:[self selectedDepotPaths]]; } - (void) resolve { [PerforceActionResolve defaultRun:[self selectedDepotPaths]]; } - (void) revert { [PerforceActionRevert defaultRun:[self selectedDepotPaths] unchanged:NO]; } - (void) revertUnchanged { [PerforceActionRevert defaultRun:[self selectedDepotPaths] unchanged:YES]; } - (void) diff { [self doSelector:@selector(diff)]; } - (void) revealInFinder { [self doSelector:@selector(revealInFinder)]; } - (void) viewInEditor { [self doSelector:@selector(viewInEditor)]; } - (NSString*) getCopyToPboardString { int numItems = [fSelectedItems count]; int n; NSMutableString* pathList = [NSMutableString string]; for ( n = 0; n < numItems; n++ ) { id<DepotViewProtocol> item = [fSelectedItems objectAtIndex:n]; [pathList appendString:[item getPasteboardData]]; [pathList appendString:@"\n"]; } return pathList; } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 4225 | Jeff Argast |
Added resolve support, reveal in finder, drag and drop edit, show local files, and showing added files. |
||
#5 | 3147 | Jeff Argast | Testing std in blockage | ||
#4 | 3134 | Jeff Argast |
Added copy/paste support in the depot view Added expand path to depot view Added bookmarks |
||
#3 | 3113 | Jeff Argast |
Reduced the times the depot view completely collapses. Now it won't collapse on refresh views or submit, but still collapses when the defaults change. |
||
#2 | 3111 | Jeff Argast |
Made multiple selection smarter by operating on the entire selection as an atomic operation with the server. Also partially fixed the read only window to not wrap at the window boundary. I did the same for the editable window, but now the problem appears to be that p4 change -o is breaking its output at some character location before the string gets into the editor (at least I think that is the problem). |
||
#1 | 2737 | Jeff Argast | Added several 0.15 revision functionality |