Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File icon overlay in java for windows

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? enter image description here

like image 473
baharcglr Avatar asked Mar 23 '12 16:03

baharcglr


2 Answers

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.

like image 120
Cebence Avatar answered Nov 02 '22 17:11

Cebence


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

like image 33
metamagikum Avatar answered Nov 02 '22 15:11

metamagikum