Skip to content

Commit 1289baa

Browse files
sigmaaakolipakakondal
authored andcommitted
feat: improving UX during run/debug (#900)
* fix: improving UX during run/debug * fix: changing dialog messages --------- Co-authored-by: Kondal Kolipaka <kondal.kolipaka@espressif.com>
1 parent 6fd8538 commit 1289baa

9 files changed

Lines changed: 428 additions & 2 deletions

File tree

bundles/com.espressif.idf.ui/plugin.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,21 @@
521521
</iterate>
522522
</with>
523523
</activeWhen>
524+
</handler>
525+
<handler
526+
class="com.espressif.idf.ui.handlers.RunActionHandler"
527+
commandId="org.eclipse.launchbar.ui.command.launchActive">
528+
<activeWhen>
529+
<with
530+
variable="activeContexts">
531+
<iterate
532+
operator="or">
533+
<equals
534+
value="com.espressif.idf.ui.espLaunchScope">
535+
</equals>
536+
</iterate>
537+
</with>
538+
</activeWhen>
524539
</handler>
525540
</extension>
526541
<extension point="org.eclipse.ui.preferencePages">

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/LaunchBarListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static void setIgnoreTargetChange(boolean status)
5151
@Override
5252
public void activeLaunchTargetChanged(ILaunchTarget target)
5353
{
54-
Display.getDefault().asyncExec(() -> {
54+
Display.getDefault().syncExec(() -> {
5555
if (target != null)
5656
{
5757
String targetName = target.getAttribute("com.espressif.idf.launch.serial.core.idfTarget", //$NON-NLS-1$

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/Messages.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public class Messages extends NLS
2828
public static String HintDetailsTitle;
2929
public static String FilterMessage;
3030
public static String HintsYmlNotFoundErrMsg;
31+
public static String SelectDebugConfigDialog_LableText;
32+
public static String SelectDebugConfigDialog_Text;
33+
public static String SelectDebugConfigDialog_Title;
34+
public static String SelectLaunchConfigDialog_LableText;
35+
public static String SelectLaunchConfigDialog_Text;
36+
public static String SelectLaunchConfigDialog_Title;
3137
public static String WriteFlashDialog_Bin_Path_Lbl;
3238
public static String WriteFlashDialog_BinFileErrFormatErrMsg;
3339
public static String WriteFlashDialog_Browse_Btn;
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*******************************************************************************
2+
* Copyright 2024-2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
3+
* Use is subject to license terms.
4+
*******************************************************************************/
5+
package com.espressif.idf.ui.dialogs;
6+
7+
import java.util.List;
8+
import java.util.Optional;
9+
import java.util.stream.Stream;
10+
11+
import org.eclipse.core.runtime.CoreException;
12+
import org.eclipse.jface.dialogs.IDialogConstants;
13+
import org.eclipse.jface.dialogs.IMessageProvider;
14+
import org.eclipse.jface.dialogs.TitleAreaDialog;
15+
import org.eclipse.launchbar.core.ILaunchBarManager;
16+
import org.eclipse.launchbar.core.ILaunchDescriptor;
17+
import org.eclipse.swt.SWT;
18+
import org.eclipse.swt.layout.GridData;
19+
import org.eclipse.swt.layout.GridLayout;
20+
import org.eclipse.swt.widgets.Combo;
21+
import org.eclipse.swt.widgets.Composite;
22+
import org.eclipse.swt.widgets.Control;
23+
import org.eclipse.swt.widgets.Label;
24+
import org.eclipse.swt.widgets.Shell;
25+
26+
import com.espressif.idf.core.logging.Logger;
27+
import com.espressif.idf.ui.UIPlugin;
28+
29+
public class SelectDebugConfigDialog extends TitleAreaDialog
30+
{
31+
32+
private Combo descriptorsCombo;
33+
private final List<String> suitableConfiguratios;
34+
35+
public SelectDebugConfigDialog(Shell parentShell, List<String> suitableConfiguratios)
36+
{
37+
super(parentShell);
38+
this.suitableConfiguratios = suitableConfiguratios;
39+
}
40+
41+
@Override
42+
public void create()
43+
{
44+
super.create();
45+
setTitle(Messages.SelectDebugConfigDialog_Title);
46+
setMessage(Messages.SelectDebugConfigDialog_Text, IMessageProvider.INFORMATION);
47+
}
48+
49+
@Override
50+
protected void configureShell(Shell newShell)
51+
{
52+
super.configureShell(newShell);
53+
newShell.setText(Messages.SelectDebugConfigDialog_Title);
54+
}
55+
56+
@Override
57+
protected void createButtonsForButtonBar(Composite parent)
58+
{
59+
// create OK and Cancel buttons by default
60+
createButton(parent, IDialogConstants.OK_ID, "Debug", true); //$NON-NLS-1$
61+
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
62+
}
63+
64+
@Override
65+
protected Control createDialogArea(Composite parent)
66+
{
67+
Composite area = (Composite) super.createDialogArea(parent);
68+
Composite container = new Composite(area, SWT.NONE);
69+
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
70+
GridLayout layout = new GridLayout(2, false);
71+
container.setLayout(layout);
72+
73+
Label descriptorsLabel = new Label(container, SWT.NONE);
74+
descriptorsLabel.setText(Messages.SelectDebugConfigDialog_LableText);
75+
76+
GridData comboLayoutData = new GridData();
77+
comboLayoutData.grabExcessHorizontalSpace = true;
78+
comboLayoutData.horizontalAlignment = GridData.FILL;
79+
comboLayoutData.horizontalSpan = 1;
80+
81+
descriptorsCombo = new Combo(container, SWT.READ_ONLY);
82+
descriptorsCombo.setItems(suitableConfiguratios.toArray(new String[0]));
83+
descriptorsCombo.select(0);
84+
descriptorsCombo.setLayoutData(comboLayoutData);
85+
return super.createDialogArea(parent);
86+
}
87+
88+
@Override
89+
protected void okPressed()
90+
{
91+
ILaunchBarManager launchBarManager = UIPlugin.getService(ILaunchBarManager.class);
92+
try
93+
{
94+
ILaunchDescriptor[] descriptors = launchBarManager.getLaunchDescriptors();
95+
Optional<ILaunchDescriptor> optDisc = Stream.of(descriptors)
96+
.filter(disc -> disc.getName().contentEquals(descriptorsCombo.getText())).findFirst();
97+
if (optDisc.isPresent())
98+
{
99+
launchBarManager.setActiveLaunchDescriptor(optDisc.get());
100+
}
101+
102+
}
103+
catch (CoreException e)
104+
{
105+
Logger.log(e);
106+
}
107+
108+
super.okPressed();
109+
}
110+
111+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*******************************************************************************
2+
* Copyright 2024-2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
3+
* Use is subject to license terms.
4+
*******************************************************************************/
5+
package com.espressif.idf.ui.dialogs;
6+
7+
import java.util.List;
8+
import java.util.Optional;
9+
import java.util.stream.Stream;
10+
11+
import org.eclipse.core.runtime.CoreException;
12+
import org.eclipse.jface.dialogs.IDialogConstants;
13+
import org.eclipse.jface.dialogs.IMessageProvider;
14+
import org.eclipse.jface.dialogs.TitleAreaDialog;
15+
import org.eclipse.launchbar.core.ILaunchBarManager;
16+
import org.eclipse.launchbar.core.ILaunchDescriptor;
17+
import org.eclipse.swt.SWT;
18+
import org.eclipse.swt.layout.GridData;
19+
import org.eclipse.swt.layout.GridLayout;
20+
import org.eclipse.swt.widgets.Combo;
21+
import org.eclipse.swt.widgets.Composite;
22+
import org.eclipse.swt.widgets.Control;
23+
import org.eclipse.swt.widgets.Label;
24+
import org.eclipse.swt.widgets.Shell;
25+
26+
import com.espressif.idf.core.logging.Logger;
27+
import com.espressif.idf.ui.UIPlugin;
28+
29+
public class SelectLaunchConfigDialog extends TitleAreaDialog
30+
{
31+
private Combo descriptorsCombo;
32+
private final List<String> suitableConfiguratios;
33+
34+
public SelectLaunchConfigDialog(Shell parentShell, List<String> suitableConfiguratios)
35+
{
36+
super(parentShell);
37+
this.suitableConfiguratios = suitableConfiguratios;
38+
}
39+
40+
@Override
41+
protected void configureShell(Shell newShell)
42+
{
43+
super.configureShell(newShell);
44+
newShell.setText(Messages.SelectLaunchConfigDialog_Title);
45+
}
46+
47+
@Override
48+
public void create()
49+
{
50+
super.create();
51+
setTitle(Messages.SelectLaunchConfigDialog_Title);
52+
setMessage(Messages.SelectLaunchConfigDialog_Text, IMessageProvider.INFORMATION);
53+
}
54+
55+
@Override
56+
protected void createButtonsForButtonBar(Composite parent)
57+
{
58+
// create OK and Cancel buttons by default
59+
createButton(parent, IDialogConstants.OK_ID, "Launch", true); //$NON-NLS-1$
60+
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
61+
}
62+
63+
@Override
64+
protected Control createDialogArea(Composite parent)
65+
{
66+
Composite area = (Composite) super.createDialogArea(parent);
67+
Composite container = new Composite(area, SWT.NONE);
68+
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
69+
GridLayout layout = new GridLayout(2, false);
70+
container.setLayout(layout);
71+
72+
Label descriptorsLabel = new Label(container, SWT.NONE);
73+
descriptorsLabel.setText(Messages.SelectLaunchConfigDialog_LableText);
74+
75+
GridData comboLayoutData = new GridData();
76+
comboLayoutData.grabExcessHorizontalSpace = true;
77+
comboLayoutData.horizontalAlignment = GridData.FILL;
78+
comboLayoutData.horizontalSpan = 1;
79+
80+
descriptorsCombo = new Combo(container, SWT.READ_ONLY);
81+
descriptorsCombo.setItems(suitableConfiguratios.toArray(new String[0]));
82+
descriptorsCombo.select(0);
83+
descriptorsCombo.setLayoutData(comboLayoutData);
84+
return super.createDialogArea(parent);
85+
}
86+
87+
@Override
88+
protected void okPressed()
89+
{
90+
ILaunchBarManager launchBarManager = UIPlugin.getService(ILaunchBarManager.class);
91+
try
92+
{
93+
ILaunchDescriptor[] descriptors = launchBarManager.getLaunchDescriptors();
94+
Optional<ILaunchDescriptor> optDisc = Stream.of(descriptors)
95+
.filter(disc -> disc.getName().contentEquals(descriptorsCombo.getText())).findFirst();
96+
if (optDisc.isPresent())
97+
{
98+
launchBarManager.setActiveLaunchDescriptor(optDisc.get());
99+
}
100+
101+
}
102+
catch (CoreException e)
103+
{
104+
Logger.log(e);
105+
}
106+
107+
super.okPressed();
108+
}
109+
110+
}

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/messages.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ DeleteResourcesWizard_project_deleteConfigurations=Delete all related configurat
2121
HintDetailsTitle=Hint Details
2222
FilterMessage=type filter text
2323
HintsYmlNotFoundErrMsg={0} is missing. Hints are only supported from esp-idf v5.0 and higher
24+
SelectDebugConfigDialog_LableText=Suitable Debug Configurations:
25+
SelectDebugConfigDialog_Text=To debug a project, the Debug Configuration should be selected. Select a Debug Configuration and click "Debug"
26+
SelectDebugConfigDialog_Title=Select Debug Configuration
27+
SelectLaunchConfigDialog_LableText=Suitable Launch Configurations:
28+
SelectLaunchConfigDialog_Text=To launch a project, the Launch Configuration should be selected. Select a Launch Configuration and click "Launch"
29+
SelectLaunchConfigDialog_Title=Select Launch Configuration
2430
WriteFlashDialog_Bin_Path_Lbl=Bin Path:
2531
WriteFlashDialog_BinFileErrFormatErrMsg=%s bin file doens't exist
2632
WriteFlashDialog_Browse_Btn=Browse

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/Messages.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public class Messages extends NLS
2020
public static String UpdateEspIdfCommand_JobMsg;
2121
public static String UpdateEspIdfCommand_InstallToolsJobMsg;
2222
public static String UpdateEspIdfCommand_SuggestToOpenInstallToolsWizard;
23+
public static String MissingDebugConfigurationTitle;
24+
public static String DebugConfigurationNotFoundMsg;
25+
26+
public static String RunActionHandler_NoProjectQuestionText;
27+
public static String RunActionHandler_NoProjectQuestionTitle;
2328

2429
static
2530
{

0 commit comments

Comments
 (0)