mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
overrides, StringUti.isEmpty, test data
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PsiFile> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -41,29 +41,35 @@ public class Html5SectionsNodeProvider implements FileStructureNodeProvider<Html
|
||||
public static final String ACTION_ID = "HTML5_OUTLINE_MODE";
|
||||
public static final String HTML5_OUTLINE_PROVIDER_PROPERTY = "html5.sections.node.provider";
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return ACTION_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ActionPresentation getPresentation() {
|
||||
return new ActionPresentationData(XmlBundle.message("html5.outline.mode"), null, AllIcons.Xml.Html5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCheckBoxText() {
|
||||
return XmlBundle.message("html5.outline.mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shortcut[] getShortcut() {
|
||||
return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getPropertyName() {
|
||||
return HTML5_OUTLINE_PROVIDER_PROPERTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Html5SectionTreeElement> provideNodes(final TreeElement node) {
|
||||
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
|
||||
|
||||
|
||||
@@ -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();}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
g2
|
||||
-body2
|
||||
body3
|
||||
-
|
||||
-
|
||||
-null
|
||||
-null
|
||||
hhh2
|
||||
hhh1
|
||||
@@ -1,2 +1,2 @@
|
||||
-HtmlFile:Simple.html
|
||||
[]
|
||||
[null]
|
||||
Reference in New Issue
Block a user