I'm running Mountain Lion, and my question is how to "attach" an icon to an extension? For example, I want all .adm files has an icon like on the picture below. Unfortunately all I can is just attach an icon to proper file, not to all files that has such extension. Thus I want .adm extension has their own icon. .adm is opening in TextEdit, so please don't suggest me to open it in right app. Thank you in advance!
In this case, you need to update TextEdit's resources and plist to get it to use your custom icon for a file type it does not know about. The LaunchServices database also needs to be updated for the changes to be seen.
Here's a small snippet from that answer (bold emphasis mine):
Icons for file types are handled by Launch Services (the service determining, among other things, which application handles a file type). The file icon is always provided by the application handling opening a file by default. This way, e.g. Preview provides PDF icons by default, and PNG icons, but if you change all PNG files to open using Pixelmator instead, these files get a Pixelmator-style icon afterwards.
What you need to do is add your file type definition to the application that opens it by default, or create your own "dummy" application for the file type.