vazexqi / CodingSpectator

Watches and analyzes code edits in the Eclipse IDE non-invasively
http://codingspectator.cs.illinois.edu
Other
20 stars 14 forks source link

Capture the time spent on each step of a refactoring #125

Closed reprogrammer closed 13 years ago

reprogrammer commented 13 years ago

Currently, CodingSpectator just records the timestamp of the invocation of a refactoring. To identify the complicated and problematic steps of a refactoring, it needs to capture the time users spend on each step.

reprogrammer commented 13 years ago

RefactoringWizard has multiple RefactoringWizardPages. If the refactoring is wizard based it's part of RefactoringWizardDialog and if it's dialog based it's part of RefactoringWizardDialog2. All of the refactorings that we've documented so far such as extract/inline and move are dialog based. So, we'll first go for instrumenting dialog based refactorings.

Wizard has a list of its pages in a list called pages. The default implementation of getNextPage() returns the next page in this list and returns null if there no unvisited pages left.

We think RefactoringWizardDialog2.showCurrentPage() is a good place to begin the timing of viewing a page. However, we noticed that the first time the refactoring dialog appears, RefactoringWizardDialog2.showCurrentPage() doesn't get invoked. We think the call dialog.open() in RefactoringWizardOpenOperation initiates the opening of the dialog. The call to dialog.open() is blocking. So, we have to begin the timing before this call.

We found that RefactoringWizardDialog2.makeVisible() is a better place to record the time of showing a page, because it gets called both the first time the dialog is shown and when the user navigates through the pages. However, it doesn't get invoked when the user navigates to an error page.To capture when the error dialog opens or closes, we can instrument RefactoringWizardDialog2.showErrorDialog().

We think that it might be just easier to record the time every navigation button (OK, CANCEL, PREVIEW, FINISH, CONTINUE) on any page or dialog is pressed. RefactoringWizardDialog2 and RefactoringStatusDialog have methods that get invoked when such buttons get pressed.

reprogrammer commented 13 years ago

To store the time in the refactoring descriptor, we have to augment the descriptors created by the refactoring objects. But, we don't want to modify the creation of refactoring descriptors in every refactoring class. Therefore, we'd prefer to get an existing refactoring descriptor and add some information to it. However, the RefactoringDescriptor class doesn't support such augmentations. JavaRefactoringDescriptor has a map of arguments. But, we cannot access this class from LTK. Our proposal for solving this is to provide a method such as cloneByAugmenting in the refactoring descriptor class hierarchy that would add some items to the arguments map of the existing refactoring descriptor and construct a new descriptor out of it.

Resolved in 06532a0b637fc36a43ea94fea46d3f98aba20088 .. 5adf343b769544bd30a4e993915e8002b79c66dc.

vazexqi commented 13 years ago

First working prototype at 8b8ec1af74ad050f3cf6b47e9488b304eb0b1947

reprogrammer commented 13 years ago
  1. Currently, we instrument performFinish and performCancel of RefactoringWizard. We investigated the possibility of doing all of the timing instrumentations in RefactoringWizardDialog2.
  2. We also investigated ways to better distinguish the different pages of a refactoring wizard. We noticed that IWizardPage#getName() is more descriptive than IWizardPage#getTitle().
  3. Also, we switched to the button labels from IDialogConstants.

Performed the above three changes in 2c8e61e48044d5b4c2ee628a57c046bdd0e35440.

reprogrammer commented 13 years ago

Updated change markers in f65820ca9f5edcb46174d653c482a6c9e261884b.

vazexqi commented 13 years ago

Merged (fast-forward) into master.

reprogrammer commented 13 years ago

We need to record an event when the user asks for help on a refactoring wizard. This event is interesting because it could signal the users' problem with the refactoring user interface.

reprogrammer commented 13 years ago

630fccf0bb363bd9c74ba585093745444327d1cf added org.eclipse.jdt.core.manipulation to the deployment configuration files.

reprogrammer commented 13 years ago

Updated the license in eb803c0ab3f266f55676510e968e3e7d1f2937f1.

rajkuma1 commented 13 years ago

Mohsen and I tried overriding org.eclipse.jface.wizard.WizardDialog.helpPressed() in org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog, but, it didn't capture the help button presses. So, we decided not to capture invocations of help pages on refactoring wizards.