boolean (final GuiEditor editor, final String serializedComponents, final IntList xs, final IntList ys, final ArrayList<? super RadComponent> componentsToPaste) { final PsiPropertiesProvider provider = new PsiPropertiesProvider(editor.getModule()); try { //noinspection HardCodedStringLiteral final Document document = SAX_BUILDER.build(new StringReader(serializedComponents), "UTF-8"); final Element rootElement = document.getRootElement(); if (!rootElement.getName().equals(ELEMENT_SERIALIZED)) { return false; } final List children = rootElement.getChildren(); for (final Object aChildren : children) { final Element e = (Element)aChildren; // we need to add component to a container in order to read them final LwContainer container = new LwContainer(JPanel.class.getName()); final String parentLayout = e.getAttributeValue(ATTRIBUTE_PARENT_LAYOUT); if (parentLayout != null) { container.setLayoutManager(parentLayout); } final int x = Integer.parseInt(e.getAttributeValue(ATTRIBUTE_X)); final int y = Integer.parseInt(e.getAttributeValue(ATTRIBUTE_Y)); xs.add(x); ys.add(y); final Element componentElement = e.getChildren().get(0); final LwComponent lwComponent = LwContainer.createComponentFromTag(componentElement); container.addComponent(lwComponent); lwComponent.read(componentElement, provider); // pasted components should have no bindings FormEditingUtil.iterate(lwComponent, new FormEditingUtil.ComponentVisitor<LwComponent>() { @Override public boolean visit(final LwComponent c) { if (c.getBinding() != null && FormEditingUtil.findComponentWithBinding(editor.getRootContainer(), c.getBinding()) != null) { c.setBinding(null); } c.setId(FormEditingUtil.generateId(editor.getRootContainer())); return true; } }); final ClassLoader loader = LoaderFactory.getInstance(editor.getProject()).getLoader(editor.getFile()); final RadComponent radComponent = XmlReader.createComponent(editor, lwComponent, loader, editor.getStringDescriptorLocale()); componentsToPaste.add(radComponent); } } catch (Exception e) { return false; } return true; }