Skip to content
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

1658: Improve null safety and refactor UI interaction handling. #2500

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
- "Copy Path/Reference" does not show the preview value [#2497](https://github.com/magento/magento2-phpstorm-plugin/pull/2497)
- Must not start write action from within read action in the other thread [#2498](https://github.com/magento/magento2-phpstorm-plugin/pull/2498)
- URN map generation during indexing [#2499](https://github.com/magento/magento2-phpstorm-plugin/pull/2499)
- Cannot invoke "com.intellij.psi.PsiDirectory.getName() [#2500](https://github.com/magento/magento2-phpstorm-plugin/pull/2500)

## 2025.0.0

Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@
import com.magento.idea.magento2plugin.util.magento.GetComponentNameByDirectoryUtil;
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
import java.util.List;
import java.util.Objects;

public class OverrideTemplateInThemeGenerator extends OverrideInThemeGenerator {

/**
* OverrideTemplateInThemeGenerator constructor.
*
@@ -41,10 +41,13 @@ public void execute(final PsiFile baseFile, final String themeName) {

final GetMagentoModuleUtil.MagentoModuleData moduleData =
GetMagentoModuleUtil.getByContext(baseFile.getContainingDirectory(), project);
List<String> pathComponents;
List<String> pathComponents; //NOPMD

if (moduleData == null) {
if (baseFile.getVirtualFile().getExtension().equals(OverridableFileType.JS.getType())) {
if (Objects.equals(
baseFile.getVirtualFile().getExtension(),
OverridableFileType.JS.getType())
) {
pathComponents = getLibPathComponets(baseFile);
} else {
return;
@@ -75,12 +78,21 @@ public void execute(final PsiFile baseFile, final String themeName) {
directory = getTargetDirectory(directory, pathComponents);

if (directory.findFile(baseFile.getName()) != null) {
JBPopupFactory.getInstance()
.createMessage(
validatorBundle.message("validator.file.alreadyExists", baseFile.getName())
)
.showCenteredInCurrentWindow(project);
directory.findFile(baseFile.getName()).navigate(true);
final PsiDirectory finalDirectory1 = directory;
ApplicationManager.getApplication().invokeLater(() -> {
JBPopupFactory.getInstance()
.createMessage(
validatorBundle.message(
"validator.file.alreadyExists",
baseFile.getName()
)
).showCenteredInCurrentWindow(project);
ApplicationManager.getApplication().invokeLater(() -> {
Objects.requireNonNull(
finalDirectory1.findFile(baseFile.getName())
).navigate(true);
});
});
return;
}