diff -r b1ea782bd20d iep.editor/nbproject/project.xml --- a/iep.editor/nbproject/project.xml Mon May 17 23:32:11 2010 +0400 +++ b/iep.editor/nbproject/project.xml Tue May 18 19:08:07 2010 +0400 @@ -77,6 +77,15 @@ + org.netbeans.modules.project.ant + + + + 1 + 1.12.1 + + + org.netbeans.modules.projectapi @@ -86,15 +95,6 @@ - org.netbeans.modules.project.ant - - - - 1 - 1.12.1 - - - org.netbeans.modules.projectuiapi @@ -104,6 +104,14 @@ + org.netbeans.modules.refactoring.api + + + + 1.0 + + + org.netbeans.modules.soa.reportgenerator @@ -128,6 +136,14 @@ + org.netbeans.modules.xml.misc + + + + 6.9 + + + org.netbeans.modules.xml.retriever @@ -163,14 +179,6 @@ - org.netbeans.modules.xml.misc - - - - 6.9 - - - org.netbeans.modules.xml.wsdl.model @@ -185,7 +193,7 @@ 1 - 1.2 + 1.10.1 @@ -311,22 +319,6 @@ 6.5.1 - - org.netbeans.modules.refactoring.api - - - - 1.0 - - - diff -r b1ea782bd20d iep.editor/src/org/netbeans/modules/iep/model/impl/IEPModelImpl.java --- a/iep.editor/src/org/netbeans/modules/iep/model/impl/IEPModelImpl.java Mon May 17 23:32:11 2010 +0400 +++ b/iep.editor/src/org/netbeans/modules/iep/model/impl/IEPModelImpl.java Tue May 18 19:08:07 2010 +0400 @@ -92,8 +92,9 @@ } @Override - public ChangeInfo prepareChangeInfo(List pathToRoot) { - ChangeInfo change = super.prepareChangeInfo(pathToRoot); + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { + ChangeInfo change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); DocumentComponent parentComponent = findComponent(change.getRootToParentPath()); if (parentComponent == null) { return change; diff -r b1ea782bd20d websvc.rest.wadl.model/nbproject/project.xml --- a/websvc.rest.wadl.model/nbproject/project.xml Mon May 17 23:32:11 2010 +0400 +++ b/websvc.rest.wadl.model/nbproject/project.xml Tue May 18 19:08:07 2010 +0400 @@ -20,7 +20,7 @@ 1 - 1.4 + 1.10.1 diff -r b1ea782bd20d websvc.rest.wadl.model/src/org/netbeans/modules/websvc/rest/wadl/model/impl/WadlModelImpl.java --- a/websvc.rest.wadl.model/src/org/netbeans/modules/websvc/rest/wadl/model/impl/WadlModelImpl.java Mon May 17 23:32:11 2010 +0400 +++ b/websvc.rest.wadl.model/src/org/netbeans/modules/websvc/rest/wadl/model/impl/WadlModelImpl.java Tue May 18 19:08:07 2010 +0400 @@ -263,8 +263,10 @@ return getElementRegistry().getKnownElementNames(); } - public ChangeInfo prepareChangeInfo(List pathToRoot) { - ChangeInfo change = super.prepareChangeInfo(pathToRoot); + @Override + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { + ChangeInfo change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); DocumentComponent parentComponent = findComponent(change.getRootToParentPath()); if (parentComponent == null) { return change; @@ -272,7 +274,7 @@ if (! (parentComponent.getModel() instanceof WadlModel)) { getElementRegistry().addEmbeddedModelQNames((AbstractDocumentModel)parentComponent.getModel()); - change = super.prepareChangeInfo(pathToRoot); + change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); } else if (isDomainElement(parentComponent.getPeer()) && ! change.isDomainElement() && change.getChangedElement() != null) { diff -r b1ea782bd20d wlm.model/nbproject/project.xml --- a/wlm.model/nbproject/project.xml Mon May 17 23:32:11 2010 +0400 +++ b/wlm.model/nbproject/project.xml Tue May 18 19:08:07 2010 +0400 @@ -31,6 +31,14 @@ + org.netbeans.modules.xml.misc + + + + 6.9 + + + org.netbeans.modules.xml.schema.model @@ -52,6 +60,7 @@ 1 + 1.10.1 @@ -102,14 +111,6 @@ 8.0 - - org.netbeans.modules.xml.misc - - - - 6.9 - - diff -r b1ea782bd20d wlm.model/src/org/netbeans/modules/wlm/model/impl/WLMModelImpl.java --- a/wlm.model/src/org/netbeans/modules/wlm/model/impl/WLMModelImpl.java Mon May 17 23:32:11 2010 +0400 +++ b/wlm.model/src/org/netbeans/modules/wlm/model/impl/WLMModelImpl.java Tue May 18 19:08:07 2010 +0400 @@ -153,8 +153,9 @@ } @Override - public ChangeInfo prepareChangeInfo(List pathToRoot) { - ChangeInfo change = super.prepareChangeInfo(pathToRoot); + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { + ChangeInfo change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); DocumentComponent parentComponent = findComponent(change.getRootToParentPath()); if (parentComponent == null) { return change; diff -r b1ea782bd20d xml.wsdl.model/src/org/netbeans/modules/xml/wsdl/model/impl/WSDLModelImpl.java --- a/xml.wsdl.model/src/org/netbeans/modules/xml/wsdl/model/impl/WSDLModelImpl.java Mon May 17 23:32:11 2010 +0400 +++ b/xml.wsdl.model/src/org/netbeans/modules/xml/wsdl/model/impl/WSDLModelImpl.java Tue May 18 19:08:07 2010 +0400 @@ -89,7 +89,8 @@ super(source); wcf = new WSDLComponentFactoryImpl(this); } - + + @Override public WSDLComponent createRootComponent(Element root) { DefinitionsImpl newDefinitions = null; QName q = root == null ? null : AbstractDocumentComponent.getQName(root); @@ -102,19 +103,23 @@ return getDefinitions(); } - + + @Override public WSDLComponent getRootComponent() { return definitions; } - + + @Override public WSDLComponent createComponent(WSDLComponent parent, Element element) { return getFactory().create(element, parent); } - + + @Override protected ComponentUpdater getComponentUpdater() { return new ChildComponentUpdateVisitor(); } - + + @Override public WSDLComponentFactory getFactory() { return wcf; } @@ -123,7 +128,8 @@ assert (def instanceof DefinitionsImpl) ; definitions = DefinitionsImpl.class.cast(def); } - + + @Override public Definitions getDefinitions(){ return definitions; } @@ -176,7 +182,8 @@ } return ret; } - + + @Override public List findWSDLModel(String namespace) { if (namespace == null) { return Collections.emptyList(); @@ -195,6 +202,7 @@ return ret; } + @Override public List findSchemas(String namespace) { List ret = new ArrayList(); for (SchemaModel sm : getEmbeddedSchemaModels()) { @@ -226,10 +234,12 @@ return null; } + @Override public T findComponentByName(String name, Class type) { return type.cast(new FindReferencedVisitor(getDefinitions()).find(name, type)); } - + + @Override public T findComponentByName(QName name, Class type) { String namespace = name.getNamespaceURI(); if (namespace == null) { @@ -245,16 +255,20 @@ return null; } + @Override public Set getQNames() { return getElementRegistry().getKnownQNames(); } + @Override public Set getElementNames() { return getElementRegistry().getKnownElementNames(); } - public ChangeInfo prepareChangeInfo(List pathToRoot) { - ChangeInfo change = super.prepareChangeInfo(pathToRoot); + @Override + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { + ChangeInfo change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); DocumentComponent parentComponent = findComponent(change.getRootToParentPath()); if (parentComponent == null) { return change; @@ -262,10 +276,17 @@ if (! (parentComponent.getModel() instanceof WSDLModel)) { getElementRegistry().addEmbeddedModelQNames((AbstractDocumentModel)parentComponent.getModel()); - change = super.prepareChangeInfo(pathToRoot); + // Run preparation again because after registration a new model, + // the set of QNames can be changed. + // + // TODO: Optimization: addEmbeddedModelQNames() has to return a flag which indicates if + // a new QNames was added. It's not necessary to do preparation again if the set + // isn't changed and parentComponent can be speficied to get rid of repeated call of findComponent() + change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); } else if (isDomainElement(parentComponent.getPeer()) && ! change.isDomainElement() && change.getChangedElement() != null) { + // TODO: Sort out with the use-case of this code. if (change.getOtherNonDomainElementNodes() == null || change.getOtherNonDomainElementNodes().isEmpty()) { @@ -288,7 +309,8 @@ } return change; } - + + @Override public SyncUnit prepareSyncUnit(ChangeInfo changes, SyncUnit unit) { unit = super.prepareSyncUnit(changes, unit); if (unit != null) { @@ -296,7 +318,8 @@ } return null; } - + + @Override public AbstractDocumentComponent findComponent( AbstractDocumentComponent current, List pathFromRoot, diff -r b1ea782bd20d xml.xam/apichanges.xml --- a/xml.xam/apichanges.xml Mon May 17 23:32:11 2010 +0400 +++ b/xml.xam/apichanges.xml Tue May 18 19:08:07 2010 +0400 @@ -104,6 +104,25 @@ + + + Method AbstractDocumentModel.prepareChangeInfo() is replaced with a new one. + + + + + + The modufication is necessary for fixing issue #166177. + The old method {@link org.netbeans.modules.xml.xam.dom.AbstractDocumentModel#prepareChangeInfo(java.util.List)} + is marked as deprecated and a new one {@link org.netbeans.modules.xml.xam.dom.AbstractDocumentModel#prepareChangeInfo(java.util.List, java.util.List)} is created. + The new one contains additional parameter nsContextPathToRoot, which + is necessary for correct calculation of namespace context after + deletion of namespace prefix. See the issue for details. + + + + + Two new methods to enhance model's performance diff -r b1ea782bd20d xml.xam/nbproject/project.properties --- a/xml.xam/nbproject/project.properties Mon May 17 23:32:11 2010 +0400 +++ b/xml.xam/nbproject/project.properties Tue May 18 19:08:07 2010 +0400 @@ -43,4 +43,4 @@ javac.source=1.6 javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=1.10.0 +spec.version.base=1.10.1 diff -r b1ea782bd20d xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java Mon May 17 23:32:11 2010 +0400 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java Tue May 18 19:08:07 2010 +0400 @@ -225,13 +225,38 @@ } /** - * Performs preparation stage of synchronization XDM --> XAM. * - * Be aware that the method isn't only called from XDM (XDMListener), - * but it also can be redifined. An example can be found in WSDL Model. + * @param pathToRoot + * @return + * @deprecated Use {@link org.netbeans.modules.xml.xam.dom.AbstractDocumentModel#prepareChangeInfo(java.util.List, java.util.List)} instead. It is necessary for fixing bug #166177. * */ public ChangeInfo prepareChangeInfo(List pathToRoot) { + return prepareChangeInfo(pathToRoot, pathToRoot); + } + + + /** + * Performs intermediate stage of synchronization XDM --> XAM. + * A new {@link org.netbeans.modules.xml.xam.dom.ChangeInfo} object + * is generated here. + * + * @param pathToRoot a path of DOM objects from root to changed one. + * @param nsContextPathToRoot Usually the same path as previous param, + * but in case of deletion it contains the same path from old model's tree. + * It is required in case of prefix declaration deletion, because the deleted + * declaration is present only in old model's tree. + * + * Be aware that the method is designed to be called only from XDM + * {@link org.netbeans.modules.xml.xdm.xam.XDMListener}, + * but it also can be redifined. An example can be found in + * {@link org.netbeans.modules.xml.wsdl.model.WSDLModel}. + * + * @since 1.10.1 + * + */ + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { // we already handle change on root before enter here if (pathToRoot.size() < 1) { throw new IllegalArgumentException("pathToRoot here should be at least 1"); @@ -261,7 +286,7 @@ } QName currentQName = new QName(getAccess().lookupNamespaceURI( - current, pathToRoot), current.getLocalName()); + current, nsContextPathToRoot), current.getLocalName()); if (!(qnames.contains(currentQName))) { changedIsDomainElement = false; break; @@ -288,7 +313,8 @@ } } - return new ChangeInfo(parent, current, changedIsDomainElement, rootToParent, otherNodes); + return new ChangeInfo(parent, current, changedIsDomainElement, + rootToParent, otherNodes); } public SyncUnit prepareSyncUnit(ChangeInfo change, SyncUnit order) { diff -r b1ea782bd20d xml.xdm/nbproject/project.xml --- a/xml.xdm/nbproject/project.xml Mon May 17 23:32:11 2010 +0400 +++ b/xml.xdm/nbproject/project.xml Tue May 18 19:08:07 2010 +0400 @@ -87,7 +87,7 @@ 1 - 1.1 + 1.10.1 diff -r b1ea782bd20d xml.xdm/src/org/netbeans/modules/xml/xdm/xam/XDMListener.java --- a/xml.xdm/src/org/netbeans/modules/xml/xdm/xam/XDMListener.java Mon May 17 23:32:11 2010 +0400 +++ b/xml.xdm/src/org/netbeans/modules/xml/xdm/xam/XDMListener.java Tue May 18 19:08:07 2010 +0400 @@ -48,8 +48,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import javax.xml.namespace.QName; import org.netbeans.modules.xml.xam.Component; import org.netbeans.modules.xml.xam.Model; import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent; @@ -182,9 +180,7 @@ assert namespacePathToRoot.size() == pathToRoot.size(); } // - ChangeInfo change = model.prepareChangeInfo(pathToRoot); - // Rollback fix for issue #166177 because it causes issue #186068 - // ChangeInfo change = prepareChangeInfo(pathToRoot, namespacePathToRoot); + ChangeInfo change = model.prepareChangeInfo(pathToRoot, namespacePathToRoot); change.setAdded(isAdded); processChange(change); } @@ -266,67 +262,4 @@ return domNodes; } - // This method isn't used after fix for issue #166177 rolled back - protected ChangeInfo prepareChangeInfo(List pathToRoot, - List nsContextPathToRoot) { - // we already handle change on root before enter here - if (pathToRoot.size() < 1) { - throw new IllegalArgumentException("pathToRoot here should be at least 1"); - } - if (pathToRoot.get(pathToRoot.size()-1) instanceof Document) { - pathToRoot.remove(pathToRoot.size()-1); - } - - if (pathToRoot.size() < 2) { - throw new IllegalArgumentException("pathToRoot here should be at least 2"); - } - // - org.w3c.dom.Node current = null; - org.w3c.dom.Element parent = null; - boolean changedIsDomainElement = true; - Set qnames = model.getQNames(); - if (qnames != null && qnames.size() > 0) { - for (int i=pathToRoot.size()-1; i>=0; i--) { - // - Node n = pathToRoot.get(i); - parent = (Element)current; - current = n; - // - if (! (n instanceof Element)) { - changedIsDomainElement = false; - break; - } - - QName currentQName = new QName(model.getAccess().lookupNamespaceURI( - current, nsContextPathToRoot), current.getLocalName()); - if (!(qnames.contains(currentQName))) { - changedIsDomainElement = false; - break; - } - } - } else { - current = pathToRoot.get(0); - parent = (org.w3c.dom.Element) pathToRoot.get(1); - changedIsDomainElement = current instanceof org.w3c.dom.Element; - } - - List rootToParent = new ArrayList(); - if (parent != null) { - for (int i = pathToRoot.indexOf(parent); i otherNodes = new ArrayList(); - if (parent != null) { - int iCurrent = pathToRoot.indexOf(current); - for (int i=0; i < iCurrent; i++) { - otherNodes.add(0, pathToRoot.get(i)); - } - } - - return new ChangeInfo(parent, current, changedIsDomainElement, - rootToParent, otherNodes); - } - } diff -r b1ea782bd20d xslt.model/nbproject/project.xml --- a/xslt.model/nbproject/project.xml Mon May 17 23:32:11 2010 +0400 +++ b/xslt.model/nbproject/project.xml Tue May 18 19:08:07 2010 +0400 @@ -24,11 +24,20 @@ org.netbeans.modules.xslt.model + org.netbeans.modules.xml.schema.model + + + + 1 + + + org.netbeans.modules.xml.xam 1 + 1.10.1 @@ -47,14 +56,6 @@ 8.0 - - org.netbeans.modules.xml.schema.model - - - - 1 - - org.netbeans.modules.xslt.core diff -r b1ea782bd20d xslt.model/src/org/netbeans/modules/xslt/model/impl/XslModelImpl.java --- a/xslt.model/src/org/netbeans/modules/xslt/model/impl/XslModelImpl.java Mon May 17 23:32:11 2010 +0400 +++ b/xslt.model/src/org/netbeans/modules/xslt/model/impl/XslModelImpl.java Tue May 18 19:08:07 2010 +0400 @@ -111,8 +111,10 @@ return XslElements.allQNames(); } - public ChangeInfo prepareChangeInfo(List pathToRoot) { - ChangeInfo change = super.prepareChangeInfo(pathToRoot); + @Override + public ChangeInfo prepareChangeInfo(List pathToRoot, + List nsContextPathToRoot) { + ChangeInfo change = super.prepareChangeInfo(pathToRoot, nsContextPathToRoot); DocumentComponent parentComponent = findComponent(change.getRootToParentPath()); if (parentComponent == null) { return change;