Show NewTournamentAction.java syntax highlighted
package geronimo.hoshigo.control.tournament;
import geronimo.hoshigo.control.MainController;
import geronimo.hoshigo.model.tournament.Tournament;
import geronimo.hoshigo.view.IconRegistry;
import geronimo.hoshigo.view.IconRegistry.IconSize;
import geronimo.hoshigo.view.newtournament.NewTournamentWizard;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.wizard.WizardDialog;
public class NewTournamentAction extends Action
{
private static NewTournamentAction instance;
private NewTournamentAction()
{
super();
this.setText("&Nouveau tournoi@Ctrl+T");
this.setToolTipText("Nouveau tournoi");
this.setImageDescriptor(IconRegistry.getDescriptor("new_tournament",
IconSize.SMALL));
}
/**
* Changement de tournoi actif
* @param tournament Nouveau tournoi actif
*/
public void setActiveTournament(Tournament tournament)
{
}
public synchronized static NewTournamentAction getInstance()
{
if (instance == null)
{
instance = new NewTournamentAction();
}
return instance;
}
public void run()
{
NewTournamentWizard wizard = new NewTournamentWizard();
WizardDialog dialog = new WizardDialog(MainController.getMainWindow()
.getShell(), wizard);
dialog.setBlockOnOpen(true);
dialog.open();
if(dialog.getReturnCode() == WizardDialog.OK)
{
Tournament tournament = new Tournament
(
wizard.getGobanSize(),
wizard.getHandicap(),
wizard.getKomi(),
wizard.isFreeHandicap(),
wizard.getProgramConfig(),
wizard.getOptions(),
wizard.getRefereeConfig()
);
tournament.start();
MainController.getGameDirectory().addTournament(tournament);
}
}
}
See more files for this project here