void (String ns, final List<? extends XmlTag> tags, final List<? extends XmlAttribute> attrs, Project project) { final int localNameIndex = ns.length() + 1; final int totalCount = tags.size() + attrs.size(); final SequentialModalProgressTask progressTask = new SequentialModalProgressTask( project, XmlBundle.message("xml.progress.changing.to.default.namespace"), true); progressTask.setTask(new SequentialTask() { int tagIndex = 0; int attrIndex = 0; @Override public boolean isDone() { return tagIndex + attrIndex >= totalCount; } @Override public boolean iteration() { progressTask.getIndicator().setFraction(((double)(tagIndex + attrIndex)) / totalCount); ApplicationManager.getApplication().runWriteAction(() -> { if (tagIndex < tags.size()) { XmlTag tag = tags.get(tagIndex++); final String s = tag.getName().substring(localNameIndex); if (!s.isEmpty()) { tag.setName(s); } } else if (attrIndex < attrs.size()) { XmlAttribute attr = attrs.get(attrIndex++); //noinspection ConstantConditions attr.setValue(attr.getValue().substring(localNameIndex)); } }); return isDone(); } }); ProgressManager.getInstance().run(progressTask); }