CPP-7641 Rework CMake support workflow 2 discussions clion/171.239
authorAnton Makeev <Anton.Makeev@jetbrains.com>
Tue, 18 Oct 2016 12:22:57 +0000 (14:22 +0200)
committerAnton Makeev <Anton.Makeev@jetbrains.com>
Tue, 18 Oct 2016 12:22:57 +0000 (14:22 +0200)
CPP-7481 CMake Merge CMake Problems and Output tool windows
CPP-7225 CMake Save and show saved CMake output as it was shown by CMake

platform/platform-impl/src/com/intellij/util/ContentUtilEx.java

index 1ef90b233c57e12c92058564ced9513c2a5cc8cc..52f6ea2d0e2ed51a794797202ecd1d5442a408d9 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentFactory;
 import com.intellij.ui.content.ContentManager;
@@ -198,10 +199,7 @@ public class ContentUtilEx extends ContentsUtil {
 
   @Nullable
   public static String getTabNameWithoutPrefix(@NotNull TabbedContent content, @NotNull String fullTabName) {
-    int fullPrefixLength = getFullPrefix(content.getTitlePrefix()).length();
-    if (fullTabName.startsWith(content.getTitlePrefix())) {
-      return fullTabName.substring(fullPrefixLength);
-    }
-    return null;
+    String prefix = content.getTitlePrefix();
+    return prefix == null ? fullTabName : StringUtil.trimStart(fullTabName, getFullPrefix(prefix));
   }
 }