Skip to content

IEP 1517: Handling case for conversion of existing json file to eim_idf.json #1218

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

Open
wants to merge 3 commits into
base: release/v4.0.0
Choose a base branch
from

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented May 7, 2025

⚠️ BLOCKED: FIX FROM EIM NEEDED FOR END-TO-END TESTING

⚠️ CODE can be REVIEWED

Description

Handling case for conversion of existing json file to eim_idf.json

Fixes # (IEP-1517)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Please try to use an older workspace with this build to test it. The condition for older workspace is that it should have the old json file that was create by installation manager before eim integration.

Test Configuration:

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

Checklist

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

Summary by CodeRabbit

  • New Features

    • Introduced a new tool management system based on a unified JSON configuration, enabling improved ESP-IDF tools setup, migration, and monitoring.
    • Added UI notifications and guidance for missing or outdated ESP-IDF tools and configurations.
    • Enhanced ESP-IDF Manager with a new table view, guide link, and streamlined activation workflow.
    • Implemented file watchers and change notifications for ESP-IDF configuration updates.
  • Improvements

    • Modernized and simplified environment variable handling for tool setup and subprocesses.
    • Streamlined ESP-IDF tool activation and setup flows within the IDE.
    • Refined user prompts and messages for better clarity during configuration and migration.
    • Updated test configurations and increased timeouts for more robust automated testing.
  • Removals

    • Removed legacy tool installation wizards, configuration managers, and related UI flows.
    • Deleted outdated commands, handlers, and wizard pages for ESP-IDF installation and updates.
    • Eliminated redundant resource files, message bundles, and test methods related to deprecated workflows.
  • Bug Fixes

    • Fixed issues with environment variable propagation and subprocess execution during tool setup.
  • Documentation

    • Updated and consolidated user-facing messages and localization resources for the new tool management experience.
  • Chores

    • Updated CI workflows to support additional branches and modernized action versions.

@alirana01 alirana01 self-assigned this May 7, 2025
@alirana01 alirana01 requested review from kolipakakondal and sigmaaa and removed request for kolipakakondal May 7, 2025 13:12
Copy link

coderabbitai bot commented May 7, 2025

Walkthrough

This update introduces a major refactor of the Espressif IDF Eclipse plugin, replacing the legacy toolset management with a new EIM (Espressif Installation Manager)-based configuration. It removes numerous legacy classes, wizards, handlers, and UI resources related to tool installation and management, and introduces new classes for EIM-based configuration, JSON parsing, change watching, and UI integration. Environment variable handling is simplified, and new startup and notification flows are implemented. Test timeouts and configurations are also updated.

Changes

Files / Paths Change Summary
.github/workflows/ci.yml, .github/workflows/ci_windows.yml Updated CI workflows to expand branch triggers, modernize action versions, and improve ESP-IDF installation steps.
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF Added export of com.espressif.idf.core.tools.watcher package.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java Removed constants related to GitHub assets, Python package index URLs, and IDF tools path.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFEnvironmentVariables.java Added ESP_IDF_EIM_ID constant; changed environment map logic.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java Removed usage of IDF_TOOLS_PATH environment variable.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/Messages.java, messages.properties Added message keys and localized messages for EIM/Espressif tool initialization and configuration export.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java, bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspToolCommands.java Changed environment variable handling to use System.getenv().
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java Added new method for Python env path; removed custom system env and tools path methods.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/ Major refactor:
- Added: EimConstants, EimIdfConfiguratinParser, Messages, SetupToolsInIde, ToolInitializer
- Deleted: IToolsInstallationWizardConstants, IToolsJsonKeys, JsonKey, ToolSetConfigurationManager, ToolsJsonParser, ToolsPlatformMapping, ToolsSystemWrapper, and all related legacy toolset management classes.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/vo/ Major refactor:
- Added: EimJson, IdfInstalled
- Deleted: IDFToolSet, ToolsVO, VersionsVO, VersionDetailsVO
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/watcher/ Added: EimJsonChangeListener, EimJsonStateChecker, EimJsonWatchService for EIM JSON file monitoring.
bundles/com.espressif.idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/JsonConfigServer.java Refactored environment preparation and process launching.
bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java Removed WebSocket dependency check; simplified environment handling.
bundles/com.espressif.idf.ui/OSGI-INF/l10n/bundle.properties, plugin.xml Removed legacy commands, handlers, menu contributions; updated startup classes.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/EspressifGeneralStartup.java Added new startup class for UI event wiring and dialog management.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InitializeToolsStartup.java Deleted old startup class for tool initialization.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SbomCommandDialog.java, help/ProductInformationHandler.java, size/IDFSizeDataManager.java, tracing/AppLvlTracingDialog.java, update/AbstractToolsHandler.java Simplified environment variable handling to use System.getenv().
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/NewProjectHandlerUtil.java Switched to EimConstants for install flag.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/UpdateEspIdfHandler.java Deleted legacy update handler class.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/ Major removal: Deleted all legacy install wizard pages, handlers, messages, and supporting classes.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java Removed "Tools Installation" settings section and related logic.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ Major refactor:
- Added: EspressifToolStartup, SetupToolsJobListener, watcher/EimJsonUiChangeHandler
- Deleted: ToolsActivationJob, ToolsInstallationJob, ToolsJob, GitWizardRepProgressMonitor, LogMessagesThread and other legacy tool management classes.
- Refactored: ManageEspIdfVersionsHandler, Messages, manager/ESPIDFManagerEditor, manager/EimEditorInput, manager/pages/ESPIDFMainTablePage to use new EIM-based model.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/messages.properties Replaced with a minimal set of new messages for EIM-based UI.
tests/com.espressif.idf.ui.test/ Updated test properties for IDF path; increased timeouts; removed/commented out several test methods; simplified environment setup logic.
tests/pom.xml Added -DtestRun=true to JVM arguments for test execution.

