/** Gets the value of the given macro key as a boolean. */ private boolean getBooleanValue(String key) { return Boolean.valueOf(Macro.getValue(arg, key, "false")); }
/** Gets the value of the given macro key as a boolean. */ private boolean getBooleanValue(String key) { return Boolean.valueOf(Macro.getValue(arg, key, "false")); }
/** * Gets a macro parameter of type {@link String}. * * @param label the name of the macro parameter * @param defaultValue the default value * @return the value */ public String getMacroParameter(final String label, final String defaultValue) { return Macro.getValue(getOptions(), label, defaultValue); }
/** * Gets a macro parameter of type {@link String}. * * @param label the name of the macro parameter * @return the value, <code>null</code> if the parameter was not specified */ public String getMacroParameter(final String label) { return Macro.getValue(getOptions(), label, null); }
/** * Gets a macro parameter of type <i>double</i>. * * @param label the name of the macro parameter * @param defaultValue the default value * @return the double value */ public double getMacroParameter(final String label, final double defaultValue) { final String value = Macro.getValue(getOptions(), label, null); return value != null ? Double.parseDouble(value) : defaultValue; }
/** * Gets a macro parameter of type {@link String}. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the value */ private static String getMacroParameter(String label, String defaultValue) { return Macro.getValue(Macro.getOptions(), label, defaultValue); } }
/** * Gets a macro parameter of type {@link String}. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the value */ private static String getMacroParameter(String label, String defaultValue) { return Macro.getValue(Macro.getOptions(), label, defaultValue); } }
/** * Gets a macro parameter of type <i>double</i>. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the double value */ private static double getMacroParameter(String label, double defaultValue) { String value = Macro.getValue(Macro.getOptions(), label, null); return value != null ? Double.parseDouble(value) : defaultValue; }
/** * Gets a macro parameter of type <i>double</i>. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the double value */ private static double getMacroParameter(String label, double defaultValue) { String value = Macro.getValue(Macro.getOptions(), label, null); return value != null ? Double.parseDouble(value) : defaultValue; }
private String substitute(final String text) { List<Macro> macros = getMacros(); StringBuilder stringBuilder=new StringBuilder(text); for(Macro macro: macros) { int index=stringBuilder.indexOf(macro.getKey()); if (index!=-1) { stringBuilder.replace(index, index+macro.getKey().length(), macro.getValue()); } } return stringBuilder.toString(); }
private static String substitute(String text) { List<Macro> macros = getMacros(); StringBuffer st = new StringBuffer(text); for (Macro macro : macros) { int start = st.indexOf(macro.getKey()); if (start != -1) { st.replace(start, start + macro.getKey().length(), macro.getValue()); } } return st.toString(); }
public <T extends IModuleUI<?>> int getModuleIndex(List<T> knownModules, String moduleKey) { String moduleName = Macro.getValue(options, moduleKey, null); if(moduleName == null) { throw new MacroException("No module specified: " + moduleKey); } for(int i = 0; i < knownModules.size(); i++) { if(knownModules.get(i).getName().equalsIgnoreCase(moduleName)) { return i; } } throw new MacroException("Module not found: " + moduleName); }
/** Returns the selected item in the next popup menu. */ public String getNextChoice() { if (choice==null) return ""; Choice thisChoice = (Choice)(choice.elementAt(choiceIndex)); String item = thisChoice.getSelectedItem(); if (macro) { String label = (String)labels.get((Object)thisChoice); item = Macro.getValue(macroOptions, label, item); if (item!=null && item.startsWith("&")) // value is macro variable item = getChoiceVariable(item); } if (recorderOn) recordOption(thisChoice, item); choiceIndex++; return item; }
/** Display a dialog using the specified title. */ public DirectoryChooser(String title) { this.title = title; if (IJ.isMacOSX() && !Prefs.useJFileChooser) getDirectoryUsingFileDialog(title); else { String macroOptions = Macro.getOptions(); if (macroOptions!=null) directory = Macro.getValue(macroOptions, title, null); if (directory==null) { if (EventQueue.isDispatchThread()) getDirectoryUsingJFileChooserOnThisThread(title); else getDirectoryUsingJFileChooser(title); } } }