Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 260018
Collapse All | Expand All

(-)src/org/eclipse/jface/wizard/WizardDialog.java (-19 / +38 lines)
Lines 72-78 Link Here
72
 * required.
72
 * required.
73
 * </p>
73
 * </p>
74
 */
74
 */
75
public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
75
public class WizardDialog extends TitleAreaDialog implements IWizardContainer3,
76
		IPageChangeProvider {
76
		IPageChangeProvider {
77
	/**
77
	/**
78
	 * Image registry key for error message image (value
78
	 * Image registry key for error message image (value
Lines 731-754 Link Here
731
	 * The Finish button has been pressed.
731
	 * The Finish button has been pressed.
732
	 */
732
	 */
733
	protected void finishPressed() {
733
	protected void finishPressed() {
734
		// Wizards are added to the nested wizards list in setWizard.
734
		finishWizard();
735
		// This means that the current wizard is always the last wizard in the
736
		// list.
737
		// Note that we first call the current wizard directly (to give it a
738
		// chance to
739
		// abort, do work, and save state) then call the remaining n-1 wizards
740
		// in the
741
		// list (to save state).
742
		if (wizard.performFinish()) {
743
			// Call perform finish on outer wizards in the nested chain
744
			// (to allow them to save state for example)
745
			for (int i = 0; i < nestedWizards.size() - 1; i++) {
746
				((IWizard) nestedWizards.get(i)).performFinish();
747
			}
748
			// Hard close the dialog.
749
			setReturnCode(OK);
750
			hardClose();
751
		}
752
	}
735
	}
753
736
754
	/*
737
	/*
Lines 1509-1512 Link Here
1509
			});
1492
			});
1510
		}
1493
		}
1511
	}
1494
	}
1495
1496
	/* (non-Javadoc)
1497
	 * @see org.eclipse.jface.wizard.IWizardContainer3#cancelWizard()
1498
	 */
1499
	public boolean cancelWizard() {
1500
		if (activeRunningOperations > 0)
1501
			return false;
1502
		setReturnCode(CANCEL);
1503
		return close();
1504
	}
1505
1506
	/* (non-Javadoc)
1507
	 * @see org.eclipse.jface.wizard.IWizardContainer3#finishWizard()
1508
	 */
1509
	public boolean finishWizard() {
1510
		// Wizards are added to the nested wizards list in setWizard.
1511
		// This means that the current wizard is always the last wizard in the
1512
		// list.
1513
		// Note that we first call the current wizard directly (to give it a
1514
		// chance to
1515
		// abort, do work, and save state) then call the remaining n-1 wizards
1516
		// in the
1517
		// list (to save state).
1518
		if (wizard.performFinish()) {
1519
			// Call perform finish on outer wizards in the nested chain
1520
			// (to allow them to save state for example)
1521
			for (int i = 0; i < nestedWizards.size() - 1; i++) {
1522
				((IWizard) nestedWizards.get(i)).performFinish();
1523
			}
1524
			// Hard close the dialog.
1525
			setReturnCode(OK);
1526
			hardClose();
1527
			return true;
1528
		}
1529
		return false;
1530
	}
1512
}
1531
}
(-)src/org/eclipse/jface/wizard/IWizardContainer3.java (+68 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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
12
package org.eclipse.jface.wizard;
13
14
/**
15
 * <p>
16
 * <code>IWizardContainer3</code> is a supplement to
17
 * <code>IWizardContainer</code> that adds methods for finishing and canceling
18
 * the contained wizard.
19
 * </p>
20
 * 
21
 * <p>
22
 * The class <code>WizardDialog</code> provides a fully functional
23
 * implementation of this interface which will meet the needs of most clients.
24
 * However, clients are also free to implement this interface if
25
 * <code>WizardDialog</code> does not suit their needs.
26
 * </p>
27
 * 
28
 * @see org.eclipse.jface.wizard.IWizardContainer
29
 * @see org.eclipse.jface.wizard.IWizardContainer2
30
 * @since 3.5
31
 */
32
public interface IWizardContainer3 extends IWizardContainer2 {
33
34
	/**
35
	 * Finishes the contained wizard.
36
	 * <p>
37
	 * This method should be used by clients, which wants to finish the wizard
38
	 * (and execute all complementing actions) in response to some custom action
39
	 * such as double clicking in a list.
40
	 * </p>
41
	 * 
42
	 * @see #cancelWizard()
43
	 * 
44
	 * @return true if the wizard has finished successfully, false otherwise.
45
	 *         After this method returns true, clients should expect that the
46
	 *         contained wizard and the wizard container itslef have been
47
	 *         disposed and are no longer accessible.
48
	 */
49
	public boolean finishWizard();
50
51
	/**
52
	 * Cancels the contained wizard.
53
	 * <p>
54
	 * This method should be used by clients, which wants to cancel the wizard
55
	 * (and execute all complementing actions) in response to some custom action
56
	 * such as double clicking in a list.
57
	 * </p>
58
	 * 
59
	 * @see #finishWizard()
60
	 * 
61
	 * @return true if the wizard has accepted the cancel request, false
62
	 *         otherwise. After this method returns true, clients should expect
63
	 *         that the contained wizard and the wizard container itslef have
64
	 *         been disposed and are no longer accessible.
65
	 */
66
	public boolean cancelWizard();
67
68
}

Return to bug 260018