2 * Copyright 2000-2012 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.lang.customFolding;
18 import com.intellij.lang.folding.CustomFoldingProvider;
21 * Supports <a href="http://msdn.microsoft.com/en-us/library/9a1ybwek%28v=vs.100%29.aspx">VisualStudio custom foldings.</a>
22 * @author Rustam Vishnyakov
24 public class VisualStudioCustomFoldingProvider extends CustomFoldingProvider {
26 public boolean isCustomRegionStart(String elementText) {
27 return elementText.contains("region") && elementText.matches("..?\\s*region.*");
31 public boolean isCustomRegionEnd(String elementText) {
32 return elementText.contains("endregion");
36 public String getPlaceholderText(String elementText) {
37 return elementText.replaceFirst("..?\\s*region(.*)","$1").trim();