//
//  SRJSErrorLog.m
//  Shiira
//
//  Created by 鷲田 基 on 06/01/28.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "SRJSErrorLogController.h"
#import <WebKit/WebKit.h>
#import "SRXMLDocument.h"
#import "SRSourceWindowController.h"

@implementation SRJSErrorLogController
- (SRJSErrorLogController*)initWithWindowNibName:(NSString*)nibName {
	self = [super initWithWindowNibName:nibName];
	
	if(!self) {
		return nil;
	}
	
	_logItems = [[NSMutableArray alloc] init];
	
	return self;
}

- (void)dealloc {
	if(_logItems) {
		[_logItems release];
	}

	[super dealloc];
}

- (IBAction)clearLog:(id)sender {
	[[self mutableArrayValueForKey: @"logItems"] removeAllObjects];
}

- (void)openJavaScriptSources:(NSArray *)items {
	NSArray *urlStrings = [items valueForKeyPath:@"@distinctUnionOfObjects.sourceURL"];
	NSEnumerator *en = [urlStrings objectEnumerator];
	id urlString;
	while((urlString = [en nextObject]) != nil) {
		// Using private method because it was too  :P
		[[NSApp delegate] _openURL:[NSURL URLWithString:urlString]];
	}
}

@end
