use of com.intellij.lang.properties.editor.inspections.ResourceBundleEditorProblemDescriptor in project intellij-community by JetBrains.
the class UnusedPropertyInspection method buildPropertyGroupVisitor.
@NotNull
@Override
public Function<IProperty[], ResourceBundleEditorProblemDescriptor[]> buildPropertyGroupVisitor(@NotNull ResourceBundle resourceBundle) {
final Module module = ModuleUtilCore.findModuleForPsiElement(resourceBundle.getDefaultPropertiesFile().getContainingFile());
if (module == null)
return x -> null;
final UnusedPropertiesSearchHelper helper = new UnusedPropertiesSearchHelper(module);
return properties -> !isPropertyUsed((Property) properties[0], helper, true) ? new ResourceBundleEditorProblemDescriptor[] { new ResourceBundleEditorProblemDescriptor(ProblemHighlightType.LIKE_UNUSED_SYMBOL, PropertiesBundle.message("unused.property.problem.descriptor.name"), new RemovePropertiesFromAllLocalesFix((Property) properties[0])) } : null;
}
use of com.intellij.lang.properties.editor.inspections.ResourceBundleEditorProblemDescriptor in project intellij-community by JetBrains.
the class ResourceBundleEditorShowQuickFixesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final ResourceBundleEditor editor = getEditor(e);
LOG.assertTrue(editor != null);
final ResourceBundlePropertyStructureViewElement element = (ResourceBundlePropertyStructureViewElement) editor.getSelectedElementIfOnlyOne();
LOG.assertTrue(element != null);
final PsiFile file = editor.getResourceBundle().getDefaultPropertiesFile().getContainingFile();
final ShowIntentionsPass.IntentionsInfo intentions = new ShowIntentionsPass.IntentionsInfo();
boolean isQuickFixListEmpty = true;
Pair<ResourceBundleEditorProblemDescriptor, HighlightDisplayKey>[] descriptorsAndSources = element.getProblemDescriptors();
for (Pair<ResourceBundleEditorProblemDescriptor, HighlightDisplayKey> p : descriptorsAndSources) {
final ResourceBundleEditorProblemDescriptor d = p.getFirst();
final HighlightDisplayKey sourceKey = p.getSecond();
QuickFix[] fixes = d.getFixes();
if (fixes != null) {
for (int i = 0; i < fixes.length; i++) {
intentions.inspectionFixesToShow.add(new HighlightInfo.IntentionActionDescriptor(new RBEQuickFixWrapper(d, i), null, null, AllIcons.Actions.IntentionBulb, sourceKey, null, null));
isQuickFixListEmpty = false;
}
}
}
if (isQuickFixListEmpty) {
return;
}
final Project project = e.getProject();
LOG.assertTrue(project != null);
JBPopupFactory.getInstance().createListPopup(new IntentionListStep(null, intentions, null, file, project)).showInBestPositionFor(e.getDataContext());
}
Aggregations