Sequence Diagram(s)

sequenceDiagram
    participant EclipseIDE
    participant EspressifToolStartup
    participant ToolInitializer
    participant EimIdfConfiguratinParser
    participant EimJsonWatchService
    participant ESPIDFManagerEditor

    EclipseIDE->>EspressifToolStartup: On early startup
    EspressifToolStartup->>ToolInitializer: Check for old config & EIM installation
    ToolInitializer-->>EspressifToolStartup: Returns config state
    EspressifToolStartup->>EimIdfConfiguratinParser: Load EIM JSON
    EimIdfConfiguratinParser-->>EspressifToolStartup: Returns EimJson
    EspressifToolStartup->>ESPIDFManagerEditor: Open editor if needed
    EspressifToolStartup->>EimJsonWatchService: Register UI change handler
    EimJsonWatchService-->>EspressifToolStartup: Notify on JSON file changes
    EspressifToolStartup->>EclipseIDE: Show notifications/dialogs as needed
Loading

Possibly related PRs

Suggested reviewers

  • kolipakakondal
  • AndriiFilippov

Poem

A rabbit hopped in the code so deep,
Sweeping old tools out with a leap.
EIM now guides the way,
JSON watched by night and day.
Wizards and handlers take their bow,
A streamlined burrow emerges now!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@alirana01 alirana01 changed the base branch from master to release/v4.0.0 May 7, 2025 13:12
@alirana01 alirana01 requested a review from kolipakakondal May 7, 2025 13:12
Copy link
Collaborator Author

@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.

Self Review

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 21

♻️ Duplicate comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java (1)

185-185: Significantly increased test timeout for SDK Configuration tab

Same concern as the previous method - the timeout was increased from 5 seconds to 15 minutes.

🧹 Nitpick comments (27)
tests/pom.xml (2)

33-33: Extract memory settings into a Maven property: Hardcoding -Xms4096m -Xmx8192m in <argLine> can make future adjustments cumbersome. Define a property (e.g., <test.memory.args>) and reference it:

<properties>
+   <test.memory.args>-Xms4096m -Xmx8192m</test.memory.args>
</properties>
...
<argLine>${test.memory.args} -DtestRun=true</argLine>

32-35: Document the testRun flag in documentation: Please update README or test guidelines to explain the purpose of -DtestRun=true and how test-specific behavior is toggled.

.github/workflows/ci.yml (1)

29-29: Remove tabs and trailing spaces
Line 29 contains a tab character before the action name, and line 43 has trailing whitespace, both of which can cause YAML syntax errors. Please convert tabs to spaces and trim trailing spaces.

Also applies to: 43-43

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 29-29: syntax error: found character '\t' that cannot start any token

(syntax)

bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/messages.properties (2)

1-7: Message keys naming convention inconsistency with refactoring

The message keys still reference "InstallToolsHandler" even though according to the PR summary and AI-generated summary, this class has been removed in favor of the new EIM-based approach. Consider renaming these keys to align with the new class names (e.g., SetupToolsInIde) for consistency.

-InstallToolsHandler_CopyingOpenOCDRules=Copying OpenOCD Rules
-InstallToolsHandler_OpenOCDRulesCopyPaths=Copying File: %s to destination: %s
-InstallToolsHandler_OpenOCDRulesCopyWarning=Warning
-InstallToolsHandler_OpenOCDRulesCopyWarningMessage=The rules file is already present in the /etc/udev/rules.d/ directory, Do you want to replace the file with the file from OpenOCD directory
-InstallToolsHandler_OpenOCDRulesNotCopied=Rules Not Copied to system
-InstallToolsHandler_OpenOCDRulesCopyError=Unable to copy rules for OpenOCD to system directory, try running the eclipse with sudo command
-InstallToolsHandler_OpenOCDRulesCopied=Rules Copied to system
+SetupToolsInIde_CopyingOpenOCDRules=Copying OpenOCD Rules
+SetupToolsInIde_OpenOCDRulesCopyPaths=Copying File: %s to destination: %s
+SetupToolsInIde_OpenOCDRulesCopyWarning=Warning
+SetupToolsInIde_OpenOCDRulesCopyWarningMessage=The rules file is already present in the /etc/udev/rules.d/ directory, Do you want to replace the file with the file from OpenOCD directory
+SetupToolsInIde_OpenOCDRulesNotCopied=Rules Not Copied to system
+SetupToolsInIde_OpenOCDRulesCopyError=Unable to copy rules for OpenOCD to system directory, try running the eclipse with sudo command
+SetupToolsInIde_OpenOCDRulesCopied=Rules Copied to system

4-4: Improve readability of warning message

The warning message is a bit lengthy and lacks proper punctuation, which might affect readability in a dialog box.

-InstallToolsHandler_OpenOCDRulesCopyWarningMessage=The rules file is already present in the /etc/udev/rules.d/ directory, Do you want to replace the file with the file from OpenOCD directory
+InstallToolsHandler_OpenOCDRulesCopyWarningMessage=The rules file is already present in the /etc/udev/rules.d/ directory. Do you want to replace it with the file from OpenOCD directory?
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/messages.properties (2)

22-23: Formatting issue in message text

The message at line 23 has a trailing space and an extra newline character at the end of the string, which might lead to unwanted spacing in the UI.

