public static void updateStringPropertyValue(GuiEditor editor, RadComponent component, IntroStringProperty prop, StringDescriptor descriptor, String result) { if (descriptor.getBundleName() == null) { prop.setValueEx(component, StringDescriptor.create(result)); } else { final String newKeyName = StringEditorDialog.saveModifiedPropertyValue(editor.getModule(), descriptor, editor.getStringDescriptorLocale(), result, editor.getPsiFile()); if (newKeyName != null) { prop.setValueEx(component, new StringDescriptor(descriptor.getBundleName(), newKeyName)); } } editor.refreshAndSave(false); }
private void refreshProperties() { final Ref<Boolean> anythingModified = new Ref<Boolean>(); FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() { public boolean visit(final IComponent component) { final RadComponent radComponent = (RadComponent)component; boolean componentModified = false; for (IProperty prop : component.getModifiedProperties()) { if (prop instanceof IntroStringProperty) { IntroStringProperty strProp = (IntroStringProperty)prop; componentModified = strProp.refreshValue(radComponent) || componentModified; } } if (component instanceof RadContainer) { componentModified = ((RadContainer)component).updateBorder() || componentModified; } if (component.getParentContainer() instanceof RadTabbedPane) { componentModified = ((RadTabbedPane)component.getParentContainer()).refreshChildTitle(radComponent) || componentModified; } if (componentModified) { anythingModified.set(Boolean.TRUE); } return true; } }); if (!anythingModified.isNull()) { refresh(); DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this); ComponentTree tree = designerToolWindow.getComponentTree(); if (tree != null) tree.repaint(); PropertyInspector inspector = designerToolWindow.getPropertyInspector(); if (inspector != null) inspector.synchWithTree(true); } }
public void run() { IProperty textProperty = FormInspectionUtil.findProperty(myComponent, SwingProperties.TEXT); StringDescriptor descriptor = (StringDescriptor) textProperty.getPropertyValue(myComponent); String value = StringDescriptorManager.getInstance(myComponent.getModule()).resolve(myComponent, descriptor); String[] variants = fillMnemonicVariants(SupportCode.parseText(value).myText); String result = Messages.showEditableChooseDialog(UIDesignerBundle.message("inspection.missing.mnemonics.quickfix.prompt"), UIDesignerBundle.message("inspection.missing.mnemonics.quickfix.title"), Messages.getQuestionIcon(), variants, variants [0], null); if (result != null) { if (!myEditor.ensureEditable()) { return; } FormInspectionUtil.updateStringPropertyValue(myEditor, myComponent, (IntroStringProperty)textProperty, descriptor, result); } }
private void refreshProperties() { final Ref<Boolean> anythingModified = new Ref<Boolean>(); FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() { public boolean visit(final IComponent component) { final RadComponent radComponent = (RadComponent)component; boolean componentModified = false; for (IProperty prop : component.getModifiedProperties()) { if (prop instanceof IntroStringProperty) { IntroStringProperty strProp = (IntroStringProperty)prop; componentModified = strProp.refreshValue(radComponent) || componentModified; } } if (component instanceof RadContainer) { componentModified = ((RadContainer)component).updateBorder() || componentModified; } if (component.getParentContainer() instanceof RadTabbedPane) { componentModified = ((RadTabbedPane)component.getParentContainer()).refreshChildTitle(radComponent) || componentModified; } if (componentModified) { anythingModified.set(Boolean.TRUE); } return true; } }); if (!anythingModified.isNull()) { refresh(); final UIDesignerToolWindowManager twm = UIDesignerToolWindowManager.getInstance(getProject()); twm.getComponentTree().repaint(); twm.getPropertyInspector().synchWithTree(true); } }
private void refreshProperties() { final Ref<Boolean> anythingModified = new Ref<Boolean>(); FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() { @Override public boolean visit(final IComponent component) { final RadComponent radComponent = (RadComponent) component; boolean componentModified = false; for(IProperty prop : component.getModifiedProperties()) { if(prop instanceof IntroStringProperty) { IntroStringProperty strProp = (IntroStringProperty) prop; componentModified = strProp.refreshValue(radComponent) || componentModified; } } if(component instanceof RadContainer) { componentModified = ((RadContainer) component).updateBorder() || componentModified; } if(component.getParentContainer() instanceof RadTabbedPane) { componentModified = ((RadTabbedPane) component.getParentContainer()).refreshChildTitle(radComponent) || componentModified; } if(componentModified) { anythingModified.set(Boolean.TRUE); } return true; } }); if(!anythingModified.isNull()) { refresh(); DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this); ComponentTree tree = designerToolWindow.getComponentTree(); if(tree != null) { tree.repaint(); } PropertyInspector inspector = designerToolWindow.getPropertyInspector(); if(inspector != null) { inspector.synchWithTree(true); } } }