-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improving UX during run/debug (#900)
* fix: improving UX during run/debug * fix: changing dialog messages --------- Co-authored-by: Kondal Kolipaka <[email protected]>
- Loading branch information
1 parent
21c0573
commit 376b484
Showing
9 changed files
with
428 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SelectDebugConfigDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/******************************************************************************* | ||
* Copyright 2024-2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.ui.dialogs; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.jface.dialogs.IDialogConstants; | ||
import org.eclipse.jface.dialogs.IMessageProvider; | ||
import org.eclipse.jface.dialogs.TitleAreaDialog; | ||
import org.eclipse.launchbar.core.ILaunchBarManager; | ||
import org.eclipse.launchbar.core.ILaunchDescriptor; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.GridData; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Combo; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.eclipse.swt.widgets.Label; | ||
import org.eclipse.swt.widgets.Shell; | ||
|
||
import com.espressif.idf.core.logging.Logger; | ||
import com.espressif.idf.ui.UIPlugin; | ||
|
||
public class SelectDebugConfigDialog extends TitleAreaDialog | ||
{ | ||
|
||
private Combo descriptorsCombo; | ||
private final List<String> suitableConfiguratios; | ||
|
||
public SelectDebugConfigDialog(Shell parentShell, List<String> suitableConfiguratios) | ||
{ | ||
super(parentShell); | ||
this.suitableConfiguratios = suitableConfiguratios; | ||
Check warning on line 38 in bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SelectDebugConfigDialog.java GitHub Actions / spotbugsEI_EXPOSE_REP2
Raw output
|
||
} | ||
|
||
@Override | ||
public void create() | ||
{ | ||
super.create(); | ||
setTitle(Messages.SelectDebugConfigDialog_Title); | ||
setMessage(Messages.SelectDebugConfigDialog_Text, IMessageProvider.INFORMATION); | ||
} | ||
|
||
@Override | ||
protected void configureShell(Shell newShell) | ||
{ | ||
super.configureShell(newShell); | ||
newShell.setText(Messages.SelectDebugConfigDialog_Title); | ||
} | ||
|
||
@Override | ||
protected void createButtonsForButtonBar(Composite parent) | ||
{ | ||
// create OK and Cancel buttons by default | ||
createButton(parent, IDialogConstants.OK_ID, "Debug", true); //$NON-NLS-1$ | ||
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); | ||
} | ||
|
||
@Override | ||
protected Control createDialogArea(Composite parent) | ||
{ | ||
Composite area = (Composite) super.createDialogArea(parent); | ||
Composite container = new Composite(area, SWT.NONE); | ||
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | ||
GridLayout layout = new GridLayout(2, false); | ||
container.setLayout(layout); | ||
|
||
Label descriptorsLabel = new Label(container, SWT.NONE); | ||
descriptorsLabel.setText(Messages.SelectDebugConfigDialog_LableText); | ||
|
||
GridData comboLayoutData = new GridData(); | ||
comboLayoutData.grabExcessHorizontalSpace = true; | ||
comboLayoutData.horizontalAlignment = GridData.FILL; | ||
comboLayoutData.horizontalSpan = 1; | ||
|
||
descriptorsCombo = new Combo(container, SWT.READ_ONLY); | ||
descriptorsCombo.setItems(suitableConfiguratios.toArray(new String[0])); | ||
descriptorsCombo.select(0); | ||
descriptorsCombo.setLayoutData(comboLayoutData); | ||
return super.createDialogArea(parent); | ||
} | ||
|
||
@Override | ||
protected void okPressed() | ||
{ | ||
ILaunchBarManager launchBarManager = UIPlugin.getService(ILaunchBarManager.class); | ||
try | ||
{ | ||
ILaunchDescriptor[] descriptors = launchBarManager.getLaunchDescriptors(); | ||
Optional<ILaunchDescriptor> optDisc = Stream.of(descriptors) | ||
.filter(disc -> disc.getName().contentEquals(descriptorsCombo.getText())).findFirst(); | ||
if (optDisc.isPresent()) | ||
{ | ||
launchBarManager.setActiveLaunchDescriptor(optDisc.get()); | ||
} | ||
|
||
} | ||
catch (CoreException e) | ||
{ | ||
Logger.log(e); | ||
} | ||
|
||
super.okPressed(); | ||
} | ||
|
||
} |
110 changes: 110 additions & 0 deletions
110
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SelectLaunchConfigDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/******************************************************************************* | ||
* Copyright 2024-2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.ui.dialogs; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.jface.dialogs.IDialogConstants; | ||
import org.eclipse.jface.dialogs.IMessageProvider; | ||
import org.eclipse.jface.dialogs.TitleAreaDialog; | ||
import org.eclipse.launchbar.core.ILaunchBarManager; | ||
import org.eclipse.launchbar.core.ILaunchDescriptor; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.GridData; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Combo; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.eclipse.swt.widgets.Label; | ||
import org.eclipse.swt.widgets.Shell; | ||
|
||
import com.espressif.idf.core.logging.Logger; | ||
import com.espressif.idf.ui.UIPlugin; | ||
|
||
public class SelectLaunchConfigDialog extends TitleAreaDialog | ||
{ | ||
private Combo descriptorsCombo; | ||
private final List<String> suitableConfiguratios; | ||
|
||
public SelectLaunchConfigDialog(Shell parentShell, List<String> suitableConfiguratios) | ||
{ | ||
super(parentShell); | ||
this.suitableConfiguratios = suitableConfiguratios; | ||
Check warning on line 37 in bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SelectLaunchConfigDialog.java GitHub Actions / spotbugsEI_EXPOSE_REP2
Raw output
|
||
} | ||
|
||
@Override | ||
protected void configureShell(Shell newShell) | ||
{ | ||
super.configureShell(newShell); | ||
newShell.setText(Messages.SelectLaunchConfigDialog_Title); | ||
} | ||
|
||
@Override | ||
public void create() | ||
{ | ||
super.create(); | ||
setTitle(Messages.SelectLaunchConfigDialog_Title); | ||
setMessage(Messages.SelectLaunchConfigDialog_Text, IMessageProvider.INFORMATION); | ||
} | ||
|
||
@Override | ||
protected void createButtonsForButtonBar(Composite parent) | ||
{ | ||
// create OK and Cancel buttons by default | ||
createButton(parent, IDialogConstants.OK_ID, "Launch", true); //$NON-NLS-1$ | ||
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); | ||
} | ||
|
||
@Override | ||
protected Control createDialogArea(Composite parent) | ||
{ | ||
Composite area = (Composite) super.createDialogArea(parent); | ||
Composite container = new Composite(area, SWT.NONE); | ||
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | ||
GridLayout layout = new GridLayout(2, false); | ||
container.setLayout(layout); | ||
|
||
Label descriptorsLabel = new Label(container, SWT.NONE); | ||
descriptorsLabel.setText(Messages.SelectLaunchConfigDialog_LableText); | ||
|
||
GridData comboLayoutData = new GridData(); | ||
comboLayoutData.grabExcessHorizontalSpace = true; | ||
comboLayoutData.horizontalAlignment = GridData.FILL; | ||
comboLayoutData.horizontalSpan = 1; | ||
|
||
descriptorsCombo = new Combo(container, SWT.READ_ONLY); | ||
descriptorsCombo.setItems(suitableConfiguratios.toArray(new String[0])); | ||
descriptorsCombo.select(0); | ||
descriptorsCombo.setLayoutData(comboLayoutData); | ||
return super.createDialogArea(parent); | ||
} | ||
|
||
@Override | ||
protected void okPressed() | ||
{ | ||
ILaunchBarManager launchBarManager = UIPlugin.getService(ILaunchBarManager.class); | ||
try | ||
{ | ||
ILaunchDescriptor[] descriptors = launchBarManager.getLaunchDescriptors(); | ||
Optional<ILaunchDescriptor> optDisc = Stream.of(descriptors) | ||
.filter(disc -> disc.getName().contentEquals(descriptorsCombo.getText())).findFirst(); | ||
if (optDisc.isPresent()) | ||
{ | ||
launchBarManager.setActiveLaunchDescriptor(optDisc.get()); | ||
} | ||
|
||
} | ||
catch (CoreException e) | ||
{ | ||
Logger.log(e); | ||
} | ||
|
||
super.okPressed(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.