1 11 package org.eclipse.team.internal.ui.wizards; 12 13 import org.eclipse.jface.dialogs.IDialogSettings; 14 import org.eclipse.jface.wizard.IWizard; 15 import org.eclipse.jface.wizard.Wizard; 16 import org.eclipse.team.internal.ui.*; 17 import org.eclipse.team.internal.ui.ITeamUIImages; 18 import org.eclipse.team.internal.ui.TeamUIPlugin; 19 import org.eclipse.team.ui.TeamImages; 20 import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference; 21 import org.eclipse.ui.IWorkbench; 22 23 28 public class GlobalSynchronizeWizard extends Wizard { 29 30 private final static String DIALOG_SETTINGS_SECTION= "SynchronizeWizard"; 32 protected IWorkbench workbench; 33 protected GlobalRefreshWizardSelectionPage mainPage; 34 protected ISynchronizeParticipantReference participant; 35 36 public GlobalSynchronizeWizard() { 37 setWindowTitle(TeamUIMessages.GlobalSynchronizeWizard_11); 38 setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_WIZBAN_SHARE)); 39 setForcePreviousAndNextButtons(true); 40 setNeedsProgressMonitor(false); 41 42 final IDialogSettings pluginSettings= TeamUIPlugin.getPlugin().getDialogSettings(); 43 IDialogSettings wizardSettings= pluginSettings.getSection(DIALOG_SETTINGS_SECTION); 44 if (wizardSettings == null) { 45 pluginSettings.addNewSection(DIALOG_SETTINGS_SECTION); 46 wizardSettings= pluginSettings.getSection(DIALOG_SETTINGS_SECTION); 47 } 48 setDialogSettings(wizardSettings); 49 } 50 51 54 public void addPages() { 55 mainPage = new GlobalRefreshWizardSelectionPage(); 56 addPage(mainPage); 57 } 58 59 62 public boolean canFinish() { 63 if (getContainer().getCurrentPage() == mainPage) { 66 if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { 67 return true; 68 } 69 return false; 70 } 71 return super.canFinish(); 72 } 73 74 77 public boolean performFinish() { 78 if (getContainer().getCurrentPage() == mainPage) { 80 IWizard noPageWizard = mainPage.getSelectedWizard(); 81 if (noPageWizard != null) { 82 if (noPageWizard.canFinish()) { 83 mainPage.savePageSettings(); 84 return noPageWizard.performFinish(); 85 } 86 } 87 } 88 mainPage.savePageSettings(); 89 return true; 90 } 91 } 92 | Popular Tags |