Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions bundles/com.espressif.idf.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,21 @@
</iterate>
</with>
</activeWhen>
</handler>
<handler
class="com.espressif.idf.ui.handlers.RunActionHandler"
commandId="org.eclipse.launchbar.ui.command.launchActive">
<activeWhen>
<with
variable="activeContexts">
<iterate
operator="or">
<equals
value="com.espressif.idf.ui.espLaunchScope">
</equals>
</iterate>
</with>
</activeWhen>
</handler>
</extension>
<extension point="org.eclipse.ui.preferencePages">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void setIgnoreTargetChange(boolean status)
@Override
public void activeLaunchTargetChanged(ILaunchTarget target)
{
Display.getDefault().asyncExec(() -> {
Display.getDefault().syncExec(() -> {
if (target != null)
{
String targetName = target.getAttribute("com.espressif.idf.launch.serial.core.idfTarget", //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class Messages extends NLS
public static String HintDetailsTitle;
public static String FilterMessage;
public static String HintsYmlNotFoundErrMsg;
public static String SelectDebugConfigDialog_LableText;
public static String SelectDebugConfigDialog_Text;
public static String SelectDebugConfigDialog_Title;
public static String SelectLaunchConfigDialog_LableText;
public static String SelectLaunchConfigDialog_Text;
public static String SelectLaunchConfigDialog_Title;
public static String WriteFlashDialog_Bin_Path_Lbl;
public static String WriteFlashDialog_BinFileErrFormatErrMsg;
public static String WriteFlashDialog_Browse_Btn;
Expand Down
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();
}

}
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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ DeleteResourcesWizard_project_deleteConfigurations=Delete all related configurat
HintDetailsTitle=Hint Details
FilterMessage=type filter text
HintsYmlNotFoundErrMsg={0} is missing. Hints are only supported from esp-idf v5.0 and higher
SelectDebugConfigDialog_LableText=Suitable Debug Configurations:
SelectDebugConfigDialog_Text=To debug a project, the Debug Configuration should be selected. Select a Debug Configuration and click "Debug"
SelectDebugConfigDialog_Title=Select Debug Configuration
SelectLaunchConfigDialog_LableText=Suitable Launch Configurations:
SelectLaunchConfigDialog_Text=To launch a project, the Launch Configuration should be selected. Select a Launch Configuration and click "Launch"
SelectLaunchConfigDialog_Title=Select Launch Configuration
WriteFlashDialog_Bin_Path_Lbl=Bin Path:
WriteFlashDialog_BinFileErrFormatErrMsg=%s bin file doens't exist
WriteFlashDialog_Browse_Btn=Browse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class Messages extends NLS
public static String UpdateEspIdfCommand_JobMsg;
public static String UpdateEspIdfCommand_InstallToolsJobMsg;
public static String UpdateEspIdfCommand_SuggestToOpenInstallToolsWizard;
public static String MissingDebugConfigurationTitle;
public static String DebugConfigurationNotFoundMsg;

public static String RunActionHandler_NoProjectQuestionText;
public static String RunActionHandler_NoProjectQuestionTitle;

static
{
Expand Down
Loading