Files
gitx/PBRepositoryDocumentController.m
T
Pieter de Bie 86606ef815 Add a --commit option to the CLI client
This changes a lot of code, so quick review:

* RepositoryDocumentController now returns the document without selecting a ref
* PBGitWindowController now optionally shows the default view, or selects no view at all
* PBGitRepository keeps a pointer to its WindowController so that it can change views
2008-09-26 23:22:15 +02:00

48 lines
1.2 KiB
Objective-C

//
// PBRepositoryDocumentController.mm
// GitX
//
// Created by Ciarán Walsh on 15/08/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "PBRepositoryDocumentController.h"
#import "PBGitRepository.h"
#import "PBGitRevList.h"
@implementation PBRepositoryDocumentController
// This method is overridden to configure the open panel to only allow
// selection of directories
- (NSInteger)runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)extensions
{
[openPanel setCanChooseFiles:YES];
[openPanel setCanChooseDirectories:YES];
return [openPanel runModalForDirectory:nil file:nil types:[NSArray arrayWithObject: @"git"]];
}
// Convert paths to the .git dir before searching for an already open document
- (id)documentForURL:(NSURL *)URL
{
return [super documentForURL:[PBGitRepository gitDirForURL:URL]];
}
- (void)noteNewRecentDocumentURL:(NSURL*)url
{
[super noteNewRecentDocumentURL:[PBGitRepository baseDirForURL:url]];
}
- (id) documentForLocation:(NSURL*) url
{
id document = [self documentForURL:url];
if (!document) {
if (!(document = [[PBGitRepository alloc] initWithURL:url]))
return NO;
[self addDocument:document];
}
return document;
}
@end