From 49cfd319c039dffa2daf6ea6739f8af0b2197266 Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 19 Dec 2012 17:48:36 +0400 Subject: [PATCH] IDEA-95410 Arrangement: Preserve fold regions on arrangement Move inner classes and interfaces to outer level as they break teamcity compilation (everything works fine locally) --- .../arrangement/AbstractRearrangerTest.groovy | 35 ------------------- .../arrangement/FoldingHandler.groovy | 30 ++++++++++++++++ .../codeStyle/arrangement/FoldingInfo.groovy | 26 ++++++++++++++ .../psi/codeStyle/arrangement/Info.groovy | 30 ++++++++++++++++ .../codeStyle/arrangement/RangeHandler.groovy | 32 +++++++++++++++++ .../arrangement/RichTextHandler.groovy | 28 +++++++++++++++ 6 files changed, 146 insertions(+), 35 deletions(-) create mode 100644 platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingHandler.groovy create mode 100644 platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingInfo.groovy create mode 100644 platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/Info.groovy create mode 100644 platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RangeHandler.groovy create mode 100644 platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RichTextHandler.groovy diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy index ffe119f8bbec..dc24e1c2e0ee 100644 --- a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy @@ -183,39 +183,4 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes } result } - - private static class Info { - String text - @Nullable List ranges = [] - List foldings = [] - } - - private static class FoldingInfo { - def placeholder - def start - def end - } - - private interface RichTextHandler { - String getMarker() - void handle(@NotNull Info info, @NotNull Map attributes, int start, int end) - } - - private static class RangeHandler implements RichTextHandler { - @Override String getMarker() { "range" } - - @Override - void handle(Info info, Map attributes, int start, int end) { - info.ranges << TextRange.create(start, end) - } - } - - private static class FoldingHandler implements RichTextHandler { - @Override String getMarker() { "fold" } - - @Override - void handle(Info info, Map attributes, int start, int end) { - info.foldings << new FoldingInfo(placeholder: attributes.text ?: '...', start: start, end: end) - } - } } diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingHandler.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingHandler.groovy new file mode 100644 index 000000000000..562049801d34 --- /dev/null +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingHandler.groovy @@ -0,0 +1,30 @@ +/* + * 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. + */ +package com.intellij.psi.codeStyle.arrangement + +/** + * @author Denis Zhdanov + * @since 12/19/12 5:46 PM + */ +class FoldingHandler implements RichTextHandler { + + @Override String getMarker() { "fold" } + + @Override + void handle(Info info, Map attributes, int start, int end) { + info.foldings << new FoldingInfo(placeholder: attributes.text ?: '...', start: start, end: end) + } +} \ No newline at end of file diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingInfo.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingInfo.groovy new file mode 100644 index 000000000000..73e0b8efcd05 --- /dev/null +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/FoldingInfo.groovy @@ -0,0 +1,26 @@ +/* + * 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. + */ +package com.intellij.psi.codeStyle.arrangement + +/** + * @author Denis Zhdanov + * @since 12/19/12 5:31 PM + */ +class FoldingInfo { + def placeholder + def start + def end +} diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/Info.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/Info.groovy new file mode 100644 index 000000000000..ac5061c410be --- /dev/null +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/Info.groovy @@ -0,0 +1,30 @@ +/* + * 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. + */ +package com.intellij.psi.codeStyle.arrangement + +import com.intellij.openapi.util.TextRange +import org.jetbrains.annotations.Nullable + +/** + * @author Denis Zhdanov + * @since 12/19/12 5:31 PM + */ +class Info { + + String text + @Nullable List ranges = [] + List foldings = [] +} diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RangeHandler.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RangeHandler.groovy new file mode 100644 index 000000000000..b0717d4fc2fa --- /dev/null +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RangeHandler.groovy @@ -0,0 +1,32 @@ +/* + * 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. + */ +package com.intellij.psi.codeStyle.arrangement + +import com.intellij.openapi.util.TextRange + +/** + * @author Denis Zhdanov + * @since 12/19/12 5:46 PM + */ +class RangeHandler implements RichTextHandler { + + @Override String getMarker() { "range" } + + @Override + void handle(Info info, Map attributes, int start, int end) { + info.ranges << TextRange.create(start, end) + } +} \ No newline at end of file diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RichTextHandler.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RichTextHandler.groovy new file mode 100644 index 000000000000..e4c0eb48218d --- /dev/null +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/RichTextHandler.groovy @@ -0,0 +1,28 @@ +/* + * 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. + */ +package com.intellij.psi.codeStyle.arrangement + +import org.jetbrains.annotations.NotNull + +/** + * @author Denis Zhdanov + * @since 12/19/12 5:31 PM + */ +interface RichTextHandler { + + String getMarker() + void handle(@NotNull Info info, @NotNull Map attributes, int start, int end) +} \ No newline at end of file