BWToolkit / BWSelectableToolbarHelper.m

//  BWSelectableToolbarHelper.m
//  BWToolkit
//  Created by Brandon Walkin (
//  All code is provided under the New BSD license.

#import "BWSelectableToolbarHelper.h"

@implementation BWSelectableToolbarHelper

@synthesize contentViewsByIdentifier;
@synthesize windowSizesByIdentifier;
@synthesize selectedIdentifier;
@synthesize oldWindowTitle;
@synthesize initialIBWindowSize;
@synthesize isPreferencesToolbar;

- (id)init
	if(self = [super init])
		if (contentViewsByIdentifier == nil)
			contentViewsByIdentifier = [[NSMutableDictionary alloc] init];
		if (windowSizesByIdentifier == nil)
			windowSizesByIdentifier = [[NSMutableDictionary alloc] init];
		if (selectedIdentifier == nil)
			selectedIdentifier = [[NSString alloc] init];
		if (oldWindowTitle == nil)
			oldWindowTitle = [[NSString alloc] init];
	return self;

- (id)initWithCoder:(NSCoder *)decoder;
    if ((self = [super init]) != nil)
		[self setContentViewsByIdentifier:[decoder decodeObjectForKey:@"BWSTHContentViewsByIdentifier"]];
		NSData *data = [decoder decodeObjectForKey:@"BWSTHWindowSizesByIdentifier"];
		[self setWindowSizesByIdentifier:[NSUnarchiver unarchiveObjectWithData:data]];
		[self setSelectedIdentifier:[decoder decodeObjectForKey:@"BWSTHSelectedIdentifier"]];
		[self setOldWindowTitle:[decoder decodeObjectForKey:@"BWSTHOldWindowTitle"]];
		[self setInitialIBWindowSize:[decoder decodeSizeForKey:@"BWSTHInitialIBWindowSize"]];
		[self setIsPreferencesToolbar:[decoder decodeBoolForKey:@"BWSTHIsPreferencesToolbar"]];
	return self;

- (void)encodeWithCoder:(NSCoder*)coder
	[coder encodeObject:[self contentViewsByIdentifier] forKey:@"BWSTHContentViewsByIdentifier"];
	NSData *data = [NSArchiver archivedDataWithRootObject:[self windowSizesByIdentifier]];
	[coder encodeObject:data forKey:@"BWSTHWindowSizesByIdentifier"];
	[coder encodeObject:[self selectedIdentifier] forKey:@"BWSTHSelectedIdentifier"];
	[coder encodeObject:[self oldWindowTitle] forKey:@"BWSTHOldWindowTitle"];
	[coder encodeSize:[self initialIBWindowSize] forKey:@"BWSTHInitialIBWindowSize"];
	[coder encodeBool:[self isPreferencesToolbar] forKey:@"BWSTHIsPreferencesToolbar"];

- (void)dealloc
	[contentViewsByIdentifier release];
	[windowSizesByIdentifier release];
	[selectedIdentifier release];
	[oldWindowTitle release];
	[super dealloc];

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.