Skip to content

Commit cf93936

Browse files
committed
IEP-1590: autoimport of old configuration (#1275)
1 parent e097ec3 commit cf93936

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/messages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ OldConfigFoundMsgBoxMsg=Espressif IDE now uses the EIM system to manage ESP-IDF
3939
OldConfigExportDirectorSelectionDialogTitle=Select Destination
4040
OldConfigExportDirectorSelectionDialogInfo=Choose a directory to save the exported settings.
4141
OldConfigExportCompleteSuccessMsgTitle=Import Successful
42-
OldConfigExportCompleteSuccessMsg=The configuration has been successfully Imported
42+
OldConfigExportCompleteSuccessMsg=The old configuration has been successfully imported.
4343
OldConfigExportCompleteFailMsgTitle=Conversion Failed
44-
OldConfigExportCompleteFailMsg=An error occurred while converting old configuration.
44+
OldConfigExportCompleteFailMsg=An error occurred while importing old configuration.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/EspressifToolStartup.java

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,9 @@ private boolean checkIfEimPathMacOsIsInApplications()
146146
private void handleOldConfigExport()
147147
{
148148
Display display = Display.getDefault();
149-
150-
GlobalModalLock.showModal(() -> MessageDialog.openQuestion(display.getActiveShell(),
151-
Messages.OldConfigFoundMsgBoxTitle, Messages.OldConfigFoundMsgBoxMsg), response -> {
152-
if (response)
153-
{
154-
startExportOldConfig();
155-
}
156-
});
157-
149+
display.asyncExec(()-> {
150+
startExportOldConfig();
151+
});
158152
}
159153

160154
private void startExportOldConfig()
@@ -184,31 +178,42 @@ else if (!StringUtil.isEmpty(eimPathEnvVar))
184178
if (status.getSeverity() != IStatus.ERROR)
185179
{
186180
preferences.putBoolean(EimConstants.OLD_CONFIG_EXPORTED_FLAG, true);
187-
displayInformationMessageBox(Messages.OldConfigExportCompleteSuccessMsgTitle,
188-
Messages.OldConfigExportCompleteSuccessMsg);
181+
writeToStandardConsoleStream(Messages.OldConfigExportCompleteSuccessMsg);
189182
}
190183
else
191184
{
192-
displayInformationMessageBox(Messages.OldConfigExportCompleteFailMsgTitle,
193-
Messages.OldConfigExportCompleteFailMsg);
185+
writeToErrorConsoleStream(Messages.OldConfigExportCompleteFailMsg);
194186
}
195187
}
196188
catch (IOException e)
197189
{
198190
Logger.log("Error exporting old configuration", e);
199-
displayInformationMessageBox(Messages.OldConfigExportCompleteFailMsgTitle,
200-
Messages.OldConfigExportCompleteFailMsg);
191+
writeToErrorConsoleStream(Messages.OldConfigExportCompleteFailMsg);
201192
}
202193
}
203-
204-
private void displayInformationMessageBox(String messageTitle, String message)
194+
195+
private void writeToStandardConsoleStream(String msg)
205196
{
206-
Display display = Display.getDefault();
207-
GlobalModalLock.showModal(() -> {
208-
MessageDialog.openInformation(display.getActiveShell(), messageTitle, message);
209-
return null;
210-
}, ignored -> {
211-
});
197+
try
198+
{
199+
standardConsoleStream.write(msg);
200+
}
201+
catch (IOException e)
202+
{
203+
Logger.log(e);
204+
}
205+
}
206+
207+
private void writeToErrorConsoleStream(String msg)
208+
{
209+
try
210+
{
211+
errorConsoleStream.write(msg);
212+
}
213+
catch (IOException e)
214+
{
215+
Logger.log(e);
216+
}
212217
}
213218

214219
private void closeEspIdfManager()

0 commit comments

Comments
 (0)