01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 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.ui.internal.dialogs;
11:
12: import org.eclipse.jface.wizard.Wizard;
13: import org.eclipse.ui.IWorkingSet;
14: import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
15: import org.eclipse.ui.dialogs.IWorkingSetPage;
16: import org.eclipse.ui.internal.WorkbenchMessages;
17:
18: /**
19: * A working set edit wizard allows the user to edit a
20: * working set using a plugin specified working set page.
21: *
22: * @since 2.0
23: * @see org.eclipse.ui.dialog.IWorkingSetPage
24: */
25: public class WorkingSetEditWizard extends Wizard implements
26: IWorkingSetEditWizard {
27: private IWorkingSetPage workingSetEditPage;
28:
29: private IWorkingSet workingSet;
30:
31: /**
32: * Creates a new instance of the receiver.
33: *
34: * @param editPage the working set page that is going to
35: * be used for editing a working set.
36: */
37: public WorkingSetEditWizard(IWorkingSetPage editPage) {
38: super ();
39: workingSetEditPage = editPage;
40: workingSetEditPage.setWizard(this );
41: setWindowTitle(WorkbenchMessages.WorkingSetEditWizard_title);
42: }
43:
44: /**
45: * Overrides Wizard.
46: *
47: * @see org.eclipse.jface.wizard.Wizard#addPages
48: */
49: public void addPages() {
50: super .addPages();
51: addPage(workingSetEditPage);
52: }
53:
54: /**
55: * Overrides Wizard.
56: *
57: * @see org.eclipse.jface.wizard.Wizard#canFinish()
58: */
59: public boolean canFinish() {
60: return workingSetEditPage.isPageComplete();
61: }
62:
63: /**
64: * Returns the working set that is being edited.
65: *
66: * @return the working set that is being edited.
67: */
68: public IWorkingSet getSelection() {
69: return workingSet;
70: }
71:
72: /**
73: * Overrides Wizard.
74: * Notifies the IWorkingSetPage that the wizard is being closed.
75: *
76: * @see org.eclipse.jface.wizard.Wizard#performFinish
77: */
78: public boolean performFinish() {
79: workingSetEditPage.finish();
80: return true;
81: }
82:
83: /**
84: * Sets the working set that should be edited.
85: *
86: * @param workingSet the working set that should be edited.
87: */
88: public void setSelection(IWorkingSet workingSet) {
89: this.workingSet = workingSet;
90: workingSetEditPage.setSelection(workingSet);
91: }
92: }
|