Changeset 250
- Timestamp:
- 09/06/07 03:30:36 (1 year ago)
- Files:
-
- trunk/cocoa/mogenerator/Xmod/Autocustomize Entity Classes.applescript (modified) (1 diff)
- trunk/cocoa/mogenerator/Xmod/Xmod.h (modified) (1 diff)
- trunk/cocoa/mogenerator/Xmod/Xmod.m (modified) (3 diffs)
- trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/project.pbxproj (modified) (4 diffs)
- trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.mode1 (modified) (10 diffs)
- trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.pbxuser (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cocoa/mogenerator/Xmod/Autocustomize Entity Classes.applescript
r248 r250 7 7 error "Please open an .xcdatamodel file and re-run the script." 8 8 tell item 1 of (every data model document whose path is mainWindowFilePath) 9 using terms from application "Finder"9 (*using terms from application "Finder" 10 10 display alert "Autocustomize Entity Classes" message "Automatically customize all generic entity classes based on their names? (This is undoable.)" buttons {"Cancel", "Auto-customize"} cancel button 1 11 11 end using terms from 12 if button returned of result is "Auto-customize" then 13 repeat with entityIt in (every entity)14 set object class of entityIt to name of entityIt & "MO"15 end repeat16 end if12 if button returned of result is "Auto-customize" then*) 13 repeat with entityIt in (every entity) 14 set object class of entityIt to name of entityIt & "MO" 15 end repeat 16 --end if 17 17 end tell 18 18 end tell trunk/cocoa/mogenerator/Xmod/Xmod.h
r207 r250 1 1 #import <Cocoa/Cocoa.h> 2 #import <objc/objc-class.h> 2 3 3 4 @interface Xmod : NSObject {} 5 - (IBAction)autocustomizeEntityClasses:(id)sender_; 4 6 @end trunk/cocoa/mogenerator/Xmod/Xmod.m
r249 r250 4 4 NSBundle *selfBundle; 5 5 6 static void runScriptNamed(NSString *scriptName) { 7 NSString *scriptPath = [selfBundle pathForResource:scriptName ofType:@"scpt" inDirectory:@"Scripts"]; 8 NSCAssert1(scriptPath, @"failed to find %@.scpt", scriptName); 9 NSDictionary *scriptInitError = nil; 10 NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:scriptPath] 11 error:&scriptInitError] autorelease]; 12 NSCAssert2(!scriptInitError, @"failed to init %@.scpt: %@", scriptName, scriptInitError); 13 if (!scriptInitError) { 14 NSDictionary *scriptExecuteError = nil; 15 [script executeAndReturnError:&scriptExecuteError]; 16 NSCAssert2(!scriptInitError, @"failed to execute %@.scpt: %@", scriptName, scriptExecuteError); 17 } 18 } 19 6 20 @interface NSObject (xmod_saveModelToFile) 7 21 @end 8 22 @implementation NSObject (xmod_saveModelToFile) 9 10 23 - (BOOL)xmod_saveModelToFile:(NSString*)modelPackagePath_ { 11 24 BOOL result = [self xmod_saveModelToFile:modelPackagePath_]; 12 25 if (result) { 13 NSString *scriptPath = [selfBundle pathForResource:@"Xmod" ofType:@"scpt" inDirectory:@"Scripts"]; 14 NSAssert(scriptPath, @"failed to find Xmod.scpt"); 15 NSDictionary *scriptInitError = nil; 16 NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:scriptPath] 17 error:&scriptInitError] autorelease]; 18 NSAssert1(!scriptInitError, @"failed to init Xmod.scpt: %@", scriptInitError); 19 if (!scriptInitError) { 20 NSDictionary *scriptExecuteError = nil; 21 [script executeAndReturnError:&scriptExecuteError]; 22 NSAssert1(!scriptInitError, @"failed to execute Xmod.scpt: %@", scriptExecuteError); 23 } 26 runScriptNamed(@"Xmod"); 24 27 } 25 28 return result; 26 29 } 27 28 30 @end 29 31 … … 32 34 + (void)pluginDidLoad:(NSBundle*)bundle_ { 33 35 selfBundle = bundle_; 36 [[self alloc] init]; 34 37 35 38 // Force loading of the Core Data XDesign plugin so we can find the class to swizzle its instance method. … … 47 50 } 48 51 52 - (id)init { 53 self = [super init]; 54 if (self) { 55 [[NSNotificationCenter defaultCenter] addObserver:self 56 selector:@selector(applicationDidFinishLaunching:) 57 name:NSApplicationDidFinishLaunchingNotification 58 object:nil]; 59 } 60 return self; 61 } 62 63 - (void)applicationDidFinishLaunching:(NSNotification*)notification_ { 64 NSMenu *designMenu = [[[NSApp mainMenu] itemWithTitle:@"Design"] submenu]; 65 NSMenu *dataModelMenu = [[designMenu itemWithTitle:@"Data Model"] submenu]; 66 67 NSMenuItem *myMenuItem = [dataModelMenu insertItemWithTitle:@"Autocustomize Entity Classes" 68 action:@selector(autocustomizeEntityClasses:) 69 keyEquivalent:@"" 70 atIndex:0]; 71 [myMenuItem setTarget:self]; 72 } 73 74 - (IBAction)autocustomizeEntityClasses:(id)sender_ { 75 runScriptNamed(@"Autocustomize Entity Classes"); 76 } 77 49 78 @end trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/project.pbxproj
r249 r250 14 14 files = ( 15 15 79D150FE0C8FBE01006706AF /* Xmod.applescript in AppleScript */, 16 79F8A9C30C8FF06700082291 /* Autocustomize Entity Classes.applescript in AppleScript */, 16 17 ); 17 18 isSharedContext = 0; … … 24 25 79DFC11F0B59B8C80056C80E /* Xmod.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DFC11E0B59B8C80056C80E /* Xmod.m */; }; 25 26 79DFC1290B59BFD60056C80E /* MethodSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DFC1280B59BFD60056C80E /* MethodSwizzle.m */; }; 27 79F8A9C30C8FF06700082291 /* Autocustomize Entity Classes.applescript in AppleScript */ = {isa = PBXBuildFile; fileRef = 79F8A9C20C8FF06600082291 /* Autocustomize Entity Classes.applescript */; settings = {ATTRIBUTES = (Debug, ); }; }; 26 28 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 27 29 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; … … 39 41 79DFC1270B59BFD60056C80E /* MethodSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MethodSwizzle.h; sourceTree = "<group>"; }; 40 42 79DFC1280B59BFD60056C80E /* MethodSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MethodSwizzle.m; sourceTree = "<group>"; }; 43 79F8A9C20C8FF06600082291 /* Autocustomize Entity Classes.applescript */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.applescript; path = "Autocustomize Entity Classes.applescript"; sourceTree = "<group>"; }; 41 44 8D5B49B6048680CD000E48DA /* Xmod.pbplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Xmod.pbplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 42 45 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; }; … … 83 86 089C167DFE841241C02AAC07 /* InfoPlist.strings */, 84 87 79D150FA0C8FBDE9006706AF /* Xmod.applescript */, 88 79F8A9C20C8FF06600082291 /* Autocustomize Entity Classes.applescript */, 85 89 ); 86 90 name = Resources; trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.mode1
r249 r250 186 186 <array/> 187 187 <key>OpenEditors</key> 188 <array> 189 <dict> 190 <key>Content</key> 191 <dict> 192 <key>PBXProjectModuleGUID</key> 193 <string>799F3CE50C8FC14900E2007D</string> 194 <key>PBXProjectModuleLabel</key> 195 <string>Xmod.m</string> 196 <key>PBXSplitModuleInNavigatorKey</key> 197 <dict> 198 <key>Split0</key> 199 <dict> 200 <key>PBXProjectModuleGUID</key> 201 <string>799F3CE60C8FC14900E2007D</string> 202 <key>PBXProjectModuleLabel</key> 203 <string>Xmod.m</string> 204 <key>_historyCapacity</key> 205 <integer>0</integer> 206 <key>bookmark</key> 207 <string>79C011900C8FC56D00E87B35</string> 208 <key>history</key> 209 <array> 210 <string>79C0118F0C8FC56D00E87B35</string> 211 </array> 212 </dict> 213 <key>SplitCount</key> 214 <string>1</string> 215 </dict> 216 <key>StatusBarVisibility</key> 217 <true/> 218 </dict> 219 <key>Geometry</key> 220 <dict> 221 <key>Frame</key> 222 <string>{{0, 20}, {762, 944}}</string> 223 <key>PBXModuleWindowStatusBarHidden2</key> 224 <false/> 225 <key>RubberWindowFrame</key> 226 <string>1501 193 762 985 0 0 2560 1578 </string> 227 </dict> 228 </dict> 229 <dict> 230 <key>Content</key> 231 <dict> 232 <key>PBXProjectModuleGUID</key> 233 <string>79C011910C8FC56D00E87B35</string> 234 <key>PBXProjectModuleLabel</key> 235 <string>Xmod.h</string> 236 <key>PBXSplitModuleInNavigatorKey</key> 237 <dict> 238 <key>Split0</key> 239 <dict> 240 <key>PBXProjectModuleGUID</key> 241 <string>79C011920C8FC56D00E87B35</string> 242 <key>PBXProjectModuleLabel</key> 243 <string>Xmod.h</string> 244 <key>_historyCapacity</key> 245 <integer>0</integer> 246 <key>bookmark</key> 247 <string>79C011940C8FC56D00E87B35</string> 248 <key>history</key> 249 <array> 250 <string>79C011930C8FC56D00E87B35</string> 251 </array> 252 </dict> 253 <key>SplitCount</key> 254 <string>1</string> 255 </dict> 256 <key>StatusBarVisibility</key> 257 <true/> 258 </dict> 259 <key>Geometry</key> 260 <dict> 261 <key>Frame</key> 262 <string>{{0, 20}, {762, 944}}</string> 263 <key>PBXModuleWindowStatusBarHidden2</key> 264 <false/> 265 <key>RubberWindowFrame</key> 266 <string>1441 274 762 985 0 0 2560 1578 </string> 267 </dict> 268 </dict> 269 </array> 188 <array/> 270 189 <key>PerspectiveWidths</key> 271 190 <array> … … 341 260 <string>089C167CFE841241C02AAC07</string> 342 261 <string>1C37FBAC04509CD000000102</string> 343 <string>79C0118C0C8FC56D00E87B35</string>344 262 <string>1C37FABC05509CD000000102</string> 345 263 </array> … … 347 265 <array> 348 266 <array> 349 <integer> 3</integer>350 <integer> 1</integer>267 <integer>11</integer> 268 <integer>7</integer> 351 269 <integer>0</integer> 352 270 </array> 353 271 </array> 354 272 <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> 355 <string>{{0, 0}, {186, 532}}</string>273 <string>{{0, 0}, {186, 412}}</string> 356 274 </dict> 357 275 <key>PBXTopSmartGroupGIDs</key> … … 365 283 <dict> 366 284 <key>Frame</key> 367 <string>{{0, 0}, {203, 550}}</string>285 <string>{{0, 0}, {203, 430}}</string> 368 286 <key>GroupTreeTableConfiguration</key> 369 287 <array> … … 372 290 </array> 373 291 <key>RubberWindowFrame</key> 374 <string>1 216 946 921 591 0 0 2560 1578 </string>292 <string>1107 1061 853 471 0 0 2560 1578 </string> 375 293 </dict> 376 294 <key>Module</key> … … 407 325 <dict> 408 326 <key>Frame</key> 409 <string>{{0, 0}, { 713, 0}}</string>327 <string>{{0, 0}, {645, 0}}</string> 410 328 <key>RubberWindowFrame</key> 411 <string>1 216 946 921 591 0 0 2560 1578 </string>329 <string>1107 1061 853 471 0 0 2560 1578 </string> 412 330 </dict> 413 331 <key>Module</key> … … 427 345 <dict> 428 346 <key>Frame</key> 429 <string>{{0, 5}, { 713, 545}}</string>347 <string>{{0, 5}, {645, 425}}</string> 430 348 <key>RubberWindowFrame</key> 431 <string>1 216 946 921 591 0 0 2560 1578 </string>349 <string>1107 1061 853 471 0 0 2560 1578 </string> 432 350 </dict> 433 351 <key>Module</key> 434 352 <string>XCDetailModule</string> 435 353 <key>Proportion</key> 436 <string> 545pt</string>354 <string>425pt</string> 437 355 </dict> 438 356 </array> 439 357 <key>Proportion</key> 440 <string> 713pt</string>358 <string>645pt</string> 441 359 </dict> 442 360 </array> … … 453 371 <key>TableOfContents</key> 454 372 <array> 455 <string>79 C0118D0C8FC56D00E87B35</string>373 <string>7988A27E0C8FF1B00098F17A</string> 456 374 <string>1CE0B1FE06471DED0097A5F4</string> 457 <string>79 C0118E0C8FC56D00E87B35</string>375 <string>7988A27F0C8FF1B00098F17A</string> 458 376 <string>1CE0B20306471E060097A5F4</string> 459 377 <string>1CE0B20506471E060097A5F4</string> … … 591 509 <string>79DFC1390B59BFE80056C80E</string> 592 510 <string>/Users/wolf/code/sf/redshed/cocoa/mogenerator/Xmod/Xmod.xcodeproj</string> 593 <string>79C011910C8FC56D00E87B35</string>594 <string>799F3CE50C8FC14900E2007D</string>595 511 </array> 596 512 <key>WindowString</key> 597 <string>1 216 946 921 591 0 0 2560 1578 </string>513 <string>1107 1061 853 471 0 0 2560 1578 </string> 598 514 <key>WindowTools</key> 599 515 <array> … … 672 588 <array> 673 589 <string>79DFC1390B59BFE80056C80E</string> 674 <string>79 C011950C8FC56D00E87B35</string>590 <string>7988A2800C8FF1B00098F17A</string> 675 591 <string>1CD0528F0623707200166675</string> 676 592 <string>XCMainBuildResultsModuleGUID</string> trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.pbxuser
r249 r250 14 14 PBXFileTableDataSourceColumnWidthsKey = ( 15 15 20, 16 4 74,16 406, 17 17 20, 18 18 48, … … 77 77 ); 78 78 }; 79 PBXPerProjectTemplateStateSaveDate = 210749283; 80 PBXWorkspaceStateSaveDate = 210749283; 81 }; 82 perUserProjectItems = { 83 79C0118F0C8FC56D00E87B35 = 79C0118F0C8FC56D00E87B35 /* PBXTextBookmark */; 84 79C011900C8FC56D00E87B35 = 79C011900C8FC56D00E87B35 /* PBXTextBookmark */; 85 79C011930C8FC56D00E87B35 = 79C011930C8FC56D00E87B35 /* PBXTextBookmark */; 86 79C011940C8FC56D00E87B35 = 79C011940C8FC56D00E87B35 /* PBXTextBookmark */; 79 PBXPerProjectTemplateStateSaveDate = 210759999; 80 PBXWorkspaceStateSaveDate = 210759999; 87 81 }; 88 82 sourceControlManager = 79DFC1170B59B8870056C80E /* Source Control */; 89 83 userBuildSettings = { 90 84 }; 91 };92 79C0118F0C8FC56D00E87B35 /* PBXTextBookmark */ = {93 isa = PBXTextBookmark;94 fRef = 79DFC11E0B59B8C80056C80E /* Xmod.m */;95 name = "Xmod.m: 4";96 rLen = 0;97 rLoc = 65;98 rType = 0;99 vrLen = 2613;100 vrLoc = 0;101 };102 79C011900C8FC56D00E87B35 /* PBXTextBookmark */ = {103 isa = PBXTextBookmark;104 fRef = 79DFC11E0B59B8C80056C80E /* Xmod.m */;105 name = "Xmod.m: 14";106 rLen = 0;107 rLoc = 365;108 rType = 0;109 vrLen = 2621;110 vrLoc = 0;111 };112 79C011930C8FC56D00E87B35 /* PBXTextBookmark */ = {113 isa = PBXTextBookmark;114 fRef = 79DFC11D0B59B8C80056C80E /* Xmod.h */;115 name = "Xmod.h: bundle";116 rLen = 0;117 rLoc = 53;118 rType = 0;119 vrLen = 60;120 vrLoc = 0;121 };122 79C011940C8FC56D00E87B35 /* PBXTextBookmark */ = {123 isa = PBXTextBookmark;124 fRef = 79DFC11D0B59B8C80056C80E /* Xmod.h */;125 name = "Xmod.h: 3";126 rLen = 0;127 rLoc = 53;128 rType = 0;129 vrLen = 60;130 vrLoc = 0;131 85 }; 132 86 79D150FA0C8FBDE9006706AF /* Xmod.applescript */ = { … … 152 106 79DFC11D0B59B8C80056C80E /* Xmod.h */ = { 153 107 uiCtxt = { 154 sepNavIntBoundsRect = "{{0, 0}, { 723, 927}}";155 sepNavSelRange = "{ 53, 0}";156 sepNavVisRect = "{{0, 0}, { 723, 927}}";157 sepNavWindowFrame = "{{ 1441, 274}, {762, 985}}";108 sepNavIntBoundsRect = "{{0, 0}, {1261, 667}}"; 109 sepNavSelRange = "{134, 0}"; 110 sepNavVisRect = "{{0, 0}, {1261, 667}}"; 111 sepNavWindowFrame = "{{751, 476}, {1300, 725}}"; 158 112 }; 159 113 }; 160 114 79DFC11E0B59B8C80056C80E /* Xmod.m */ = { 161 115 uiCtxt = { 162 sepNavIntBoundsRect = "{{0, 0}, {723, 980}}"; 163 sepNavSelRange = "{371, 0}"; 164 sepNavVisRect = "{{0, 0}, {723, 927}}"; 165 sepNavWindowFrame = "{{1501, 193}, {762, 985}}"; 116 sepNavIntBoundsRect = "{{0, 0}, {1186, 1106}}"; 117 sepNavSelRange = "{0, 0}"; 118 sepNavVisRect = "{{0, 0}, {1186, 856}}"; 119 sepNavWindowFrame = "{{1120, 289}, {1225, 914}}"; 120 }; 121 }; 122 79DFC1280B59BFD60056C80E /* MethodSwizzle.m */ = { 123 uiCtxt = { 124 sepNavIntBoundsRect = "{{0, 0}, {1186, 1722}}"; 125 sepNavSelRange = "{3053, 23}"; 126 sepNavVisRect = "{{0, 586}, {1186, 856}}"; 127 sepNavWindowFrame = "{{38, 638}, {1225, 914}}"; 128 }; 129 }; 130 79F8A9C20C8FF06600082291 /* Autocustomize Entity Classes.applescript */ = { 131 uiCtxt = { 132 sepNavIntBoundsRect = "{{0, 0}, {566, 375}}"; 133 sepNavSelRange = "{911, 0}"; 134 sepNavVisRect = "{{0, 0}, {566, 375}}"; 135 sepNavWindowFrame = "{{512, 306}, {605, 433}}"; 166 136 }; 167 137 }; … … 172 142 uiCtxt = { 173 143 sepNavIntBoundsRect = "{{0, 0}, {723, 927}}"; 174 sepNavSelRange = "{ 0, 0}";144 sepNavSelRange = "{698, 0}"; 175 145 sepNavVisRect = "{{0, 0}, {723, 927}}"; 176 sepNavWindowFrame = "{{1 5, 38}, {762, 985}}";146 sepNavWindowFrame = "{{1302, 337}, {762, 985}}"; 177 147 }; 178 148 };
