Author: ericwa
Date: Sun Mar 23 07:57:23 2014
New Revision: 10616
URL: http://svn.gna.org/viewcvs/etoile?rev=10616&view=rev
Log:
ProjectDemo: add 'reattach as branch' menu item
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.h
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.m
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/English.lproj/ProjectDemoMainMenu.xib
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.h
URL:
http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.h?rev=10616&r1=10615&r2=10616&view=diff
==============================================================================
---
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.h
(original)
+++
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.h
Sun Mar 23 07:57:23 2014
@@ -29,7 +29,7 @@
- (IBAction) newDrawing: (id)sender;
- (IBAction) newWindow: (id)sender;
-
+- (IBAction) reattachAsBranch:(id)sender;
- (IBAction) duplicate:(id)sender;
- (void)checkpointWithName: (NSString*)name;
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.m
URL:
http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.m?rev=10616&r1=10615&r2=10616&view=diff
==============================================================================
---
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.m
(original)
+++
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/ApplicationDelegate.m
Sun Mar 23 07:57:23 2014
@@ -8,6 +8,7 @@
#import "SKTDrawDocument.h"
#import "Project.h"
#import <CoreObject/CoreObject.h>
+#import <CoreObject/COPersistentRoot+Private.h>
@implementation ApplicationDelegate
@@ -205,6 +206,53 @@
Document *doc = persistentRoot.rootObject;
[self registerDocumentRootObject: doc];
}
+}
+
+- (IBAction) reattachAsBranch:(id)sender
+{
+ id wcObject = [[NSApp mainWindow] windowController];
+ if (wcObject != nil && [wcObject respondsToSelector:
@selector(projectDocument)])
+ {
+ EWDocumentWindowController *wc = wcObject;
+ COPersistentRoot *proot = wc.persistentRoot;
+
+ [wc close];
+ [controllerForWindowID removeObjectForKey: wc.windowID];
+
+ ETAssert(proot.isCopy);
+
+ // FIXME: This is a private method. The ability to create a
branch at an arbitrary
+ // revision should probably be exposed by COPersistentRoot
+ COBranch *reattachedBranch = [proot.parentPersistentRoot
makeBranchWithLabel: proot.name
+
atRevision:
proot.currentRevision
+
parentBranch:
nil];
+
+ proot.deleted = YES;
+
+ [context commit];
+ }
+}
+
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
+{
+ SEL theAction = [anItem action];
+
+ EWDocumentWindowController *wc = nil;
+ COPersistentRoot *proot = nil;
+
+ id wcObject = [[NSApp mainWindow] windowController];
+ if (wcObject != nil && [wcObject respondsToSelector:
@selector(projectDocument)])
+ {
+ wc = wcObject;
+ proot = wc.persistentRoot;
+ }
+
+ if (theAction == @selector(reattachAsBranch:))
+ {
+ return proot.isCopy;
+ }
+
+ return [self respondsToSelector: theAction];;
}
- (EWDocumentWindowController *) makeWindowControllerForDocumentRootObject:
(Document *)aDoc
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/English.lproj/ProjectDemoMainMenu.xib
URL:
http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/English.lproj/ProjectDemoMainMenu.xib?rev=10616&r1=10615&r2=10616&view=diff
==============================================================================
---
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/English.lproj/ProjectDemoMainMenu.xib
(original)
+++
trunk/Etoile/Frameworks/CoreObject/Samples/ProjectDemo/English.lproj/ProjectDemoMainMenu.xib
Sun Mar 23 07:57:23 2014
@@ -290,6 +290,14 @@
<object
class="NSMenuItem" id="212240817">
<reference key="NSMenu" ref="958508040"/>
<string
key="NSTitle">Duplicate</string>
+ <string
key="NSKeyEquiv"/>
+ <int
key="NSMnemonicLoc">2147483647</int>
+
<reference key="NSOnImage" ref="128092494"/>
+
<reference key="NSMixedImage" ref="818417131"/>
+ </object>
+ <object
class="NSMenuItem" id="117003011">
+
<reference key="NSMenu" ref="958508040"/>
+ <string
key="NSTitle">Re-attach as branch</string>
<string
key="NSKeyEquiv"/>
<int
key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="128092494"/>
@@ -1615,7 +1623,6 @@
<string
key="NSFrame">{{1, 119}, {223, 15}}</string>
<reference key="NSSuperview" ref="371928918"/>
<reference key="NSWindow"/>
-
<reference key="NSNextKeyView"/>
<bool
key="NSAllowsLogicalLayoutDirection">NO</bool>
<int
key="NSsFlags">1</int>
<reference key="NSTarget" ref="371928918"/>
@@ -1837,7 +1844,6 @@
<string
key="NSFrame">{{338, 12}, {96, 32}}</string>
<reference
key="NSSuperview" ref="967803874"/>
<reference
key="NSWindow"/>
- <reference
key="NSNextKeyView"/>
<string
key="NSHuggingPriority">{250, 750}</string>
<bool
key="NSEnabled">YES</bool>
<object
class="NSButtonCell" key="NSCell" id="669802616">
@@ -1906,6 +1912,13 @@
<reference key="NSOnImage" ref="128092494"/>
<reference key="NSMixedImage" ref="818417131"/>
</object>
+ <object class="NSMenuItem" id="217847298">
+ <string key="NSTitle">Item</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="128092494"/>
+ <reference key="NSMixedImage" ref="818417131"/>
+ </object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<bool key="usesAutoincrementingIDs">NO</bool>
@@ -2597,6 +2610,14 @@
<reference key="destination"
ref="275679904"/>
</object>
<string key="id">TUk-IY-EZV</string>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection"
key="connection">
+ <string
key="label">reattachAsBranch:</string>
+ <reference key="source"
ref="471146553"/>
+ <reference key="destination"
ref="117003011"/>
+ </object>
+ <string key="id">iIN-cR-bOw</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection"
key="connection">
@@ -3004,6 +3025,7 @@
<reference
ref="212240817"/>
<reference
ref="209018966"/>
<reference
ref="790466051"/>
+ <reference
ref="117003011"/>
</array>
<reference key="parent"
ref="753782612"/>
</object>
@@ -4140,6 +4162,16 @@
<string key="id">809</string>
<reference key="object"
ref="796451796"/>
<reference key="parent"
ref="853014698"/>
+ </object>
+ <object class="IBObjectRecord">
+ <string
key="id">Agr-hk-GVz</string>
+ <reference key="object"
ref="217847298"/>
+ <reference key="parent"
ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <string
key="id">90C-0l-Xg1</string>
+ <reference key="object"
ref="117003011"/>
+ <reference key="parent"
ref="958508040"/>
</object>
</array>
</object>
@@ -4511,8 +4543,10 @@
<string
key="8SS-ae-TLD.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="8SS-ae-TLD.showNotes"/>
<string
key="8aD-2S-poi.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string
key="90C-0l-Xg1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string
key="9xf-eK-abN.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string
key="A0F-d0-oUC.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string
key="Agr-hk-GVz.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string
key="DEf-Y0-PTG.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string
key="Go5-4C-6Ug.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string
key="I6F-dJ-MtP.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4730,6 +4764,7 @@
<string
key="moveToTrash:">id</string>
<string
key="projectDemoRedo:">id</string>
<string
key="projectDemoUndo:">id</string>
+ <string
key="reattachAsBranch:">id</string>
<string
key="rename:">id</string>
<string
key="shareWith:">id</string>
<string
key="showDocumentHistory:">id</string>
@@ -4761,6 +4796,10 @@
</object>
<object class="IBActionInfo"
key="projectDemoUndo:">
<string
key="name">projectDemoUndo:</string>
+ <string
key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo"
key="reattachAsBranch:">
+ <string
key="name">reattachAsBranch:</string>
<string
key="candidateClassName">id</string>
</object>
<object class="IBActionInfo"
key="rename:">
_______________________________________________
Etoile-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-cvs