mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: check read-only status
This commit is contained in:
+2
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -62,6 +63,7 @@ public class UnwrapTagFix implements LocalQuickFix {
|
||||
final XmlTag parentTag = xmlTag.getParentTag();
|
||||
final PsiElement[] children = PsiTreeUtil.getChildrenOfType(xmlTag, XmlTagChild.class);
|
||||
if (children != null) {
|
||||
if (!CodeInsightUtilBase.preparePsiElementsForWrite(element)) return;
|
||||
if (children.length > 0) {
|
||||
parentTag.addRange(children[0], children[children.length - 1]);
|
||||
}
|
||||
|
||||
+2
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.javaFX.fxml.codeInsight.intentions;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -52,6 +53,7 @@ public class JavaFxWrapWithDefineIntention extends PsiElementBaseIntentionAction
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
|
||||
if (!CodeInsightUtilBase.preparePsiElementsForWrite(element)) return;
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(project).createTagFromText("<" + FxmlConstants.FX_DEFINE + "/>");
|
||||
tagFromText.addSubTag(myTag, true);
|
||||
myTag.replace(tagFromText);
|
||||
|
||||
Reference in New Issue
Block a user