-ToolsInitializationEimMissingMsgBoxMessage=ESP-IDF is not found on your system. To use the IDE, install ESP-IDF using <a href="{0}">EIM - GUI Installer</a>. \n\nOnce installed, the IDE will automatically detect ESP-IDF. You can verify and activate it from the ESP-IDF Manager, accessible via the menu: Espressif > ESP-IDF Manager.\n\n 
+ToolsInitializationEimMissingMsgBoxMessage=ESP-IDF is not found on your system. To use the IDE, install ESP-IDF using <a href="{0}">EIM - GUI Installer</a>. \n\nOnce installed, the IDE will automatically detect ESP-IDF. You can verify and activate it from the ESP-IDF Manager, accessible via the menu: Espressif > ESP-IDF Manager.

29-32: Inconsistent spacing between message properties

There's an empty line between some message properties, which is inconsistent with the rest of the file.

 IDFBuildConfiguration_PreCheck_DifferentIdfPath=The project was built using the ESP-IDF located at the {0} path.\nThe currently active ESP-IDF path in the IDE is {1}.\nPlease clean the project using "ESP-IDF:Project Full Clean" menu option to use the active ESP-IDF configuration. 
 IDFToolChainsMissingErrorMsg=Toolchains are missing. Please use ESP-IDF Manager for configuring
-
 NoActiveEspIdfInWorkspaceMsgTitle=ESP-IDF Setup
 NoActiveEspIdfInWorkspaceMsg=ESP-IDF is required to use Espressif IDE. Would you like to configure it now?
-
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/vo/EimJson.java (3)

8-18: Improve collection handling and add documentation

