Implement - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
in your app delegate. Check the documentation for the details of the return value.
Document based apps and non-document based apps behave slightly differently. If there are no open windows when the dock icon of a document based app is clicked then it will create a new document. If there are no open windows when the dock icon of a non-document based app is clicked then it will do nothing.