Search in sources :

Example 1 with ToolInformationData

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

the class UsbdmDeviceSelectionPage_2 method createPageData.

private synchronized void createPageData() {
    fPageData = new HashMap<String, String>();
    fPageData.put(UsbdmConstants.PATH_SEPARATOR_KEY, String.valueOf(File.separator));
    String buildToolsId = getBuildToolsId();
    ToolInformationData toolInfo = ToolInformationData.getToolInformationTable().get(buildToolsId);
    if (toolInfo == null) {
        fPageData.put(UsbdmConstants.BUILD_TOOLS_BIN_PATH_KEY, "");
        fPageData.put(UsbdmConstants.GDB_COMMAND_KEY, "gdb");
    } else {
        fPageData.put(UsbdmConstants.BUILD_TOOLS_BIN_PATH_KEY, "${" + toolInfo.getPathVariableName() + "}");
        fPageData.put(UsbdmConstants.GDB_COMMAND_KEY, "${" + toolInfo.getPrefixVariableName() + "}gdb");
    }
    fPageData.put(UsbdmConstants.BUILD_TOOLS_ID_KEY, buildToolsId);
    fPageData.put(UsbdmConstants.INTERFACE_TYPE_KEY, fInterfaceType.name());
    Device device = getDevice();
    if (device == null) {
        return;
    }
    addDeviceAttributes(fPageData, device);
    // Add launch parameters from device information
    LaunchParameterUtilities.addLaunchParameters(fPageData, device, null);
// System.err.println("UsbdmProjectParametersPage_2.updatePageData() - exit");
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) Device(net.sourceforge.usbdm.deviceDatabase.Device)

Example 2 with ToolInformationData

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

the class UsbdmExampleSelectionPage method validate.

/**
 *  Validates control & sets error message
 *
 * @param message error message (null if none)
 *
 * @return true => dialogue values are valid
 */
public boolean validate() {
    String message = null;
    String projectDesc = null;
    String buildtoolId = null;
    if (projectInformation != null) {
        projectDesc = projectInformation.getLongDescription();
        buildtoolId = projectInformation.getBuildTool();
        File file = projectInformation.getPath().toFile();
        if (!file.isFile() || !file.canRead()) {
            message = "Project file not found";
        }
    }
    if (buildtoolId == null) {
        buildtoolId = "";
    }
    ToolInformationData toolInfo = ToolInformationData.getToolInformationTable().get(buildtoolId);
    if (toolInfo == null) {
        buildToolLabel.setText("None");
    } else {
        buildToolLabel.setText(toolInfo.getDescription());
    }
    if (projectDesc == null) {
        projectDesc = "";
    }
    projectDescription.setText(projectDesc);
    if (projectInformation == null) {
        message = "Project not selected";
    }
    setErrorMessage(message);
    setPageComplete(message == null);
    return message == null;
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) File(java.io.File)

Example 3 with ToolInformationData

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

the class UsbdmPathVariableInitialiser method initialize.

@Override
public void initialize(IValueVariable variable) {
    Hashtable<String, ToolInformationData> pathInformation = ToolInformationData.getToolInformationTable();
    ToolInformationData variableData = pathInformation.get(variable.getName());
    if (variableData != null) {
        variable.setDescription(variableData.getDescription());
    }
    variable.setValue(UsbdmConstants.PATH_NOT_SET);
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData)

Example 4 with ToolInformationData

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

the class UsbdmDebuggerPanel method initializeFrom.

/**
 * Initialises this panel's controls with values from the given launch
 * configuration. This method is called when a configuration is selected to
 * view or edit, after this tab's control has been created.
 *
 * @param configuration
 *           launch configuration
 * @throws Exception
 */
