01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards.tools;
11:
12: import org.eclipse.core.runtime.jobs.Job;
13: import org.eclipse.jface.dialogs.IDialogSettings;
14: import org.eclipse.jface.wizard.Wizard;
15: import org.eclipse.pde.core.plugin.IPluginModelBase;
16: import org.eclipse.pde.internal.ui.PDEPlugin;
17: import org.eclipse.pde.internal.ui.PDEPluginImages;
18: import org.eclipse.pde.internal.ui.PDEUIMessages;
19: import org.eclipse.ui.PlatformUI;
20:
21: public class UpdateBuildpathWizard extends Wizard {
22: private UpdateBuildpathWizardPage page1;
23: private IPluginModelBase[] fSelected;
24: private IPluginModelBase[] fUnupdated;
25: private static final String STORE_SECTION = "UpdateBuildpathWizard"; //$NON-NLS-1$
26:
27: public UpdateBuildpathWizard(IPluginModelBase[] models,
28: IPluginModelBase[] selected) {
29: IDialogSettings masterSettings = PDEPlugin.getDefault()
30: .getDialogSettings();
31: setDialogSettings(getSettingsSection(masterSettings));
32: setDefaultPageImageDescriptor(PDEPluginImages.DESC_CONVJPPRJ_WIZ);
33: setWindowTitle(PDEUIMessages.UpdateBuildpathWizard_wtitle);
34: setNeedsProgressMonitor(true);
35: this .fSelected = selected;
36: this .fUnupdated = models;
37: }
38:
39: private IDialogSettings getSettingsSection(IDialogSettings master) {
40: IDialogSettings setting = master.getSection(STORE_SECTION);
41: if (setting == null) {
42: setting = master.addNewSection(STORE_SECTION);
43: }
44: return setting;
45: }
46:
47: public boolean performFinish() {
48: if (!PlatformUI.getWorkbench().saveAllEditors(true))
49: return false;
50:
51: Object[] finalSelected = page1.getSelected();
52: page1.storeSettings();
53: IPluginModelBase[] modelArray = new IPluginModelBase[finalSelected.length];
54: System.arraycopy(finalSelected, 0, modelArray, 0,
55: finalSelected.length);
56: Job j = new UpdateClasspathJob(modelArray);
57: j.setUser(true);
58: j.schedule();
59: return true;
60: }
61:
62: public void addPages() {
63: page1 = new UpdateBuildpathWizardPage(fUnupdated, fSelected);
64: addPage(page1);
65: }
66: }
|