diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j
index d017a1239..8f5c7b6f8 100644
--- a/AppKit/CPControl.j
+++ b/AppKit/CPControl.j
@@ -134,18 +134,18 @@ var CPControlBlackColor = [CPColor blackColor];
+ (void)initialize
{
- if (self === [CPControl class])
- {
- [self exposeBinding:@"value"];
- [self exposeBinding:@"objectValue"];
- [self exposeBinding:@"stringValue"];
- [self exposeBinding:@"integerValue"];
- [self exposeBinding:@"intValue"];
- [self exposeBinding:@"doubleValue"];
- [self exposeBinding:@"floatValue"];
+ if (self !== [CPControl class])
+ return;
- [self exposeBinding:@"enabled"];
- }
+ [self exposeBinding:@"value"];
+ [self exposeBinding:@"objectValue"];
+ [self exposeBinding:@"stringValue"];
+ [self exposeBinding:@"integerValue"];
+ [self exposeBinding:@"intValue"];
+ [self exposeBinding:@"doubleValue"];
+ [self exposeBinding:@"floatValue"];
+
+ [self exposeBinding:@"enabled"];
}
+ (Class)_binderClassForBinding:(CPString)theBinding
diff --git a/AppKit/CPFont.j b/AppKit/CPFont.j
index f125ffe5d..b96e4560c 100644
--- a/AppKit/CPFont.j
+++ b/AppKit/CPFont.j
@@ -67,7 +67,7 @@ var _CPFonts = {},
@code
CPSystemFontFace
Lucida Grande
- @endcode
+ @endcode
*/
@implementation CPFont : CPObject
{
@@ -84,6 +84,9 @@ var _CPFonts = {},
+ (void)initialize
{
+ if (self !== [CPFont class])
+ return;
+
var systemFontFace = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPSystemFontFace"];
if (!systemFontFace)
diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j
index 6ecba3738..e7ea02c3b 100644
--- a/AppKit/CPImageView.j
+++ b/AppKit/CPImageView.j
@@ -59,6 +59,9 @@ var CPImageViewEmptyPlaceholderImage = nil;
+ (void)initialize
{
+ if (self !== [CPImageView class])
+ return;
+
var bundle = [CPBundle bundleForClass:[CPView class]];
CPImageViewEmptyPlaceholderImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"empty.png"]];
diff --git a/AppKit/CPKeyBinding.j b/AppKit/CPKeyBinding.j
index 768e99578..c62faabcb 100644
--- a/AppKit/CPKeyBinding.j
+++ b/AppKit/CPKeyBinding.j
@@ -153,7 +153,7 @@ var CPKeyBindingCache = {};
+ (void)initialize
{
- if ([self class] !== CPKeyBinding)
+ if (self !== [CPKeyBinding class])
return;
[self createKeyBindingsFromJSObject:CPStandardKeyBindings];
diff --git a/AppKit/CPLevelIndicator.j b/AppKit/CPLevelIndicator.j
index e4a5474d1..27d688800 100644
--- a/AppKit/CPLevelIndicator.j
+++ b/AppKit/CPLevelIndicator.j
@@ -64,6 +64,9 @@ var _CPLevelIndicatorBezelColor = nil,
+ (void)initialize
{
+ if (self !== [CPLevelIndicator class])
+ return;
+
var bundle = [CPBundle bundleForClass:CPLevelIndicator];
_CPLevelIndicatorBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j
index 494598252..c022037cf 100644
--- a/AppKit/CPMenu/CPMenu.j
+++ b/AppKit/CPMenu/CPMenu.j
@@ -80,7 +80,7 @@ var _CPMenuBarVisible = NO,
+ (void)initialize
{
- if (self !== CPMenu)
+ if (self !== [CPMenu class])
return;
[[self class] setMenuBarAttributes:[CPDictionary dictionary]];
diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j
index d8406f3e9..7f93dbd59 100644
--- a/AppKit/CPMenu/_CPMenuBarWindow.j
+++ b/AppKit/CPMenu/_CPMenuBarWindow.j
@@ -34,7 +34,7 @@ var _CPMenuBarWindowBackgroundColor = nil,
+ (void)initialize
{
- if (self != [_CPMenuBarWindow class])
+ if (self !== [_CPMenuBarWindow class])
return;
var bundle = [CPBundle bundleForClass:self];
diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j
index c1150fb54..27d14dcb1 100644
--- a/AppKit/CPMenu/_CPMenuWindow.j
+++ b/AppKit/CPMenu/_CPMenuWindow.j
@@ -65,7 +65,7 @@ var STICKY_TIME_INTERVAL = 500,
+ (void)initialize
{
- if (self != [_CPMenuWindow class])
+ if (self !== [_CPMenuWindow class])
return;
var bundle = [CPBundle bundleForClass:self];
diff --git a/AppKit/CPMenuItem/_CPMenuItemView.j b/AppKit/CPMenuItem/_CPMenuItemView.j
index 695b9d8e7..86df38996 100644
--- a/AppKit/CPMenuItem/_CPMenuItemView.j
+++ b/AppKit/CPMenuItem/_CPMenuItemView.j
@@ -40,7 +40,7 @@ var _CPMenuItemSelectionColor = nil,
+ (void)initialize
{
- if (self != [_CPMenuItemView class])
+ if (self !== [_CPMenuItemView class])
return;
_CPMenuItemSelectionColor = [CPColor colorWithCalibratedRed:95.0 / 255.0 green:131.0 / 255.0 blue:185.0 / 255.0 alpha:1.0];
diff --git a/AppKit/CPObjectController.j b/AppKit/CPObjectController.j
index 8999f84da..64ee8f5a0 100644
--- a/AppKit/CPObjectController.j
+++ b/AppKit/CPObjectController.j
@@ -51,6 +51,9 @@
+ (id)initialize
{
+ if (self !== [CPObjectController class])
+ return;
+
[self exposeBinding:@"editable"];
[self exposeBinding:@"contentObject"];
}
diff --git a/AppKit/CPPasteboard.j b/AppKit/CPPasteboard.j
index 86d34bead..5a898ead0 100644
--- a/AppKit/CPPasteboard.j
+++ b/AppKit/CPPasteboard.j
@@ -73,7 +73,7 @@ var CPPasteboards = nil,
*/
+ (void)initialize
{
- if (self != [CPPasteboard class])
+ if (self !== [CPPasteboard class])
return;
[self setVersion:1.0];
diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j
index 7f43d5fbf..b7166e51c 100644
--- a/AppKit/CPProgressIndicator.j
+++ b/AppKit/CPProgressIndicator.j
@@ -78,7 +78,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
*/
+ (void)initialize
{
- if (self != [CPProgressIndicator class])
+ if (self !== [CPProgressIndicator class])
return;
var bundle = [CPBundle bundleForClass:self];
@@ -120,11 +120,11 @@ var CPProgressIndicatorSpinningStyleColors = nil,
// Bar Style
var prefixes = [
- CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
- CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
- CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle],
- CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]
- ];
+ CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
+ CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
+ CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle],
+ CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]
+ ];
for (var i = 0, count = prefixes.length; i < count; i++)
{
diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j
index 1d55fc2bd..42bfddf86 100644
--- a/AppKit/CPScrollView.j
+++ b/AppKit/CPScrollView.j
@@ -125,6 +125,9 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
+ (void)initialize
{
+ if (self !== [CPScrollView class])
+ return;
+
var globalValue = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPScrollersGlobalStyle"];
if (globalValue == nil || globalValue == -1)
diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j
index 246fc2a9b..173fbfd7b 100644
--- a/AppKit/CPSearchField.j
+++ b/AppKit/CPSearchField.j
@@ -72,7 +72,7 @@ var RECENT_SEARCH_PREFIX = @" ";
+ (void)initialize
{
- if (self != [CPSearchField class])
+ if (self !== [CPSearchField class])
return;
var bundle = [CPBundle bundleForClass:self];
diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j
index 4517d69e3..081e0666a 100644
--- a/AppKit/CPShadowView.j
+++ b/AppKit/CPShadowView.j
@@ -54,7 +54,7 @@ var LIGHT_LEFT_INSET = 3.0,
+ (void)initialize
{
- if (self != [CPShadowView class])
+ if (self !== [CPShadowView class])
return;
var bundle = [CPBundle bundleForClass:[self class]];
diff --git a/AppKit/CPSplitView.j b/AppKit/CPSplitView.j
index 02b1e06f9..499f6f7e4 100644
--- a/AppKit/CPSplitView.j
+++ b/AppKit/CPSplitView.j
@@ -113,7 +113,7 @@ var CPSplitViewHorizontalImage = nil,
*/
+ (void)initialize
{
- if (self != [CPSplitView class])
+ if (self !== [CPSplitView class])
return;
var bundle = [CPBundle bundleForClass:self];
diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j
index 4c7429638..5412642d9 100644
--- a/AppKit/CPToolbar.j
+++ b/AppKit/CPToolbar.j
@@ -114,7 +114,7 @@ var CPToolbarsByIdentifier = nil,
/* @ignore */
+ (void)initialize
{
- if (self != [CPToolbar class])
+ if (self !== [CPToolbar class])
return;
CPToolbarsByIdentifier = [CPDictionary dictionary];
diff --git a/AppKit/CPViewController.j b/AppKit/CPViewController.j
index 879df04ae..5f355c4c0 100644
--- a/AppKit/CPViewController.j
+++ b/AppKit/CPViewController.j
@@ -78,8 +78,10 @@ var CPViewControllerCachedCibs;
+ (void)initialize
{
- if (self === CPViewController)
- CPViewControllerCachedCibs = [CPDictionary dictionary];
+ if (self !== [CPViewController class])
+ return;
+
+ CPViewControllerCachedCibs = [CPDictionary dictionary];
}
/*!
diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j
index d0b942254..834d41311 100644
--- a/AppKit/CPWindow/CPWindow.j
+++ b/AppKit/CPWindow/CPWindow.j
@@ -343,7 +343,7 @@ var CPWindowActionMessageKeys = [
*/
+ (void)initialize
{
- if (self != [CPWindow class])
+ if (self !== [CPWindow class])
return;
var bundle = [CPBundle bundleForClass:[CPWindow class]];
diff --git a/AppKit/CPWindow/_CPHUDWindowView.j b/AppKit/CPWindow/_CPHUDWindowView.j
index b668e865f..a45e6118e 100644
--- a/AppKit/CPWindow/_CPHUDWindowView.j
+++ b/AppKit/CPWindow/_CPHUDWindowView.j
@@ -38,7 +38,7 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
+ (void)initialize
{
- if (self != [_CPHUDWindowView class])
+ if (self !== [_CPHUDWindowView class])
return;
var bundle = [CPBundle bundleForClass:self];
diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j
index 7154ec0ab..56b5ee8cd 100644
--- a/AppKit/CPWindow/_CPWindowView.j
+++ b/AppKit/CPWindow/_CPWindowView.j
@@ -45,7 +45,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
+ (void)initialize
{
- if (self != [_CPWindowView class])
+ if (self !== [_CPWindowView class])
return;
_CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)];
diff --git a/Foundation/CPKeyedArchiver.j b/Foundation/CPKeyedArchiver.j
index 870ae465b..83dbc52ee 100644
--- a/Foundation/CPKeyedArchiver.j
+++ b/Foundation/CPKeyedArchiver.j
@@ -125,7 +125,7 @@ var _CPKeyedArchiverStringClass = Nil,
*/
+ (void)initialize
{
- if (self != [CPKeyedArchiver class])
+ if (self !== [CPKeyedArchiver class])
return;
_CPKeyedArchiverStringClass = [CPString class];
diff --git a/Foundation/CPRunLoop.j b/Foundation/CPRunLoop.j
index af897360d..7d6cbbbc3 100644
--- a/Foundation/CPRunLoop.j
+++ b/Foundation/CPRunLoop.j
@@ -166,7 +166,7 @@ var CPRunLoopLastNativeRunLoop = 0;
*/
+ (void)initialize
{
- if (self != [CPRunLoop class])
+ if (self !== [CPRunLoop class])
return;
CPMainRunLoop = [[CPRunLoop alloc] init];
diff --git a/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/StringToURLTransformer.j b/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/StringToURLTransformer.j
index 477569d4e..14ea21cae 100644
--- a/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/StringToURLTransformer.j
+++ b/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/StringToURLTransformer.j
@@ -26,6 +26,9 @@
+ (void)initialize
{
+ if (self !== [StringToURLTransformer class])
+ return;
+
[CPValueTransformer setValueTransformer:[self new]
forName:@"StringToURLTransformer"];
}
diff --git a/Tests/Manual/UserlandNSTest/BorderView.j b/Tests/Manual/UserlandNSTest/BorderView.j
index 3328dafe1..fbeac462b 100644
--- a/Tests/Manual/UserlandNSTest/BorderView.j
+++ b/Tests/Manual/UserlandNSTest/BorderView.j
@@ -21,7 +21,8 @@ BorderViewDefaultBorderColor = nil;
+ (void)initialize
{
- BorderViewDefaultBorderColor = [CPColor colorWithHexString:@"0000ff"];
+ if (self === [BorderView class])
+ BorderViewDefaultBorderColor = [CPColor colorWithHexString:@"0000ff"];
}
- (id)initWithFrame:(CGRect)aFrame
diff --git a/Tools/nib2cib/NSFont.j b/Tools/nib2cib/NSFont.j
index 90a8004d6..cb336dc74 100644
--- a/Tools/nib2cib/NSFont.j
+++ b/Tools/nib2cib/NSFont.j
@@ -54,6 +54,9 @@ var IBDefaultFontFace = @"Lucida Grande",
+ (void)initialize
{
+ if (self !== [NSFont class])
+ return;
+
CPLog.debug("NSFont: default IB font: %s %f", IBDefaultFontFace, IBDefaultFontSize);
}