Search in sources :

Example 1 with EditorQuickFixProvider

use of com.intellij.uiDesigner.inspections.EditorQuickFixProvider in project intellij-community by JetBrains.

the class I18nFormInspection method checkStringDescriptor.

@Override
protected void checkStringDescriptor(final Module module, final IComponent component, final IProperty prop, final StringDescriptor descriptor, final FormErrorCollector collector) {
    if (isHardCodedStringDescriptor(descriptor)) {
        if (isPropertyDescriptor(prop)) {
            if (isSetterNonNls(module.getProject(), GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module), component.getComponentClassName(), prop.getName())) {
                return;
            }
        }
        EditorQuickFixProvider provider;
        if (prop.getName().equals(BorderProperty.NAME)) {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeFormBorderQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.border.title"), (RadContainer) component);
                }
            };
        } else if (prop.getName().equals(ITabbedPane.TAB_TITLE_PROPERTY) || prop.getName().equals(ITabbedPane.TAB_TOOLTIP_PROPERTY)) {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeTabTitleQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.tab.title", prop.getName()), component, prop.getName());
                }
            };
        } else {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeFormPropertyQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.property", prop.getName()), component, (IntrospectedProperty) prop);
                }
            };
        }
        collector.addError(getID(), component, prop, UIDesignerBundle.message("inspection.i18n.message.in.form", descriptor.getValue()), provider);
    }
}
Also used : QuickFix(com.intellij.uiDesigner.quickFixes.QuickFix) EditorQuickFixProvider(com.intellij.uiDesigner.inspections.EditorQuickFixProvider) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Aggregations

GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)1 EditorQuickFixProvider (com.intellij.uiDesigner.inspections.EditorQuickFixProvider)1 QuickFix (com.intellij.uiDesigner.quickFixes.QuickFix)1 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)1 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)1