Skip to content

Commit

Permalink
#1294: Fixed three bugs in "Chrome Debug":
Browse files Browse the repository at this point in the history
1. It is now impossible to select both radio buttons at the same time
2. The debug dialog no longer deletes user input when reverting
3. The debug dialog no longer deletes user input when re-opening

See: #1306 (comment)
  • Loading branch information
Si-So authored and vrubezhny committed Aug 15, 2023
1 parent 9775dd8 commit 780bfb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
public class AbstractHTMLDebugDelegate extends DSPLaunchDelegate {
public static final String ARGUMENTS = "runtimeArgs"; //$NON-NLS-1$
public static final String WEBROOT = "webRoot";
public static final String FILE_RADIO_BUTTON_SELECTED = "fileRadioButtonSelected";

public void launchWithParameters(ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor, Map<String, Object> param, File debugAdapter) throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,22 +303,29 @@ public void initializeFrom(ILaunchConfiguration configuration) {
configuration.getAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, pathOrEmpty(getSelectedProject())));
this.urlText.setText(configuration.getAttribute(ChromeRunDAPDebugDelegate.URL, "")); //$NON-NLS-1$
this.webRootText.setText(configuration.getAttribute(AbstractHTMLDebugDelegate.WEBROOT, ""));
if (urlText.getText().isEmpty()) {
boolean fileRadioButtonSelected = configuration.getAttribute(AbstractHTMLDebugDelegate.FILE_RADIO_BUTTON_SELECTED, true);
if (fileRadioButtonSelected) {
fileRadio.setSelection(true);
urlRadio.setSelection(false);
programPathText.setEnabled(true);
filePath.setEnabled(true);
urlText.setEnabled(false);
webRootText.setEnabled(false);
webRootProjectSelectButton.setEnabled(false);
webRootFilesystemSelectButton.setEnabled(false);
} else {
fileRadio.setSelection(false);
urlRadio.setSelection(true);
programPathText.setEnabled(false);
filePath.setEnabled(false);
urlText.setEnabled(true);
webRootText.setEnabled(true);
webRootProjectSelectButton.setEnabled(true);
webRootFilesystemSelectButton.setEnabled(true);
urlRadio.setSelection(true);
fileDecoration.hide();
}

validateProgramPathAndURL();

} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
Expand All @@ -327,14 +334,10 @@ public void initializeFrom(ILaunchConfiguration configuration) {
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
String programPath = this.programPathText.getText();
if (programPathText.isEnabled()) {
configuration.setAttribute(LaunchConstants.PROGRAM, programPath);
configuration.setAttribute(ChromeRunDAPDebugDelegate.URL, "");
} else if (urlText.isEnabled()) {
configuration.setAttribute(ChromeRunDAPDebugDelegate.URL, urlText.getText());
configuration.setAttribute(LaunchConstants.PROGRAM, "");
configuration.setAttribute(AbstractHTMLDebugDelegate.WEBROOT, this.webRootText.getText());
}
configuration.setAttribute(LaunchConstants.PROGRAM, programPath);
configuration.setAttribute(ChromeRunDAPDebugDelegate.URL, urlText.getText());
configuration.setAttribute(AbstractHTMLDebugDelegate.WEBROOT, this.webRootText.getText());
configuration.setAttribute(AbstractHTMLDebugDelegate.FILE_RADIO_BUTTON_SELECTED, fileRadio.getSelection());

configuration.setAttribute(AbstractHTMLDebugDelegate.ARGUMENTS, this.argumentsText.getText());
String workingDirectory = this.workingDirectoryText.getText();
Expand Down

0 comments on commit 780bfb6

Please sign in to comment.