Bug 164955 - [move static members] enhance validation process
Summary: [move static members] enhance validation process
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-17 07:40 EST by Bartosz Kowalewski CLA
Modified: 2007-06-14 10:45 EDT (History)
0 users

See Also:


Attachments
Additional validation (3.45 KB, patch)
2006-11-20 06:28 EST, Bartosz Kowalewski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Kowalewski CLA 2006-11-17 07:40:28 EST
There is one simple scenario which could be easily eliminated using plain validation mechanisms directly on the "Move static members" wizard (that is the MoveMembersWizard class). 

Currently it is possible to choose the declaring type as destination of refactoring. The error is produced later - during the refactoring process. Adding a single (two line) if-statement in the validateDestinationType() method will do ;)

I can provide a patch :).
Comment 1 Martin Aeschlimann CLA 2006-11-17 10:48:34 EST
Patches are always welcome!
Comment 2 Bartosz Kowalewski CLA 2006-11-20 06:28:48 EST
Created attachment 54162 [details]
Additional validation
Comment 3 Bartosz Kowalewski CLA 2006-11-20 06:29:14 EST
A simple patch is now attached to this bug. Unfortunately I had to remove static modifier from one of the methods.

Before applying the provided patch, I advise checking the given scenario (I did not have time to check what causes the wizard to behave this way, but this could be a bug):

- open the Move Static Members wizard (alt + shift + v with any of the static members highlighted),
- choose the destination type -> it should be the same as the declaring type !!,
- click ok, an error message will be displayed,
- click the back button -> Move Static Members wizard will be displayed,
- change the input's contents (type in a correct class name),
- the OK button is disabled !!! :/ (nothing seems to be able to make it enabled),  
- ... however, it is possible to accept the action using the preview button - click preview, and OK on the next page.