The class structure is good, but the collection handling could be improved and documentation should be added.

  1. Add class-level JavaDoc explaining this class's purpose (handling EIM configuration)
  2. Add defensive copying for the list getter/setter to prevent external modification:
 public class EimJson
 {
+	/**
+	 * Data model for the eim_idf.json configuration file that stores ESP-IDF and 
+	 * Espressif Installation Manager (EIM) settings.
+	 */
 	@Expose
 	private String eimPath;
 	@Expose
 	private String gitPath;
 	@Expose
 	private String idfSelectedId;
 	@Expose
-	private List<IdfInstalled> idfInstalled = Collections.emptyList();
+	private List<IdfInstalled> idfInstalled = Collections.emptyList();

39-47: Add defensive copying to protect collection

The current implementation returns the internal list directly, which could lead to unexpected modifications.

 public List<IdfInstalled> getIdfInstalled()
 {
-	return idfInstalled;
+	return Collections.unmodifiableList(idfInstalled);
 }

 public void setIdfInstalled(List<IdfInstalled> idfInstalled)
 {
-	this.idfInstalled = idfInstalled;
+	this.idfInstalled = idfInstalled != null ? 
+		new ArrayList<>(idfInstalled) : Collections.emptyList();
 }

1-60: Consider adding utility methods for object management

This class would benefit from additional utility methods for better object-oriented design.

Consider adding:

  1. A toString() method for debugging
  2. equals() and hashCode() implementations
  3. A builder pattern or fluent setters for easier construction
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/watcher/EimJsonUiChangeHandler.java (1)

1-4: Incorrect copyright year

The copyright year is set to 2025, which is in the future.

 /*******************************************************************************
- * Copyright 2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
+ * Copyright 2023 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
  * Use is subject to license terms.
  *******************************************************************************/
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/watcher/EimJsonStateChecker.java (1)

1-3: Update copyright year

The copyright year is set to 2025, which is in the future. It should be updated to the current year (2024).

-/*******************************************************************************
- * Copyright 2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
- * Use is subject to license terms.
+/*******************************************************************************
+ * Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
+ * Use is subject to license terms.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/EimIdfConfiguratinParser.java (1)

12-12: Fix spelling in class name

There's a spelling error in the class name - "Configuratin" should be "Configuration".

-public class EimIdfConfiguratinParser
+public class EimIdfConfigurationParser
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java (2)

3-6: Remove unused import
java.util.ArrayList is no longer referenced.
Cleaning unused imports avoids unnecessary recompilations and keeps the code tidy.


46-57: Graceful handling when configuration parsing fails
If EimIdfConfiguratinParser#getEimJson(true) throws, the editor still opens with an empty EimJson, but the user is not informed and an error is only logged.
Consider notifying the user (e.g. a warning dialog or Eclipse error log entry) so they understand why no IDF versions are listed.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/EimEditorInput.java (1)

25-31: Delegate adapter queries to the platform
Returning null prevents downstream consumers from adapting this input. Use the AdapterManager:

-	public <T> T getAdapter(Class<T> adapter)
-	{
-		// TODO Auto-generated method stub
-		return null;
-	}
+	public <T> T getAdapter(Class<T> adapter)
+	{
+		return org.eclipse.core.runtime.Platform.getAdapterManager().getAdapter(this, adapter);
+	}
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/EspressifGeneralStartup.java (1)

82-92: Consider removing unnecessary suppressions.

The @SuppressWarnings("static-access") annotations may not be needed if launchBarListener.setIgnoreTargetChange(boolean) is an instance method rather than a static method.

-    @SuppressWarnings("static-access")
	private void disableLaunchBarEvents()
    {
        launchBarListener.setIgnoreTargetChange(true);
    }

-    @SuppressWarnings("static-access")
	private void enableLaunchBarEvents()
    {
        launchBarListener.setIgnoreTargetChange(false);
    }
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/ToolInitializer.java (1)

64-83: Add specific error message for conversion failure.

The error message "Error in conversion" is generic. Consider providing a more specific error message that indicates what went wrong during the conversion process.

-		return new Status(IStatus.ERROR, IDFCorePlugin.getId(), -1, "Error in conversion", null); //$NON-NLS-1$
+		return new Status(IStatus.ERROR, IDFCorePlugin.getId(), -1, 
+				"Old configuration file not found or could not be converted", null); //$NON-NLS-1$
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/watcher/EimJsonWatchService.java (1)

69-75: Prevent duplicate listeners
CopyOnWriteArrayList allows duplicates, so callers registering twice will receive events twice. Add a containment check to keep semantics predictable:

-			eimJsonChangeListeners.add(listener);
+			if (!eimJsonChangeListeners.contains(listener))
+			{
+				eimJsonChangeListeners.add(listener);
+			}
bundles/com.espressif.idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/JsonConfigServer.java (1)

157-164: Environment PATH merging may clobber case-sensitive keys on Windows
You overwrite whichever casing (PATH/Path) you discover first, but keep both if they already co-exist. Down-stream you remove Path in ProcessBuilderFactory.run(). Prefer normalising to one key here to avoid subtle path leaks.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/SetupToolsInIde.java (3)

148-151: Typos in status messages (“pyhton”, “web-socket”)

Minor, but these appear in the UI/console:

-            monitor.setTaskName("Installing pyhton dependency web-socket");
-            log("Installing pyhton dependency web-socket", IStatus.INFO);
+            monitor.setTaskName("Installing python dependency websocket-client");
+            log("Installing python dependency websocket-client", IStatus.INFO);

96-105: Variable name misspelled (arguemnts)

Although consistent, the typo reduces readability and may propagate.

-        List<String> arguemnts = new ArrayList<>();
+        List<String> arguments = new ArrayList<>();-        arguemnts = ToolsUtility.getExportScriptCommand(…);
+        arguments = ToolsUtility.getExportScriptCommand(…);

498-503: Duplicate env-vars in activation output may throw IllegalStateException

Collectors.toMap fails on duplicate keys. Some activation scripts echo the same variable twice (e.g., when sourcing multiple profiles).

Consider using Collectors.toMap(..., (v1, v2) -> v2) to retain the last value.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (1)

330-337: Unused gitPath parameter in ToolsUtility.getIdfVersion

Call sites pass eimJson.getGitPath() but the method ignores it, indicating either dead code or an unfinished feature.

Drop the parameter or integrate its use (e.g., prepend Git to PATH).

bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java (1)

27-33: gitPath parameter is unused

getIdfVersion(IdfInstalled idfInstalled, String gitPath) never references gitPath, yet every caller supplies it. This is misleading and clutters the API.

-public static String getIdfVersion(IdfInstalled idfInstalled, String gitPath)
+public static String getIdfVersion(IdfInstalled idfInstalled)

Adjust callers accordingly, or actually employ gitPath when building the environment.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/Messages.java (2)

25-25: Inconsistent naming: remove underscore in key.
The key IDFGuideLinkLabel_Text uses an underscore, deviating from the camel-case convention seen in other message keys. Rename to IDFGuideLinkLabelText for consistency.


27-27: Inconsistent naming: remove underscore in key.
The key IDFToolsHandler_ToolsManagerConsole combines two concerns with an underscore. For clarity and to match the existing style, rename to IDFToolsHandlerToolsManagerConsole.

🛑 Comments failed to post (21)
.github/workflows/ci_windows.yml (1)

8-14: ⚠️ Potential issue

Fix YAML indentation for branch filters
The branch arrays under push and pull_request are currently indented incorrectly (5 spaces instead of 6), which will result in a YAML parsing error. Please apply the following diff:

@@ lines 8-14
-  push:
-    branches:
-     - master
-     - release/**
+  push:
+    branches:
+      - master
+      - release/**
-  pull_request:
-    branches:
-     - master
-     - release/**
+  pull_request:
+    branches:
+      - master
+      - release/**
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 9-9: wrong indentation: expected 6 but found 5

(indentation)


[warning] 13-13: wrong indentation: expected 6 but found 5

(indentation)

.github/workflows/ci.yml (1)

8-14: ⚠️ Potential issue

Fix YAML indentation for branch filters
The branches lists under push and pull_request need consistent 6-space indentation for the dash entries to avoid syntax errors:

@@ lines 8-14
-  push:
-    branches:
-     - master
-     - release/**
+  push:
+    branches:
+      - master
+      - release/**
-  pull_request:
-    branches:
-     - master
-     - release/**
+  pull_request:
+    branches:
+      - master
+      - release/**
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 9-9: wrong indentation: expected 6 but found 5

(indentation)


[warning] 13-13: wrong indentation: expected 6 but found 5

(indentation)

tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java (1)

178-178: 💡 Verification agent

🧩 Analysis chain

Significantly increased test timeout for SDK Configuration tab

The timeout was increased from 5 seconds to 15 minutes, which seems exceptionally long for a UI test operation.

While this change aligns with the PR objective of handling older workspaces and ensuring compatibility, such a long timeout could mask performance issues or result in very long test execution times. Consider:

  1. Is this extreme timeout increase necessary, or could a more moderate value work?
  2. Is there a way to improve the initialization process to reduce this wait time?
  3. Could you add logging during this wait period to help diagnose what's taking so long?

🏁 Script executed:

#!/bin/bash
# Check for any timeout-related configuration in test utility classes
fd TestWidgetWaitUtility.java --exec cat {} | grep -A 10 -B 10 waitForSDKConfigurationTab

Length of output: 557


🏁 Script executed:

#!/bin/bash
# Locate all invocations of waitForSDKConfigurationTab to see past defaults
rg -n "waitForSDKConfigurationTab" .

# Enumerate all waitFor* methods in TestWidgetWaitUtility for comparison
fd TestWidgetWaitUtility.java --exec grep -n "public static void waitFor" {}

Length of output: 1202


🏁 Script executed:

#!/bin/bash
# Check typical timeout values for waitForDialogToAppear in tests
rg -n "waitForDialogToAppear" tests/com.espressif.idf.ui.test

# Check typical usage of waitForTreeItem to see if timeouts are passed
rg -n "waitForTreeItem" tests/com.espressif.idf.ui.test

# Inspect other waitUntil usages to gauge common default timeouts
rg -n "waitUntil" tests/com.espressif.idf.ui.test

Length of output: 7141


Re-evaluate 15-minute timeout for SDK Configuration tab
The test now calls waitForSDKConfigurationTab(bot, 900000) (15 min), whereas other UI waits use 5 000–10 000 ms. Even though some long-running operations (e.g. env setup) use very large timeouts, a 15-minute UI wait can mask regressions and bloat test runs.

• Could we reduce this to a more moderate value (e.g. 60 000 ms)?
• Is it possible to optimize the SDK Configuration view’s initialization to speed up tab activation?
• Add interim logging or progress markers inside the DefaultCondition to surface where the delay occurs.

Example patch:

- TestWidgetWaitUtility.waitForSDKConfigurationTab(bot, 900000);
+ TestWidgetWaitUtility.waitForSDKConfigurationTab(bot, 60000); // lowered to 60 s
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			TestWidgetWaitUtility.waitForSDKConfigurationTab(bot, 60000); // lowered to 60 s
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/EimConstants.java (1)

7-7: 💡 Verification agent

🧩 Analysis chain

Verify path construction for non-standard home directories

The POSIX path construction uses the user's home directory, but be careful with edge cases like non-standard home directory paths.


🏁 Script executed:

#!/bin/bash
# Check if the code handles spaces or special characters in home directory paths
echo "Testing home directory path handling for: ${HOME}"
if [[ "${HOME}" == *" "* || "${HOME}" == *"'"* || "${HOME}" == *"\""* ]]; then
  echo "WARNING: Home directory contains spaces or quotes which might cause issues in path construction"
fi

Length of output: 215


Construct EIM_POSIX_DIR with the Path API to handle all home‐directory edge cases

String concatenation of System.getProperty("user.home") with "/.espressif/tools/" can break on non‐standard paths (spaces, trailing separators, OS-specific separators, etc.). Instead, use Java NIO’s Paths.get(...):

• File: bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/EimConstants.java:7
• Replace:

- String EIM_POSIX_DIR = System.getProperty("user.home")
-     .concat("/.espressif/tools/"); //$NON-NLS-1$//$NON-NLS-2$
+ import java.nio.file.Path;
+ import java.nio.file.Paths;
+
+ Path eimPosixPath = Paths.get(
+     System.getProperty("user.home"), 
+     ".espressif", 
+     "tools"
+ );
+ String EIM_POSIX_DIR = eimPosixPath.toString(); //$NON-NLS-1$ //$NON-NLS-2$

This ensures correct separators, quoting and encoding for any valid home directory path.

Committable suggestion skipped: line range outside the PR's diff.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/watcher/EimJsonUiChangeHandler.java (2)

27-30: 🛠️ Refactor suggestion

Add null check for preferences in constructor

The constructor should validate the preferences parameter to prevent NullPointerExceptions later.

 public EimJsonUiChangeHandler(Preferences preferences)
 {
+	if (preferences == null) {
+		throw new IllegalArgumentException("Preferences cannot be null");
+	}
 	this.preferences = preferences;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	public EimJsonUiChangeHandler(Preferences preferences)
	{
		if (preferences == null) {
			throw new IllegalArgumentException("Preferences cannot be null");
		}
		this.preferences = preferences;
	}

32-42: 🛠️ Refactor suggestion

Add defensive programming to onJsonFileChanged

The method should check if the file parameter is null and handle potential UI exceptions.

 @Override
 public void onJsonFileChanged(Path file)
 {
+	if (file == null) {
+		return;
+	}
+
 	Display.getDefault().asyncExec(() -> {
-		MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.EimJsonChangedMsgTitle,
-				Messages.EimJsonChangedMsgDetail);
+		try {
+			MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.EimJsonChangedMsgTitle,
+					Messages.EimJsonChangedMsgDetail);
+		} catch (Exception e) {
+			// Log the exception but don't let it propagate
+			// Consider adding proper logging here
+		}
 	});

 	EimJsonStateChecker checker = new EimJsonStateChecker(preferences);
 	checker.updateLastSeenTimestamp();
 }
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/SetupToolsJobListener.java (2)

55-59: ⚠️ Potential issue

Null-check before invoking rollback
setupToolsInIde may legitimately be null (see default ctor), which would trigger an NPE on failed jobs.
Add a guard:

-			// Rollback all the changes
-			setupToolsInIde.rollback();
+			// Roll-back if we have a valid job instance
+			if (setupToolsInIde != null)
+			{
+				setupToolsInIde.rollback();
+			}

39-41: 🛠️ Refactor suggestion

⚠️ Potential issue

Potential NPE from default constructor
setupToolsInIde is never initialised when the no-arg constructor is used.
If any caller still uses this constructor (e.g. via DI or reflective instantiation) the done() method will dereference a null value and crash Eclipse.

-	public SetupToolsJobListener()
-	{
-	}
+	/**
+	 * Default constructor kept only for framework usage.<br>
+	 * ⚠️  Avoid using this, prefer the parameterised constructor so that
+	 * {@link #setupToolsInIde} is never {@code null}.
+	 */
+	public SetupToolsJobListener()
+	{
+		this(null, null);
+	}

Alternatively, remove the default constructor entirely and update call-sites.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java (1)

61-63: 💡 Verification agent

🧩 Analysis chain

firstStartup flag never set in the editor input
Later logic in ESPIDFManagerEditor relies on this flag to trigger initial setup, but it remains false. Pass the flag explicitly:

-IDE.openEditor(activeww.getActivePage(), new EimEditorInput(eimJson), ESPIDFManagerEditor.EDITOR_ID, true);
+EimEditorInput input = new EimEditorInput(eimJson);
+input.setFirstStartup(/* determine first-startup here */ true);
+IDE.openEditor(activeww.getActivePage(), input, ESPIDFManagerEditor.EDITOR_ID, true);

🏁 Script executed:

#!/bin/bash
# Find the EimEditorInput class declaration
rg "class EimEditorInput" -n

# Find any declaration or usage of firstStartup
rg "firstStartup" -n

# Find whether a setter exists for firstStartup
rg "setFirstStartup" -n

# Inspect any usage of firstStartup within ESPIDFManagerEditor
rg -C3 "firstStartup" -n

Length of output: 3121


🏁 Script executed:

#!/bin/bash
# Show context around EimEditorInput instantiation in ManageEspIdfVersionsHandler
rg -n -C5 "new EimEditorInput" bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java

Length of output: 400


🏁 Script executed:

#!/bin/bash
# Locate ESPIDFManagerEditor and inspect its use of firstStartup
rg -l "class ESPIDFManagerEditor" -n bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager | \
  xargs grep -n -C3 "isFirstStartup"
rg -l "class ESPIDFManagerEditor" -n bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager | \
  xargs grep -n -C3 "firstStartup"

Length of output: 589


🏁 Script executed:

#!/bin/bash
# Show context around setFirstStartup in EspressifToolStartup
rg -n -C5 "input.setFirstStartup" bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/EspressifToolStartup.java
# Also show how EimEditorInput is used there
rg -n -C5 "new EimEditorInput" bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/EspressifToolStartup.java

Length of output: 993


🏁 Script executed:

#!/bin/bash
FILE="bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java"
echo "----- Lines 1-100 -----"
sed -n '1,100p' "$FILE"
echo "----- Lines 101-200 -----"
sed -n '101,200p' "$FILE"

Length of output: 2761


Set the firstStartup flag when opening the ESP-IDF Manager editor

Without explicitly setting firstStartup, the editor’s initial‐setup logic (isFirstStartup()) never runs when invoked from ManageEspIdfVersionsHandler. Add a setter before calling IDE.openEditor(...):

• File: bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java
• Around line 61:

-               IDE.openEditor(activeww.getActivePage(),
-                       new EimEditorInput(eimJson),
-                       ESPIDFManagerEditor.EDITOR_ID,
-                       true);
+               // Prepare editor input and mark as first startup so initial setup runs
+               EimEditorInput input = new EimEditorInput(eimJson);
+               input.setFirstStartup(true);
+               IDE.openEditor(activeww.getActivePage(),
+                       input,
+                       ESPIDFManagerEditor.EDITOR_ID,
+                       true);

This ensures ESPIDFManagerEditor will invoke its setupInitialEspIdf() path.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

				// Prepare editor input and mark as first startup so initial setup runs
				EimEditorInput input = new EimEditorInput(eimJson);
				input.setFirstStartup(true);
				IDE.openEditor(activeww.getActivePage(),
						input,
						ESPIDFManagerEditor.EDITOR_ID,
						true);
			}
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/EimEditorInput.java (2)

