Here is a run-down of how Mac OS X handles icons.
Get ready for a trip down memory lane...

For generic files that OS X just can't identify, it uses the plain doc icon.

That's the easy part. Now it gets tricky.

There are two ways you can identify a file: by the extension or by the type and creator codes. The type and creator codes are bits of data stored invisibly in files saved on a Mac (with an HFS or HFS+ formatted drive). The type code is a four-character code (similar to the DOS filename extensions) that identifies what kind of file it is (QuickTime movie is MooV, JPEG is JPEG, plain text is TEXT). The creator code is a unique four-character code that identifies what program created that file (Photoshop is 8BIM, GraphicConverter is GKON, Audion is Audn). These codes are supposed to be registered with Apple so that multiple apps won't use the same code.
What does all that mean? Well, I'll get to that in a minute...
The method you are familiar with is to choose the icon by the extension. Let's say I have a JPEG image. I have several apps that can open it though, including OmniWeb, GraphicConverter, Photoshop, Internet Explorer, Preview, QuickTime Player, and a dozen others. Well, like Windows, Mac OS will have a "preferred" app for opening these kinds of files (assuming there is no type/creator code) that you can set yourself. I have set GraphicConverter as the default app to handle jpg images, so this file inherits GC's icon.

Here you can also see where you can change the default handling. To get this window, simply select a file and choose "Show Info" from the File menu.
That's like what you're probably accustomed to with Windows.
For as long as I can remember, though, Mac OS has had a different approach to handling files. Macs have never had to deal with file extensions until recent years and the need to exchange Windows-based files from the Internet. How did it work? Well, each file was assigned a type and creator code as I mentioned before. The system dynamically kept track of what codes belonged to what apps (nothing dirty like the Windows registry). If I created a picture in Photoshop and saved it in the jpeg format, it would use Photoshop's jpeg icon. If I created it in GraphicConverter, it would use its icon. This was a boon for many users because it meant that you could have different files of the same type but they would open with their respective parent applications when double-clicked.

Of course, just because the default handler for the second file was Photoshop doesn't mean GK can't open it -- it's just that Photoshop is, well, the default for specifically
that file.
This is the secondary method that Mac OS X uses to identify files and choose their icons. If a file was created by a Mac application, it will probably have the type and creator codes so it doesn't need an extension to determine how it will be handled.
However, in recent months, Apple seems to be abandoning the type/creator method. Cocoa apps, IIRC, do not have a default way of setting these codes. Thus, new apps have to rely on the clunky file extensions.
It's all quite a mess right now.
There has been an ongoing debate for quite some time. There are some people that want Apple to stick by the type/creator codes but there are others who want to give in to depending on DOS filename extensions. There are others still who insist Apple should build a new filesystem that uses MIME codes to identify files.
*whew* I hope that makes some sense...

[ 05-31-2002: Message edited by: starfleetX ]</p>