use of org.apache.hop.ui.core.dialog.HopDescribedVariablesDialog in project hop by apache.
the class HopGui method menuToolsEditConfigVariables.
@GuiMenuElement(root = ID_MAIN_MENU, id = ID_MAIN_MENU_TOOLS_SYSPROPS, label = "i18n::HopGui.Menu.Tools.EditConfigVariables", parentId = ID_MAIN_MENU_TOOLS_PARENT_ID)
public void menuToolsEditConfigVariables() {
List<DescribedVariable> describedVariables = HopConfig.getInstance().getDescribedVariables();
String message = "Editing file: " + HopConfig.getInstance().getConfigFilename();
HopDescribedVariablesDialog dialog = new HopDescribedVariablesDialog(shell, message, describedVariables, null);
if (dialog.open() != null) {
try {
HopConfig.getInstance().setDescribedVariables(describedVariables);
HopConfig.getInstance().saveToFile();
} catch (Exception e) {
new ErrorDialog(getShell(), "Error", "Error saving config variables to configuration file '" + HopConfig.getInstance().getConfigFilename() + "'", e);
}
}
}
use of org.apache.hop.ui.core.dialog.HopDescribedVariablesDialog in project hop by apache.
the class HopGui method editConfigFile.
public static boolean editConfigFile(Shell shell, String configFilename, DescribedVariablesConfigFile variablesConfigFile, String selectedVariable) throws HopException {
String message = "Editing configuration file: " + configFilename;
HopDescribedVariablesDialog variablesDialog = new HopDescribedVariablesDialog(shell, message, variablesConfigFile.getDescribedVariables(), selectedVariable);
List<DescribedVariable> vars = variablesDialog.open();
if (vars != null) {
variablesConfigFile.setDescribedVariables(vars);
variablesConfigFile.saveToFile();
return true;
}
return false;
}
Aggregations