44-48: ⚠️ Potential issue

Return meaningful text for editor tabs & tool-tips
Returning null causes Eclipse to show a blank label and may lead to NPEs in some views.

-	public String getName()
-	{
-		return null;
-	}
+	public String getName()
+	{
+		return FILE_NAME;
+	}
...
-	public String getToolTipText()
-	{
-		return null;
-	}
+	public String getToolTipText()
+	{
+		return "ESP-IDF EIM configuration";
+	}

Also applies to: 56-60


13-14: 🛠️ Refactor suggestion

Make FILE_NAME a real constant
FILE_NAME should be static final to reflect its constant nature and avoid per-instance duplication.

-	private String FILE_NAME = "idf_eim.json"; //$NON-NLS-1$
+	private static final String FILE_NAME = "idf_eim.json"; //$NON-NLS-1$
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    private static final String FILE_NAME = "idf_eim.json"; //$NON-NLS-1$
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/watcher/EimJsonWatchService.java (3)

52-60: 🛠️ Refactor suggestion

getInstance() can return null when construction fails
If new EimJsonWatchService() throws, INSTANCE remains null, and subsequent callers will NPE. Consider falling back to a no-op implementation or re-throwing a checked exception so callers can handle the failure explicitly.


30-44: 🛠️ Refactor suggestion

