This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | XmlMultiViewDataObject delays Rename action | ||
---|---|---|---|
Product: | xml | Reporter: | Dongmei Cao <dongmeic> |
Component: | XML Multiview | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED WONTFIX | ||
Severity: | blocker | CC: | pjiricka |
Priority: | P4 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Dongmei Cao
2008-02-22 23:28:26 UTC
You can reproduce the problem on the web.xml file too. But of course, you first need to modify its layer file to have a Rename action. The same rename delay is also in the Navigator tab The problem seems to be that XmlMultiviewDataObject overrides handleRename(String) and calls XmlMultiviewEditorSupport#updateDisplayName before the primary file of the data object has actually been changed (it is changed in DataObject after handleRename(String) returns (below is the impl of the method): protected FileObject handleRename(String name) throws IOException { FileObject retValue = super.handleRename(name); getEditorSupport().updateDisplayName(); return retValue; } To fix this, I can think of two solutions: - listen on the name change events fired by DataObject and only update the display name once the name has actually been changed - create an overloaded version of XmlMultiviewDataObject#updateDisplayName that takes a FileObject parameter and pass the return value of super.handleRename to that method and update the display name using the passed FileObject (however, if the actual rename fails, this would leave the display name in an invalid state) I need to think about how to fix this in xml/multiview in a compatible way. If you need a quick solution, you might want to override the handleRename method in your DataObject and do one the above. Another workaround for this could be overriding the XmlMultiViewEditorSupport#updateDisplay method so that it uses the name of the primary file which is changed by handleRename in MultiDataObject), e.g.: // old - String displayName = messageName(); String displayName = dObj.getPrimaryFile().getNameExt(); if (!displayName.equals(mvtc.getDisplayName())) { mvtc.setDisplayName(displayName); } mvtc.setToolTipText(FileUtil.getFileDisplayName(dObj.getPrimaryFile())); This works if the name of the top component should always be the name of the file. I can't make this assumption in xml/ multiview though as some clients may have overridded the messageName method. If you're going to fix in 6.1, then I'll wait for your fix. Actually my idea was to fix this for 6.1 only if none of the provided workarounds work for you (since your module seems to be the only one that faces this problem, web/persistence/ejb editors don't allow renaming). I chose the 3rd workaround you suggested. The renaming works now. See my checkin http://hg.netbeans.org/main/contrib/rev/34243f79b3b1 Great, thanks. I'm downgrading this to P3 then as the workaround proved to be viable. bad tm value... reset to tbd There is workaround in place for Hibernate and Spring, but this is still reproducible with web.xml: 1. Create a web.xml in web project 2. Open it in the editor 3. Choose Properties in the web.xml node's popup menu 4. Change the Name property => only the node name is changed, not the editor tab name Since this is a very improbable usecase, changing to P4. This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss |