Skip to content

Commit

Permalink
#1294: WebRoot folder is now validated
Browse files Browse the repository at this point in the history
  • Loading branch information
Si-So authored and vrubezhny committed Aug 15, 2023
1 parent 780bfb6 commit 4dbd75b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,31 @@ private void validateProgramPathAndURL() {
urlDecoration.setDescriptionText(errorMessage);
urlDecoration.show();
}
boolean showWebRootDecoration = false;
if(webRootText.getText().isBlank()) {
errorMessage = Messages.AbstractRunHTMLDebugTab_cannot_debug_without_webroot;
showWebRootDecoration = true;
} else {
try {
File file = new File(VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(webRootText.getText()));
if (!file.exists()) {
errorMessage = Messages.AbstractRunHTMLDebugTab_cannot_access_webroot_folder;
showWebRootDecoration = true;
} else if (!file.isDirectory()) {
errorMessage = Messages.AbstractRunHTMLDebugTab_webroot_folder_is_not_a_directory;
showWebRootDecoration = true;
}
} catch (CoreException e) {
errorMessage = e.getMessage();
showWebRootDecoration = true;
}
}

if (showWebRootDecoration) {
webRootDecoration.setDescriptionText(errorMessage);
webRootDecoration.show();
}

if (errorMessage != null) {
setErrorMessage(errorMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class Messages extends NLS {
public static String AbstractRunHTMLDebugTab_browse_workspace;
public static String AbstractRunHTMLDebugTab_select_webroot;
public static String AbstractRunHTMLDebugTab_cannot_debug_without_webroot;
public static String AbstractRunHTMLDebugTab_cannot_access_webroot_folder;
public static String AbstractRunHTMLDebugTab_webroot_folder_is_not_a_directory;
public static String AttachTab_address;
public static String AttachTab_port;
public static String AttachTab_title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ AbstractRunHTMLDebugTab_webRoot_folder=WebRoot Folder
AbstractRunHTMLDebugTab_browse_workspace=\ud83d\udcc2 Browse workspace...
AbstractRunHTMLDebugTab_select_webroot=Select the root folder of your web application
AbstractRunHTMLDebugTab_cannot_debug_without_webroot=Without specifying the webRoot folder, no breakpoints will be triggered.
AbstractRunHTMLDebugTab_cannot_access_webroot_folder=Cannot open webRoot folder.
AbstractRunHTMLDebugTab_webroot_folder_is_not_a_directory=WebRoot folder must be a directory.
AttachTab_address=Address:
AttachTab_port=Port:
AttachTab_title=\ud83d\udd17 Attach
Expand Down

0 comments on commit 4dbd75b

Please sign in to comment.