Bug 334819

Summary: Allow to set access modifier (visibility) for Java elements
Product: [Eclipse Project] JDT Reporter: Matt Whitlock <eclipse>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Matt Whitlock CLA 2011-01-19 13:17:59 EST
Build Identifier: I20100909-0800

It would be very handy if the Java Outline view would have a context menu allowing the user to change the access modifiers of one or more class members in one shot.  For example, when only class members are selected in the Outline, the Refactor menu would have a submenu labeled "Set Access", which would cascade to another menu containing "public", "protected", "(default)", and "private", using Eclipse's symbols for those access levels as the menu item icons.  Choosing one of those modifiers would alter the source code with the appropriate access modifier keyword.  The context menu should be available for all class members (fields, methods, and member types) as well as for top-level types (with "private" excluded).

Reproducible: Always
Comment 1 Markus Keller CLA 2011-01-20 05:53:58 EST
A refactoring for this would be quite expensive, since we would have to check all references to all members to be sure that the the changed members are still visible and that we don't change semantics (e.g. changed shadowing / overloading / overriding).
Comment 2 Matt Whitlock CLA 2011-01-20 08:54:15 EST
Cheaper than moving elements to another class, and there's a refactoring for that.