Problem disabling inspections & Problem when using the table/grid GUI element

Hello,

I have two questions regarding a plugin  I have written - Maybe someone can give me a tip how to find a solution.

1) Currently, the code inspection of the plugin cannot be disabled for lines / functions / classes. For example in the following snippet, the warnings are still shown:

# noinspection CustomInspectionsInspector 
class wrongClassName:
def wrongFuncName(self):
pass

Internally, the plugin verifies the code using regex and returns an array of ProblemDescriptors. Is there any way, to request the areas of code where an inspection is not applied, so I could filter the list of ProblemDescriptors? Below is a very simplified example code that may make it clearer:

public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { 
Array doNotInspectOnLines = api.openApi.xyz();
Array problems = findProblemsInFile(file)
return filterProblems(problems, doNotInspectOnLines)
}


2) With the plugin, the user can write custom inspections using regular expressions. The plugin is configured using a table similar to the one of the webbrowsers-settings, supporting inline editing for each cell.


Here I have one and a half problem:
The half problem occurs when editing the cell: The new value is applied only when the cell looses its focus. But if I close the settings dialog using the "OK" button, at first the current settings are saved, and after that the cell gets the focus lost event. This means, that the changes made in the currently focused cell are not applied. Technically, the setValue function of EditableColumnInfo object is called after the settings have already been saved. I have workarounded this issue by creating a custom cell renderer and saving the plugin's settings on each key press. Is there a better way to solve this problem?
By the way, it also occurs for the webbrowsers settings, e.g. when editing a browser's name and hitting the "OK" button while the cell is still focused.

The one problem: At the moment, I verify the user's regular expressions in the apply() method of my configurable. This is called when closing the settings dialog using the OK button. If there is a syntactically wrong expression in a cell, I show a modal dialog telling the user that something is wrong. Currently, I throw an explicit exception at that place to prevent the settings dialog from closing. This exception is visible in the event log of the IDE. So the user typically sees the exception twice - once in the modal dialog and another one if he closed the settings dialog and checks his log (by clicking the blinking red (!) in the status bar). Is there any way to prevent the settings dialog from being closed without throwing an exception?

Thank you in advance and best regards

Please sign in to leave a comment.