javafx: check read-only status

This commit is contained in:
anna
2013-04-08 13:15:06 +02:00
parent 1c0bfa3b1d
commit e21422c4c4
2 changed files with 4 additions and 0 deletions
@@ -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]);
}
@@ -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);