mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Rework symbol chooser code
The symbol chooser is now owned by DocumentView instead of DocumentController. The symbol chooser does not know about its owner and is not an observer of any notifications. Instead it has a property for “document” and one for “selectionString”. It is the owners job to update these properties (i.e. when switching document or changing the selection).
This commit is contained in:
@@ -58,7 +58,6 @@ PUBLIC @interface DocumentController : NSObject
|
||||
// =============================
|
||||
|
||||
- (IBAction)orderFrontFindPanel:(id)sender;
|
||||
- (IBAction)showSymbolChooser:(id)sender;
|
||||
- (IBAction)goToFile:(id)sender;
|
||||
|
||||
// ==================
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#import <OakFileBrowser/OakFileBrowser.h>
|
||||
#import <HTMLOutputWindow/HTMLOutputWindow.h>
|
||||
#import <OakFilterList/FileChooser.h>
|
||||
#import <OakFilterList/SymbolChooser.h>
|
||||
#import <OakSystem/application.h>
|
||||
#import <Find/Find.h>
|
||||
#import <file/path_info.h>
|
||||
@@ -68,8 +67,6 @@ static BOOL IsInShouldTerminateEventLoop = NO;
|
||||
@property (nonatomic) NSString* pathAttributes;
|
||||
@property (nonatomic) NSString* projectPath;
|
||||
|
||||
@property (nonatomic) OakFilterWindowController* filterWindowController;
|
||||
|
||||
@property (nonatomic) NSArray* urlArrayForQuickLook;
|
||||
|
||||
+ (void)scheduleSessionBackup:(id)sender;
|
||||
@@ -267,7 +264,6 @@ namespace
|
||||
self.tabBarView.dataSource = nil;
|
||||
self.tabBarView.delegate = nil;
|
||||
self.textView.delegate = nil;
|
||||
self.filterWindowController = nil; // ensures we removeObserver: and set target to nil
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)aNotification
|
||||
@@ -1384,27 +1380,6 @@ namespace
|
||||
// = Opening Auxiliary Windows =
|
||||
// =============================
|
||||
|
||||
- (void)setFilterWindowController:(OakFilterWindowController*)controller
|
||||
{
|
||||
if(_filterWindowController != controller)
|
||||
{
|
||||
if(_filterWindowController)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_filterWindowController.window];
|
||||
_filterWindowController.target = nil;
|
||||
[_filterWindowController close];
|
||||
}
|
||||
|
||||
if(_filterWindowController = controller)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(filterWindowWillClose:) name:NSWindowWillCloseNotification object:_filterWindowController.window];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)filterWindowWillClose:(NSNotification*)notification
|
||||
{
|
||||
self.filterWindowController = nil;
|
||||
}
|
||||
|
||||
- (IBAction)orderFrontFindPanel:(id)sender
|
||||
{
|
||||
Find* find = [Find sharedInstance];
|
||||
@@ -1454,20 +1429,6 @@ namespace
|
||||
[find showFindPanel:self];
|
||||
}
|
||||
|
||||
- (IBAction)showSymbolChooser:(id)sender
|
||||
{
|
||||
self.filterWindowController = [OakFilterWindowController new];
|
||||
self.filterWindowController.dataSource = [SymbolChooser symbolChooserForDocumentView:[self documentView]];
|
||||
self.filterWindowController.action = @selector(symbolChooserDidSelectItems:);
|
||||
self.filterWindowController.sendActionOnSingleClick = YES;
|
||||
[self.filterWindowController showWindowRelativeToWindow:self.window];
|
||||
}
|
||||
|
||||
- (void)symbolChooserDidSelectItems:(id)sender
|
||||
{
|
||||
[self openItems:[sender selectedItems] closingOtherTabs:NO];
|
||||
}
|
||||
|
||||
// ==================
|
||||
// = OakFileChooser =
|
||||
// ==================
|
||||
|
||||
Reference in New Issue
Block a user