Search in sources :

Example 6 with ToolInformationData

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

the class UsbdmDebuggerPanel method getToolInformationDataFromConfig.

/**
 * Try to get interface type from project via ILaunchConfiguration
 *
 * @param configuration
 * @return
 */
private ToolInformationData getToolInformationDataFromConfig(ILaunchConfiguration configuration) {
    String buildToolsId = null;
    try {
        // ToDo Consider using - ICProject projectHandle =
        // CDebugUtils.verifyCProject(configuration);
        String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
        String projectBuildId = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String) null);
        if ((projectName != null) && (projectBuildId != null)) {
            ICProject projectHandle = CoreModel.getDefault().getCModel().getCProject(projectName);
            IConfiguration buildConfig = ManagedBuildManager.getBuildInfo(projectHandle.getProject()).getManagedProject().getConfiguration(projectBuildId);
            if (buildConfig != null) {
                IToolChain toolChain = buildConfig.getToolChain();
                if (toolChain != null) {
                    IOption option = toolChain.getOptionBySuperClassId("net.sourceforge.usbdm.cdt.arm.toolchain.buildtools");
                    if (option == null) {
                        option = toolChain.getOptionBySuperClassId("net.sourceforge.usbdm.cdt.coldfire.toolchain.buildtools");
                    }
                    if (option != null) {
                        // System.err.println("option(net.sourceforge.usbdm.cdt.arm.toolchain.buildtools).getId()
                        // = "+option.getId());
                        // System.err.println("option(net.sourceforge.usbdm.cdt.arm.toolchain.buildtools).getName()
                        // = "+option.getName());
                        buildToolsId = option.getStringValue();
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    // System.err.println("Selected Build Tools ID = " + buildToolsId);
    ToolInformationData toolInformationData = null;
    if (buildToolsId != null) {
        toolInformationData = ToolInformationData.get(buildToolsId);
    }
    // System.err.println("Selected Build Tools = " + toolInformationData);
    return toolInformationData;
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) ICProject(org.eclipse.cdt.core.model.ICProject) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) CoreException(org.eclipse.core.runtime.CoreException)

Example 7 with ToolInformationData

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

the class UsbdmDeviceSelectionPage_2 method loadBuildtoolNames.

private void loadBuildtoolNames() {
    String currentTool = fBuildToolsCombo.getText();
    fBuildToolsCombo.removeAll();
    Hashtable<String, ToolInformationData> toolInformationData = ToolInformationData.getToolInformationTable();
    fBuildToolIds = new String[toolInformationData.size()];
    int index = 0;
    for (ToolInformationData toolInformation : toolInformationData.values()) {
        if (toolInformation.applicableTo(fInterfaceType)) {
            fBuildToolsCombo.add(toolInformation.getDescription());
            fBuildToolIds[index++] = toolInformation.getBuildToolId();
        }
    }
    // Try to restore current selection
    fBuildToolsCombo.setText(currentTool);
    updateBuildToolId();
}
Also used : ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData)

Example 8 with ToolInformationData

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

the class UsbdmGCCSpecsRunSIProvider method getToolPrefix.

/**
 * @param project       The project to look in for options
 * @return              The prefix for the build tools
 */
private String getToolPrefix(IProject project) {
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    if (info == null) {
        return "";
    }
    IConfiguration cfg = info.getDefaultConfiguration();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found IConfiguration = " + cfg.getName());
    IToolChain toolChain = cfg.getToolChain();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found toolChain = " + toolChain.getName());
    // Find selected build tool (either ARM or Coldfire)
    IOption buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS);
    if (buildToolOption == null) {
        buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS);
    }
    if (buildToolOption == null) {
        return "";
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        return "";
    }
    String toolPrefixVariableId = toolData.getPrefixVariableName();
    if (toolPrefixVariableId == null) {
        return "";
    }
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPrefix = null;
    if (settings != null) {
        toolPrefix = settings.get(toolPrefixVariableId);
    }
    if (toolPrefix == null) {
        toolPrefix = "Tool Prefix not set";
        return "";
    }
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found tool prefix = " + toolPrefix);
    return toolPrefix;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) IManagedBuildInfo(org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 9 with ToolInformationData

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

the class UsbdmGCCSpecsRunSIProvider method getToolPrefix.

/**
 * @param project       The project to look in for options
 * @return              The prefix for the build tools
 */
private String getToolPrefix(IProject project) {
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    if (info == null) {
        return "";
    }
    IConfiguration cfg = info.getDefaultConfiguration();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found IConfiguration = " + cfg.getName());
    IToolChain toolChain = cfg.getToolChain();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found toolChain = " + toolChain.getName());
    // Find selected build tool (either ARM or Coldfire)
    IOption buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS);
    if (buildToolOption == null) {
        buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS);
    }
    if (buildToolOption == null) {
        return "";
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        return "";
    }
    String toolPrefixVariableId = toolData.getPrefixVariableName();
    if (toolPrefixVariableId == null) {
        return "";
    }
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPrefix = null;
    if (settings != null) {
        toolPrefix = settings.get(toolPrefixVariableId);
    }
    if (toolPrefix == null) {
        toolPrefix = "Tool Prefix not set";
        return "";
    }
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found tool prefix = " + toolPrefix);
    return toolPrefix;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) IManagedBuildInfo(org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 10 with ToolInformationData

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

the class ConfigurationEnvironmentVariableSupplier method getToolPath.

/**
 * @param configuration       The configuration to look in for options
 * @return                    The path to the build tools bin directory or null if error
 */
private String getToolPath(IConfiguration configuration) {
    if (configuration == null) {
        // No configuration - Use default settings
        // System.err.println("ConfigEnvVarSupplier.getToolPath() configuration = null");
        String toolPath = "";
        String pathVariableId = null;
        if (buildToolOptionId.equals(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS)) {
            pathVariableId = "usbdm_codesourcery_coldfire_path";
        } else if (buildToolOptionId.equals(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS)) {
            pathVariableId = "usbdm_armLtd_arm_path";
        }
        UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
        if ((settings != null) && (pathVariableId != null)) {
            toolPath = settings.get(pathVariableId);
        }
        // System.err.println("ConfigEnvVarSupplier.getToolPath() Found tool path = " + toolPath);
        return toolPath;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() configuration = "+configuration.getId());
    IToolChain toolChain = configuration.getToolChain();
    if (toolChain == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolChain = null");
        return null;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() Checking toolchain: " + toolChain.getId());
    // Find selected build tool
    IOption buildToolOption = toolChain.getOptionBySuperClassId(buildToolOptionId);
    // }
    if (buildToolOption == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption = null");
        return null;
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolData = null");
        System.err.println("ConfigEnvVarSupplier.getToolPath() configuration              = " + configuration.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolChain                  = " + toolChain.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption            = " + buildToolOption.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption.getValue() = " + buildToolOption.getValue().toString());
        return null;
    }
    String pathVariableId = toolData.getPathVariableName();
    if (pathVariableId == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() pathVariableId = null");
        return null;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() pathVariableId = "+pathVariableId);
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPath = "";
    if (settings != null) {
        toolPath = settings.get(pathVariableId);
    }
    // }
    return toolPath;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption)

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