Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Error during new lauchconfig when there are no projects #917

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

kolipakakondal
Copy link
Collaborator

@kolipakakondal kolipakakondal commented Mar 21, 2024

Description

Exception while creating a new lauchconfig when there are no projects

Fixes # (IEP-1186)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • Try to create a new lunch config when there are no projects in the project explorer, wizard shouldn't throw any exception to the user intead it should show that project is not found or similar error.

Test Configuration:

  • ESP-IDF Version: master
  • OS (Windows,Linux and macOS):macOS

Dependent components impacted by this PR:

  • New launch config

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Refactor
    • Improved code readability and maintenance in serial flash configuration UI components.
    • Enhanced method signature clarity for better development experience.

Copy link

coderabbitai bot commented Mar 21, 2024

Walkthrough

The update focuses on refining the user interface and functionality of the ESP-IDF Eclipse plugin, specifically within the serial flash launch configuration. It encompasses a series of method signature adjustments and UI enhancements across two primary files, aimed at improving the development experience for ESP32 projects. The changes streamline project setup, flash configuration, and debugging processes, making it easier for developers to manage their ESP-IDF projects within Eclipse.

Changes

File Path Change Summary
bundles/.../CMakeMainTab2.java Enhanced class structure, reformatted enum, and refined method signatures for better project management and flash configuration.
bundles/.../SerialFlashLaunchConfigTabGroup.java Introduced IResource initialization handling, improving project setup and debugging experience.

Related issues

🐇✨
To flash, to build, in Eclipse we trust,
Through code, through bugs, our efforts robust.
With each commit, a step to the moon,
Our code now sings a harmonious tune.
So here's to the devs, with eyes on the stars,
In the realm of the code, we make Mars ours.
🚀🐰

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Logger.log(e);
}

return projectList.get(0);
return !projectList.isEmpty() ? projectList.get(0) : null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return null when there are no projects

Comment on lines +54 to +59
{
IResource[] resources = configuration.getMappedResources();
if (resources != null)
{
super.initializeFrom(configuration);
}
Copy link
Collaborator Author

@kolipakakondal kolipakakondal Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initalize UI only when there are projets

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4ede117 and 826c09e.
Files selected for processing (2)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/CMakeMainTab2.java (27 hunks)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java (1 hunks)
Additional comments: 3
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java (3)
  • 19-21: The addition of imports for IResource, CoreException, and ILaunchConfiguration is appropriate given their usage in the initializeFrom method.
  • 32-32: The class declaration and use of @SuppressWarnings("restriction") are appropriate for Eclipse plugin development.
  • 51-65: The initializeFrom method correctly initializes resources and handles exceptions. However, consider providing user feedback, such as a dialog, in case of exceptions to improve the user experience.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 826c09e and e340f72.
Files selected for processing (1)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/CMakeMainTab2.java (28 hunks)
Additional comments: 14
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/CMakeMainTab2.java (14)
  • 18-18: The addition of import java.net.URI; is noted. Ensure that the new functionality using URIs properly handles input validation and security considerations.
  • 81-82: The formatting change with the newline after the class declaration extends clause improves readability.
  • 106-111: The reformatting of the FlashInterface enum enhances code readability without altering functionality.
  • 118-119: Adjustments to method signatures throughout the file enhance readability. Verify that these changes maintain consistent method behavior and do not introduce any functional discrepancies.
  • 103-122: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [118-144]

The createControl method has been significantly modified. Ensure that the dispose listener properly cleans up resources and that the UI components are initialized correctly. The method's structure appears to be well-organized, enhancing maintainability.

  • 144-146: The updateArgument method override indicates that the default argument field is not needed. Confirm that this decision aligns with the overall functionality and that any necessary argument handling is performed elsewhere.
  • 165-172: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [154-199]

Significant changes in createArgumentComponent and handleVariablesButtonSelected methods improve the UI component setup and variable handling. Ensure that UI components are correctly laid out and that variable insertion into text fields is secure and error-free.

  • 282-312: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [213-325]

The addition of createUartComposite, createJtagflashComposite, and createDfuTargetComposite methods enhances the modularity of UI component creation. Review these methods for correct UI setup, especially ensuring that event listeners are properly attached and handled.

  • 369-390: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [351-383]

The createProjectGroup and chooseProject methods focus on project selection UI. Verify that the project selection dialog is correctly populated and that selected projects are properly handled.

  • 424-439: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [417-457]

The createJtagFlashButton method introduces a UI component for selecting the flash interface. Ensure that the selection logic correctly updates the UI and that the method properly handles the case when JTAG flashing is not available.

  • 468-487: The setDefaults and getSelectedProject methods are crucial for initializing launch configuration defaults and selecting a project, respectively. Confirm that these methods correctly handle default values and project selection, especially in edge cases.
  • 465-522: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [509-528]

The initializeCProject and switchUI methods are important for setting up the C project in the launch configuration and switching the UI based on the selected flash interface. Ensure that project initialization is correctly performed and that the UI switching logic is robust.

  • 538-583: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [541-589]

The isValid, performApply, updateProjetFromConfig, updateFlashOverStatus, and updateArgumentsWithDefaultFlashCommand methods contain logic for validating the launch configuration, applying changes, and updating the UI based on the configuration. Review these methods for correct logic and error handling, particularly in the validation logic to prevent incorrect configurations.

  • 831-919: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [632-915]

The saveLaunchTargetName, initializeFrom, updateProjetFromConfig, updateFlashOverStatus, updateArgumentsWithDefaultFlashCommand, initializeJtagComboFields, createOpenOcdSetupComponent, updateArgumentsField, newVariableExpression, getLaunchTarget, updateLocation, updateWorkingDirectory, and scheduleApplyTargetJob methods introduce or modify significant functionality related to launch configuration handling and UI updates. Ensure that these methods are thoroughly reviewed for correctness, security considerations, and adherence to best practices.

Copy link
Collaborator

@alirana01 alirana01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kolipakakondal kolipakakondal merged commit cc1bd1d into master Mar 26, 2024
3 of 6 checks passed
@kolipakakondal kolipakakondal deleted the IEP-1186 branch March 26, 2024 17:23
@kolipakakondal kolipakakondal added this to the v2.13.0 milestone Mar 26, 2024
AndriiFilippov pushed a commit that referenced this pull request Apr 22, 2024
* fix: Error during new lauchconfig when there are no projects

* fix: exception when deleting project without deleting configurations

---------

Co-authored-by: Denys Almazov <almazovdenys@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants