package org.eparapher.rcp.tools; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eparapher.rcp.views.documents.SecuredDocumentsView.TreeObject; public class GUIIcons { public final static Image FILE_ICON_PDF = eParapherTools.getPluginImage("resources/icons/files/pdf.png"); public final static Image FILE_ICON_ZIP = eParapherTools.getPluginImage("resources/icons/files/zip.png"); public final static Image FILE_ICON_TXT = eParapherTools.getPluginImage("resources/icons/files/txt.png"); public final static Image FILE_ICON_EXE = eParapherTools.getPluginImage("resources/icons/files/exec_wine.png"); public final static Image FILE_ICON_IMG = eParapherTools.getPluginImage("resources/icons/files/image2.png"); public final static Image FILE_ICON_DOC = eParapherTools.getPluginImage("resources/icons/files/kword_kwd.png"); public final static Image FILE_ICON_XLS = eParapherTools.getPluginImage("resources/icons/files/spreadsheet_document.png"); public final static Image FILE_ICON_PPT = eParapherTools.getPluginImage("resources/icons/files/kpresenter_kpr.png"); public final static Image FILE_ICON_LOG = eParapherTools.getPluginImage("resources/icons/files/log.png"); public final static Image FILE_ICON_SHELL = eParapherTools.getPluginImage("resources/icons/files/shell1.png"); public final static Image FILE_ICON_BINARY = eParapherTools.getPluginImage("resources/icons/files/binary.png"); public final static Image FILE_ICON_FOLDER = eParapherTools.getPluginImage("resources/icons/files/folder.png"); public final static Image FILE_ICON_HTML = eParapherTools.getPluginImage("resources/icons/files/html.png"); public static final Image FILE_ICON_ISO = eParapherTools.getPluginImage("resources/icons/files/cdimage.png"); public final static Image FILE_ICON_DEFAULT = eParapherTools.getPluginImage("resources/icons/files/file_doc.png"); public final static Image FILE_ICON_VIDEO = eParapherTools.getPluginImage("resources/icons/files/video.png"); public final static Image FILE_ICON_MUSIC = eParapherTools.getPluginImage("resources/icons/files/midi.png"); public final static Image FILE_ICON_OOWRITER = eParapherTools.getPluginImage("resources/icons/files/text_obj.gif"); public final static Image FILE_ICON_OOCALC = eParapherTools.getPluginImage("resources/icons/files/spreadsheet_obj.gif"); public final static Image FILE_ICON_OOIMPRES = eParapherTools.getPluginImage("resources/icons/files/presentation_obj.gif"); public final static Image FILE_ICON_OODRAW = eParapherTools.getPluginImage("resources/icons/files/draw_obj.gif"); public final static Image FILE_BTN_ICON_ADD_FILE = eParapherTools.getPluginImage("resources/icons/16x16/add_file.png"); public final static Image FILE_BTN_ICON_REMOVE_FILE = eParapherTools.getPluginImage("resources/icons/16x16/remove_file.png"); public final static Image HOME_LOCAL_FILE_ICON = eParapherTools.getPluginImage("resources/icons/16x16/folder_home.png"); public final static Image FILE_ICON_CMS = eParapherTools.getPluginImage("resources/icons/16x16/signature.png"); public final static Image FILE_ICON_ENC = eParapherTools.getPluginImage("resources/icons/16x16/lock.png"); public final static Image FILE_ICON_DEC = eParapherTools.getPluginImage("resources/icons/16x16/decrypted.png"); public final static Image VIEW_CONSOLE_ICON = eParapherTools.getPluginImage("resources/icons/16x16/xconsole.png"); public final static Image DLG_ICON_VALID_CERT = eParapherTools.getPluginImage("resources/icons/32x32/certificate.png"); public final static Image DLG_ICON_UNVALID_CERT = eParapherTools.getPluginImage("resources/icons/32x32/certificate.png"); public final static Image DLG_ICON_UNTRUSTED_CERT = eParapherTools.getPluginImage("resources/icons/32x32/certificate.png"); public static final Image LOCK32_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/32x32/lock.png"); public static final Image LOCK32KO_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/32x32/lock_ko.png"); public final static Image CERTIFICATE_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/application-certificate.png"); public final static Image PK_AND_CERT_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/key-certificate.png"); public final static Image PRIVATE_KEY_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/keypair.png"); public final static Image CERTIFICATE_SEL_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/selected-certificate.png"); public final static Image NEW_CERTIFICATE_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/Menu/certificate-new.png"); public final static Image NEW_KEY_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/Menu/key-new.png"); public static final Image OK_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/ok.png"); public static final Image KO_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/cancel.png"); public static final Image WARN_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/warning.png"); public static final Image TRASH_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/trash.png"); public static final Image REFRESH_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/refresh.png"); public static final Image INFO_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/info.png"); public static final Image RUN_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/run-build.png"); public final static Image TRAY_ICON_IMG = eParapherTools.getPluginImage("resources/icons/exe/alt_window_16.gif"); public static final Image TRAY_EXIT_IMG = eParapherTools.getPluginImage("resources/icons/16x16/logout.png"); public static final Image LOCK_ICON_IMG = eParapherTools.getPluginImage("resources/icons/16x16/lock.png"); public static final Image PREF_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/Menu/configure.png"); public static final Image MENU_IMPORT_IMG = eParapherTools.getPluginImage("resources/icons/Menu/import_wiz.gif"); public static final Image MENU_EXPORT_IMG = eParapherTools.getPluginImage("resources/icons/Menu/export_wiz.gif"); public static final Image EDIT_COPY_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/editcopy.png"); public static final Image EDIT_CUT_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/editcut.png"); public static final Image EDIT_PASTE_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/editpaste.png"); public static final Image EDIT_DEL_ICON_IMAGE = eParapherTools.getPluginImage("resources/icons/16x16/editdelete.png"); public final static ImageDescriptor EDIT_COPY_ICON = ImageDescriptor.createFromImage(EDIT_COPY_ICON_IMAGE); public final static ImageDescriptor EDIT_CUT_ICON = ImageDescriptor.createFromImage(EDIT_CUT_ICON_IMAGE); public final static ImageDescriptor EDIT_PASTE_ICON = ImageDescriptor.createFromImage(EDIT_PASTE_ICON_IMAGE); public final static ImageDescriptor EDIT_DEL_ICON = ImageDescriptor.createFromImage(EDIT_DEL_ICON_IMAGE); public final static ImageDescriptor RUN_ICON = ImageDescriptor.createFromImage( RUN_ICON_IMAGE ); public final static ImageDescriptor PDF_ICON = ImageDescriptor.createFromImage(FILE_ICON_PDF); public final static ImageDescriptor XML_ICON = ImageDescriptor.createFromImage(FILE_ICON_HTML); public final static ImageDescriptor CERTIFICATE_ICON = ImageDescriptor.createFromImage(CERTIFICATE_ICON_IMAGE); public final static ImageDescriptor CERT_DEF_ICON = ImageDescriptor.createFromImage(CERTIFICATE_SEL_ICON_IMAGE); public final static ImageDescriptor NEW_KEY_ICON = ImageDescriptor.createFromImage(NEW_KEY_ICON_IMAGE); public final static ImageDescriptor NEW_CERT_ICON = ImageDescriptor.createFromImage(NEW_CERTIFICATE_ICON_IMAGE); public final static ImageDescriptor IMPORT_ICON = ImageDescriptor.createFromImage(MENU_IMPORT_IMG); public final static ImageDescriptor EXPORT_ICON = ImageDescriptor.createFromImage(MENU_EXPORT_IMG); public final static ImageDescriptor SIGNATURE_ICON = ImageDescriptor.createFromImage(FILE_ICON_CMS); public final static ImageDescriptor ENCRYPTION_ICON = ImageDescriptor.createFromImage(FILE_ICON_ENC); public final static ImageDescriptor DECRYPTION_ICON = ImageDescriptor.createFromImage(FILE_ICON_DEC); public final static ImageDescriptor REFRESH_ICON = ImageDescriptor.createFromImage(REFRESH_ICON_IMAGE); public final static ImageDescriptor INFO_ICON = ImageDescriptor.createFromImage(INFO_ICON_IMAGE); public final static ImageDescriptor LOCK_ICON = ImageDescriptor.createFromImage(LOCK_ICON_IMG); public final static ImageDescriptor TRASH_ICON = ImageDescriptor.createFromImage(TRASH_ICON_IMAGE); public static final ImageDescriptor PREF_ICON = ImageDescriptor.createFromImage(PREF_ICON_IMAGE); public final static ImageDescriptor WARNING_ICON = ImageDescriptor.createFromImage(WARN_ICON_IMAGE); public static final ImageDescriptor EXIT_ICON = ImageDescriptor.createFromImage(TRAY_EXIT_IMG); public final static ImageDescriptor WIZARD_SIGN_IMG2 = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/ds2.png")); public final static ImageDescriptor WIZARD_SIGN_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/ds.png")); public final static ImageDescriptor WIZARD_PKEY_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/key.png")); public final static ImageDescriptor WIZARD_KEYST_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/keystore.png")); public final static ImageDescriptor WIZARD_SCARD_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/smartcard.png")); public final static ImageDescriptor WIZARD_IMPORT_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/import_wiz.png")); public final static ImageDescriptor WIZARD_EXPORT_IMG = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/export_wiz.png")); public final static ImageDescriptor WIZARD_NEW_KEYST = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/new_keystore.png")); public final static ImageDescriptor WIZARD_NEW_CERT = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/new_certificate.png")); public final static ImageDescriptor WIZARD_NEW_KEYPAIR = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/new_keypair.png")); public final static ImageDescriptor WIZARD_NEW_KEYCERT = ImageDescriptor.createFromImage( eParapherTools.getPluginImage("resources/icons/wizards/new_certificate_and_keypair.png")); public static Image getIconFromFileExt(TreeObject to) { return getIconFromFileExt(to.getName()); } public static Image getIconFromFileExt(String fileName) { String f = fileName.toLowerCase(); if ( f.endsWith(".pdf") ) return GUIIcons.FILE_ICON_PDF; if ( hasExtention( f, new String[] {".zip", ".rar", ".tar", ".jar", ".gz", ".jar", ".arj", ".7z"}) ) return GUIIcons.FILE_ICON_ZIP; if ( f.endsWith(".txt") ) return GUIIcons.FILE_ICON_TXT; if ( f.endsWith(".bin") || (f.indexOf(".")==-1) ) return GUIIcons.FILE_ICON_BINARY; if (f.endsWith(".p7") || f.endsWith(".p7s") || f.endsWith(".p7m")) return GUIIcons.FILE_ICON_CMS; if (f.endsWith(".exe")) return GUIIcons.FILE_ICON_EXE; if (f.endsWith(".iso") || f.endsWith(".nrg")) return GUIIcons.FILE_ICON_ISO; if (f.endsWith(".html") || f.endsWith(".html")) return GUIIcons.FILE_ICON_HTML; if ( f.endsWith(".sh") || f.endsWith(".csh") || f.endsWith(".ksh") || f.endsWith(".tcsh") || f.endsWith(".cmd") || f.endsWith(".bat")) return GUIIcons.FILE_ICON_SHELL; if (f.endsWith(".log")) return GUIIcons.FILE_ICON_LOG; if (f.endsWith(".doc")) return GUIIcons.FILE_ICON_DOC; if (f.endsWith(".xls")) return GUIIcons.FILE_ICON_XLS; if (f.endsWith(".ppt")) return GUIIcons.FILE_ICON_PPT; if ( f.endsWith(".odt") || f.endsWith(".sxw") || f.endsWith(".ott") || f.endsWith(".stw")) return GUIIcons.FILE_ICON_OOWRITER; if ( f.endsWith(".ods") || f.endsWith(".sxc") || f.endsWith(".ots") || f.endsWith(".stc")) return GUIIcons.FILE_ICON_OOCALC; if ( f.endsWith(".odp") || f.endsWith(".sxi") || f.endsWith(".otp") || f.endsWith(".sti")) return GUIIcons.FILE_ICON_OOIMPRES; if ( f.endsWith(".odg") || f.endsWith(".sxd") || f.endsWith(".otg") || f.endsWith(".std")) return GUIIcons.FILE_ICON_OODRAW; if ( f.endsWith(".jpg") || f.endsWith(".jpe") || f.endsWith(".jpeg")|| f.endsWith(".png") || f.endsWith(".gif") || f.endsWith(".xcf") || f.endsWith(".tif") || f.endsWith(".psd") || f.endsWith(".bmp") || f.endsWith(".tiff") ) return GUIIcons.FILE_ICON_IMG; if ( f.endsWith(".avi") || f.endsWith(".mp4") || f.endsWith(".xvid")|| f.endsWith(".3gp") || f.endsWith(".asf") || f.endsWith(".asx") || f.endsWith(".mov") || f.endsWith(".mpg") || f.endsWith(".mpe") || f.endsWith(".mpeg") || f.endsWith(".wmv") || f.endsWith(".ts") || f.endsWith(".ogm") || f.endsWith(".m2v") || f.endsWith(".m4v") || f.endsWith(".mkv") || f.endsWith(".ifo") || f.endsWith(".vob") || f.endsWith(".divx") || f.endsWith(".xvid") || f.endsWith(".rm") || f.endsWith(".rmvb") ) return GUIIcons.FILE_ICON_VIDEO; if ( f.endsWith(".mp3") || f.endsWith(".ogg") || f.endsWith(".wav")|| f.endsWith(".mid") || f.endsWith(".ram")|| f.endsWith(".ra") || f.endsWith(".wma")|| f.endsWith(".iff") || f.endsWith(".aac") || f.endsWith(".ac3") || f.endsWith(".aif") || f.endsWith(".au") || f.endsWith(".m3u") || f.endsWith(".m4p") ) return GUIIcons.FILE_ICON_MUSIC; return GUIIcons.FILE_ICON_DEFAULT; } private static boolean hasExtention(String f, String[] strings) { for (int i = 0; i < strings.length; i++) if (f.endsWith(strings[i])) return true; return false; } }