Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 199937

Summary: [actions] RefactorActionGroup needs public constructor and overridable initAction(..)
Product: [Eclipse Project] JDT Reporter: Vikas Trivedi <vtrivedi>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: martinae
Version: 2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Vikas Trivedi CLA 2007-08-14 14:48:28 EDT
Build ID: Really old build

Steps To Reproduce:
In order to reuse RefactorActionGroup the constructor that accepts IWorkbenchSite needs to be public and the method initAction(..) need to be protected at the very least. Our use requires that we create our own site that is initialized using the IWorkbenchSite. This custom site is then used to obtain the selection provider.

Similarly in initAction we need to create own custom selectionChangedListener. 

NOTE:This relates to an older version of Eclipse.

More information:
public class RefactorActionGroup extends ActionGroup {

   ...
   ...
   ...

	/**
	 * Method RefactorActionGroup.
	 * @param site
	 */
	public RefactorActionGroup(IWorkbenchSite site) {
        
        ...
        ...

	}

	/**
	 * Method initAction.
	 * @param action
	 * @param provider
	 * @param selection
	 */
	protected void initAction(
		...
                ...
	}

   ...
   ...
   ...

}
Comment 1 Vikas Trivedi CLA 2007-08-14 14:59:50 EDT
The following fields also need to be protected so they can be initialized in the constructor and used in the overridden methods ...


        protected IWorkbenchSite fSite;

	protected SelectionDispatchAction fMoveAction;
	protected SelectionDispatchAction fRenameAction;
	protected SelectionDispatchAction fModifyParametersAction;
	protected SelectionDispatchAction fConvertNestedToTopAction;

	protected SelectionDispatchAction fPullUpAction;
	protected SelectionDispatchAction fPushDownAction;
	protected SelectionDispatchAction fExtractInterfaceAction;
	protected SelectionDispatchAction fUseSupertypeAction;

	protected SelectionDispatchAction fInlineAction;
	protected SelectionDispatchAction fSelfEncapsulateField;

	protected Map actionlisteners = new HashMap();
Comment 2 Martin Aeschlimann CLA 2007-08-15 05:50:38 EDT
I think one of the purposes of the RefactorActionGroup is to hide from the client what actions belong to the refactor menu. So when we add a new refactoring, you won't have to update your code. Making the actions fields protected doesn't make sense to me.

Do you only want to use a special selection provider to replace the one from the site. Or is there anything else you want to replace from the site? You know that IWorkbenchSite is not intended to be implemented (as well as the RefactorActionGroup)

For our actions that are subclassing SelectionDispatchAction it is possible to plug in an own provider: see SelectionDispatchAction.setSpecialSelectionProvider().
Would it solve your problem if we offer the same for the RefactorActionGroup?
Comment 3 Eclipse Genie CLA 2020-01-01 14:41:53 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.