} } pluginService = plugins; } catch (ServiceConfigurationError e) { // Error occurs during initialization of plugin System.out.println(Resources.getText("Fail to load plugin", e.getMessage())); } catch (MalformedURLException e) { if (JConsole.isDebug()) { e.printStackTrace(); } System.out.println(Resources.getText("Invalid plugin path", e.getMessage())); } } if (pluginService == null) { initEmptyPlugin(); } } private static void initEmptyPlugin() { ClassLoader pluginCL = new URLClassLoader(new URL[0]); pluginService = ServiceLoader.load(JConsolePlugin.class, pluginCL); } /** * Utility method for converting a search path string to an array * of directory and JAR file URLs. * * @param path the search path string * @return the resulting array of directory and JAR file URLs */ private static URL[] pathToURLs(String path) throws MalformedURLException { String[] names = path.split(File.pathSeparator); URL[] urls = new URL[names.length]; int count = 0; for (String f : names) { URL url = fileToURL(new File(f)); urls[count++] = url; } return urls; } /** * Returns the directory or JAR file URL corresponding to the specified * local file name. * * @param file the File object * @return the resulting directory or JAR file URL, or null if unknown */ private static URL fileToURL(File file) throws MalformedURLException { String name; try { name = file.getCanonicalPath(); } catch (IOException e) { name = file.getAbsolutePath(); } name = name.replace(File.separatorChar, '/'); if (!name.startsWith("/")) { name = "/" + name; } // If the file does not exist, then assume that it's a directory if (!file.isFile()) { name = name + "/"; } return new URL("file", "", name); } private static class FixedJRootPane extends JRootPane { public void updateUI() { updateLafValues(); super.updateUI(); } /** * The revalidate method seems to be the only one that gets * called whenever there is a change of L&F or change of theme * in Windows L&F and GTK L&F. */ @Override public void revalidate() { // Workaround for Swing bug where the titledborder in both // GTK and Windows L&F's use calculated colors instead of // the highlight/shadow colors from the theme. // // Putting null removes any previous override and causes a // fallback to the current L&F's value. UIManager.put("TitledBorder.border", null); Border border = UIManager.getBorder("TitledBorder.border"); if (border instanceof BorderUIResource.EtchedBorderUIResource) { Color highlight = UIManager.getColor("ToolBar.highlight"); Color shadow = UIManager.getColor("ToolBar.shadow"); border = new BorderUIResource.EtchedBorderUIResource(highlight, shadow); UIManager.put("TitledBorder.border", border); } if (IS_GTK) { // Workaround for Swing bug where the titledborder in // GTK L&F use hardcoded color and font for the title // instead of getting them from the theme. UIManager.put("TitledBorder.titleColor", UIManager.getColor("Label.foreground")); UIManager.put("TitledBorder.font", UIManager.getFont("Label.font")); } super.revalidate(); } }}Lines 1001–1112 of 1112. Previous lines
} } pluginService = plugins; } catch (ServiceConfigurationError e) { // Error occurs during initialization of plugin System.out.println(Resources.getText("Fail to load plugin", e.getMessage())); } catch (MalformedURLException e) { if (JConsole.isDebug()) { e.printStackTrace(); } System.out.println(Resources.getText("Invalid plugin path", e.getMessage())); } } if (pluginService == null) { initEmptyPlugin(); } } private static void initEmptyPlugin() { ClassLoader pluginCL = new URLClassLoader(new URL[0]); pluginService = ServiceLoader.load(JConsolePlugin.class, pluginCL); } /** * Utility method for converting a search path string to an array * of directory and JAR file URLs. * * @param path the search path string * @return the resulting array of directory and JAR file URLs */ private static URL[] pathToURLs(String path) throws MalformedURLException { String[] names = path.split(File.pathSeparator); URL[] urls = new URL[names.length]; int count = 0; for (String f : names) { URL url = fileToURL(new File(f)); urls[count++] = url; } return urls; } /** * Returns the directory or JAR file URL corresponding to the specified * local file name. * * @param file the File object * @return the resulting directory or JAR file URL, or null if unknown */ private static URL fileToURL(File file) throws MalformedURLException { String name; try { name = file.getCanonicalPath(); } catch (IOException e) { name = file.getAbsolutePath(); } name = name.replace(File.separatorChar, '/'); if (!name.startsWith("/")) { name = "/" + name; } // If the file does not exist, then assume that it's a directory if (!file.isFile()) { name = name + "/"; } return new URL("file", "", name); } private static class FixedJRootPane extends JRootPane { public void updateUI() { updateLafValues(); super.updateUI(); } /** * The revalidate method seems to be the only one that gets * called whenever there is a change of L&F or change of theme * in Windows L&F and GTK L&F. */ @Override public void revalidate() { // Workaround for Swing bug where the titledborder in both // GTK and Windows L&F's use calculated colors instead of // the highlight/shadow colors from the theme. // // Putting null removes any previous override and causes a // fallback to the current L&F's value. UIManager.put("TitledBorder.border", null); Border border = UIManager.getBorder("TitledBorder.border"); if (border instanceof BorderUIResource.EtchedBorderUIResource) { Color highlight = UIManager.getColor("ToolBar.highlight"); Color shadow = UIManager.getColor("ToolBar.shadow"); border = new BorderUIResource.EtchedBorderUIResource(highlight, shadow); UIManager.put("TitledBorder.border", border); } if (IS_GTK) { // Workaround for Swing bug where the titledborder in // GTK L&F use hardcoded color and font for the title // instead of getting them from the theme. UIManager.put("TitledBorder.titleColor", UIManager.getColor("Label.foreground")); UIManager.put("TitledBorder.font", UIManager.getFont("Label.font")); } super.revalidate(); } } }