Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.ide.IDE;

import com.espressif.idf.ui.EclipseUtil;

public class OpenSdkConfigEditor extends AbstractHandler
{

Expand All @@ -22,7 +22,7 @@ public class OpenSdkConfigEditor extends AbstractHandler
public Object execute(ExecutionEvent event) throws ExecutionException
{
IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
IProject project = getCurrentProject();
IProject project = EclipseUtil.getSelectedProjectInExplorer();
try
{
IFile sdkConfigFile = project.getFile(SDKCONFIG_FILE_NAME);
Expand All @@ -43,21 +43,4 @@ public Object execute(ExecutionEvent event) throws ExecutionException

return null;
}

/**
* Get the currently selected project in the workspace.
*/
private IProject getCurrentProject()
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = root.getProjects();
for (IProject project : projects)
{
if (project.isOpen() && project.getFile(SDKCONFIG_FILE_NAME).exists())
{
return project;
}
}
return null;
}
}
}
Loading