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.
C++ team has defining feature to add several refactorings for 7.0 (http://wiki.netbeans.org/CND70Refactoring): # Encapsulate field (generate and use getter/setter) IZ#135627 # Change method parameters IZ#153818 # Extract function # Extract variable But now this actions are created as global ones by Java Refactoring API. There should be a way to introduce C++ refactorings without dependency on Java Refactoring API and to prevent duplication of actions in menus like: Java Encapsulate field C++ Encapsulate field The same problem is with "Introduce Variable", "Introduce Field", ... contributed by java.hints
rising to P2, because it blocks defining feature
Tentatively marking for M2.
Jan, Any news about implementing our requirements? I had a look at Java tricks and they just C&P your global refactoring actions to be presented in Refactoring menu (JavaRefactoringGlobalAction). Same tricks from java.hint as well (with Introduce...) actions. Could we generalize such approach and eliminate C&P by introducing smth like org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider? I.e. it could be class with methods { canRefactoring doRefactoring isRefactoringSupported() // <-- if we'd like to hide refactoring in menus until at least one provider supports it .... } Then java easily migrates and we implement it as well
I have prepared an implementation (http://hg.netbeans.org/main/rev/4e29fca63fb9) that allows to add context aware refactoring actions to the global menu. The previous implementation permitted to add new menu items under module_layer.xml/Menu/Refactoring. This possibility still remains for global generic actions like Move, Rename, .... In case you want to register some language specific action then use module_layer.xml/Editors/<mimepath>/RefactoringActions and add actions with required position there. I have also moved java refactoring and java hint actions under module_layer.xml/Editors/text/x-java/RefactoringActions/. The main Refactoring menu will look as follows: | Refactor | a (mnemonics) ============ Rename... R Move... M Copy... y Safely Delete... S ================================= <list of mime type aware actions> ================================= Undo n Redo o and in case of selected java file, <list of mime type aware actions> will be replaced with: Change Method Parameters... P ================================= Pull Up... U Push Down... D Extract Interface... I Extract Superclass... E Use Supertype Where Possible... W ================================= Move Inner to Outer Level... L Convert Anonymous to Member... A ================================= Introduce Variable... V Introduce Constant... C Introduce Field... F Introduce Method... h Encapsulate Fields... t The solution preserves backward compatibility as much as possible. It complies with the present Main UI spec. It also scales well as it is not necessary to call isRefactoringSupported() on every action. In regards to c&p of RefactoringGlobalAction I have filed an issue #159069 against platform/actions as it does not belong to refactoring API IMO.
Integrated into 'main-golden', will be available in build *200902270313* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4e29fca63fb9 User: Jan Pokorsky <jpokorsky@netbeans.org> Log: #154630: make possible to register language specific refactoring actions