use of com.intellij.uiDesigner.ErrorInfo in project intellij-community by JetBrains.
the class PropertyInspectorTable method getErrorForRow.
/**
* @return first error for the property at the specified row. If component doesn't contain
* any error then the method returns <code>null</code>.
*/
@Nullable
private String getErrorForRow(final int row) {
LOG.assertTrue(row < myProperties.size());
final ErrorInfo errorInfo = getErrorInfoForRow(row);
return errorInfo != null ? errorInfo.myDescription : null;
}
use of com.intellij.uiDesigner.ErrorInfo in project intellij-community by JetBrains.
the class FormEditorErrorCollector method addError.
public void addError(@NotNull final String inspectionId, final IComponent component, @Nullable IProperty prop, @NotNull String errorMessage, EditorQuickFixProvider... editorQuickFixProviders) {
if (myResults == null) {
myResults = new ArrayList<>();
}
List<QuickFix> quickFixes = new ArrayList<>();
for (EditorQuickFixProvider provider : editorQuickFixProviders) {
if (provider != null) {
quickFixes.add(provider.createQuickFix(myEditor, myComponent));
}
}
final ErrorInfo errorInfo = new ErrorInfo(myComponent, prop == null ? null : prop.getName(), errorMessage, myProfile.getErrorLevel(HighlightDisplayKey.find(inspectionId), myFormPsiFile), quickFixes.toArray(new QuickFix[quickFixes.size()]));
errorInfo.setInspectionId(inspectionId);
myResults.add(errorInfo);
}
use of com.intellij.uiDesigner.ErrorInfo in project intellij-community by JetBrains.
the class PropertyInspectorTable method getErrorInfoForRow.
@Nullable
ErrorInfo getErrorInfoForRow(final int row) {
LOG.assertTrue(row < myProperties.size());
if (mySelection.size() != 1) {
return null;
}
RadComponent component = mySelection.get(0);
final Property property = myProperties.get(row);
ErrorInfo errorInfo = null;
if (myClassToBindProperty.equals(property)) {
errorInfo = (ErrorInfo) component.getClientProperty(ErrorAnalyzer.CLIENT_PROP_CLASS_TO_BIND_ERROR);
} else if (myBindingProperty.equals(property)) {
errorInfo = (ErrorInfo) component.getClientProperty(ErrorAnalyzer.CLIENT_PROP_BINDING_ERROR);
} else {
//noinspection unchecked
ArrayList<ErrorInfo> errors = (ArrayList<ErrorInfo>) component.getClientProperty(ErrorAnalyzer.CLIENT_PROP_ERROR_ARRAY);
if (errors != null) {
for (ErrorInfo err : errors) {
if (property.getName().equals(err.getPropertyName())) {
errorInfo = err;
break;
}
}
}
}
return errorInfo;
}
use of com.intellij.uiDesigner.ErrorInfo in project intellij-community by JetBrains.
the class QuickFixManagerImpl method getErrorInfos.
@NotNull
public ErrorInfo[] getErrorInfos() {
final int selectedRow = myComponent.getSelectedRow();
if (selectedRow < 0 || selectedRow >= myComponent.getRowCount()) {
return ErrorInfo.EMPTY_ARRAY;
}
final ErrorInfo info = myComponent.getErrorInfoForRow(selectedRow);
if (info != null) {
return new ErrorInfo[] { info };
}
return ErrorInfo.EMPTY_ARRAY;
}
use of com.intellij.uiDesigner.ErrorInfo in project intellij-community by JetBrains.
the class QuickFixManager method showIntentionPopup.
final void showIntentionPopup() {
LOG.debug("showIntentionPopup()");
if (myHint == null || !myHint.isVisible()) {
return;
}
final ErrorInfo[] errorInfos = getErrorInfos();
if (!haveFixes(errorInfos)) {
return;
}
final ArrayList<ErrorWithFix> fixList = new ArrayList<>();
for (ErrorInfo errorInfo : errorInfos) {
final QuickFix[] quickFixes = errorInfo.myFixes;
if (quickFixes.length > 0) {
for (QuickFix fix : quickFixes) {
fixList.add(new ErrorWithFix(errorInfo, fix));
}
} else if (errorInfo.getInspectionId() != null) {
buildSuppressFixes(errorInfo, fixList, true);
}
}
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new QuickFixPopupStep(fixList, true));
popup.showUnderneathOf(myHint.getComponent());
}
Aggregations