Skip to content

Commit

Permalink
Fix failed cast to TypeDeclaration in file paste event
Browse files Browse the repository at this point in the history
  • Loading branch information
hopehadfield authored and rgrunber committed Aug 13, 2024
1 parent 0375248 commit 949a9a2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public static String handleFilePasteEvent(String path, String content, IProgress
}

String possibleFileName = "Untitled";
if (!root.types().isEmpty()) {
if (!root.types().isEmpty() && root.types().get(0) instanceof TypeDeclaration) {
possibleFileName = ((TypeDeclaration) root.types().get(0)).getName().getIdentifier();
}
if (Files.exists(Paths.get(desiredPath, possibleFileName + ".java"))) {
Expand Down

0 comments on commit 949a9a2

Please sign in to comment.