inspection tool window: proper insert "of" when tabs.size == 1

This commit is contained in:
Dmitry Batkovich
2016-04-13 10:04:17 +03:00
parent f43e6b3ed8
commit ffdd1380f7
3 changed files with 13 additions and 10 deletions
@@ -72,6 +72,8 @@ public class InspectionManagerEx extends InspectionManagerBase {
toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowInspection);
new ContentManagerWatcher(toolWindow, contentManager);
contentManager.addContentManagerListener(new ContentManagerAdapter() {
private static final String PREFIX = "of ";
@Override
public void contentAdded(ContentManagerEvent event) {
handleContentSizeChanged();
@@ -84,16 +86,19 @@ public class InspectionManagerEx extends InspectionManagerBase {
private void handleContentSizeChanged() {
final int count = contentManager.getContentCount();
String newStripeTitle = null;
if (count == 1) {
newStripeTitle = InspectionsBundle.message("inspection.tool.window.stripe.title.single.content");
final Content content = contentManager.getContent(0);
final String displayName = content.getDisplayName();
if (!content.getDisplayName().startsWith(PREFIX)) {
content.setDisplayName(PREFIX + displayName);
}
}
else if (count > 1) {
newStripeTitle = InspectionsBundle.message("inspection.tool.window.stripe.title.multiple.content");
}
final String stripeTitle = toolWindow.getStripeTitle();
if (newStripeTitle != null && !stripeTitle.equals(newStripeTitle)) {
toolWindow.setStripeTitle(newStripeTitle);
for (Content content : contentManager.getContents()) {
if (content.getDisplayName().startsWith(PREFIX)) {
content.setDisplayName(content.getDisplayName().substring(PREFIX.length()));
}
}
}
}
});
@@ -710,5 +710,3 @@ todo.comment.problem.descriptor=TODO comment <code>#ref</code> #loc
long.line.display.name=Line is longer than allowed by code style
inspection.default.annotation.param=Default annotation parameter value
inspection.tool.window.stripe.title.single.content=Inspection Results of
inspection.tool.window.stripe.title.multiple.content=Inspection Results
@@ -51,7 +51,7 @@ tool.window.name.run=Run
tool.window.name.find=Find
tool.window.name.cvs=CVS
tool.window.name.hierarchy=Hierarchy
tool.window.name.inspection=Inspection
tool.window.name.inspection=Inspection Results
tool.window.name.todo=TODO
tool.window.name.dependency.viewer=Dependency Viewer
tool.window.name.version.control=Version Control