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)
This commit is contained in:
Denis.Zhdanov
2012-12-19 17:48:53 +04:00
parent 174104458a
commit 49cfd319c0
6 changed files with 146 additions and 35 deletions
@@ -183,39 +183,4 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
}
result
}
private static class Info {
String text
@Nullable List<TextRange> ranges = []
List<FoldingInfo> foldings = []
}
private static class FoldingInfo {
def placeholder
def start
def end
}
private interface RichTextHandler {
String getMarker()
void handle(@NotNull Info info, @NotNull Map<String, String> attributes, int start, int end)
}
private static class RangeHandler implements RichTextHandler {
@Override String getMarker() { "range" }
@Override
void handle(Info info, Map<String, String> 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<String, String> attributes, int start, int end) {
info.foldings << new FoldingInfo(placeholder: attributes.text ?: '...', start: start, end: end)
}
}
}
@@ -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<String, String> attributes, int start, int end) {
info.foldings << new FoldingInfo(placeholder: attributes.text ?: '...', start: start, end: end)
}
}
@@ -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
}
@@ -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<TextRange> ranges = []
List<FoldingInfo> foldings = []
}
@@ -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<String, String> attributes, int start, int end) {
info.ranges << TextRange.create(start, end)
}
}
@@ -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<String, String> attributes, int start, int end)
}