]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FileIconNameLabelProvider.java
Move JCR utilities from API to CMS JCR
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / fs / FileIconNameLabelProvider.java
index 777d57567c97ac6708207ca4c2714f6dc0b02a92..d3fc1c9039c63288d6de6615053ca7c0680c520a 100644 (file)
@@ -7,6 +7,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.swt.graphics.Image;
 
+/** Basic label provider with icon for NIO file viewers */
 public class FileIconNameLabelProvider extends ColumnLabelProvider {
        private static final long serialVersionUID = 8187902187946523148L;
 
@@ -15,8 +16,8 @@ public class FileIconNameLabelProvider extends ColumnLabelProvider {
 
        public FileIconNameLabelProvider() {
                // if (!PlatformUI.isWorkbenchRunning()) {
-               folderIcon = ImageDescriptor.createFromFile(getClass(), "fldr_obj.gif").createImage();
-               fileIcon = ImageDescriptor.createFromFile(getClass(), "file_obj.gif").createImage();
+               folderIcon = ImageDescriptor.createFromFile(getClass(), "folder.png").createImage();
+               fileIcon = ImageDescriptor.createFromFile(getClass(), "file.png").createImage();
                // }
        }
 
@@ -38,6 +39,8 @@ public class FileIconNameLabelProvider extends ColumnLabelProvider {
                                return "[No name]";
                        else
                                return name.toString();
+               } else if (element instanceof ParentDir) {
+                       return "..";
                }
                return null;
        }
@@ -57,7 +60,25 @@ public class FileIconNameLabelProvider extends ColumnLabelProvider {
                        // else
                        // return
                        // PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+               } else if (element instanceof ParentDir) {
+                       return folderIcon;
                }
                return null;
        }
+
+       @Override
+       public String getToolTipText(Object element) {
+               if (element instanceof Path) {
+                       Path curr = ((Path) element);
+                       Path name = curr.getFileName();
+                       if (name == null)
+                               return "[No name]";
+                       else
+                               return name.toAbsolutePath().toString();
+               } else if (element instanceof ParentDir) {
+                       return ((ParentDir) element).getPath().toAbsolutePath().toString();
+               }
+               return null;
+       }
+
 }
\ No newline at end of file