-
Notifications
You must be signed in to change notification settings - Fork 133
feat: improving UX during run/debug #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+428
−2
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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; | ||
| } | ||
|
|
||
| @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(); | ||
| } | ||
|
|
||
| } | ||
sigmaaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
110 changes: 110 additions & 0 deletions
110
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SelectLaunchConfigDialog.java
This file contains hidden or 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; | ||
| } | ||
|
|
||
| @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(); | ||
| } | ||
|
|
||
| } | ||
sigmaaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.