@Override public void actionPerformed(ActionEvent e) { m_flowEnvironment = new Environment(); loadLayout(); } };
/** * Add a a variable to the internal map of this properties object and to the * global system-wide environment; * * @param key the name of the variable * @param value its value */ public void addVariableSystemWide(String key, String value) { addVariable(key, value); // local // system wide if (this != getSystemWide()) { getSystemWide().addVariableSystemWide(key, value); } System.setProperty(key, value); }
/** * Substitute environment variables in the supplied string. * * @param orig the string to modify * @return the string with environment variables resolved */ public String environmentSubstitute(String orig) { if (m_env != null) { try { orig = m_env.substitute(orig); } catch (Exception ex) { // not interested if there are no variables substituted } } return orig; }
public String environmentSubstitute(String source) { Environment env = m_env != null ? m_env : Environment.getSystemWide(); try { source = env.substitute(source); } catch (Exception ex) { } return source; }
@Override public String getProperty(String key) { // allow system-wide properties to override if (m_env == null) { m_env = Environment.getSystemWide(); } String result = m_env.getVariableValue(key); if (result == null) { result = super.getProperty(key); } return result; } }
getMainApplication().getApplicationSettings().getSetting( getPerspectiveID(), PreprocessDefaults.ENABLE_UNDO_KEY, PreprocessDefaults.ENABLE_UNDO, Environment.getSystemWide()); if (!undoEnabled) { return; .getSetting(getPerspectiveID(), PreprocessDefaults.UNDO_DIR_KEY, PreprocessDefaults.UNDO_DIR).toString(); if (Environment.getSystemWide().containsEnvVariables(dir)) { dir = Environment.getSystemWide().substitute(dir);
@Override public Filter getFilter() { AddUserFields temp = new AddUserFields(); Environment env = new Environment(); env.addVariable("NOM", "aNomValue"); String params = "-A douglas@numeric@42 -A nomAtt@nominal@aValue -A " + "aDate@date:yyyy-MM-dd@2012-07-09 -A varTest@nominal@${NOM}"; try { String[] opts = Utils.splitOptions(params); temp.setEnvironment(env); temp.setOptions(opts); } catch (Exception ex) { ex.printStackTrace(); } return temp; }
String[] elements = doNotLoadIfUnsetVar.toString().split(","); Environment env = Environment.getSystemWide(); if (env.getVariableValue(var.trim()) == null) { dnlM = Environment.getSystemWide().substitute(dnlM); } catch (Exception e) {
/** * Constructor. Initializes with system-wide environment variables and uses no * status message and no log. * * @param matchDetails the internally encoded match details string * @param inputStructure the incoming instances structure */ public SubstringReplacerRules(String matchDetails, Instances inputStructure) { this(matchDetails, inputStructure, "", null, Environment.getSystemWide()); }
public void setCurrentDirectory(File directory) { String tmpString = directory.toString(); if (Environment.containsEnvVariables(tmpString)) { try { tmpString = m_env.substitute(tmpString); } catch (Exception ex) { // ignore } } File tmp2 = new File((new File(tmpString)).getAbsolutePath()); JFileChooser embeddedEditor = (JFileChooser) m_fileEditor.getCustomEditor(); if (tmp2.isDirectory()) { embeddedEditor.setCurrentDirectory(tmp2); if (embeddedEditor.getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY) { super.setAsText(directory.toString()); } } else { embeddedEditor.setSelectedFile(tmp2); if (embeddedEditor.getFileSelectionMode() == JFileChooser.FILES_ONLY) { super.setAsText(directory.toString()); } } }
/** * Set the file path for the flow being edited by this layout * * @param path the path on disk for the flow being edited */ public void setFilePath(File path) { m_filePath = path != null ? path : new File("-NONE-"); if (path != null) { File absolute = new File(path.getAbsolutePath()); getEnvironment().addVariable(KFGUIConsts.FLOW_DIRECTORY_KEY, absolute.getParent()); } }
Environment env = Environment.getSystemWide(); String wh = env.getVariableValue("WEKA_HOME"); if (wh != null) { WEKA_HOME = new File(wh); NATIVE_LIBS_DIR = new File(wh + File.separator + NATIVE_LIBS_DIR_NAME); } else { env.addVariableSystemWide("WEKA_HOME", WEKA_HOME.toString()); env.getVariableValue("weka.core.wekaPackageRepositoryURL"); if (repURL == null || repURL.length() == 0) { String offline = env.getVariableValue("weka.packageManager.offline"); if (offline != null) { m_offline = offline.equalsIgnoreCase("true"); env.getVariableValue("weka.packageManager.loadPackages"); if (loadPackages == null) { loadPackages = env.getVariableValue("weka.core.loadPackages"); if (loadPackages == null) { loadPackages = env.getVariableValue("weka.core.loadPackages");
/** * Main method for testing this class. * * @param args a list of strings to replace variables in (e.g. "\${os.name} * "\${java.version}") */ public static void main(String[] args) { Environment t = new Environment(); // String test = // "Here is a string with the variable ${java.version} and ${os.name} in it"; if (args.length == 0) { System.err .println("Usage: java weka.core.Environment <string> <string> ..."); } else { try { for (String arg : args) { String newS = t.substitute(arg); System.out.println("Original string:\n" + arg + "\n\nNew string:\n" + newS); } } catch (Exception ex) { ex.printStackTrace(); } } }
&& currentEnv.getVariableValue(key) == null) { getStepManager() .logDetailed("Setting variable: " + key + " = " + value); currentEnv.addVariable(key, value);
if (value instanceof String) { try { value = (T) env.substitute((String) value); } catch (Exception ex) { String val = env.getVariableValue(key.getKey()); if (val != null) { value = stringToT(val, defaultValue);
@Override public Object getSelectedItem() { Object item = super.getSelectedItem(); if (item instanceof String) { if (env.getVariableValue((String) item) != null) { String newS = "${" + (String) item + "}"; item = newS; } } return item; } };
getStepManager().getExecutionEnvironment().getEnvironmentVariables(); if (flowEnv != null) { Set<String> vars = flowEnv.getVariableNames(); for (String var : vars) { env.put(var, flowEnv.getVariableValue(var));
containsEnv = Environment.containsEnvVariables(file);
public void setEnvironment(final Environment env) { m_env = env; Vector<String> varKeys = new Vector<String>(env.getVariableNames());
getMainApplication().getApplicationSettings().getSetting( getPerspectiveID(), PreprocessDefaults.ENABLE_UNDO_KEY, PreprocessDefaults.ENABLE_UNDO, Environment.getSystemWide()); if (!undoEnabled) { return; .getSetting(getPerspectiveID(), PreprocessDefaults.UNDO_DIR_KEY, PreprocessDefaults.UNDO_DIR).toString(); if (Environment.getSystemWide().containsEnvVariables(dir)) { dir = Environment.getSystemWide().substitute(dir);