Avoid launching the watcher thread from inside the constructor
Calling start() inside the constructor causes the partially-constructed object (this) to escape, which can lead to subtle concurrency bugs (the thread may observe un-initialised state if more fields are added later). A safer pattern is to expose a static start()/init() factory or let callers start the thread explicitly after construction.

-		setDaemon(true);
-		start();
+		setDaemon(true);

…and start it in getInstance() or an explicit startService() method.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

 private EimJsonWatchService() throws IOException
 {
     String directoryPathString = Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_DIR
             : EimConstants.EIM_POSIX_DIR;

     watchDirectoryPath = Paths.get(directoryPathString);
     watchService = FileSystems.getDefault().newWatchService();
     watchDirectoryPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
             StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);

     Logger.log("Watcher added to the directory: " + directoryPathString); //$NON-NLS-1$
     setName("EimJsonWatchService"); //$NON-NLS-1$
     setDaemon(true);
 }

32-38: ⚠️ Potential issue

Ensure the watched directory exists before registering it
Paths.get(directoryPathString) will throw NoSuchFileException at register() time if the path does not exist. Create the directory (including parents) on first run to avoid a hard failure on clean machines.

-		watchDirectoryPath = Paths.get(directoryPathString);
+		watchDirectoryPath = Paths.get(directoryPathString);
+		if (Files.notExists(watchDirectoryPath))
+		{
+			Files.createDirectories(watchDirectoryPath);
+		}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		String directoryPathString = Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_DIR
				: EimConstants.EIM_POSIX_DIR;

		watchDirectoryPath = Paths.get(directoryPathString);
		if (Files.notExists(watchDirectoryPath))
		{
			Files.createDirectories(watchDirectoryPath);
		}
		watchService = FileSystems.getDefault().newWatchService();
		watchDirectoryPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
				StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
