diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java index e0adc5ec9d61..ca6131138d6a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java @@ -27,9 +27,9 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; -import com.intellij.psi.javadoc.PsiDocToken; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.tree.TokenSet; +import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlEntityDecl; import com.intellij.psi.xml.XmlFile; import com.intellij.util.IncorrectOperationException; @@ -44,7 +44,6 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; - public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.ConvertToBasicLatinAction"); @@ -156,13 +155,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { @Override public PsiElement findApplicable(final PsiElement element) { - if (element instanceof PsiDocComment) return element; - if (element instanceof PsiDocToken) return element.getParent(); - if (element instanceof PsiWhiteSpace) { - final PsiElement parent = element.getParent(); - if (parent instanceof PsiDocComment) return parent; - } - return null; + return PsiTreeUtil.getParentOfType(element, PsiDocComment.class, false); } @Override diff --git a/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag.java b/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag.java new file mode 100644 index 000000000000..11f4e2e59e38 --- /dev/null +++ b/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class C { + /** + * Some method. + * + * @param value some (©) param. + */ + abstract void m(int value); +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag_after.java b/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag_after.java new file mode 100644 index 000000000000..28606ca1d7b2 --- /dev/null +++ b/java/java-tests/testData/codeInsight/convertToBasicLatin/DocTag_after.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class C { + /** + * Some method. + * + * @param value some (©) param. + */ + abstract void m(int value); +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java index a1b0d3498340..0e696c65493e 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.codeInsight.intention; import com.intellij.JavaTestUtil; @@ -22,7 +21,6 @@ import com.intellij.openapi.vfs.encoding.EncodingManager; import com.intellij.testFramework.fixtures.CodeInsightTestUtil; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; - public class ConvertToBasicLatinTest extends JavaCodeInsightFixtureTestCase { private String myIntention; @@ -33,24 +31,19 @@ public class ConvertToBasicLatinTest extends JavaCodeInsightFixtureTestCase { EncodingManager.getInstance().setDefaultCharsetName("UTF-8"); } - public void testConvertCharLiteral() throws Exception { - CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "CharLiteral.java", "CharLiteral_after.java"); - } - - public void testConvertStringLiteral() throws Exception { - CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "StringLiteral.java", "StringLiteral_after.java"); - } - - public void testConvertPlainComment() throws Exception { - CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "PlainComment.java", "PlainComment_after.java"); - } - - public void testConvertDocComment() throws Exception { - CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "DocComment.java", "DocComment_after.java"); - } - @Override protected String getTestDataPath() { return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/convertToBasicLatin/"; } + + public void testCharLiteral() { doTest(); } + public void testStringLiteral() { doTest(); } + public void testPlainComment() { doTest(); } + public void testDocComment() { doTest(); } + public void testDocTag() { doTest(); } + + private void doTest() { + final String name = getTestName(false); + CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, name + ".java", name + "_after.java"); + } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetHistoryService.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetHistoryService.java index c5d93927585a..499588347494 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetHistoryService.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetHistoryService.java @@ -73,7 +73,7 @@ public class MvcRunTargetHistoryService implements PersistentStateComponent