diff --git a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java index d950d6d51..8f43e142a 100644 --- a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java +++ b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java @@ -33,6 +33,10 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.launchbar.core.ILaunchBarManager; import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.part.ViewPart; import org.osgi.service.prefs.BackingStoreException; import com.espressif.idf.core.IDFConstants; @@ -813,4 +817,23 @@ public static String getIDFToolsPathFromPreferences() IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null); return idfToolsPath; } + + public static void closeWelcomePage(IWorkbenchWindow activeww) + { + Display.getDefault().syncExec(()-> { + if (activeww != null) + { + IWorkbenchPage page = activeww.getActivePage(); + if (page != null) + { + ViewPart viewPart = (ViewPart) page.findView("org.eclipse.ui.internal.introview"); //$NON-NLS-1$ + if (viewPart != null) + { + page.hideView(viewPart); + } + + } + } + }); + } } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/NewProjectHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/NewProjectHandler.java index a118a41d5..d7c72bff1 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/NewProjectHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/NewProjectHandler.java @@ -7,6 +7,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; +import com.espressif.idf.core.util.IDFUtil; import com.espressif.idf.ui.wizard.NewIDFProjectWizard; /** @@ -18,6 +19,7 @@ public class NewProjectHandler extends AbstractHandler @Override public Object execute(ExecutionEvent event) throws ExecutionException { + IDFUtil.closeWelcomePage(EclipseHandler.getActiveWorkbenchWindow()); if (!NewProjectHandlerUtil.installToolsCheck()) { return null; 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 1ff60db38..ceb02b514 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,14 +10,13 @@ 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.core.util.IDFUtil; import com.espressif.idf.ui.handlers.EclipseHandler; import com.espressif.idf.ui.tools.manager.ESPIDFManagerEditor; @@ -39,19 +38,8 @@ 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); - } - - } - } + IDFUtil.closeWelcomePage(activeww); + try { File inputFile = new File(toolSetConfigFilePath()); @@ -62,7 +50,6 @@ public void run() IFile iFile = ResourcesPlugin.getWorkspace().getRoot() .getFile(new Path(inputFile.getAbsolutePath())); - IDE.openEditor(activeww.getActivePage(), new FileEditorInput(iFile), ESPIDFManagerEditor.EDITOR_ID); } catch (Exception e)