Move intention-related classes and tests to "intentions" directory

This commit is contained in:
Alexey Sedunov
2013-06-13 18:56:54 +04:00
parent 57252ea491
commit 6f942a21de
275 changed files with 303 additions and 309 deletions
@@ -38,7 +38,7 @@ import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRenderer
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest;
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest;
import org.jetbrains.jet.modules.xml.AbstractModuleXmlParserTest; import org.jetbrains.jet.modules.xml.AbstractModuleXmlParserTest;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationTest; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationTest;
import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest; import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest;
import org.jetbrains.jet.plugin.folding.AbstractKotlinFoldingTest; import org.jetbrains.jet.plugin.folding.AbstractKotlinFoldingTest;
import org.jetbrains.jet.plugin.hierarchy.AbstractHierarchyTest; import org.jetbrains.jet.plugin.hierarchy.AbstractHierarchyTest;
@@ -330,25 +330,25 @@ public class GenerateTests {
"idea/tests/", "idea/tests/",
"CodeTransformationsTestGenerated", "CodeTransformationsTestGenerated",
AbstractCodeTransformationTest.class, AbstractCodeTransformationTest.class,
testModel("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment", "doTestFoldIfToAssignment"), testModel("idea/testData/intentions/branched/folding/ifToAssignment", "doTestFoldIfToAssignment"),
testModel("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn", "doTestFoldIfToReturn"), testModel("idea/testData/intentions/branched/folding/ifToReturn", "doTestFoldIfToReturn"),
testModel("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically", "doTestFoldIfToReturnAsymmetrically"), testModel("idea/testData/intentions/branched/folding/ifToReturnAsymmetrically", "doTestFoldIfToReturnAsymmetrically"),
testModel("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment", "doTestFoldWhenToAssignment"), testModel("idea/testData/intentions/branched/folding/whenToAssignment", "doTestFoldWhenToAssignment"),
testModel("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn", "doTestFoldWhenToReturn"), testModel("idea/testData/intentions/branched/folding/whenToReturn", "doTestFoldWhenToReturn"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf", "doTestUnfoldAssignmentToIf"), testModel("idea/testData/intentions/branched/unfolding/assignmentToIf", "doTestUnfoldAssignmentToIf"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen", "doTestUnfoldAssignmentToWhen"), testModel("idea/testData/intentions/branched/unfolding/assignmentToWhen", "doTestUnfoldAssignmentToWhen"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf", "doTestUnfoldPropertyToIf"), testModel("idea/testData/intentions/branched/unfolding/propertyToIf", "doTestUnfoldPropertyToIf"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen", "doTestUnfoldPropertyToWhen"), testModel("idea/testData/intentions/branched/unfolding/propertyToWhen", "doTestUnfoldPropertyToWhen"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf", "doTestUnfoldReturnToIf"), testModel("idea/testData/intentions/branched/unfolding/returnToIf", "doTestUnfoldReturnToIf"),
testModel("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen", "doTestUnfoldReturnToWhen"), testModel("idea/testData/intentions/branched/unfolding/returnToWhen", "doTestUnfoldReturnToWhen"),
testModel("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen", "doTestIfToWhen"), testModel("idea/testData/intentions/branched/ifWhen/ifToWhen", "doTestIfToWhen"),
testModel("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf", "doTestWhenToIf"), testModel("idea/testData/intentions/branched/ifWhen/whenToIf", "doTestWhenToIf"),
testModel("idea/testData/codeInsight/codeTransformations/branched/when/flatten", "doTestFlattenWhen"), testModel("idea/testData/intentions/branched/when/flatten", "doTestFlattenWhen"),
testModel("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject", "doTestIntroduceWhenSubject"), testModel("idea/testData/intentions/branched/when/introduceSubject", "doTestIntroduceWhenSubject"),
testModel("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject", "doTestEliminateWhenSubject"), testModel("idea/testData/intentions/branched/when/eliminateSubject", "doTestEliminateWhenSubject"),
testModel("idea/testData/codeInsight/codeTransformations/declarations/split", "doTestSplitProperty"), testModel("idea/testData/intentions/declarations/split", "doTestSplitProperty"),
testModel("idea/testData/codeInsight/codeTransformations/declarations/join", "doTestJoinProperty"), testModel("idea/testData/intentions/declarations/join", "doTestJoinProperty"),
testModel("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses", "doTestRemoveUnnecessaryParentheses") testModel("idea/testData/intentions/removeUnnecessaryParentheses", "doTestRemoveUnnecessaryParentheses")
); );
generateTest( generateTest(
+23 -23
View File
@@ -28,7 +28,7 @@
<implementation-class>org.jetbrains.jet.plugin.versions.OutdatedKotlinRuntimeNotification</implementation-class> <implementation-class>org.jetbrains.jet.plugin.versions.OutdatedKotlinRuntimeNotification</implementation-class>
</component> </component>
<component> <component>
<implementation-class>org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureInJavaMarkerUpdater</implementation-class> <implementation-class>org.jetbrains.jet.plugin.ktSignature.KotlinSignatureInJavaMarkerUpdater</implementation-class>
</component> </component>
</project-components> </project-components>
@@ -71,7 +71,7 @@
</action> </action>
<group id="EditorGutterKotlinPopupMenu"> <group id="EditorGutterKotlinPopupMenu">
<action id="ShowKotlinSignatures" class="org.jetbrains.jet.plugin.codeInsight.ktSignature.ShowKotlinSignaturesAction"/> <action id="ShowKotlinSignatures" class="org.jetbrains.jet.plugin.ktSignature.ShowKotlinSignaturesAction"/>
<add-to-group group-id="EditorGutterPopupMenu" anchor="last"/> <add-to-group group-id="EditorGutterPopupMenu" anchor="last"/>
</group> </group>
</actions> </actions>
@@ -211,7 +211,7 @@
<configurationProducer implementation="org.jetbrains.jet.plugin.run.JetJUnitConfigurationProducer"/> <configurationProducer implementation="org.jetbrains.jet.plugin.run.JetJUnitConfigurationProducer"/>
<codeInsight.lineMarkerProvider language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.JetLineMarkerProvider"/> <codeInsight.lineMarkerProvider language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.JetLineMarkerProvider"/>
<codeInsight.lineMarkerProvider language="JAVA" <codeInsight.lineMarkerProvider language="JAVA"
implementationClass="org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureInJavaMarkerProvider"/> implementationClass="org.jetbrains.jet.plugin.ktSignature.KotlinSignatureInJavaMarkerProvider"/>
<iconProvider implementation="org.jetbrains.jet.plugin.JetIconProvider"/> <iconProvider implementation="org.jetbrains.jet.plugin.JetIconProvider"/>
<itemPresentationProvider implementationClass="org.jetbrains.jet.plugin.presentation.JetFunctionPresenter" <itemPresentationProvider implementationClass="org.jetbrains.jet.plugin.presentation.JetFunctionPresenter"
forClass="org.jetbrains.jet.lang.psi.JetNamedFunction"/> forClass="org.jetbrains.jet.lang.psi.JetNamedFunction"/>
@@ -291,7 +291,7 @@
implementation="org.jetbrains.jet.plugin.codeInsight.upDownMover.JetDeclarationMover" implementation="org.jetbrains.jet.plugin.codeInsight.upDownMover.JetDeclarationMover"
order="before jetExpression" /> order="before jetExpression" />
<joinLinesHandler implementation="org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations.JetDeclarationJoinLinesHandler"/> <joinLinesHandler implementation="org.jetbrains.jet.plugin.intentions.declarations.JetDeclarationJoinLinesHandler"/>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction</className> <className>org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction</className>
@@ -299,97 +299,97 @@
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureAnnotationIntention</className> <className>org.jetbrains.jet.plugin.ktSignature.KotlinSignatureAnnotationIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToAssignmentIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToAssignmentIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnAsymmetricallyIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnAsymmetricallyIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToAssignmentIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToAssignmentIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToReturnIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToReturnIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToIfIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToIfIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldPropertyToIfIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldPropertyToIfIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToWhenIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToWhenIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldPropertyToWhenIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldPropertyToWhenIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToIfIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToIfIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToWhenIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToWhenIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.IfToWhenIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IfToWhenIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.WhenToIfIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.WhenToIfIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FlattenWhenIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FlattenWhenIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.IntroduceWhenSubjectIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IntroduceWhenSubjectIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.EliminateWhenSubjectIntention</className> <className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.EliminateWhenSubjectIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.RemoveUnnecessaryParenthesesIntention</className> <className>org.jetbrains.jet.plugin.intentions.RemoveUnnecessaryParenthesesIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
<intentionAction> <intentionAction>
<className>org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations.SplitPropertyDeclarationIntention</className> <className>org.jetbrains.jet.plugin.intentions.declarations.SplitPropertyDeclarationIntention</className>
<category>Kotlin</category> <category>Kotlin</category>
</intentionAction> </intentionAction>
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations; package org.jetbrains.jet.plugin.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.codeInsight.intention.impl.BaseIntentionAction; import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiUtil; import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.plugin.JetBundle; import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer;
public abstract class AbstractCodeTransformationIntention<T extends Transformer> extends BaseIntentionAction { public abstract class AbstractCodeTransformationIntention<T extends Transformer> extends BaseIntentionAction {
private final T transformer; private final T transformer;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations; package org.jetbrains.jet.plugin.intentions;
import com.intellij.codeInsight.intention.impl.BaseIntentionAction; import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations; package org.jetbrains.jet.plugin.intentions;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations.DeclarationUtils; import org.jetbrains.jet.plugin.intentions.declarations.DeclarationUtils;
public class BranchedUnfoldingUtils { public class BranchedUnfoldingUtils {
private BranchedUnfoldingUtils() { private BranchedUnfoldingUtils() {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetIfExpression; import org.jetbrains.jet.lang.psi.JetIfExpression;
import org.jetbrains.jet.lang.psi.JetWhenExpression; import org.jetbrains.jet.lang.psi.JetWhenExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public enum FoldableKind implements Transformer { public enum FoldableKind implements Transformer {
IF_TO_ASSIGNMENT("fold.if.to.assignment") { IF_TO_ASSIGNMENT("fold.if.to.assignment") {
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
@@ -23,7 +23,7 @@ import org.jetbrains.jet.lang.psi.JetBinaryExpression;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetProperty; import org.jetbrains.jet.lang.psi.JetProperty;
import org.jetbrains.jet.lang.psi.JetReturnExpression; import org.jetbrains.jet.lang.psi.JetReturnExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public enum UnfoldableKind implements Transformer { public enum UnfoldableKind implements Transformer {
ASSIGNMENT_TO_IF("unfold.assignment.to.if") { ASSIGNMENT_TO_IF("unfold.assignment.to.if") {
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations; package org.jetbrains.jet.plugin.intentions.branchedTransformations;
import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -7,9 +7,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetWhenExpression; import org.jetbrains.jet.lang.psi.JetWhenExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.WhenUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.WhenUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class EliminateWhenSubjectIntention extends AbstractCodeTransformationIntention<Transformer> { public class EliminateWhenSubjectIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -7,9 +7,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetWhenExpression; import org.jetbrains.jet.lang.psi.JetWhenExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.WhenUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.WhenUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class FlattenWhenIntention extends AbstractCodeTransformationIntention<Transformer> { public class FlattenWhenIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -14,16 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.BranchedFoldingUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.BranchedFoldingUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; import org.jetbrains.jet.plugin.intentions.branchedTransformations.FoldableKind;
public abstract class FoldBranchedExpressionIntention extends AbstractCodeTransformationIntention<FoldableKind> { public abstract class FoldBranchedExpressionIntention extends AbstractCodeTransformationIntention<FoldableKind> {
protected FoldBranchedExpressionIntention(@NotNull final FoldableKind foldableKind) { protected FoldBranchedExpressionIntention(@NotNull final FoldableKind foldableKind) {
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -7,9 +7,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetIfExpression; import org.jetbrains.jet.lang.psi.JetIfExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.IfWhenUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.IfWhenUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class IfToWhenIntention extends AbstractCodeTransformationIntention<Transformer> { public class IfToWhenIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -7,9 +7,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetWhenExpression; import org.jetbrains.jet.lang.psi.JetWhenExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.WhenUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.WhenUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class IntroduceWhenSubjectIntention extends AbstractCodeTransformationIntention<Transformer> { public class IntroduceWhenSubjectIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -14,15 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.*; import org.jetbrains.jet.plugin.intentions.branchedTransformations.*;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
public abstract class UnfoldBranchedExpressionIntention extends AbstractCodeTransformationIntention<UnfoldableKind> { public abstract class UnfoldBranchedExpressionIntention extends AbstractCodeTransformationIntention<UnfoldableKind> {
protected UnfoldBranchedExpressionIntention(@NotNull final UnfoldableKind unfoldableKind) { protected UnfoldBranchedExpressionIntention(@NotNull final UnfoldableKind unfoldableKind) {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; package org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -23,9 +23,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetWhenExpression; import org.jetbrains.jet.lang.psi.JetWhenExpression;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.IfWhenUtils; import org.jetbrains.jet.plugin.intentions.branchedTransformations.IfWhenUtils;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class WhenToIfIntention extends AbstractCodeTransformationIntention<Transformer> { public class WhenToIfIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations; package org.jetbrains.jet.plugin.intentions.declarations;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
@@ -1,4 +1,4 @@
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations; package org.jetbrains.jet.plugin.intentions.declarations;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.codeInsight.editorActions.JoinRawLinesHandlerDelegate; import com.intellij.codeInsight.editorActions.JoinRawLinesHandlerDelegate;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.codeTransformations.declarations; package org.jetbrains.jet.plugin.intentions.declarations;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetProperty; import org.jetbrains.jet.lang.psi.JetProperty;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTransformationIntention; import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationIntention;
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.Transformer; import org.jetbrains.jet.plugin.intentions.Transformer;
public class SplitPropertyDeclarationIntention extends AbstractCodeTransformationIntention<Transformer> { public class SplitPropertyDeclarationIntention extends AbstractCodeTransformationIntention<Transformer> {
private static final Transformer TRANSFORMER = new Transformer() { private static final Transformer TRANSFORMER = new Transformer() {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.ExternalAnnotationsManager; import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnAction;
@@ -26,15 +26,13 @@ import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiModifierListOwner; import com.intellij.psi.PsiModifierListOwner;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.*;
public class DeleteSignatureAction extends AnAction { public class DeleteSignatureAction extends AnAction {
private final PsiModifierListOwner annotationOwner; private final PsiModifierListOwner annotationOwner;
public DeleteSignatureAction(@NotNull PsiModifierListOwner elementInEditor) { public DeleteSignatureAction(@NotNull PsiModifierListOwner elementInEditor) {
super("Delete"); super("Delete");
this.annotationOwner = getAnnotationOwner(elementInEditor); this.annotationOwner = KotlinSignatureUtil.getAnnotationOwner(elementInEditor);
getTemplatePresentation().setVisible(isAnnotationEditable(elementInEditor)); getTemplatePresentation().setVisible(KotlinSignatureUtil.isAnnotationEditable(elementInEditor));
} }
@Override @Override
@@ -42,7 +40,7 @@ public class DeleteSignatureAction extends AnAction {
final Project project = e.getProject(); final Project project = e.getProject();
assert project != null; assert project != null;
final PsiAnnotation annotation = findKotlinSignatureAnnotation(annotationOwner); final PsiAnnotation annotation = KotlinSignatureUtil.findKotlinSignatureAnnotation(annotationOwner);
assert annotation != null; assert annotation != null;
if (annotation.getContainingFile() != annotationOwner.getContainingFile()) { if (annotation.getContainingFile() != annotationOwner.getContainingFile()) {
@@ -50,7 +48,7 @@ public class DeleteSignatureAction extends AnAction {
new WriteCommandAction(project) { new WriteCommandAction(project) {
@Override @Override
protected void run(Result result) throws Throwable { protected void run(Result result) throws Throwable {
ExternalAnnotationsManager.getInstance(project).deannotate(annotationOwner, KOTLIN_SIGNATURE_ANNOTATION); ExternalAnnotationsManager.getInstance(project).deannotate(annotationOwner, KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION);
} }
}.execute(); }.execute();
} }
@@ -64,6 +62,6 @@ public class DeleteSignatureAction extends AnAction {
} }
refreshMarkers(project); KotlinSignatureUtil.refreshMarkers(project);
} }
} }
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.navigation.NavigationUtil; import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnAction;
@@ -30,13 +30,11 @@ import org.jetbrains.annotations.Nullable;
import java.awt.*; import java.awt.*;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.*;
public class EditSignatureAction extends AnAction { public class EditSignatureAction extends AnAction {
private final PsiModifierListOwner elementInEditor; private final PsiModifierListOwner elementInEditor;
public EditSignatureAction(@NotNull PsiModifierListOwner elementInEditor) { public EditSignatureAction(@NotNull PsiModifierListOwner elementInEditor) {
super(isAnnotationEditable(elementInEditor) ? "Edit" : "View"); super(KotlinSignatureUtil.isAnnotationEditable(elementInEditor) ? "Edit" : "View");
this.elementInEditor = elementInEditor; this.elementInEditor = elementInEditor;
} }
@@ -52,7 +50,7 @@ public class EditSignatureAction extends AnAction {
} }
static void invokeEditSignature(@NotNull PsiElement elementInEditor, @NotNull Editor editor, @Nullable Point point) { static void invokeEditSignature(@NotNull PsiElement elementInEditor, @NotNull Editor editor, @Nullable Point point) {
PsiAnnotation annotation = findKotlinSignatureAnnotation(elementInEditor); PsiAnnotation annotation = KotlinSignatureUtil.findKotlinSignatureAnnotation(elementInEditor);
assert annotation != null; assert annotation != null;
if (annotation.getContainingFile() == elementInEditor.getContainingFile()) { if (annotation.getContainingFile() == elementInEditor.getContainingFile()) {
// not external, go to // not external, go to
@@ -75,9 +73,9 @@ public class EditSignatureAction extends AnAction {
} }
} }
else { else {
PsiModifierListOwner annotationOwner = getAnnotationOwner(elementInEditor); PsiModifierListOwner annotationOwner = KotlinSignatureUtil.getAnnotationOwner(elementInEditor);
boolean editable = isAnnotationEditable(elementInEditor); boolean editable = KotlinSignatureUtil.isAnnotationEditable(elementInEditor);
EditSignatureBalloon balloon = new EditSignatureBalloon(annotationOwner, getKotlinSignature(annotation), editable); EditSignatureBalloon balloon = new EditSignatureBalloon(annotationOwner, KotlinSignatureUtil.getKotlinSignature(annotation), editable);
balloon.show(point, editor, elementInEditor); balloon.show(point, editor, elementInEditor);
} }
} }
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.ExternalAnnotationsManager; import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
@@ -54,9 +54,6 @@ import java.awt.event.ActionListener;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.signatureToNameValuePairs;
class EditSignatureBalloon implements Disposable { class EditSignatureBalloon implements Disposable {
private final Editor editor; private final Editor editor;
private final PsiModifierListOwner annotatedElement; private final PsiModifierListOwner annotatedElement;
@@ -179,7 +176,8 @@ class EditSignatureBalloon implements Disposable {
@Override @Override
protected void run(Result result) throws Throwable { protected void run(Result result) throws Throwable {
ExternalAnnotationsManager.getInstance(project).editExternalAnnotation( ExternalAnnotationsManager.getInstance(project).editExternalAnnotation(
annotatedElement, KOTLIN_SIGNATURE_ANNOTATION, signatureToNameValuePairs(project, newSignature)); annotatedElement, KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION, KotlinSignatureUtil
.signatureToNameValuePairs(project, newSignature));
} }
}.execute(); }.execute();
} }
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.ExternalAnnotationsListener; import com.intellij.codeInsight.ExternalAnnotationsListener;
import com.intellij.codeInsight.ExternalAnnotationsManager; import com.intellij.codeInsight.ExternalAnnotationsManager;
@@ -47,8 +47,6 @@ import org.jetbrains.jet.renderer.DescriptorRendererBuilder;
import javax.swing.*; import javax.swing.*;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.*;
public class KotlinSignatureAnnotationIntention extends BaseIntentionAction implements Iconable { public class KotlinSignatureAnnotationIntention extends BaseIntentionAction implements Iconable {
private static final DescriptorRenderer RENDERER = new DescriptorRendererBuilder() private static final DescriptorRenderer RENDERER = new DescriptorRendererBuilder()
.setShortNames(true) .setShortNames(true)
@@ -80,8 +78,8 @@ public class KotlinSignatureAnnotationIntention extends BaseIntentionAction impl
if (!PsiUtil.isLanguageLevel5OrHigher(annotationOwner)) return false; if (!PsiUtil.isLanguageLevel5OrHigher(annotationOwner)) return false;
if (findKotlinSignatureAnnotation(annotationOwner) != null) { if (KotlinSignatureUtil.findKotlinSignatureAnnotation(annotationOwner) != null) {
if (isAnnotationEditable(annotationOwner)) { if (KotlinSignatureUtil.isAnnotationEditable(annotationOwner)) {
setText(JetBundle.message("edit.kotlin.signature.action.text")); setText(JetBundle.message("edit.kotlin.signature.action.text"));
} }
else { else {
@@ -100,7 +98,7 @@ public class KotlinSignatureAnnotationIntention extends BaseIntentionAction impl
assert annotatedElement != null; assert annotatedElement != null;
if (findKotlinSignatureAnnotation(annotatedElement) != null) { if (KotlinSignatureUtil.findKotlinSignatureAnnotation(annotatedElement) != null) {
EditSignatureAction.invokeEditSignature(annotatedElement, editor, null); EditSignatureAction.invokeEditSignature(annotatedElement, editor, null);
return; return;
} }
@@ -113,11 +111,11 @@ public class KotlinSignatureAnnotationIntention extends BaseIntentionAction impl
public void afterExternalAnnotationChanging(@NotNull PsiModifierListOwner owner, @NotNull String annotationFQName, boolean successful) { public void afterExternalAnnotationChanging(@NotNull PsiModifierListOwner owner, @NotNull String annotationFQName, boolean successful) {
busConnection.disconnect(); busConnection.disconnect();
if (successful && owner == annotatedElement && KOTLIN_SIGNATURE_ANNOTATION.equals(annotationFQName)) { if (successful && owner == annotatedElement && KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION.equals(annotationFQName)) {
ApplicationManager.getApplication().invokeLater(new Runnable() { ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
refreshMarkers(project); KotlinSignatureUtil.refreshMarkers(project);
EditSignatureAction.invokeEditSignature(annotatedElement, editor, null); EditSignatureAction.invokeEditSignature(annotatedElement, editor, null);
} }
}, ModalityState.NON_MODAL); }, ModalityState.NON_MODAL);
@@ -126,7 +124,8 @@ public class KotlinSignatureAnnotationIntention extends BaseIntentionAction impl
}); });
AddAnnotationFix addAnnotationFix = new AddAnnotationFix( AddAnnotationFix addAnnotationFix = new AddAnnotationFix(
KOTLIN_SIGNATURE_ANNOTATION, annotatedElement, signatureToNameValuePairs(annotatedElement.getProject(), signature)); KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION, annotatedElement, KotlinSignatureUtil
.signatureToNameValuePairs(annotatedElement.getProject(), signature));
addAnnotationFix.invoke(project, editor, file); addAnnotationFix.invoke(project, editor, file);
} }
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeHighlighting.Pass; import com.intellij.codeHighlighting.Pass;
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler; import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
@@ -53,8 +53,6 @@ import java.awt.event.MouseEvent;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.*;
public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider { public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
private static final String SHOW_MARKERS_PROPERTY = "kotlin.signature.markers.enabled"; private static final String SHOW_MARKERS_PROPERTY = "kotlin.signature.markers.enabled";
@@ -104,7 +102,7 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
if (memberDescriptor == null) continue; if (memberDescriptor == null) continue;
List<String> errors = trace.get(BindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS, memberDescriptor); List<String> errors = trace.get(BindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS, memberDescriptor);
boolean hasSignatureAnnotation = findKotlinSignatureAnnotation(element) != null; boolean hasSignatureAnnotation = KotlinSignatureUtil.findKotlinSignatureAnnotation(element) != null;
if (errors != null || hasSignatureAnnotation) { if (errors != null || hasSignatureAnnotation) {
result.add(new MyLineMarkerInfo((PsiModifierListOwner) element, errors, hasSignatureAnnotation)); result.add(new MyLineMarkerInfo((PsiModifierListOwner) element, errors, hasSignatureAnnotation));
@@ -200,7 +198,7 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
memberScope.getProperties(name); memberScope.getProperties(name);
} }
PsiModifierListOwner annotationOwner = getAnnotationOwner(member); PsiModifierListOwner annotationOwner = KotlinSignatureUtil.getAnnotationOwner(member);
return trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, annotationOwner); return trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, annotationOwner);
} }
@@ -210,7 +208,7 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
public static void setMarkersEnabled(@NotNull Project project, boolean value) { public static void setMarkersEnabled(@NotNull Project project, boolean value) {
PropertiesComponent.getInstance(project).setValue(SHOW_MARKERS_PROPERTY, Boolean.toString(value)); PropertiesComponent.getInstance(project).setValue(SHOW_MARKERS_PROPERTY, Boolean.toString(value));
refreshMarkers(project); KotlinSignatureUtil.refreshMarkers(project);
} }
private static class MyLineMarkerInfo extends LineMarkerInfo<PsiModifierListOwner> { private static class MyLineMarkerInfo extends LineMarkerInfo<PsiModifierListOwner> {
@@ -245,11 +243,11 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
@Nullable @Nullable
@Override @Override
public String fun(PsiElement element) { public String fun(PsiElement element) {
PsiAnnotation annotation = findKotlinSignatureAnnotation(element); PsiAnnotation annotation = KotlinSignatureUtil.findKotlinSignatureAnnotation(element);
if (annotation == null) return errorsString(); if (annotation == null) return errorsString();
String signature = getKotlinSignature(annotation); String signature = KotlinSignatureUtil.getKotlinSignature(annotation);
String text = "Alternative Kotlin signature is available for this method:\n" String text = "Alternative Kotlin signature is available for this method:\n"
+ StringUtil.escapeXml(signature); + StringUtil.escapeXml(signature);
if (errors == null) { if (errors == null) {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.ExternalAnnotationsListener; import com.intellij.codeInsight.ExternalAnnotationsListener;
import com.intellij.codeInsight.ExternalAnnotationsManager; import com.intellij.codeInsight.ExternalAnnotationsManager;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.codeInsight.ExternalAnnotationsManager; import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.jet.plugin.codeInsight.ktSignature; package org.jetbrains.jet.plugin.ktSignature;
import com.intellij.lang.java.JavaLanguage; import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionEvent;

Some files were not shown because too many files have changed in this diff Show More