bundles/com.espressif.idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/JsonConfigServer.java (2)

96-100: ⚠️ Potential issue

Possible NPE when idfExportPath ends up null or empty
prepEnvMap() may put null values into env, but ProcessBuilder.environment() rejects null values and will throw NullPointerException when putAll() executes in ProcessBuilderFactory.run(...).

Add a guard to guarantee non-null values:

-		systemEnv.put(pathVar, idfExportPath);
+		if (!StringUtil.isEmpty(idfExportPath))
+		{
+			systemEnv.put(pathVar, idfExportPath);
+		}

Committable suggestion skipped: line range outside the PR's diff.


108-115: ⚠️ Potential issue

pythonPath can be null → ProcessBuilder failure
IDFUtil.getIDFPythonEnvPath() returns null when the executable cannot be located. Adding null to the arguments list will trigger ProcessBuilder’s NullPointerException.

-			String pythonPath = IDFUtil.getIDFPythonEnvPath();
+			String pythonPath = IDFUtil.getIDFPythonEnvPath();
+			if (StringUtil.isEmpty(pythonPath))
+			{
+				pythonPath = "python"; // last-chance fallback
+			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			String pythonPath = IDFUtil.getIDFPythonEnvPath();
			if (StringUtil.isEmpty(pythonPath))
			{
				pythonPath = "python"; // last-chance fallback
			}
			arguments.add(pythonPath);
			arguments.add(idfPythonScriptFile.getAbsolutePath());
			arguments.add("-B"); //$NON-NLS-1$
			arguments.add(IDFUtil.getBuildDir(project));
			arguments.add("-DSDKCONFIG=".concat(file.getName())); //$NON-NLS-1$
			arguments.add(IDFConstants.CONF_SERVER_CMD);
			Logger.log(arguments.toString());
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/EspressifToolStartup.java (1)

94-99: ⚠️ Potential issue

Incorrect MessageDialog constructor parameters – code will not compile
MessageDialog expects (Shell, String, Image, String, int, String[] , int). The current call passes two ints before the String[], violating the signature and causing a compilation error.

-			MessageDialog messageDialog = new MessageDialog(display.getActiveShell(),
-					Messages.OldConfigFoundMsgBoxTitle, null, Messages.OldConfigFoundMsgBoxMsg, 0, 0,
-					new String[] { Messages.ToolsInitializationDifferentPathMessageBoxOptionYes,
-							Messages.ToolsInitializationDifferentPathMessageBoxOptionNo });
+			MessageDialog messageDialog = new MessageDialog(display.getActiveShell(),
+					Messages.OldConfigFoundMsgBoxTitle, null, Messages.OldConfigFoundMsgBoxMsg,
+					MessageDialog.WARNING,
+					new String[] { Messages.ToolsInitializationDifferentPathMessageBoxOptionYes,
+							Messages.ToolsInitializationDifferentPathMessageBoxOptionNo },
+					0);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			MessageDialog messageDialog = new MessageDialog(display.getActiveShell(),
					Messages.OldConfigFoundMsgBoxTitle, null, Messages.OldConfigFoundMsgBoxMsg,
					MessageDialog.WARNING,
					new String[] {
							Messages.ToolsInitializationDifferentPathMessageBoxOptionYes,
							Messages.ToolsInitializationDifferentPathMessageBoxOptionNo
					},
					0);
			response[0] = messageDialog.open();
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/SetupToolsInIde.java (2)

548-560: ⚠️ Potential issue

*Hard-coding ‘;’ as path separator breaks nix installations

addGitToEnvironment prepends the Git directory using ";" which is only valid on Windows.
Use File.pathSeparator instead to remain platform-agnostic.

-                path1 = gitDir.concat(";").concat(path1);
+                path1 = gitDir + File.pathSeparator + path1;-                path2 = gitDir.concat(";").concat(path2);
+                path2 = gitDir + File.pathSeparator + path2;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			String gitDir = gitPath.removeLastSegments(1).toOSString();
			String path1 = envMap.get("PATH"); //$NON-NLS-1$
			String path2 = envMap.get("Path"); //$NON-NLS-1$
			if (!StringUtil.isEmpty(path1) && !path1.contains(gitDir)) // Git not found on the PATH environment
			{
-				path1 = gitDir.concat(";").concat(path1); //$NON-NLS-1$
+				path1 = gitDir + File.pathSeparator + path1; //$NON-NLS-1$
				envMap.put("PATH", path1); //$NON-NLS-1$
			}
			else if (!StringUtil.isEmpty(path2) && !path2.contains(gitDir)) // Git not found on the Path environment
			{
-				path2 = gitDir.concat(";").concat(path2); //$NON-NLS-1$
+				path2 = gitDir + File.pathSeparator + path2; //$NON-NLS-1$
				envMap.put("Path", path2); //$NON-NLS-1$
			}

100-109: ⚠️ Potential issue

Activation script is executed without the augmented environment map

You build an env map (adding Git to the PATH) but then discard it and pass System.getenv() to runInBackground.
On hosts where Git is not already on the system PATH, the activation script will fail.

-            IStatus status = processBuilderFactory.runInBackground(arguemnts, Path.ROOT, System.getenv());
+            IStatus status = processBuilderFactory.runInBackground(arguemnts, Path.ROOT, env);
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (2)

392-397: 🛠️ Refactor suggestion

Repeated idf.py --version calls in cell renderer hurt UI responsiveness

getIdfVersion() spawns an external process for every table refresh, which can freeze the UI on large IDF lists.

Cache the version inside IdfInstalled (populate once during JSON parse) or memoise in a Map<Id,String>.


530-546: ⚠️ Potential issue

Column-index / comparator mismatch causes incorrect sorting

setComparatorForCols assigns indices:
0 → Version, 1 → Name, 2 → Location.

compare() currently maps
0 → getName(), 1 → getPath(), 2 → active state – none of which align.

Users will see unexpected sort order.

case 0: // Version
-    rc = p1.getName().compareTo(p2.getName());
+    rc = ToolsUtility.getIdfVersion(p1, eimJson.getGitPath())
+            .compareTo(ToolsUtility.getIdfVersion(p2, eimJson.getGitPath()));
    break;
case 1: // Name
-    rc = p1.getPath().compareTo(p2.getPath());
+    rc = p1.getName().compareTo(p2.getName());
    break;
case 2: // Location
-    Boolean p1State = …;
-    Boolean p2State = …;
-    rc = p1State.compareTo(p2State);
+    rc = p1.getPath().compareTo(p2.getPath());
    break;

Or remap the colIndex arguments passed to setComparatorForCols.
Please adjust whichever is simpler to maintain.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			IdfInstalled p1 = (IdfInstalled) e1;
			IdfInstalled p2 = (IdfInstalled) e2;
			int rc = 0;
			switch (propertyIndex)
			{
			case 0: // Version
				rc = ToolsUtility.getIdfVersion(p1, eimJson.getGitPath())
						.compareTo(ToolsUtility.getIdfVersion(p2, eimJson.getGitPath()));
				break;
			case 1: // Name
				rc = p1.getName().compareTo(p2.getName());
				break;
			case 2: // Location
				rc = p1.getPath().compareTo(p2.getPath());
				break;
			default:

preferences = org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE.getNode(UIPlugin.PLUGIN_ID);
toolInitializer = new ToolInitializer(preferences);

if (toolInitializer.isEspIdfSet() && toolInitializer.isOldEspIdfConfigPresent()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two things here:

Do we need the isEspIdfSet() condition when we are already checking toolInitializer.isOldEspIdfConfigPresent()? I'm thinking — if the old configuration is present, doesn't that already imply that the IDF is set?

Since we're calling this in earlyStartup(), it means it will be invoked as soon as the IDE is launched. If EIM is not available, the conversion will fail anyway because EIM itself isn't available. So, are we checking whether EIM is installed before invoking the conversion?

@AndriiFilippov Please consider this case while testing E2E.

Comment on lines +106 to +107
Logger.log("Tools Conversion Process Message: ");
Logger.log(status.getMessage());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Introduce a new method Logger.log(String message, Exception e) to log these kind of messages if it's not available in the class Logger.

@@ -32,10 +32,10 @@ NoActiveEspIdfInWorkspaceMsgTitle=ESP-IDF Setup
NoActiveEspIdfInWorkspaceMsg=ESP-IDF is required to use Espressif IDE. Would you like to configure it now?

OldConfigFoundMsgBoxTitle=Old Configuration Found
OldConfigFoundMsgBoxMsg=An old ESP-IDF configuration has been detected.\nIf you want to use these you need to export these configuration and pass them on to EIM for updated configurations.\nWould you like to export these settings?\n\nPress 'Yes' to choose a location to save.
OldConfigFoundMsgBoxMsg=Please export the current workspace configuration to the EIM configuration for proper environment setup. Do you want to export configurations?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we convey below points in the message?

  • Explain why the prompt is appearing (legacy setup detected).
  • Clarify what will happen (conversion to EIM format).
  • State how it benefits the user (proper management and IDE will be ready to use with the existing setup).

Something like below or whatever you think that will convey above points -

Espressif IDE now uses EIM to manage ESP-IDF Installations. A legacy ESP-IDF configuration was detected in your workspace. Would you like to convert it to the EIM-compatible format to prepare the IDE for use?

OldConfigExportCompleteSuccessMsg=The configuration has been successfully Imported
OldConfigExportCompleteFailMsgTitle=Import Failed
OldConfigExportCompleteFailMsg=An error occurred while importing old configuration.
Copy link
Collaborator

@kolipakakondal kolipakakondal May 7, 2025

Choose a reason for hiding this comment

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

I think we are "converting" from the user perspective

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.

2 participants