0

I'm doing a plugin in Eclipse IDE in order to do a refactoring. I'm using LTK, the point is: I don't know how I can disabled the back button after the preview. I've tried to create the RefactoringWizard using some flags like 'NO_BACK_BUTTON_ON_STATUS_DIALOG', but I think it is not the rigth way to do it.

The poblem I have in the background is that when I push preview and then push back, and preview again, the preview box shows the change related with the refactoring twice!.

I think the best solution is disabling the back button after the preview because this is the solution I have seen in others plugins.

Sorry because of my English and thanks beforehand.

recluising
  • 348
  • 1
  • 3
  • 13

1 Answers1

1

The method org.eclipse.jface.wizard.WizardDialog#updateButtons disables the back button when currentPage.getPreviousPage() returns null. So, I suggest you to override the method org.eclipse.ltk.ui.refactoring.RefactoringWizard#getPreviousPage to return null.

reprogrammer
  • 14,298
  • 16
  • 57
  • 93
  • Thanks for your answer but it doesn't run. I have put the code below: `public IWizardPage getPreviousPage(IWizardPage page) { return null; }` overriding the old one. After pushing the preview button, the back button is still enabled. Eclipse also show me the flag that says 'Override org.eclipse.ltk.ui.refactoring.RefactoringWizard#getPreviousPage'. I think it can't be so hard but I do not have idea. – recluising Jul 11 '11 at 11:10
  • Did you debug the program? I suggest to put a break point inside your method to see when it gets invoked and how the caller reacts on the return value of your method. I'd also suggest you to put a break point at `org.eclipse.jface.wizard.WizardDialog#updateButtons` to get more insight about how it decides to show or hide the back button. – reprogrammer Jul 11 '11 at 13:08
  • I have tried it. I have put a breakpoint at _org.eclipse.jface.wizard.WizardDialog#updateButtons_ and it is not called. Could it be possible that my app use another method to set the state of the buttons? – recluising Jul 12 '11 at 08:32
  • It's ok I think the problem is that the back button I want to disable is the one that appears after pressing the preview button. Anyway, I have solved the problem in a different way because of my concrete situation. Thanks for all! – recluising Jul 12 '11 at 09:07