I am trying to implement icon overlaying on files and folders just like Tortoise SVN or Dropbox does.
I did a lot of searching on the Internet, but I cannot find a solution in Java.
Can anyone help me with this?
I am sorry to confirm your fears, but it can't be done in Java.
Since the Windows Explorer is the one in control, Icon Overlay is sort of a plug-in. It has to be implemented as a DLL (not a JNI but a true native DLL), and registered in the Windows Registry. As you saw in CodeProject article, your DLL has to implement specific interface - IShellIconOverlayIdentifier
.
Take for example the TortoiseSVN implementation.
TortoiseSVN's DLL is loaded by the Explorer and attached to its process:
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */)
{
...
if (dwReason == DLL_PROCESS_ATTACH)
...
In order to do this in Java you would need to write a DLL that would load the JVM and your JAR which would be an overkill.
As for the Tray Icon overlay, your Java application is the one in control so it can be done.
I had the same problem and just found a solution for Java 1.7+ in combination with native and jni dlls. Works with Windows Vista+, Mac and Linux.
You can find the GIT project here: https://github.com/liferay/liferay-nativity
See my SO question here: Method to implement Windows Explorer icon overlays with Java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With