diff --git a/platform/lang-impl/src/com/intellij/ide/util/PlatformModuleRendererFactory.java b/platform/lang-impl/src/com/intellij/ide/util/PlatformModuleRendererFactory.java index ceb0d1670bb2..046de8dc6de7 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/PlatformModuleRendererFactory.java +++ b/platform/lang-impl/src/com/intellij/ide/util/PlatformModuleRendererFactory.java @@ -18,6 +18,7 @@ package com.intellij.ide.util; import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.NavigationItem; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ui.UIUtil; import javax.swing.*; @@ -51,7 +52,7 @@ public class PlatformModuleRendererFactory extends ModuleRendererFactory { final ItemPresentation presentation = ((NavigationItem)value).getPresentation(); if (presentation != null) { String containerText = presentation.getLocationString(); - if (containerText != null && containerText.length() > 0) { + if (!StringUtil.isEmpty(containerText)) { text = " " + containerText; } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileCellRenderer.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileCellRenderer.java index 08e84da01b57..11a6b56d2889 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileCellRenderer.java @@ -26,6 +26,7 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.util.Iconable; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; @@ -126,7 +127,10 @@ public class GotoFileCellRenderer extends PsiElementListCellRenderer { assert itemPresentation != null; renderer.setIcon(itemPresentation.getIcon(true)); - renderer.append(itemPresentation.getLocationString(), new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY)); + String locationString = itemPresentation.getLocationString(); + if (!StringUtil.isEmpty(locationString)) { + renderer.append(locationString, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY)); + } return true; } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java b/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java index 21c8b75e9749..f3e267d94146 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java @@ -22,6 +22,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.SimpleTextAttributes; import org.jetbrains.annotations.Nls; @@ -71,7 +72,7 @@ public class NodeRenderer extends ColoredTreeCellRenderer { } final String location = presentation.getLocationString(); - if (location != null && !location.isEmpty()) { + if (!StringUtil.isEmpty(location)) { doAppend(presentation.getLocationPrefix() + location + presentation.getLocationSuffix(), SimpleTextAttributes.GRAY_ATTRIBUTES, false, selected); } diff --git a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java b/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java index a1cbc3555a89..dd3341df4133 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java @@ -41,29 +41,35 @@ public class Html5SectionsNodeProvider implements FileStructureNodeProvider provideNodes(final TreeElement node) { if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList(); diff --git a/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java b/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java index e822249910bc..77aab443bd03 100644 --- a/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java +++ b/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java @@ -6,15 +6,16 @@ import com.intellij.lang.html.structureView.Html5SectionsNodeProvider; import com.intellij.testFramework.FileStructureTestBase; public class HtmlFileStructureTest extends FileStructureTestBase { - private boolean myHtml5OutlineModeDefault; + @Override public void setUp() throws Exception { super.setUp(); myHtml5OutlineModeDefault = PropertiesComponent.getInstance().getBoolean(getHtml5OutlineModePropertyName(), false); setHtml5OutlineMode(true); } + @Override public void tearDown() throws Exception { PropertiesComponent.getInstance().setValue(getHtml5OutlineModePropertyName(), String.valueOf(myHtml5OutlineModeDefault)); super.tearDown(); @@ -24,14 +25,17 @@ public class HtmlFileStructureTest extends FileStructureTestBase { return FileStructurePopup.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY); } + @Override protected String getFileExtension() { return "html"; } + @Override protected String getBasePath() { return "/xml/tests/testData/structureView/"; } + @Override protected boolean isCommunity() { return true; } @@ -46,4 +50,4 @@ public class HtmlFileStructureTest extends FileStructureTestBase { public void testNoSectioningRoot() throws Exception {checkTree();} public void testImplicitSections() throws Exception {checkTree();} public void testMultipleRootTags() throws Exception {checkTree();} -} +} \ No newline at end of file diff --git a/xml/tests/testData/structureView/ImplicitSections.tree b/xml/tests/testData/structureView/ImplicitSections.tree index 9903463aa790..8ae4cdc85d18 100644 --- a/xml/tests/testData/structureView/ImplicitSections.tree +++ b/xml/tests/testData/structureView/ImplicitSections.tree @@ -18,7 +18,7 @@ g2 -body2 body3 - - - - + -null + -null hhh2 hhh1 \ No newline at end of file diff --git a/xml/tests/testData/structureView/Simple.tree b/xml/tests/testData/structureView/Simple.tree index 4f8e03e31bd5..3d9a21b66a44 100644 --- a/xml/tests/testData/structureView/Simple.tree +++ b/xml/tests/testData/structureView/Simple.tree @@ -1,2 +1,2 @@ -HtmlFile:Simple.html - [] \ No newline at end of file + [null] \ No newline at end of file