1 11 package org.eclipse.team.ui.synchronize; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.jface.wizard.*; 15 import org.eclipse.osgi.util.NLS; 16 import org.eclipse.team.internal.ui.ITeamUIImages; 17 import org.eclipse.team.internal.ui.TeamUIMessages; 18 import org.eclipse.team.ui.TeamImages; 19 20 26 public abstract class ParticipantSynchronizeWizard extends Wizard { 27 28 private WizardPage selectionPage; 29 private IWizard importWizard; 30 31 34 protected ParticipantSynchronizeWizard() { 35 setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_WIZBAN_SHARE)); 36 setNeedsProgressMonitor(false); 37 } 38 39 42 public String getWindowTitle() { 43 return TeamUIMessages.GlobalRefreshSubscriberPage_0; 44 } 45 46 49 public void addPages() { 50 if (getRootResources().length == 0) { 51 importWizard = getImportWizard(); 52 if (importWizard != null){ 53 importWizard.setContainer(getContainer()); 54 importWizard.addPages(); 55 IWizardPage startingPage = importWizard.getStartingPage(); 56 if (startingPage != null) { 57 startingPage.setTitle(NLS.bind(TeamUIMessages.SubscriberParticipantWizard_0, new String [] { getPageTitle() })); 58 startingPage.setDescription(NLS.bind(TeamUIMessages.SubscriberParticipantWizard_1, new String [] { importWizard.getWindowTitle() })); 59 } 60 } 61 } else { 62 selectionPage = createScopeSelectionPage(); 63 selectionPage.setTitle(NLS.bind(TeamUIMessages.GlobalRefreshSubscriberPage_1, new String [] { getPageTitle() })); 64 selectionPage.setMessage(TeamUIMessages.GlobalRefreshSubscriberPage_2); 65 addPage(selectionPage); 66 } 67 } 68 69 72 public boolean performFinish() { 73 if (importWizard != null) { 74 return importWizard.performFinish(); 75 } else { 76 createParticipant(); 77 return true; 78 } 79 } 80 81 84 public IWizardPage getNextPage(IWizardPage page) { 85 if(importWizard != null ) { 86 return importWizard.getNextPage(page); 87 } 88 return super.getNextPage(page); 89 } 90 91 94 public boolean performCancel() { 95 if(importWizard != null) { 96 return importWizard.performCancel(); 97 } 98 return super.performCancel(); 99 } 100 101 104 public boolean canFinish() { 105 if(importWizard != null) { 106 return importWizard.canFinish(); 107 } 108 return super.canFinish(); 109 } 110 111 114 public IWizardPage getStartingPage() { 115 if(importWizard != null) { 116 return importWizard.getStartingPage(); 117 } 118 return super.getStartingPage(); 119 } 120 121 125 protected abstract String getPageTitle(); 126 127 132 protected abstract IWizard getImportWizard(); 133 134 140 protected abstract IResource[] getRootResources(); 141 142 148 protected abstract WizardPage createScopeSelectionPage(); 149 150 155 protected abstract void createParticipant(); 156 157 } 158 | Popular Tags |