diff --git a/idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/after.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/after.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/before.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/before.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/description.html b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToAssignmentIntention/description.html rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToAssignmentIntention/description.html diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/after.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/after.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/before.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/before.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/description.html b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnAsymmetricallyIntention/description.html rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnAsymmetricallyIntention/description.html diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnIntention/after.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnIntention/after.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnIntention/before.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnIntention/before.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/FoldIfToReturnIntention/description.html b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/FoldIfToReturnIntention/description.html rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldIfToReturnIntention/description.html diff --git a/idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/after.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/after.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/before.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/before.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/description.html b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToAssignmentIntention/description.html rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToAssignmentIntention/description.html diff --git a/idea/resources/intentionDescriptions/FoldWhenToReturnIntention/after.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToReturnIntention/after.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/FoldWhenToReturnIntention/before.kt.template b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToReturnIntention/before.kt.template rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/FoldWhenToReturnIntention/description.html b/idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/FoldWhenToReturnIntention/description.html rename to idea/resources/intentionDescriptions/FoldBranchedExpressionIntentionFoldWhenToReturnIntention/description.html diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToIfIntention/description.html diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/after.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/after.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/before.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/before.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/description.html b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldAssignmentToWhenIntention/description.html rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldAssignmentToWhenIntention/description.html diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/after.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/after.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/before.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/before.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/description.html b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToIfIntention/description.html rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToIfIntention/description.html diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/after.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/after.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/after.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/after.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/before.kt.template b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/before.kt.template similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/before.kt.template rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/before.kt.template diff --git a/idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/description.html b/idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/description.html similarity index 100% rename from idea/resources/intentionDescriptions/UnfoldReturnToWhenIntention/description.html rename to idea/resources/intentionDescriptions/UnfoldBranchedExpressionIntentionUnfoldReturnToWhenIntention/description.html diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 56dd14cd602..effb936cd4e 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -292,47 +292,47 @@ - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldIfToAssignmentIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToAssignmentIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnAsymmetricallyIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldIfToReturnIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldIfToReturnIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldWhenToAssignmentIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToAssignmentIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldWhenToReturnIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.FoldBranchedExpressionIntention$FoldWhenToReturnIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldAssignmentToIfIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToIfIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldAssignmentToWhenIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldAssignmentToWhenIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldReturnToIfIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToIfIntention Kotlin - org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldReturnToWhenIntention + org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.UnfoldBranchedExpressionIntention$UnfoldReturnToWhenIntention Kotlin diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/AbstractCodeTransformationIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/AbstractCodeTransformationIntention.java index 72aace46d98..f26858cf736 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/AbstractCodeTransformationIntention.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/AbstractCodeTransformationIntention.java @@ -46,14 +46,6 @@ public abstract class AbstractCodeTransformationIntention return JetPsiUtil.getParentByTypeAndPredicate(element, JetElement.class, filter, false); } - protected final T getTransformer() { - return transformer; - } - - protected final Predicate getFilter() { - return filter; - } - @NotNull @Override public String getFamilyName() { diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/core/Transformer.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/core/Transformer.java index a2ce45fed31..1693b4b40b8 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/core/Transformer.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/core/Transformer.java @@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; public interface Transformer { - public @NotNull String getKey(); + @NotNull + public String getKey(); public void transform(@NotNull PsiElement element); } diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldBranchedExpressionIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldBranchedExpressionIntention.java index e61bcce509f..1c07527fe46 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldBranchedExpressionIntention.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldBranchedExpressionIntention.java @@ -37,4 +37,34 @@ public abstract class FoldBranchedExpressionIntention extends AbstractCodeTransf } ); } + + public static class FoldIfToAssignmentIntention extends FoldBranchedExpressionIntention { + public FoldIfToAssignmentIntention() { + super(FoldableKind.IF_TO_ASSIGNMENT); + } + } + + public static class FoldIfToReturnAsymmetricallyIntention extends FoldBranchedExpressionIntention { + public FoldIfToReturnAsymmetricallyIntention() { + super(FoldableKind.IF_TO_RETURN_ASYMMETRICALLY); + } + } + + public static class FoldIfToReturnIntention extends FoldBranchedExpressionIntention { + public FoldIfToReturnIntention() { + super(FoldableKind.IF_TO_RETURN); + } + } + + public static class FoldWhenToAssignmentIntention extends FoldBranchedExpressionIntention { + public FoldWhenToAssignmentIntention() { + super(FoldableKind.WHEN_TO_ASSIGNMENT); + } + } + + public static class FoldWhenToReturnIntention extends FoldBranchedExpressionIntention { + public FoldWhenToReturnIntention() { + super(FoldableKind.WHEN_TO_RETURN); + } + } } diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToAssignmentIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToAssignmentIntention.java deleted file mode 100644 index 30b2466f232..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToAssignmentIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; - -public class FoldIfToAssignmentIntention extends FoldBranchedExpressionIntention { - public FoldIfToAssignmentIntention() { - super(FoldableKind.IF_TO_ASSIGNMENT); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnAsymmetricallyIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnAsymmetricallyIntention.java deleted file mode 100644 index 128ecf8a25a..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnAsymmetricallyIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; - -public class FoldIfToReturnAsymmetricallyIntention extends FoldBranchedExpressionIntention { - public FoldIfToReturnAsymmetricallyIntention() { - super(FoldableKind.IF_TO_RETURN_ASYMMETRICALLY); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnIntention.java deleted file mode 100644 index a63fd84b868..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldIfToReturnIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; - -public class FoldIfToReturnIntention extends FoldBranchedExpressionIntention { - public FoldIfToReturnIntention() { - super(FoldableKind.IF_TO_RETURN); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToAssignmentIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToAssignmentIntention.java deleted file mode 100644 index 3c307dc3b3d..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToAssignmentIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; - -public class FoldWhenToAssignmentIntention extends FoldBranchedExpressionIntention { - public FoldWhenToAssignmentIntention() { - super(FoldableKind.WHEN_TO_ASSIGNMENT); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToReturnIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToReturnIntention.java deleted file mode 100644 index fd1bc61726c..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/FoldWhenToReturnIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.FoldableKind; - -public class FoldWhenToReturnIntention extends FoldBranchedExpressionIntention { - public FoldWhenToReturnIntention() { - super(FoldableKind.WHEN_TO_RETURN); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.java deleted file mode 100644 index a0db1a07526..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.UnfoldableKind; - -public class UnfoldAssignmentToIfIntention extends UnfoldBranchedExpressionIntention { - public UnfoldAssignmentToIfIntention() { - super(UnfoldableKind.ASSIGNMENT_TO_IF); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToWhenIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToWhenIntention.java deleted file mode 100644 index 102c65ddd1f..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldAssignmentToWhenIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.UnfoldableKind; - -public class UnfoldAssignmentToWhenIntention extends UnfoldBranchedExpressionIntention { - public UnfoldAssignmentToWhenIntention() { - super(UnfoldableKind.ASSIGNMENT_TO_WHEN); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldBranchedExpressionIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldBranchedExpressionIntention.java index 6d21ec4afa9..40cf4066f8d 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldBranchedExpressionIntention.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldBranchedExpressionIntention.java @@ -35,4 +35,28 @@ public abstract class UnfoldBranchedExpressionIntention extends AbstractCodeTran } ); } + + public static class UnfoldAssignmentToIfIntention extends UnfoldBranchedExpressionIntention { + public UnfoldAssignmentToIfIntention() { + super(UnfoldableKind.ASSIGNMENT_TO_IF); + } + } + + public static class UnfoldAssignmentToWhenIntention extends UnfoldBranchedExpressionIntention { + public UnfoldAssignmentToWhenIntention() { + super(UnfoldableKind.ASSIGNMENT_TO_WHEN); + } + } + + public static class UnfoldReturnToIfIntention extends UnfoldBranchedExpressionIntention { + public UnfoldReturnToIfIntention() { + super(UnfoldableKind.RETURN_TO_IF); + } + } + + public static class UnfoldReturnToWhenIntention extends UnfoldBranchedExpressionIntention { + public UnfoldReturnToWhenIntention() { + super(UnfoldableKind.RETURN_TO_WHEN); + } + } } diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToIfIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToIfIntention.java deleted file mode 100644 index 4018d2dcfc2..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToIfIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.UnfoldableKind; - -public class UnfoldReturnToIfIntention extends UnfoldBranchedExpressionIntention { - public UnfoldReturnToIfIntention() { - super(UnfoldableKind.RETURN_TO_IF); - } -} diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToWhenIntention.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToWhenIntention.java deleted file mode 100644 index 156954aada1..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/intentions/UnfoldReturnToWhenIntention.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions; - -import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.UnfoldableKind; - -public class UnfoldReturnToWhenIntention extends UnfoldBranchedExpressionIntention { - public UnfoldReturnToWhenIntention() { - super(UnfoldableKind.RETURN_TO_WHEN); - } -} diff --git a/idea/tests/org/jetbrains/jet/plugin/codeInsight/codeTransformations/AbstractCodeTransformationTest.java b/idea/tests/org/jetbrains/jet/plugin/codeInsight/codeTransformations/AbstractCodeTransformationTest.java index 690abe64d19..b838ac1dcf7 100644 --- a/idea/tests/org/jetbrains/jet/plugin/codeInsight/codeTransformations/AbstractCodeTransformationTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/codeInsight/codeTransformations/AbstractCodeTransformationTest.java @@ -27,39 +27,39 @@ import java.io.File; public abstract class AbstractCodeTransformationTest extends LightCodeInsightTestCase { public void doTestFoldIfToAssignment(@NotNull String path) throws Exception { - doTest(path, new FoldIfToAssignmentIntention()); + doTest(path, new FoldBranchedExpressionIntention.FoldIfToAssignmentIntention()); } public void doTestFoldIfToReturn(@NotNull String path) throws Exception { - doTest(path, new FoldIfToReturnIntention()); + doTest(path, new FoldBranchedExpressionIntention.FoldIfToReturnIntention()); } public void doTestFoldIfToReturnAsymmetrically(@NotNull String path) throws Exception { - doTest(path, new FoldIfToReturnAsymmetricallyIntention()); + doTest(path, new FoldBranchedExpressionIntention.FoldIfToReturnAsymmetricallyIntention()); } public void doTestFoldWhenToAssignment(@NotNull String path) throws Exception { - doTest(path, new FoldWhenToAssignmentIntention()); + doTest(path, new FoldBranchedExpressionIntention.FoldWhenToAssignmentIntention()); } public void doTestFoldWhenToReturn(@NotNull String path) throws Exception { - doTest(path, new FoldWhenToReturnIntention()); + doTest(path, new FoldBranchedExpressionIntention.FoldWhenToReturnIntention()); } public void doTestUnfoldAssignmentToIf(@NotNull String path) throws Exception { - doTest(path, new UnfoldAssignmentToIfIntention()); + doTest(path, new UnfoldBranchedExpressionIntention.UnfoldAssignmentToIfIntention()); } public void doTestUnfoldAssignmentToWhen(@NotNull String path) throws Exception { - doTest(path, new UnfoldAssignmentToWhenIntention()); + doTest(path, new UnfoldBranchedExpressionIntention.UnfoldAssignmentToWhenIntention()); } public void doTestUnfoldReturnToIf(@NotNull String path) throws Exception { - doTest(path, new UnfoldReturnToIfIntention()); + doTest(path, new UnfoldBranchedExpressionIntention.UnfoldReturnToIfIntention()); } public void doTestUnfoldReturnToWhen(@NotNull String path) throws Exception { - doTest(path, new UnfoldReturnToWhenIntention()); + doTest(path, new UnfoldBranchedExpressionIntention.UnfoldReturnToWhenIntention()); } public void doTestRemoveUnnecessaryParentheses(@NotNull String path) throws Exception {