Bug 538133 - [ltk] Allow LTK's rename resource dialog/wizard to be extended
Summary: [ltk] Allow LTK's rename resource dialog/wizard to be extended
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.9   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.16 M3   Edit
Assignee: Kalyan Prasad Tatavarthi CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2018-08-21 14:52 EDT by Jonah Graham CLA
Modified: 2020-05-15 00:57 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Graham CLA 2018-08-21 14:52:50 EDT
In Bug 537176 I added an "Update references..." checkbox to CDT projects rename resource action. To do this required quite a bit of copying code. The "Update references" logic already existed in all the data classes, but did not appear in the UI anywhere.

Therefore I would like a way to extend the rename resource dialog to be able to customize the UI area. 

If fully customizing the dialog/wizard page is too much, at least a way to turn on the "Update references..." without having to write lots of code.

For now in CDT's case, rather than duplicating the code, I am referencing some internal LTK classes and extending classes with @noextend.
Comment 1 Andrey Loskutov CLA 2018-08-21 15:16:54 EDT
Jonah, please propose a minimal working patch via Gerrit. CDT has enough duplicated code :)
Comment 2 Eclipse Genie CLA 2018-08-21 17:22:57 EDT
New Gerrit change created: https://git.eclipse.org/r/127820
Comment 3 Eclipse Genie CLA 2018-08-21 17:25:10 EDT
New Gerrit change created: https://git.eclipse.org/r/127821
Comment 4 Jonah Graham CLA 2018-08-21 17:29:20 EDT
> New Gerrit change created: https://git.eclipse.org/r/127820
> New Gerrit change created: https://git.eclipse.org/r/127821

These changes provide the minimum level change I am looking for, it allows CDT to show the "Update references" checkbox.

I need more time to think about how to contribute a bigger customisation. In CDT's case, in addition to "Update references" we have a link to the preferences page that is relevant. PyDev also has a UI like this that they could have taken advantage of, they have a couple of checkboxes/buttons to contribute too. See https://bugs.eclipse.org/bugs/attachment.cgi?id=275049 for some screenshots.
Comment 5 Dani Megert CLA 2018-08-24 12:43:14 EDT
Kalyan, if you have time, you can look at this during 4.10.
Comment 6 Eclipse Genie CLA 2020-05-08 02:45:32 EDT
New Gerrit change created: https://git.eclipse.org/r/162679
Comment 7 Kalyan Prasad Tatavarthi CLA 2020-05-08 02:47:04 EDT
(In reply to Eclipse Genie from comment #6)
> New Gerrit change created: https://git.eclipse.org/r/162679

@Jonah, Can you please confirm if the above change set helps you in extending the RenameResourceWizard.
Comment 8 Eclipse Genie CLA 2020-05-10 19:42:30 EDT
New Gerrit change created: https://git.eclipse.org/r/162772
Comment 9 Jonah Graham CLA 2020-05-10 19:48:50 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #7)
> (In reply to Eclipse Genie from comment #6)
> > New Gerrit change created: https://git.eclipse.org/r/162679
> 
> @Jonah, Can you please confirm if the above change set helps you in
> extending the RenameResourceWizard.

This change achieves the goal of not having to use the internal class you added an interface for. Thanks, I will merge https://git.eclipse.org/r/#/c/162772/ into CDT once your commit is in platform.

However, it does not prevent most of what I raised in Comment 0. For example, I still have to have a whole bunch of LTK's UI copied into CDT. See my original CDT commit that made the copy - https://git.eclipse.org/r/#/c/127738/
Comment 10 Kalyan Prasad Tatavarthi CLA 2020-05-11 04:21:11 EDT
(In reply to Jonah Graham from comment #9)
> (In reply to Kalyan Prasad Tatavarthi from comment #7)
> > (In reply to Eclipse Genie from comment #6)
> > > New Gerrit change created: https://git.eclipse.org/r/162679
> > 
> > @Jonah, Can you please confirm if the above change set helps you in
> > extending the RenameResourceWizard.
> 
> This change achieves the goal of not having to use the internal class you
> added an interface for. Thanks, I will merge
> https://git.eclipse.org/r/#/c/162772/ into CDT once your commit is in
> platform.
> 
> However, it does not prevent most of what I raised in Comment 0. For
> example, I still have to have a whole bunch of LTK's UI copied into CDT. See
> my original CDT commit that made the copy -
> https://git.eclipse.org/r/#/c/127738/

I have made storeSettings() and initializeRefactoring() as protected methods in RenameResourceRefactoringConfigurationPage and the Class RenameResourceRefactoringConfigurationPage is public .

So Now CResourceRenameRefactoringInputPage can extend RenameResourceRefactoringConfigurationPage and override the above two methods to store and read custom dialog settings.

Also createControl() is a public function in RenameResourceRefactoringConfigurationPage  which can be overridden in the subclass. Top get the control created by the super class to add additional dialog settings in subclass there is a getControl() function available too. This will be needed to be used to extend the existing dialog.
		}
Comment 11 Jonah Graham CLA 2020-05-11 07:38:09 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #10)

:-) Thank you for being explicit - yes this change does address fully the duplication originally addressed in this bug. I updated CDT's corresponding change https://git.eclipse.org/r/#/c/162772/ 

Thank you.
Comment 12 Kalyan Prasad Tatavarthi CLA 2020-05-15 00:56:46 EDT
Gerrit change https://git.eclipse.org/r/162679/ was merged to [master].
Commit: https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=c384fefe236dee91353ea4db42c9330f86331c17