Maven: rename handlers

This commit is contained in:
Anton.Makeev
2009-12-03 19:31:50 +03:00
parent 72c1513317
commit cdeafa405b
3 changed files with 4 additions and 5 deletions
@@ -55,8 +55,6 @@ public class MavenPropertyRenameHandler extends PsiElementRenameHandler {
}
private PsiElement findTarget(DataContext context) {
PsiElement target = MavenTargetUtil.getRefactorTarget(PlatformDataKeys.EDITOR.getData(context),
LangDataKeys.PSI_FILE.getData(context));
return isVetoed(target) ? null : target;
return MavenTargetUtil.getRefactorTarget(PlatformDataKeys.EDITOR.getData(context), LangDataKeys.PSI_FILE.getData(context));
}
}
@@ -18,9 +18,10 @@ package org.jetbrains.idea.maven.dom.refactorings;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiElement;
import org.jetbrains.idea.maven.dom.MavenDomUtil;
import org.jetbrains.idea.maven.dom.references.MavenPsiElementWrapper;
public class MavenVetoModelRenameCondition implements Condition<PsiElement> {
public boolean value(PsiElement target) {
return MavenDomUtil.isMavenFile(target) && !MavenDomUtil.isMavenProperty(target);
return target instanceof MavenPsiElementWrapper || MavenDomUtil.isMavenFile(target);
}
}
@@ -28,7 +28,7 @@ import org.jetbrains.idea.maven.dom.MavenDomUtil;
public class MavenTargetUtil {
public static PsiElement getRefactorTarget(Editor editor, PsiFile file) {
PsiElement target = getFindTarget(editor, file);
return target == null || !MavenDomUtil.isMavenFile(target) ? null : target;
return target == null || !MavenDomUtil.isMavenProperty(target) ? null : target;
}
public static PsiElement getFindTarget(Editor editor, PsiFile file) {