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.
Development version #200310150100 of NetBeans 4.0 Windows 2000 SP 2 with JDK 1.4.2 build #28 Description: ============ Confirmation message about successfull saving process depends on position of cursor in the file. If it is at declaration line of main method, message says: "main saved." instead of correct "<classname> saved." Steps to reproduce: =================== 1. Mount some local directory. 2. Open some Java file and modify it. 3. Place cursor at the end of line with main method declaration so that its properties are displayed. 4. Press CTRL+S and observe incorrect status bar message.
Reassigning to openide.
Passing to the Java module. I have modified SaveAction as follows: When finding a message name, it will first call Node.getValue("saveName"). If that returns non-null, the string returned will be used. So you should be able to simply override getValue() in MemberElement (or whatever) to return the name of the owning file, data object or whatever.
Jesse suggests this should go through fast track API review process. Also mentioned a possible alternative: IMHO better to add a nested interface to SaveCookie: interface Named extends SaveCookie { String getDisplayName(); } which e.g. EditorSupport.EntryEnv should then implement to return getDataObject().getNodeDelegate().getDisplayName() (or getDataObject().getPrimaryFile().getNameExt(), which would as a pleasant side-effect avoid putting the stupid VCS status label in the message).
BTW far from being after "lo these many years", this is in fact a regression introduced in 3.6 in SaveAction.java: revision 1.27 date: 2003/04/02 09:46:13; author: jtulach; state: Exp; lines: +0 -8 branches: 1.27.12; #32143 openide-loaders.jar is separated from openide.jar that patch removing the special treatment of data nodes that formerly served as the workaround for this issue. Downgrading because it doesn't seem like a P3 issue to me, but change back if you disagree.
That is right, this behaviour has been introduced early in 3.6 cycle as the old one was found not important enough to be supported. That is why I would suggest to close as wontfix. But as I am the one who removed it, I am ready to fix it. The simplest solution that would guarantee exactly the same behaviour is to check for DataObject in the SaveAction. Given the state of development we are in, this would be my second prefered solution. If we want real fix, then I belive SaveCookie.Named is good solution, definitively better than check for node.getValue.
Created attachment 13565 [details] Returns back the 3.5 behaviour
Go for it - I didn't know this had been fixed in 3.5, just assumed I coincidentally never typed ctrl-S when the caret was in the right place in 3.5.
I can't at all agree with WONTFIX resolution. If you even have a solution, please fix it in 3.6 although it is only P3. This behaviour might confuse users: "What should I do to save also myMethod() and not only main(String[] args) ?" and in addition I think is not definitely proffesional.
The regression is in openide code not java module. Reassigned back to openide.
Yarda's patch looks like an OK workaround for 3.6 but I would like to see it replaced by a proper API for D, at least.
I'll apply the patch to mimic behaviour of 3.5
Checking in src/org/openide/actions/SaveAction.java; /cvs/openide/src/org/openide/actions/SaveAction.java,v <-- SaveAction.java new revision: 1.31; previous revision: 1.30 done Processing log script arguments... More commits to come... RCS file: /cvs/openide/test/unit/src/org/openide/actions/SaveActionTest.java,v done Checking in test/unit/src/org/openide/actions/SaveActionTest.java; /cvs/openide/test/unit/src/org/openide/actions/SaveActionTest.java,v <-- SaveActionTest.java initial revision: 1.1
Opened issue #40427 for the future.
closed