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.

Bug 61772 - Cannot rename package with subpackages
Summary: Cannot rename package with subpackages
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-03 15:24 UTC by Jiri Prox
Modified: 2007-04-03 18:02 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2005-08-03 15:24:28 UTC
NB 4.2 (200508021800)
JDK 1.5.0_4

When thre tree view is switched on, the package containing another packages can
not be renamed from the menu.

Steps to reproduce:
1) create this package sturcture:
    sources:
      \--packA
           \--subPack1
           \--subPack2
2) switch to tree view (right click in the project view and select 'view java
packages as | tree' from the context menu)
3) select packA from the tree
4) right click and select 'Refactor | Rename'
   (or use main menu Refactor | Rename)
5) write new name (e.g. packB) and confirm
-> in the preview there is only written 'Rename packA to packB' and no usages
are listed (althoug in the subPacks there are several classes)
-> the package is not renamed

Inline renaming works fine.
Comment 1 Jan Becicka 2005-08-03 15:38:12 UTC
Is there any specification regarding this? There was no option to switch to tree
mode in previous versions.
Comment 2 Jan Becicka 2005-08-03 15:59:23 UTC
Jesse, is there any spec. regarding this? Thanks
Comment 3 Jesse Glick 2005-08-03 20:05:26 UTC
I don't think there is any spec. Jano might know. If you want consistency with
NB 4.0 (the tree mode was added as a visible UI option in 4.1), I would guess
that Rename on a tree view should work the same as it does in the Files tab.

<aside>
BTW don't ask me for my real opinion - I always thought that the way Rename
works on parent packages in the current UI spec is too clever and opaque. IMHO
if you try to rename a Java source folder (whether displayed as a package or
not) which has subpackages, the Rename dialog should have a checkbox - always
checked by default - "Also Rename Subpackages". You could uncheck it if you
wanted (though I think the common case would be to leave it checked). Then there
would be no confusing difference of behavior according to the view you started
with. I feel the same about CVS operations, etc. - better to just ask the user
whether he intended to work on subdirs too.
</aside>
Comment 4 Jan Becicka 2005-08-04 08:30:04 UTC
I'll rather don't have any opinion :) I'll not implement anything without spec.
I don't want another QA war again ragarding this. Jano?
Comment 5 Jan Becicka 2005-08-24 13:03:02 UTC
This issue cannot be fixed after UI freeze. UI please respond.
Comment 6 Roman Strobl 2005-08-24 13:08:08 UTC
I have replied yesterday but IZ ate my reply. We've discuss this topic with Jano
and we think the best solution is to make it work in tree view the same way as
in files view. 

That means if user renames a package, all the subpackages should be moved as
well, as it is now in files view.

We have also discussed the possibility of adding a checkbox to let user decide,
but that would add complexity to the UI.

Comment 7 Jesse Glick 2005-08-24 14:30:02 UTC
"We have also discussed the possibility of adding a checkbox to let user decide,
but that would add complexity to the UI." - not as much as the current
complexity, by which the UI behaves differently, with no warning to the user or
possibility of override, according to which otherwise interchangeable view you
invoke essentially the same action from. IMHO of course. :-)
Comment 8 Jan Becicka 2005-08-24 14:35:14 UTC
Checking in src/org/netbeans/modules/refactoring/ui/RenameAction.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/RenameAction.java,v 
<--  RenameAction.java
new revision: 1.32; previous revision: 1.31
done
Checking in src/org/netbeans/modules/refactoring/ui/RSMJavaDOAction.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/RSMJavaDOAction.java,v
 <--  RSMJavaDOAction.java
new revision: 1.12; previous revision: 1.11
done
Checking in src/org/netbeans/modules/refactoring/CheckUtils.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/CheckUtils.java,v  <-- 
CheckUtils.java
new revision: 1.29; previous revision: 1.28
done
Comment 9 Jiri Prox 2005-08-30 12:01:39 UTC
verified