Question

I am using JFace Wizard and I want to set my own text on buttons Next, Back, Finish and Cancel. I found only very old advices which are completely useless today. I also found some solution with external jar files, but I really don't want to add whole library to project only for setting text on 4 buttons...

Is there any reasonable solution?

Thanks in advance

Was it helpful?

Solution

After massive finding and trying, I have to say there is no such way. There are some brutal solutions, but compared with them, adding one jar file to project is much easier and nicer.

I will cite best working solution for me:

You need to download a language pack from here:

http://archive.eclipse.org/eclipse/downloads/drops/L-3.2.1_Language_Packs-200609210945/index.php

NLpack2-eclipse-SDK-3.2.1-gtk.zip works for me while I'm using Eclipse 3.7.2.

Extract org.eclipse.jface.nl2_3.2.1.v200609270227.jar (or other nl for your language) from the archive and add it to your project. It will be used automatically.

This do not let you to set texts on buttons, but at least gives you texts translated into your language.

OTHER TIPS

Saw this post. Seems to be the answer to your question. It basically says to create a dialog using WizardDialog class. Create a class that inherits from Wizard with the implementation of your choice then do below:

WizardDialog wizardDialog = new CustomWizardDialog(shell, new YourWizard());

and then in your CustomWizardDialog do the following:

public class CustomWizardDialog  {
    @Override
    protected void createButtonsForButtonBar(Composite parent) {
        super.createButtonsForButtonBar(parent);

        Button finishButton = getButton(IDialogConstants.FINISH_ID);
        finishButton.setText("FinishButtonText");

        Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
        cancelButton.setText("CancelButtonText");
    }
}

All that is left is to perform wizardDialog.open() to open dialog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top