@Test public void testGetOxygenIcon() { ImageIcon applicationExitIcon = Utils.getOxygenIcon("application-exit", 32); Assert.assertNotNull(applicationExitIcon); applicationExitIcon = Utils.getOxygenIcon("action/application-exit", 48); Assert.assertNotNull(applicationExitIcon); ImageIcon nonExistingIcon = Utils.getOxygenIcon("non-existing-name", 32); Assert.assertNull(nonExistingIcon); nonExistingIcon = Utils.getOxygenIcon("application-exit", -42); Assert.assertNull(nonExistingIcon); }
public static ImageIcon getOxygenIcon(String name, int size) { ArrayList<String> looked = new ArrayList<String>(); String[] oxygenFolderNames = KDEPathFinder.getIconPaths(); for (int i = 0; i < oxygenFolderNames.length; i++) { oxygenFolderNames[i] += "oxygen" + fileSep + size + "x" + size + fileSep; File file = new File(oxygenFolderNames[i] + name + ".png"); if (file.exists()) { return new ImageIcon(file.getPath()); } else { looked.add(file.getPath()); } } String folderName = name.split("/")[0]; String realFileName = name.split("/")[name.split("/").length - 1]; File[] oxygenFolders = new File[oxygenFolderNames.length]; for (int i = 0; i < oxygenFolders.length; i++) { oxygenFolders[i] = new File(oxygenFolderNames[i]); } for (File oxygenFolder : oxygenFolders) { if (oxygenFolder.exists() && oxygenFolder.isDirectory()) { File[] subFolders = oxygenFolder.listFiles(); for (File subFolder : subFolders) { if (subFolder.getName().equals(folderName)) continue; File possibleFile = new File(subFolder.getAbsolutePath() + "/" + realFileName + ".png"); if (possibleFile.exists()) { return new ImageIcon(possibleFile.getPath()); } looked.add(possibleFile.getPath()); } } } Output.warning("Could not find " + name + " icon."); Output.warning("Searched on places:"); for (String lookedAt : looked) { Output.warning(" " + lookedAt); } return null; }
Utils { public static ImageIcon getOxygenIcon(String name, int size) { ArrayList<String> looked = new ArrayList<String>(); String[] oxygenFolderNames = KDEPathFinder.getIconPaths(); for (int i = 0; i < oxygenFolderNames.length; i++) { oxygenFolderNames[i] += "oxygen" + fileSep + size + "x" + size + fileSep; File file = new File(oxygenFolderNames[i] + name + ".png"); if (file.exists()) { return new ImageIcon(file.getPath()); } else { looked.add(file.getPath()); } } String folderName = name.split("/")[0]; String realFileName = name.split("/")[name.split("/").length - 1]; File[] oxygenFolders = new File[oxygenFolderNames.length]; for (int i = 0; i < oxygenFolders.length; i++) { oxygenFolders[i] = new File(oxygenFolderNames[i]); } for (File oxygenFolder : oxygenFolders) { if (oxygenFolder.exists() && oxygenFolder.isDirectory()) { File[] subFolders = oxygenFolder.listFiles(); for (File subFolder : subFolders) { if (subFolder.getName().equals(folderName)) continue; File possibleFile = new File(subFolder.getAbsolutePath() + "/" + realFileName + ".png"); if (possibleFile.exists()) { return new ImageIcon(possibleFile.getPath()); } looked.add(possibleFile.getPath()); } } } Output.warning("Could not find " + name + " icon."); Output.warning("Searched on places:"); for (String lookedAt : looked) { Output.warning(" " + lookedAt); } return null; } }
Utils { public static ImageIcon getOxygenIcon(String name, int size) { ArrayList<String> looked = new ArrayList<String>(); String[] oxygenFolderNames = KDEPathFinder.getIconPaths(); for (int i = 0; i < oxygenFolderNames.length; i++) { oxygenFolderNames[i] += "oxygen" + fileSep + size + "x" + size + fileSep; File file = new File(oxygenFolderNames[i] + name + ".png"); if (file.exists()) { return new ImageIcon(file.getPath()); } else { looked.add(file.getPath()); } } String folderName = name.split("/")[0]; String realFileName = name.split("/")[name.split("/").length - 1]; File[] oxygenFolders = new File[oxygenFolderNames.length]; for (int i = 0; i < oxygenFolders.length; i++) { oxygenFolders[i] = new File(oxygenFolderNames[i]); } for (File oxygenFolder : oxygenFolders) { if (oxygenFolder.exists() && oxygenFolder.isDirectory()) { File[] subFolders = oxygenFolder.listFiles(); for (File subFolder : subFolders) { if (subFolder.getName().equals(folderName)) continue; File possibleFile = new File(subFolder.getAbsolutePath() + "/" + realFileName + ".png"); if (possibleFile.exists()) { return new ImageIcon(possibleFile.getPath()); } looked.add(possibleFile.getPath()); } } } Output.warning("Could not find " + name + " icon."); Output.warning("Searched on places:"); for (String lookedAt : looked) { Output.warning(" " + lookedAt); } return null; }  }
Utils { public static ImageIcon getOxygenIcon(String name, int size) { ArrayList<String> looked = new ArrayList<String>(); String[] oxygenFolderNames = KDEPathFinder.getIconPaths(); for (int i = 0; i < oxygenFolderNames.length; i++) { oxygenFolderNames[i] += "oxygen" + fileSep + size + "x" + size + fileSep; File file = new File(oxygenFolderNames[i] + name + ".png"); if (file.exists()) { return new ImageIcon(file.getPath()); } else { looked.add(file.getPath()); } } String folderName = name.split("/")[0]; String realFileName = name.split("/")[name.split("/").length - 1]; File[] oxygenFolders = new File[oxygenFolderNames.length]; for (int i = 0; i < oxygenFolders.length; i++) { oxygenFolders[i] = new File(oxygenFolderNames[i]); } for (File oxygenFolder : oxygenFolders) { if (oxygenFolder.exists() && oxygenFolder.isDirectory()) { File[] subFolders = oxygenFolder.listFiles(); for (File subFolder : subFolders) { if (subFolder.getName().equals(folderName)) continue; File possibleFile = new File(subFolder.getAbsolutePath() + "/" + realFileName + ".png"); if (possibleFile.exists()) { return new ImageIcon(possibleFile.getPath()); } looked.add(possibleFile.getPath()); } } } Output.warning("Could not find " + name + " icon."); Output.warning("Searched on places:"); for (String lookedAt : looked) { Output.warning(" " + lookedAt); } return null; }  static T[] concatArrays(T[] first, T[] second); static boolean isKDE(); static boolean isLinux(); static Object[] getKDEColorMap(); @SuppressWarnings("boxing") static Object[] getKDEPropertiesMap(); static Object[] getKDEIconsMap(); static ImageIcon getOxygenIcon(String name, int size); static void displayNotification(String title, String text, MessageType type); static boolean isJoxyActive(); }
Utils { public static ImageIcon getOxygenIcon(String name, int size) { ArrayList<String> looked = new ArrayList<String>(); String[] oxygenFolderNames = KDEPathFinder.getIconPaths(); for (int i = 0; i < oxygenFolderNames.length; i++) { oxygenFolderNames[i] += "oxygen" + fileSep + size + "x" + size + fileSep; File file = new File(oxygenFolderNames[i] + name + ".png"); if (file.exists()) { return new ImageIcon(file.getPath()); } else { looked.add(file.getPath()); } } String folderName = name.split("/")[0]; String realFileName = name.split("/")[name.split("/").length - 1]; File[] oxygenFolders = new File[oxygenFolderNames.length]; for (int i = 0; i < oxygenFolders.length; i++) { oxygenFolders[i] = new File(oxygenFolderNames[i]); } for (File oxygenFolder : oxygenFolders) { if (oxygenFolder.exists() && oxygenFolder.isDirectory()) { File[] subFolders = oxygenFolder.listFiles(); for (File subFolder : subFolders) { if (subFolder.getName().equals(folderName)) continue; File possibleFile = new File(subFolder.getAbsolutePath() + "/" + realFileName + ".png"); if (possibleFile.exists()) { return new ImageIcon(possibleFile.getPath()); } looked.add(possibleFile.getPath()); } } } Output.warning("Could not find " + name + " icon."); Output.warning("Searched on places:"); for (String lookedAt : looked) { Output.warning(" " + lookedAt); } return null; }  static T[] concatArrays(T[] first, T[] second); static boolean isKDE(); static boolean isLinux(); static Object[] getKDEColorMap(); @SuppressWarnings("boxing") static Object[] getKDEPropertiesMap(); static Object[] getKDEIconsMap(); static ImageIcon getOxygenIcon(String name, int size); static void displayNotification(String title, String text, MessageType type); static boolean isJoxyActive(); static final String MENU_HIGHLIGHT_DARK; static final String MENU_HIGHLIGHT_SUBTLE; static final String MENU_HIGHLIGHT_STRONG; static boolean useRNDColorScheme; }