From 5906da4a2b029a74d4ff53d93ab3f451d9bd29d2 Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:39:32 +0200 Subject: [PATCH] IEP-1268: Welcome page closed when opening ESP-IDF Manager --- .../ui/tools/ManageEspIdfVersionsHandler.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java index 0777e4c03..1ff60db38 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ManageEspIdfVersionsHandler.java @@ -10,16 +10,17 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ViewPart; import com.espressif.idf.core.logging.Logger; import com.espressif.idf.core.tools.IToolsInstallationWizardConstants; import com.espressif.idf.ui.handlers.EclipseHandler; import com.espressif.idf.ui.tools.manager.ESPIDFManagerEditor; - public class ManageEspIdfVersionsHandler extends AbstractHandler { @@ -29,7 +30,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException launchEditor(); return null; } - + private void launchEditor() { Display.getDefault().asyncExec(new Runnable() @@ -38,6 +39,19 @@ private void launchEditor() public void run() { IWorkbenchWindow activeww = EclipseHandler.getActiveWorkbenchWindow(); + if (activeww != null) + { + IWorkbenchPage page = activeww.getActivePage(); + if (page != null) + { + ViewPart viewPart = (ViewPart) page.findView("org.eclipse.ui.internal.introview"); + if (viewPart != null) + { + page.hideView(viewPart); + } + + } + } try { File inputFile = new File(toolSetConfigFilePath()); @@ -45,9 +59,10 @@ public void run() { inputFile.createNewFile(); } - - IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(inputFile.getAbsolutePath())); - + + IFile iFile = ResourcesPlugin.getWorkspace().getRoot() + .getFile(new Path(inputFile.getAbsolutePath())); + IDE.openEditor(activeww.getActivePage(), new FileEditorInput(iFile), ESPIDFManagerEditor.EDITOR_ID); } catch (Exception e) @@ -57,7 +72,7 @@ public void run() } }); } - + private String toolSetConfigFilePath() { IPath path = ResourcesPlugin.getWorkspace().getRoot().getLocation();