Search in sources :

Example 1 with VariableInformationData

use of net.sourceforge.usbdm.constants.VariableInformationData in project usbdm-eclipse-plugins by podonoghue.

the class UsbdmDynamicVariableResolver method resolveValue.

@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
    if (variable.getName().equals(UsbdmSharedConstants.USBDM_APPLICATION_PATH_VAR)) {
        // System.err.println("UsbdmDynamicVariableResolver.resolveValue(usbdm_application_path) => " + usbdmApplicationPath.toOSString());
        return usbdmApplicationPath.toOSString();
    }
    if (variable.getName().equals(UsbdmSharedConstants.USBDM_RESOURCE_PATH_VAR)) {
        // System.err.println("UsbdmDynamicVariableResolver.resolveValue(usbdm_application_path) => " + usbdmApplicationPath.toOSString());
        return usbdmResourcePath.toOSString();
    }
    UsbdmSharedSettings usbdmSharedSettings = UsbdmSharedSettings.getSharedSettings();
    String variableValue = usbdmSharedSettings.get(variable.getName());
    if (variableValue == null) {
        Hashtable<String, VariableInformationData> variableInformationTable = VariableInformationData.getVariableInformationTable();
        VariableInformationData variableInfo = variableInformationTable.get(argument);
        if (variableInfo == null) {
            variableValue = "";
        } else {
            variableValue = variableInfo.getDefaultValue();
        }
    }
    // System.err.println("UsbdmDynamicVariableResolver.resolveValue("+variable.getName()+") => " + variableValue);
    return variableValue;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) VariableInformationData(net.sourceforge.usbdm.constants.VariableInformationData)

Example 2 with VariableInformationData

use of net.sourceforge.usbdm.constants.VariableInformationData in project usbdm-eclipse-plugins by podonoghue.

the class UsbdmVariableInitializer method initialize.

@Override
public void initialize(IValueVariable variable) {
    Hashtable<String, VariableInformationData> variableInformation = VariableInformationData.getVariableInformationTable();
    VariableInformationData variableData = variableInformation.get(variable.getName());
    if (variableData != null) {
        variable.setValue(variableData.getDefaultValue());
        variable.setDescription(variableData.getDescription());
    }
}
Also used : VariableInformationData(net.sourceforge.usbdm.constants.VariableInformationData)

Aggregations

VariableInformationData (net.sourceforge.usbdm.constants.VariableInformationData)2 UsbdmSharedSettings (net.sourceforge.usbdm.constants.UsbdmSharedSettings)1