public void initializeFrom(ILaunchConfiguration configuration) throws Exception {
    try {
        // Get interface type from settings
        InterfaceType interfaceType = null;
        ToolInformationData toolInformationData = null;
        if (configuration != null) {
            // System.err.println("UsbdmDebuggerPanel.initializeFrom() #1 "+configuration);
            String interfaceTypeName = configuration.getAttribute(USBDM_GDB_INTERFACE_TYPE_KEY, (String) null);
            if (interfaceTypeName != null) {
                interfaceType = InterfaceType.valueOf(interfaceTypeName);
            // System.err.println("Setting interface to launch saved value = "+interfaceType.toString());
            }
            // Try to get tool information from project via configuration
            toolInformationData = getToolInformationDataFromConfig(configuration);
        }
        Boolean discardSettings = (configuration == null);
        if ((interfaceType == null) || ((toolInformationData != null) && !toolInformationData.applicableTo(interfaceType))) {
            // Interface type not set or incompatible - reset settings
            // System.err.println("UsbdmDebuggerPanel.initializeFrom() #2 "+configuration);
            discardSettings = true;
            // Interface type not set or incompatible - reset
            if (toolInformationData == null) {
                // Use ARM as default
                interfaceType = InterfaceType.T_ARM;
            // System.err.println("Setting interface to default =
            // "+interfaceType.toString());
            } else {
                // Use tool default
                interfaceType = toolInformationData.getPreferredInterfaceType();
            // System.err.println("Setting interface to tool default =
            // "+interfaceType.toString());
            }
        }
        // System.err.println("Interface = "+interfaceType.toString());
        // Populate & set the initial interface
        populateInterfaceTypes(interfaceType);
        // Load default settings for this target
        // System.err.println("UsbdmDebuggerPanel.initializeFrom() new fGdbServerParameters");
        setGdbServerParameters(GdbServerParameters.getDefaultServerParameters(interfaceType));
        // Update from configuration (if appropriate)
        if (!discardSettings) {
            // Only load if appropriate to current interface
            // System.err.println("Loading fGdbServerParameters from settings");
            fGdbServerParameters.initializeFrom(configuration, USBDM_LAUNCH_ATTRIBUTE_KEY);
        }
        // Load GDB Server parameters into controls
        // System.err.println("Loading fGdbServerParameters into controls");
        loadGdbServerParameters();
        if (!discardSettings) {
            // Only load settings if appropriate to interface
            fTextGdbBinPath.setText(configuration.getAttribute(USBDM_GDB_BIN_PATH_KEY, ""));
            fTextGdbCommand.setText(configuration.getAttribute(USBDM_GDB_COMMAND_KEY, ""));
            String buildToolId = configuration.getAttribute(USBDM_BUILD_TOOL_KEY, "");
            ToolInformationData toolInfo = ToolInformationData.get(buildToolId);
            if (toolInfo != null) {
                fComboBuildTool.setText(ToolInformationData.get(buildToolId).getDescription());
            } else {
                fComboBuildTool.select(0);
            }
            buildToolSelectionChanged();
        // boolean verboseModeAttr = false; // configuration.getAttribute(
        // // ATTR_DEBUGGER_VERBOSE_MODE,
        // // false);
        // btnVerboseMode.setSelection(verboseModeAttr);
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
}
Also used : InterfaceType(net.sourceforge.usbdm.constants.UsbdmSharedConstants.InterfaceType) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) CoreException(org.eclipse.core.runtime.CoreException)

Example 5 with ToolInformationData

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

the class UsbdmDebuggerPanel method populateBuildTools.

/**
 * Populate the Build Tool combo Build tool list depends on current interface
 * Tries to maintain currently selected build tool if possible
 */
private void populateBuildTools() {
    if (fComboBuildTool == null) {
        return;
    }
    String currentBuildTool = fComboBuildTool.getText();
    Hashtable<String, ToolInformationData> toolData = ToolInformationData.getToolInformationTable();
    if (fBuildToolsIds == null) {
        fBuildToolsIds = new String[toolData.size() + 1];
    }
    fComboBuildTool.removeAll();
    final String customSettings = "Custom Settings";
    // Add Custom Settings entry
    int index = 0;
    fComboBuildTool.add(customSettings);
    fBuildToolsIds[index++] = "";
    String defaultBuildTool = customSettings;
    for (ToolInformationData toolInfo : toolData.values()) {
        if (!toolInfo.applicableTo(getInterfaceType())) {
            continue;
        }
        fComboBuildTool.add(toolInfo.getDescription());
        if (defaultBuildTool.equals(customSettings)) {
            // First added tool becomes default
            defaultBuildTool = toolInfo.getDescription();
        }
        fBuildToolsIds[index++] = toolInfo.getBuildToolId();
    }
    // Set to default
    fComboBuildTool.setText(defaultBuildTool);
    // try to set to last selected
    fComboBuildTool.setText(currentBuildTool);
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData)

Aggregations

ToolInformationData (net.sourceforge.usbdm.constants.ToolInformationData)12 IOption (org.eclipse.cdt.managedbuilder.core.IOption)5 IToolChain (org.eclipse.cdt.managedbuilder.core.IToolChain)5 UsbdmSharedSettings (net.sourceforge.usbdm.constants.UsbdmSharedSettings)4 IConfiguration (org.eclipse.cdt.managedbuilder.core.IConfiguration)3 IManagedBuildInfo (org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo)2 CoreException (org.eclipse.core.runtime.CoreException)2 File (java.io.File)1 InterfaceType (net.sourceforge.usbdm.constants.UsbdmSharedConstants.InterfaceType)1 Device (net.sourceforge.usbdm.deviceDatabase.Device)1 ICProject (org.eclipse.cdt.core.model.ICProject)1