Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 154630 - Not possibility to provide non-Java refactorings through common NB UI
Not possibility to provide non-Java refactorings through common NB UI
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Refactoring
6.x
All All
: P2 (vote)
: 6.x
Assigned To: issues@java
issues@java
:
Depends on:
Blocks: 136314
  Show dependency treegraph
 
Reported: 2008-12-04 17:12 UTC by Vladimir Voskresensky
Modified: 2009-02-27 10:32 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2008-12-04 17:12:07 UTC
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
Comment 1 Vladimir Voskresensky 2008-12-04 17:13:28 UTC
rising to P2, because it blocks defining feature
Comment 2 David Strupl 2008-12-16 12:44:18 UTC
Tentatively marking for M2.
Comment 3 Vladimir Voskresensky 2009-01-19 17:03:36 UTC
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
Comment 4 Jan Pokorsky 2009-02-25 13:50:11 UTC
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.

Comment 5 Quality Engineering 2009-02-27 10:32:30 UTC
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo