I just noticed that not all icons in the dock allows you to drag files to them. For example, I can drag a file to textedit but not finder. What exactly is it that decides whether or not an application supports an action like that? Just curious.
            Asked
            
        
        
            Active
            
        
            Viewed 2,700 times
        
    2 Answers
5
            I believe it's the list of supported file types set in the application's Info.plist. If you drag a supported file type onto the app, it will allow the drop. Otherwise it will not.
        Marc W
        
- 19,083
 - 4
 - 59
 - 71
 
- 
                    I don't think Info.plist as to do with that. See my answer. – yogsototh Oct 06 '09 at 19:29
 - 
                    Actually, it does. Your answer involves accepting dropped objects into views, not dropped files onto the app icon. – Marc W Oct 06 '09 at 19:42
 - 
                    Does all programs have a Info.plist? I'm thinking of multiplatform java programs for example. Though I dont know if they support this feature. But if they do, does that mean they also have a info.plist? – quano Oct 06 '09 at 20:33
 - 
                    Iirc, old school Java-Cocoa bridge apps had one (but you might want to verify that yourself). Not sure about regular Java apps. I think they do have to do some platform-specific things to register handled document types, but I haven't done Java desktop app development in eons so I don't know the specifics. – Marc W Oct 06 '09 at 20:35
 
-2
            
            
        The application had to register itself to accept Drag'n Drop of certain kind of Data.
Before a view can receive a drag operation, you need to register the data types that it can accept by invoking its registerForDraggedTypes:, like this:
[self registerForDraggedTypes:[NSArray arrayWithObjects: NSColorPboardType, NSFilenamesPboardType, nil]];
The full details are here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.pdf
        yogsototh
        
- 14,371
 - 1
 - 22
 - 21
 
- 
                    He's not talking about views, he's talking about dragging an onto an icon in the dock or on the desktop. – Amok Oct 06 '09 at 19:34
 - 
                    Moreover, the document doesn't explain how a not launched application is able to accept or refuse drag-open operation. – mouviciel Oct 06 '09 at 19:39