/** * Make the default projections from the internal list of classes. * * @return list of default projections */ public static List makeDefaultProjections() { List defaults = new ArrayList(); List classNames = getDefaultProjections(); for (int i = 0; i < classNames.size(); i++) { String className = (String) classNames.get(i); try { Class projClass = Misc.findClass(className); ProjectionImpl pi = (ProjectionImpl) projClass.newInstance(); pi.setName("Default " + pi.getProjectionTypeLabel()); defaults.add(pi); } catch (Exception ee) { System.err.println("Error creating default projection: " + className); ee.printStackTrace(); } } return defaults; }
/** * Show the given error to the user. If it was an Adde exception that was a bad server error then * print out a nice message. * * @param excp The exception */ protected void handleConnectionError(Exception excp) { String message = excp.getMessage(); if (excp instanceof AddeURLException) { handleUnknownDataSetError(); } else if (message.toLowerCase().indexOf("unknownhostexception") >= 0) { LogUtil.userErrorMessage("Could not access server: " + getServer()); } else if (message.toLowerCase().indexOf("server unable to resolve this dataset") >= 0) { handleUnknownDataSetError(); } else if ((message.toLowerCase().indexOf("no images satisfy") >= 0) || (message.toLowerCase().indexOf("error generating list of files") >= 0)) { LogUtil.userErrorMessage("No data available for the selection"); return; } else { LogUtil.logException("Error connecting to: " + getServer(), excp); } if (!(getState() == STATE_CONNECTED)) { setState(STATE_UNCONNECTED); } }