1 11 package org.eclipse.pde.internal.ui.wizards.tools; 12 13 import org.eclipse.core.runtime.jobs.Job; 14 import org.eclipse.jface.dialogs.IDialogSettings; 15 import org.eclipse.jface.wizard.Wizard; 16 import org.eclipse.pde.core.plugin.IPluginModelBase; 17 import org.eclipse.pde.internal.ui.PDEPlugin; 18 import org.eclipse.pde.internal.ui.PDEPluginImages; 19 import org.eclipse.pde.internal.ui.PDEUIMessages; 20 import org.eclipse.ui.PlatformUI; 21 22 public class UpdateBuildpathWizard extends Wizard { 23 private UpdateBuildpathWizardPage page1; 24 private IPluginModelBase[] fSelected; 25 private IPluginModelBase[] fUnupdated; 26 private static final String STORE_SECTION = "UpdateBuildpathWizard"; public UpdateBuildpathWizard(IPluginModelBase[] models, IPluginModelBase[] selected) { 28 IDialogSettings masterSettings = PDEPlugin.getDefault().getDialogSettings(); 29 setDialogSettings(getSettingsSection(masterSettings)); 30 setDefaultPageImageDescriptor(PDEPluginImages.DESC_CONVJPPRJ_WIZ); 31 setWindowTitle(PDEUIMessages.UpdateBuildpathWizard_wtitle); 32 setNeedsProgressMonitor(true); 33 this.fSelected = selected; 34 this.fUnupdated = models; 35 } 36 37 private IDialogSettings getSettingsSection(IDialogSettings master) { 38 IDialogSettings setting = master.getSection(STORE_SECTION); 39 if (setting == null) { 40 setting = master.addNewSection(STORE_SECTION); 41 } 42 return setting; 43 } 44 45 public boolean performFinish() { 46 if (!PlatformUI.getWorkbench().saveAllEditors(true)) 47 return false; 48 49 Object [] finalSelected = page1.getSelected(); 50 page1.storeSettings(); 51 IPluginModelBase [] modelArray = new IPluginModelBase[finalSelected.length]; 52 System.arraycopy(finalSelected, 0, modelArray, 0, finalSelected.length); 53 Job j = new UpdateClasspathJob(modelArray); 54 j.setUser(true); 55 j.schedule(); 56 return true; 57 } 58 59 public void addPages() { 60 page1 = new UpdateBuildpathWizardPage(fUnupdated, fSelected); 61 addPage(page1); 62 } 63 } 64 | Popular Tags |