diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java index 7d94f6f0a602..04fc290b0c7b 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java @@ -156,8 +156,7 @@ public class MavenDomProjectProcessorUtils { @NotNull - public static Set searchDependencyUsages(@NotNull final MavenDomDependency dependency, - @NotNull final Project project) { + public static Set searchDependencyUsages(@NotNull final MavenDomDependency dependency) { final MavenDomProjectModel model = dependency.getParentOfType(MavenDomProjectModel.class, false); if (model != null) { final String artifactId = dependency.getArtifactId().getStringValue(); @@ -206,6 +205,43 @@ public class MavenDomProjectProcessorUtils { return usages; } + @NotNull + public static Collection searchManagedPluginUsages(@NotNull final MavenDomPlugin plugin) { + String artifactId = plugin.getArtifactId().getStringValue(); + if (artifactId == null) return Collections.emptyList(); + + String groupId = plugin.getGroupId().getStringValue(); + + MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false); + if (model == null) return Collections.emptyList(); + + return searchManagedPluginUsages(model, groupId, artifactId); + } + + @NotNull + public static Collection searchManagedPluginUsages(@NotNull final MavenDomProjectModel model, + @Nullable final String groupId, + @NotNull final String artifactId) { + Project project = model.getManager().getProject(); + + final Set usages = new HashSet(); + + Processor collectProcessor = new Processor() { + public boolean process(MavenDomProjectModel mavenDomProjectModel) { + for (MavenDomPlugin domPlugin : mavenDomProjectModel.getBuild().getPlugins().getPlugins()) { + if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) { + usages.add(domPlugin); + } + } + return false; + } + }; + + processChildrenRecursively(model, collectProcessor, project, new HashSet(), true); + + return usages; + } + public static void processChildrenRecursively(@Nullable MavenDomProjectModel model, @NotNull Processor processor) { processChildrenRecursively(model, processor, true); @@ -291,65 +327,85 @@ public class MavenDomProjectProcessorUtils { return processor.myResult; } + @Nullable + public static MavenDomPlugin searchManagingPlugin(@NotNull final MavenDomPlugin plugin) { + final String artifactId = plugin.getArtifactId().getStringValue(); + final String groupId = plugin.getGroupId().getStringValue(); + if (artifactId == null) return null; + + final MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false); + if (model == null) return null; + + SearchProcessor processor = new SearchProcessor() { + @Override + protected MavenDomPlugin find(MavenDomPlugins mavenDomPlugins) { + if (!model.equals(mavenDomPlugins.getParentOfType(MavenDomProjectModel.class, true))) { + for (MavenDomPlugin domPlugin : mavenDomPlugins.getPlugins()) { + if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) { + return domPlugin; + } + } + } + + return null; + } + }; + + Function domProfileFunction = new Function() { + public MavenDomPlugins fun(MavenDomProjectModelBase mavenDomProfile) { + return mavenDomProfile.getBuild().getPluginManagement().getPlugins(); + } + }; + + process(model, processor, model.getManager().getProject(), domProfileFunction, domProfileFunction); + + return processor.myResult; + } + public static boolean processDependenciesInDependencyManagement(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor, @NotNull final Project project) { - Function domProfileFunction = new Function() { - public MavenDomDependencies fun(MavenDomProfile mavenDomProfile) { + Function domFunction = new Function() { + public MavenDomDependencies fun(MavenDomProjectModelBase mavenDomProfile) { return mavenDomProfile.getDependencyManagement().getDependencies(); } }; - Function projectDomFunction = new Function() { - public MavenDomDependencies fun(MavenDomProjectModel mavenDomProjectModel) { - return mavenDomProjectModel.getDependencyManagement().getDependencies(); - } - }; - return process(projectDom, processor, project, domProfileFunction, projectDomFunction); + return process(projectDom, processor, project, domFunction, domFunction); } public static boolean processDependencies(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor) { - Function domProfileFunction = new Function() { - public MavenDomDependencies fun(MavenDomProfile mavenDomProfile) { + Function domFunction = new Function() { + public MavenDomDependencies fun(MavenDomProjectModelBase mavenDomProfile) { return mavenDomProfile.getDependencies(); } }; - Function projectDomFunction = new Function() { - public MavenDomDependencies fun(MavenDomProjectModel mavenDomProjectModel) { - return mavenDomProjectModel.getDependencies(); - } - }; - return process(projectDom, processor, projectDom.getManager().getProject(), domProfileFunction, projectDomFunction); + return process(projectDom, processor, projectDom.getManager().getProject(), domFunction, domFunction); } public static boolean processProperties(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor, @NotNull final Project project) { - Function domProfileFunction = new Function() { - public MavenDomProperties fun(MavenDomProfile mavenDomProfile) { + Function domFunction = new Function() { + public MavenDomProperties fun(MavenDomProjectModelBase mavenDomProfile) { return mavenDomProfile.getProperties(); } }; - Function projectDomFunction = new Function() { - public MavenDomProperties fun(MavenDomProjectModel mavenDomProjectModel) { - return mavenDomProjectModel.getProperties(); - } - }; - return process(projectDom, processor, project, domProfileFunction, projectDomFunction); + return process(projectDom, processor, project, domFunction, domFunction); } public static boolean process(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor, @NotNull final Project project, - @NotNull final Function domProfileFunction, - @NotNull final Function projectDomFunction) { + @NotNull final Function domProfileFunction, + @NotNull final Function projectDomFunction) { return process(projectDom, processor, project, domProfileFunction, projectDomFunction, new HashSet()); } @@ -358,8 +414,8 @@ public class MavenDomProjectProcessorUtils { public static boolean process(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor, @NotNull final Project project, - @NotNull final Function domProfileFunction, - @NotNull final Function projectDomFunction, + @NotNull final Function domProfileFunction, + @NotNull final Function projectDomFunction, final Set processed) { if (processed.contains(projectDom)) return true; processed.add(projectDom); @@ -375,8 +431,8 @@ public class MavenDomProjectProcessorUtils { private static boolean processParentProjectFile(MavenDomProjectModel projectDom, final Processor processor, final Project project, - final Function domProfileFunction, - final Function projectDomFunction, + final Function domProfileFunction, + final Function projectDomFunction, final Set processed) { Boolean aBoolean = new DomParentProjectFileProcessor(MavenProjectsManager.getInstance(project)) { protected Boolean doProcessParent(VirtualFile parentFile) { @@ -395,7 +451,7 @@ public class MavenDomProjectProcessorUtils { private static boolean processSettingsXml(@Nullable MavenProject mavenProject, @NotNull Processor processor, @NotNull Project project, - Function domProfileFunction) { + Function domProfileFunction) { MavenGeneralSettings settings = MavenProjectsManager.getInstance(project).getGeneralSettings(); for (VirtualFile each : settings.getEffectiveSettingsFiles()) { @@ -411,8 +467,8 @@ public class MavenDomProjectProcessorUtils { MavenProject mavenProjectOrNull, Processor processor, Project project, - Function domProfileFunction, - Function projectDomFunction) { + Function domProfileFunction, + Function projectDomFunction) { if (processProfilesXml(MavenDomUtil.getVirtualFile(projectDom), mavenProjectOrNull, processor, project, domProfileFunction)) { return true; @@ -428,7 +484,7 @@ public class MavenDomProjectProcessorUtils { MavenProject mavenProjectOrNull, Processor processor, Project project, - Function f) { + Function f) { VirtualFile profilesFile = MavenUtil.findProfilesXmlFile(projectFile); if (profilesFile == null) return false; @@ -441,7 +497,7 @@ public class MavenDomProjectProcessorUtils { private static boolean processProfiles(MavenDomProfiles profilesDom, MavenProject mavenProjectOrNull, Processor processor, - Function f) { + Function f) { Collection activePropfiles = mavenProjectOrNull == null ? null : mavenProjectOrNull.getActivatedProfilesIds(); for (MavenDomProfile each : profilesDom.getProfiles()) { XmlTag idTag = each.getId().getXmlTag(); @@ -455,7 +511,7 @@ public class MavenDomProjectProcessorUtils { private static boolean processProfile(MavenDomProfile profileDom, Processor processor, - Function f) { + Function f) { T t = f.fun(profileDom); return t != null && processor.process(t); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java index 4233475a5031..2d7e40bec492 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java @@ -44,18 +44,22 @@ public class MavenPluginDomUtil { return MavenDomUtil.getMavenDomModel(p, pluginXmlFile, MavenDomPluginModel.class); } - public static boolean isPlugin(@NotNull MavenDomConfiguration configuration, @NotNull String groupId, @NotNull String artifactId) { + public static boolean isPlugin(@NotNull MavenDomConfiguration configuration, @Nullable String groupId, @NotNull String artifactId) { MavenDomPlugin domPlugin = configuration.getParentOfType(MavenDomPlugin.class, true); if (domPlugin == null) return false; return isPlugin(domPlugin, groupId, artifactId); } - public static boolean isPlugin(@NotNull MavenDomPlugin plugin, @NotNull String groupId, @NotNull String artifactId) { + public static boolean isPlugin(@NotNull MavenDomPlugin plugin, @Nullable String groupId, @NotNull String artifactId) { if (!artifactId.equals(plugin.getArtifactId().getStringValue())) return false; String pluginGroupId = plugin.getGroupId().getStringValue(); + if (groupId == null) { + return pluginGroupId == null || (pluginGroupId.equals("org.apache.maven.plugins") || pluginGroupId.equals("org.codehaus.mojo")); + } + if (pluginGroupId == null && (groupId.equals("org.apache.maven.plugins") || groupId.equals("org.codehaus.mojo"))) { return true; } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java index 60aa37b6ab8b..1daf45ba9f17 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java @@ -44,6 +44,152 @@ import java.util.Set; public class MavenDomGutterAnnotator implements Annotator { + private static void annotateDependencyUsages(@NotNull MavenDomDependency dependency, AnnotationHolder holder) { + final XmlTag tag = dependency.getXmlTag(); + if (tag == null) return; + + final Set children = MavenDomProjectProcessorUtils.searchDependencyUsages(dependency); + if (children.size() > 0) { + final NavigationGutterIconBuilder iconBuilder = + NavigationGutterIconBuilder.create(AllIcons.General.OverridenMethod, DependencyConverter.INSTANCE); + iconBuilder. + setTargets(children). + setPopupTitle(MavenDomBundle.message("navigate.parent.dependency.title")). + setCellRenderer(MyListCellRenderer.INSTANCE). + setTooltipText(MavenDomBundle.message("overriding.dependency.title")). + install(holder, dependency.getXmlTag()); + } + } + + private static void annotateManagedDependency(MavenDomDependency dependency, AnnotationHolder holder) { + final XmlTag tag = dependency.getXmlTag(); + if (tag == null) return; + + final List children = getManagingDependencies(dependency); + if (children.size() > 0) { + + final NavigationGutterIconBuilder iconBuilder = + NavigationGutterIconBuilder.create(AllIcons.General.OverridingMethod, DependencyConverter.INSTANCE); + iconBuilder. + setTargets(children). + setTooltipText(MavenDomBundle.message("overriden.dependency.title")). + install(holder, tag); + } + } + + private static List getManagingDependencies(@NotNull MavenDomDependency dependency) { + Project project = dependency.getManager().getProject(); + MavenDomDependency parentDependency = MavenDomProjectProcessorUtils.searchManagingDependency(dependency, project); + + if (parentDependency != null) { + return Collections.singletonList(parentDependency); + } + return Collections.emptyList(); + } + + public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { + if (psiElement instanceof XmlTag) { + final DomElement element = DomManager.getDomManager(psiElement.getProject()).getDomElement((XmlTag)psiElement); + if (element instanceof MavenDomDependency) { + if (element.getParentOfType(MavenDomPlugin.class, true) != null) return; + + MavenDomDependency dependency = (MavenDomDependency)element; + if (isDependencyManagementSection(dependency)) { + annotateDependencyUsages(dependency, holder); + } + else { + annotateManagedDependency(dependency, holder); + } + } + else if (element instanceof MavenDomParent) { + annotateMavenDomParent((MavenDomParent)element, holder); + } + else if (element instanceof MavenDomProjectModel) { + annotateMavenDomProjectChildren((MavenDomProjectModel)element, holder); + } + else if (element instanceof MavenDomPlugin) { + annotateMavenDomPlugin((MavenDomPlugin)element, holder); + } + } + } + + private static void annotateMavenDomPlugin(@NotNull MavenDomPlugin plugin, @NotNull AnnotationHolder holder) { + XmlTag xmlTag = plugin.getArtifactId().getXmlTag(); + if (xmlTag == null) return; + + DomElement plugins = plugin.getParent(); + if (plugins == null) return; + + DomElement parent = plugins.getParent(); + if (parent instanceof MavenDomPluginManagement) { + annotateMavenDomPluginInManagement(plugin, holder); + return; + } + + MavenDomPlugin managingPlugin = MavenDomProjectProcessorUtils.searchManagingPlugin(plugin); + + if (managingPlugin != null) { + NavigationGutterIconBuilder iconBuilder = + NavigationGutterIconBuilder.create(AllIcons.General.OverridingMethod, PluginConverter.INSTANCE); + + iconBuilder. + setTargets(Collections.singletonList(managingPlugin)). + setTooltipText(MavenDomBundle.message("overriden.plugin.title")). + install(holder, xmlTag); + } + } + + private static void annotateMavenDomPluginInManagement(@NotNull MavenDomPlugin plugin, @NotNull AnnotationHolder holder) { + XmlTag xmlTag = plugin.getArtifactId().getXmlTag(); + if (xmlTag == null) return; + + Collection children = MavenDomProjectProcessorUtils.searchManagedPluginUsages(plugin); + + if (children.size() > 0) { + NavigationGutterIconBuilder iconBuilder = + NavigationGutterIconBuilder.create(AllIcons.General.OverridenMethod, PluginConverter.INSTANCE); + + iconBuilder. + setTargets(children). + setPopupTitle(MavenDomBundle.message("navigate.parent.plugin.title")). + setCellRenderer(MyListCellRenderer.INSTANCE). + setTooltipText(MavenDomBundle.message("overriding.plugin.title")). + install(holder, xmlTag); + } + } + + + private static void annotateMavenDomParent(@NotNull MavenDomParent mavenDomParent, @NotNull AnnotationHolder holder) { + MavenDomProjectModel parent = MavenDomProjectProcessorUtils.findParent(mavenDomParent, mavenDomParent.getManager().getProject()); + + if (parent != null) { + NavigationGutterIconBuilder.create(icons.MavenIcons.ParentProject, MavenProjectConverter.INSTANCE). + setTargets(parent). + setTooltipText(MavenDomBundle.message("parent.pom.title")). + install(holder, mavenDomParent.getXmlElement()); + } + } + + private static void annotateMavenDomProjectChildren(MavenDomProjectModel model, AnnotationHolder holder) { + MavenProject mavenProject = MavenDomUtil.findProject(model); + if (mavenProject != null) { + Set children = MavenDomProjectProcessorUtils.getChildrenProjects(model); + + if (children.size() > 0) { + NavigationGutterIconBuilder.create(icons.MavenIcons.ChildrenProjects, MavenProjectConverter.INSTANCE). + setTargets(children). + setCellRenderer(MyListCellRenderer.INSTANCE). + setPopupTitle(MavenDomBundle.message("navigate.children.poms.title")). + setTooltipText(MavenDomBundle.message("children.poms.title")). + install(holder, model.getXmlElement()); + } + } + } + + private static boolean isDependencyManagementSection(@NotNull MavenDomDependency dependency) { + return dependency.getParentOfType(MavenDomDependencyManagement.class, false) != null; + } + private static class MyListCellRenderer extends PsiElementListCellRenderer { public static final MyListCellRenderer INSTANCE = new MyListCellRenderer(); @@ -91,6 +237,15 @@ public class MavenDomGutterAnnotator implements Annotator { } } + private static class PluginConverter implements NotNullFunction> { + public static final PluginConverter INSTANCE = new PluginConverter(); + + @NotNull + public Collection fun(final MavenDomPlugin pointer) { + return ContainerUtil.createMaybeSingletonList(pointer.getXmlTag()); + } + } + private static class MavenProjectConverter implements NotNullFunction> { public static final MavenProjectConverter INSTANCE = new MavenProjectConverter(); @@ -99,106 +254,4 @@ public class MavenDomGutterAnnotator implements Annotator { return ContainerUtil.createMaybeSingletonList(pointer.getXmlTag()); } } - - private static void annotateDependencyUsages(@NotNull MavenDomDependency dependency, AnnotationHolder holder) { - final XmlTag tag = dependency.getXmlTag(); - if (tag == null) return; - - final Set children = getDependencyUsages(dependency); - if (children.size() > 0) { - final NavigationGutterIconBuilder iconBuilder = - NavigationGutterIconBuilder.create(AllIcons.General.OverridenMethod, DependencyConverter.INSTANCE); - iconBuilder. - setTargets(children). - setPopupTitle(MavenDomBundle.message("navigate.parent.dependency.title")). - setCellRenderer(MyListCellRenderer.INSTANCE). - setTooltipText(MavenDomBundle.message("overriding.dependency.title")). - install(holder, dependency.getXmlTag()); - } - } - - private static void annotateManagedDependency(MavenDomDependency dependency, AnnotationHolder holder) { - final XmlTag tag = dependency.getXmlTag(); - if (tag == null) return; - - final List children = getManagingDependencies(dependency); - if (children.size() > 0) { - - final NavigationGutterIconBuilder iconBuilder = - NavigationGutterIconBuilder.create(AllIcons.General.OverridingMethod, DependencyConverter.INSTANCE); - iconBuilder. - setTargets(children). - setTooltipText(MavenDomBundle.message("overriden.dependency.title")). - install(holder, dependency.getXmlTag()); - } - } - - private static List getManagingDependencies(@NotNull MavenDomDependency dependency) { - Project project = dependency.getManager().getProject(); - MavenDomDependency parentDependency = MavenDomProjectProcessorUtils.searchManagingDependency(dependency, project); - - if (parentDependency != null) { - return Collections.singletonList(parentDependency); - } - return Collections.emptyList(); - } - - @NotNull - private static Set getDependencyUsages(@NotNull MavenDomDependency dependency) { - return MavenDomProjectProcessorUtils.searchDependencyUsages(dependency, dependency.getManager().getProject()); - } - - public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { - if (psiElement instanceof XmlTag) { - final DomElement element = DomManager.getDomManager(psiElement.getProject()).getDomElement((XmlTag)psiElement); - if (element instanceof MavenDomDependency) { - if (element.getParentOfType(MavenDomPlugin.class, true) != null) return; - - MavenDomDependency dependency = (MavenDomDependency)element; - if (isDependencyManagementSection(dependency)) { - annotateDependencyUsages(dependency, holder); - } - else { - annotateManagedDependency(dependency, holder); - } - } - else if (element instanceof MavenDomParent) { - annotateMavenDomParent((MavenDomParent)element, holder); - } - else if (element instanceof MavenDomProjectModel) { - annotateMavenDomProjectChildren((MavenDomProjectModel)element, holder); - } - } - } - - private static void annotateMavenDomParent(@NotNull MavenDomParent mavenDomParent, @NotNull AnnotationHolder holder) { - MavenDomProjectModel parent = MavenDomProjectProcessorUtils.findParent(mavenDomParent, mavenDomParent.getManager().getProject()); - - if (parent != null) { - NavigationGutterIconBuilder.create(icons.MavenIcons.ParentProject, MavenProjectConverter.INSTANCE). - setTargets(parent). - setTooltipText(MavenDomBundle.message("parent.pom.title")). - install(holder, mavenDomParent.getXmlElement()); - } - } - - private static void annotateMavenDomProjectChildren(MavenDomProjectModel model, AnnotationHolder holder) { - MavenProject mavenProject = MavenDomUtil.findProject(model); - if (mavenProject != null) { - Set children = MavenDomProjectProcessorUtils.getChildrenProjects(model); - - if (children.size() > 0) { - NavigationGutterIconBuilder.create(icons.MavenIcons.ChildrenProjects, MavenProjectConverter.INSTANCE). - setTargets(children). - setCellRenderer(MyListCellRenderer.INSTANCE). - setPopupTitle(MavenDomBundle.message("navigate.children.poms.title")). - setTooltipText(MavenDomBundle.message("children.poms.title")). - install(holder, model.getXmlElement()); - } - } - } - - private static boolean isDependencyManagementSection(@NotNull MavenDomDependency dependency) { - return dependency.getParentOfType(MavenDomDependencyManagement.class, false) != null; - } } diff --git a/plugins/maven/src/main/resources/MavenDomBundle.properties b/plugins/maven/src/main/resources/MavenDomBundle.properties index b33e9186e551..2b10fb8080d7 100644 --- a/plugins/maven/src/main/resources/MavenDomBundle.properties +++ b/plugins/maven/src/main/resources/MavenDomBundle.properties @@ -19,8 +19,11 @@ generate.repository.template=Repository Template generate.parent=Parent overriden.dependency.title=Navigate to Managing Dependency +overriden.plugin.title=Navigate to 'pluginManagement' section overriding.dependency.title=Navigate to Dependency Usages +overriding.plugin.title=Navigate to Plugin Usages navigate.parent.dependency.title=Choose Dependency to Navigate to +navigate.parent.plugin.title=Choose Plugin to Navigate to parent.pom.title=Navigate to Parent children.poms.title=Navigate to Children Projects diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomAnnotatorTest.groovy b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomAnnotatorTest.groovy new file mode 100644 index 000000000000..28dbf7cc4eec --- /dev/null +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomAnnotatorTest.groovy @@ -0,0 +1,76 @@ +package org.jetbrains.idea.maven.dom + +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.PsiFile +import com.intellij.psi.PsiManager +import com.intellij.util.containers.ContainerUtil + +/** + * @author Sergey Evdokimov + */ +class MavenDomAnnotatorTest extends MavenDomTestCase { + + public void testAnnotatePlugin() { + def modulePom = createModulePom("m", """ + + test + project + 1 + + m + + + + + maven-compiler-plugin + + + +""") + + importProject(""" +test +project +1 + + + m + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + +""") + + checkGutters(PsiManager.getInstance(myProject).findFile(modulePom), "maven-compiler-plugin", """ + test + project + 1 +""") + } + + protected void checkGutters(PsiFile file, String ... expectedProperties) { + myFixture.configureFromExistingVirtualFile(file.virtualFile); + + String text = file.getText(); + + Set actualProperties = new HashSet(); + + for (com.intellij.codeInsight.daemon.impl.HighlightInfo h : myFixture.doHighlighting()) { + if (h.getGutterIconRenderer() != null) { + String s = text.substring(h.getStartOffset(), h.getEndOffset()); + actualProperties.add(s); + } + } + + assertEquals(ContainerUtil.newHashSet(expectedProperties), actualProperties); + } + +}