removing item from NSTreeController or NSOutlineView

  • I've been looking at the SourceView sample code and was wondering how
    I would create a custom remove method.  For example, I don't want to
    remove certain nodes, so what I want to do is check if the node
    isSpecialGroup (a node that should not be removed) and remove the node
    if it is not.  I'm not sure if I need to remove this from the Tree
    Controller or the outlineView or both.  I started doing something like
    the method below, but I'm pretty sure I'm way off, any help would be
    much appreciated!

    //
    -------------------------------------------------------------------------------
    //    remove:
    //
    -------------------------------------------------------------------------------
    - (void)remove:(id)sender
    {
    NSArray *selectedItems = [treeController selectedObjects];
    int i;

    for (i=0; i<[selectedItems count];i++){
      if([self isSpecialGroup [selectedItems objectAtIndex:i]] == YES){
      [treeController remove:sender];
      }
    }

    }

    Thanks,
    Steven
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today