KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > dialogs > WorkingSetEditWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.dialogs;
12
13 import org.eclipse.jface.wizard.Wizard;
14 import org.eclipse.ui.IWorkingSet;
15 import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
16 import org.eclipse.ui.dialogs.IWorkingSetPage;
17 import org.eclipse.ui.internal.WorkbenchMessages;
18
19 /**
20  * A working set edit wizard allows the user to edit a
21  * working set using a plugin specified working set page.
22  *
23  * @since 2.0
24  * @see org.eclipse.ui.dialog.IWorkingSetPage
25  */

26 public class WorkingSetEditWizard extends Wizard implements
27         IWorkingSetEditWizard {
28     private IWorkingSetPage workingSetEditPage;
29
30     private IWorkingSet workingSet;
31
32     /**
33      * Creates a new instance of the receiver.
34      *
35      * @param editPage the working set page that is going to
36      * be used for editing a working set.
37      */

38     public WorkingSetEditWizard(IWorkingSetPage editPage) {
39         super();
40         workingSetEditPage = editPage;
41         workingSetEditPage.setWizard(this);
42         setWindowTitle(WorkbenchMessages.WorkingSetEditWizard_title);
43     }
44
45     /**
46      * Overrides Wizard.
47      *
48      * @see org.eclipse.jface.wizard.Wizard#addPages
49      */

50     public void addPages() {
51         super.addPages();
52         addPage(workingSetEditPage);
53     }
54
55     /**
56      * Overrides Wizard.
57      *
58      * @see org.eclipse.jface.wizard.Wizard#canFinish()
59      */

60     public boolean canFinish() {
61         return workingSetEditPage.isPageComplete();
62     }
63
64     /**
65      * Returns the working set that is being edited.
66      *
67      * @return the working set that is being edited.
68      */

69     public IWorkingSet getSelection() {
70         return workingSet;
71     }
72
73     /**
74      * Overrides Wizard.
75      * Notifies the IWorkingSetPage that the wizard is being closed.
76      *
77      * @see org.eclipse.jface.wizard.Wizard#performFinish
78      */

79     public boolean performFinish() {
80         workingSetEditPage.finish();
81         return true;
82     }
83
84     /**
85      * Sets the working set that should be edited.
86      *
87      * @param workingSet the working set that should be edited.
88      */

89     public void setSelection(IWorkingSet workingSet) {
90         this.workingSet = workingSet;
91         workingSetEditPage.setSelection(workingSet);
92     }
93 }
94
Popular Tags