Skip to content

Commit

Permalink
IEP-868: Fixing the export of global openocd path in preferences (esp…
Browse files Browse the repository at this point in the history
…ressif#690)

* IEP-868: Fixing the export of global openocd path in preferences

* IEP-868: Refactoring to reuse same code by moving function to IDFUtil
  • Loading branch information
alirana01 authored Feb 7, 2023
1 parent fa9a33e commit 372969e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;

import com.espressif.idf.core.ExecutableFinder;
import com.espressif.idf.core.IDFConstants;
Expand Down Expand Up @@ -615,4 +617,21 @@ public static String getNvsGeneratorScriptPath()
.collect(Collectors.joining(String.valueOf(IPath.SEPARATOR)));

}

/**
* Update the openocd path in configurations
*/
public static void updateEspressifPrefPageOpenocdPath()
{
IEclipsePreferences newNode = DefaultScope.INSTANCE.getNode("com.espressif.idf.debug.gdbjtag.openocd"); //$NON-NLS-1$
newNode.put("install.folder", getOpenOCDLocation()); //$NON-NLS-1$
try
{
newNode.flush();
}
catch (BackingStoreException e)
{
Logger.log(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ public Boolean call() throws Exception
configureToolChain();
configEnv();
copyOpenOcdRules();
IDFUtil.updateEspressifPrefPageOpenocdPath();
return Boolean.TRUE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -368,21 +366,7 @@ public void done(IJobChangeEvent event)
}
else
{
updateEspressifPrefPageOpenocdPath();
}
}

private void updateEspressifPrefPageOpenocdPath()
{
IEclipsePreferences newNode = DefaultScope.INSTANCE.getNode("com.espressif.idf.debug.gdbjtag.openocd"); //$NON-NLS-1$
newNode.put("install.folder", IDFUtil.getOpenOCDLocation()); //$NON-NLS-1$
try
{
newNode.flush();
}
catch (BackingStoreException e)
{
Logger.log(e);
IDFUtil.updateEspressifPrefPageOpenocdPath();
}
}

Expand Down

0 comments on commit 372969e

Please sign in to comment.