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 168888
Collapse All | Expand All

(-)src/org/eclipse/jface/dialogs/IPageTransitionProvider.java (-55 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
 *     Chris Gross (schtoo@schtoo.com) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.dialogs;
12
13
/**
14
 * <p>
15
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
16
 * part of a work in progress. There is a guarantee neither that this API will
17
 * work nor that it will remain the same. Please do not use this API without
18
 * consulting with the Platform/UI team.
19
 * </p>
20
 * 
21
 * Minimal interface to a page changing provider. Used for dialogs that
22
 * transition between pages.
23
 * 
24
 * @since 3.3
25
 */
26
public interface IPageTransitionProvider {
27
	/**
28
	 * Returns the currently selected page in the dialog.
29
	 * 
30
	 * @return the selected page in the dialog or <code>null</code> if none is
31
	 *         selected. The type may be domain specific. In the dialogs
32
	 *         provided by JFace, this will be an instance of
33
	 *         <code>IDialogPage</code>.
34
	 */
35
	Object getSelectedPage();
36
	
37
	/**
38
	 * Adds a listener for page changes in this page changing provider. Has no
39
	 * effect if an identical listener is already registered.
40
	 * 
41
	 * @param listener
42
	 *            a page transition listener
43
	 */
44
	void addPageTransitionListener(IPageTransitionListener listener);
45
46
	/**
47
	 * Removes the given page changing listener from this page changing provider.
48
	 * Has no effect if an identical listener is not registered.
49
	 * 
50
	 * @param listener
51
	 *            a page transition listener
52
	 */
53
	void removePageTransitionListener(IPageTransitionListener listener);
54
55
}
(-)src/org/eclipse/jface/dialogs/PageTransitionEvent.java (-110 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
 *     Chris Gross (schtoo@schtoo.com) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.dialogs;
12
13
import java.util.EventObject;
14
15
import org.eclipse.core.runtime.Assert;
16
17
/**
18
 * <p>
19
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
20
 * part of a work in progress. There is a guarantee neither that this API will
21
 * work nor that it will remain the same. Please do not use this API without
22
 * consulting with the Platform/UI team.
23
 * </p>
24
 * 
25
 * Event object describing a dialog page being changed. The source of these
26
 * events is a page changing provider.
27
 * 
28
 * @see IPageTransitionProvider
29
 * @see IPageTransitionListener
30
 * @since 3.3
31
 */
32
public class PageTransitionEvent extends EventObject {
33
34
35
	private static final long serialVersionUID = 1L;
36
	
37
	/**
38
	 * The selected page.
39
	 */
40
	protected Object selectedPage;
41
	
42
	/**
43
	 * The type of action that caused the page change event to be fired. 
44
	 */
45
	protected int type;
46
	
47
	/**
48
	 * Constant describing a backward page navigation
49
	 */
50
	public static final int EVENT_BACK = 1;
51
	/**
52
	 * Constant describing a forward page navigation
53
	 */
54
	public static final int EVENT_NEXT = 2;
55
	
56
	/**
57
	 * Public field that determines if page change will continue.
58
	 */
59
	public boolean doit = true;
60
	
61
	/**
62
	 * Creates a new event for the given source,selected page and direction.
63
	 * 
64
	 * @param source
65
	 *            the page changing provider
66
	 * @param selectedPage
67
	 *            the selected page. In the JFace provided dialogs this will be
68
	 *            an <code>IDialogPage</code>.
69
	 * @param eventType
70
	 *            indicates the action that triggered the page change
71
	 */
72
	public PageTransitionEvent(IPageTransitionProvider source, Object selectedPage,
73
			int eventType) {
74
		super(source);
75
		Assert.isNotNull(selectedPage);
76
		Assert.isTrue(eventType == EVENT_BACK || eventType == EVENT_NEXT);
77
		this.type = eventType;
78
		this.selectedPage = selectedPage;
79
	}
80
81
	/**
82
	 * Returns the selected page.
83
	 * 
84
	 * @return the selected page. In dialogs implemented by JFace, 
85
	 * 		this will be an <code>IDialogPage</code>.
86
	 */
87
	public Object getSelectedPage() {
88
		return selectedPage;
89
	}
90
91
	/**
92
	 * Returns the page change provider that is the source of this event.
93
	 * 
94
	 * @return the originating page change provider
95
	 */
96
	public IPageTransitionProvider getPageTransitionProvider() {
97
		return (IPageTransitionProvider) getSource();
98
	}
99
100
	/**
101
	 * Returns a integer constant indicating the action that triggered the 
102
	 * change request.
103
	 * 
104
	 * @return constant indicating the action that triggered the page change
105
	 */
106
	public int getType() {
107
		return type;
108
	}
109
	
110
}
(-)src/org/eclipse/jface/dialogs/IPageTransitionListener.java (-39 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
 *     Chris Gross (schtoo@schtoo.com) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.dialogs;
12
13
/**
14
 * <p>
15
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
16
 * part of a work in progress. There is a guarantee neither that this API will
17
 * work nor that it will remain the same. Please do not use this API without
18
 * consulting with the Platform/UI team.
19
 * </p>
20
 * 
21
 * A listener which is notified when the current page of the multi-page dialog
22
 * is changing.
23
 * 
24
 * @see IPageTransitionProvider
25
 * @see PageTransitionEvent
26
 * @since 3.3
27
 */
28
public interface IPageTransitionListener {
29
	
30
	/**
31
	 * Notifies that the selected page is changing.  The doit field of the
32
	 * PageTransitionEvent can be set to false to prevent the page from changing.
33
	 * 
34
	 * @param event
35
	 *            event object describing the change
36
	 */
37
	public void pageTransition(PageTransitionEvent event);
38
39
}
(-)src/org/eclipse/jface/wizard/WizardDialog.java (-47 / +34 lines)
Lines 16-21 Link Here
16
import java.util.HashMap;
16
import java.util.HashMap;
17
import java.util.Map;
17
import java.util.Map;
18
18
19
import org.eclipse.core.runtime.Assert;
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.core.runtime.ListenerList;
22
import org.eclipse.core.runtime.ListenerList;
Lines 24-39 Link Here
24
import org.eclipse.jface.dialogs.IMessageProvider;
25
import org.eclipse.jface.dialogs.IMessageProvider;
25
import org.eclipse.jface.dialogs.IPageChangeProvider;
26
import org.eclipse.jface.dialogs.IPageChangeProvider;
26
import org.eclipse.jface.dialogs.IPageChangedListener;
27
import org.eclipse.jface.dialogs.IPageChangedListener;
27
import org.eclipse.jface.dialogs.IPageTransitionListener;
28
import org.eclipse.jface.dialogs.IPageChangingListener;
28
import org.eclipse.jface.dialogs.IPageTransitionProvider;
29
import org.eclipse.jface.dialogs.MessageDialog;
29
import org.eclipse.jface.dialogs.MessageDialog;
30
import org.eclipse.jface.dialogs.PageChangedEvent;
30
import org.eclipse.jface.dialogs.PageChangedEvent;
31
import org.eclipse.jface.dialogs.PageTransitionEvent;
31
import org.eclipse.jface.dialogs.PageChangingEvent;
32
import org.eclipse.jface.dialogs.TitleAreaDialog;
32
import org.eclipse.jface.dialogs.TitleAreaDialog;
33
import org.eclipse.jface.operation.IRunnableWithProgress;
33
import org.eclipse.jface.operation.IRunnableWithProgress;
34
import org.eclipse.jface.operation.ModalContext;
34
import org.eclipse.jface.operation.ModalContext;
35
import org.eclipse.jface.resource.JFaceResources;
35
import org.eclipse.jface.resource.JFaceResources;
36
import org.eclipse.core.runtime.Assert;
37
import org.eclipse.jface.util.SafeRunnable;
36
import org.eclipse.jface.util.SafeRunnable;
38
import org.eclipse.swt.SWT;
37
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.custom.BusyIndicator;
38
import org.eclipse.swt.custom.BusyIndicator;
Lines 75-81 Link Here
75
 * </p>
74
 * </p>
76
 */
75
 */
77
public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
76
public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
78
		IPageChangeProvider, IPageTransitionProvider {
77
		IPageChangeProvider {
79
    /**
78
    /**
80
     * Image registry key for error message image (value <code>"dialog_title_error_image"</code>).
79
     * Image registry key for error message image (value <code>"dialog_title_error_image"</code>).
81
     */
80
     */
Lines 142-148 Link Here
142
	
141
	
143
    private ListenerList pageChangedListeners = new ListenerList();
142
    private ListenerList pageChangedListeners = new ListenerList();
144
    
143
    
145
    private ListenerList pageTransitionListeners = new ListenerList();
144
    private ListenerList pageChangingListeners = new ListenerList();
146
145
147
    /**
146
    /**
148
     * A layout for a container which includes several pages, like
147
     * A layout for a container which includes several pages, like
Lines 336-345 Link Here
336
            return;
335
            return;
337
		}
336
		}
338
337
339
        // If page transition unsuccessful, do not change the page
340
        if (!doPageTransition(PageTransitionEvent.EVENT_BACK))
341
        	return;
342
        
343
        // set flag to indicate that we are moving back
338
        // set flag to indicate that we are moving back
344
        isMovingToPreviousPage = true;
339
        isMovingToPreviousPage = true;
345
        // show the page
340
        // show the page
Lines 769-794 Link Here
769
            return;
764
            return;
770
        }
765
        }
771
766
772
        // If page transition unsuccessful, do not advance the page
773
        if (!doPageTransition(PageTransitionEvent.EVENT_NEXT))
774
        	return;
775
        
776
        // show the next page
767
        // show the next page
777
        showPage(page);
768
        showPage(page);
778
    }
769
    }
779
    
770
    
780
    /**
771
    /**
781
	 * Notifies page transition listeners and returns result of page transition
772
	 * Notifies page changing listeners and returns result of page changing
782
	 * processing to the sender.
773
	 * processing to the sender.
783
	 * 
774
	 * 
784
	 * @param eventType
775
	 * @param eventType
785
	 * @return <code>true</code> if page transition listener completes
776
	 * @return <code>true</code> if page changing listener completes
786
	 *         successfully, <code>false</code> otherwise
777
	 *         successfully, <code>false</code> otherwise
787
	 */
778
	 */
788
    private boolean doPageTransition(int eventType){
779
    private boolean doPageChanging(IWizardPage targetPage){
789
    	PageTransitionEvent e = new PageTransitionEvent(this, getCurrentPage(),
780
    	PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(), targetPage);
790
				eventType);
781
		firePageChanging(e);
791
		firePageTransitioning(e);
792
		// Prevent navigation if necessary
782
		// Prevent navigation if necessary
793
		if (e.doit == false){
783
		if (e.doit == false){
794
			return false;
784
			return false;
Lines 1057-1062 Link Here
1057
		} else {
1047
		} else {
1058
			isMovingToPreviousPage = false;
1048
			isMovingToPreviousPage = false;
1059
		}
1049
		}
1050
1051
        // If page changing evaluation unsuccessful, do not change the page
1052
        if (!doPageChanging(page))
1053
        	return;
1054
        
1060
        //Update for the new page ina busy cursor if possible
1055
        //Update for the new page ina busy cursor if possible
1061
        if (getContents() == null) {
1056
        if (getContents() == null) {
1062
			updateForPage(page);
1057
			updateForPage(page);
Lines 1400-1433 Link Here
1400
        }
1395
        }
1401
    }
1396
    }
1402
1397
1403
	/* 
1398
	/**
1404
	 * <p>
1399
	 * Adds a listener for page changes in this page changing provider. Has no
1405
	 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
1400
	 * effect if an identical listener is already registered.
1406
	 * part of a work in progress. There is a guarantee neither that this API will
1407
	 * work nor that it will remain the same. Please do not use this API without
1408
	 * consulting with the Platform/UI team.
1409
	 * </p>
1410
	 * 
1401
	 * 
1411
	 * (non-Javadoc)
1402
	 * @param listener
1412
	 * @see org.eclipse.jface.dialogs.IPageChangingProvider#addPageChangingListener(org.eclipse.jface.dialogs.IPageTransitionListener)
1403
	 *            a page changing listener
1413
	 */
1404
	 */
1414
	public void addPageTransitionListener(IPageTransitionListener listener) {
1405
	public void addPageChangingListener(IPageChangingListener listener) {
1415
		pageTransitionListeners.add(listener);		
1406
		pageChangingListeners.add(listener);		
1416
	}
1407
	}
1417
1408
1418
	/* 
1409
	/**
1419
	 * <p>
1410
	 * Removes the given page changing listener from this page changing provider.
1420
	 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
1411
	 * Has no effect if an identical listener is not registered.
1421
	 * part of a work in progress. There is a guarantee neither that this API will
1422
	 * work nor that it will remain the same. Please do not use this API without
1423
	 * consulting with the Platform/UI team.
1424
	 * </p>
1425
	 * 
1412
	 * 
1426
	 * (non-Javadoc)
1413
	 * @param listener
1427
	 * @see org.eclipse.jface.dialogs.IPageChangingProvider#removePageChangingdListener(org.eclipse.jface.dialogs.IPageTransitionListener)
1414
	 *            a page changing listener
1428
	 */
1415
	 */
1429
	public void removePageTransitionListener(IPageTransitionListener listener) {
1416
	public void removePageChangingListener(IPageChangingListener listener) {
1430
		pageTransitionListeners.remove(listener);		
1417
		pageChangingListeners.remove(listener);		
1431
	}
1418
	}
1432
	
1419
	
1433
	/**
1420
	/**
Lines 1444-1458 Link Here
1444
     *
1431
     *
1445
     * @param event a selection changing event
1432
     * @param event a selection changing event
1446
     *
1433
     *
1447
     * @see IPageTransitionListener#pageTransition(PageTransitionEvent)
1434
     * @see IPageChangingListener#handlePageChanging(PageChangingEvent)
1448
     */
1435
     */
1449
    protected void firePageTransitioning(final PageTransitionEvent event) {
1436
    protected void firePageChanging(final PageChangingEvent event) {
1450
        Object[] listeners = pageTransitionListeners.getListeners();
1437
        Object[] listeners = pageChangingListeners.getListeners();
1451
        for (int i = 0; i < listeners.length; ++i) {
1438
        for (int i = 0; i < listeners.length; ++i) {
1452
            final IPageTransitionListener l = (IPageTransitionListener) listeners[i];
1439
            final IPageChangingListener l = (IPageChangingListener) listeners[i];
1453
            SafeRunnable.run(new SafeRunnable() {
1440
            SafeRunnable.run(new SafeRunnable() {
1454
                public void run() {
1441
                public void run() {
1455
                    l.pageTransition(event);
1442
                    l.handlePageChanging(event);
1456
                }
1443
                }
1457
            });
1444
            });
1458
        }
1445
        }
(-)src/org/eclipse/jface/wizard/Wizard.java (-92 / +1 lines)
Lines 15-23 Link Here
15
15
16
import org.eclipse.core.runtime.Assert;
16
import org.eclipse.core.runtime.Assert;
17
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.dialogs.IDialogSettings;
18
import org.eclipse.jface.dialogs.IPageTransitionListener;
19
import org.eclipse.jface.dialogs.IPageTransitionProvider;
20
import org.eclipse.jface.dialogs.PageTransitionEvent;
21
import org.eclipse.jface.resource.ImageDescriptor;
18
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.JFaceResources;
19
import org.eclipse.jface.resource.JFaceResources;
23
import org.eclipse.swt.graphics.Image;
20
import org.eclipse.swt.graphics.Image;
Lines 57-63 Link Here
57
 * <code>IWizardPage</code>.
54
 * <code>IWizardPage</code>.
58
 * </p>
55
 * </p>
59
 */
56
 */
60
public abstract class Wizard implements IWizard, IPageTransitionListener {
57
public abstract class Wizard implements IWizard {
61
    /**
58
    /**
62
     * Image registry key of the default image for wizard pages (value
59
     * Image registry key of the default image for wizard pages (value
63
     * <code>"org.eclipse.jface.wizard.Wizard.pageImage"</code>).
60
     * <code>"org.eclipse.jface.wizard.Wizard.pageImage"</code>).
Lines 136-227 Link Here
136
        page.setWizard(this);
133
        page.setWizard(this);
137
    }
134
    }
138
135
139
    /* (non-Javadoc)
140
	 * @see org.eclipse.jface.dialogs.IPageTransitionListener#pageTransition(org.eclipse.jface.dialogs.PageTransitionEvent)
141
	 */
142
	public void pageTransition(PageTransitionEvent event) {
143
		int eventType = event.getType();
144
		if (eventType == PageTransitionEvent.EVENT_NEXT) {
145
			event.doit = doNextPressed();
146
		}
147
		else if (eventType == PageTransitionEvent.EVENT_BACK){
148
			event.doit = doBackPressed();
149
		}
150
	}
151
152
	/**
153
	 * Add the listener that gets notified when a page is transitioning.
154
	 */
155
    private void hookPageTransitionProvider(){
156
		IPageTransitionProvider provider = getPageTransitionProvider();
157
		if (provider != null)
158
			provider.addPageTransitionListener(this);
159
    }
160
    
161
    /**
162
     * Remove the listener that gets notified when a page is transitioning.
163
     */
164
    private void unhookPageTransitionListener(){
165
		IPageTransitionProvider provider = getPageTransitionProvider();
166
		if (provider != null)
167
			provider.removePageTransitionListener(this); 	
168
    }
169
170
    /**
171
     * Return the wizard container that facilitates the page transition events.
172
     * 
173
     * @return IPageTransitionProvider the page transition provider
174
     */
175
    private IPageTransitionProvider getPageTransitionProvider(){
176
    	IWizardContainer container = getContainer();
177
   		if (container instanceof IPageTransitionProvider){
178
    		return (IPageTransitionProvider)container;
179
    	}
180
    	return null;
181
    }
182
	
183
	/**
184
	 * <p>
185
	 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
186
	 * part of a work in progress. There is a guarantee neither that this API will
187
	 * work nor that it will remain the same. Please do not use this API without
188
	 * consulting with the Platform/UI team.
189
	 * </p>
190
	 * 
191
	 * This method is called when the next button of the wizard container is
192
	 * pressed. This method should be overridden when validation of a wizard
193
	 * page should be done upon page completion, rather than at the widget
194
	 * level.
195
	 * 
196
	 * @return <code>true</code> if the next page should be shown,
197
	 *         <code>false</code> otherwise
198
	 * @since 3.3
199
	 */
200
	protected boolean doNextPressed(){
201
		return true;
202
	}
203
204
	/**
205
	 * <p>
206
	 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
207
	 * part of a work in progress. There is a guarantee neither that this API will
208
	 * work nor that it will remain the same. Please do not use this API without
209
	 * consulting with the Platform/UI team.
210
	 * </p>
211
	 * 
212
	 * This method is called when the back button of the wizard container is
213
	 * pressed. This method should be overridden when validation of a wizard
214
	 * page should be done upon page completion, rather than at the widget
215
	 * level.
216
	 * 
217
	 * @return <code>true</code> if the previous page should be shown,
218
	 *         <code>false</code> otherwise
219
	 * @since 3.3
220
	 */
221
	protected boolean doBackPressed(){
222
		return true;
223
	}
224
	
225
	/**
136
	/**
226
     * The <code>Wizard</code> implementation of this <code>IWizard</code>
137
     * The <code>Wizard</code> implementation of this <code>IWizard</code>
227
     * method does nothing. Subclasses should extend if extra pages need to be
138
     * method does nothing. Subclasses should extend if extra pages need to be
Lines 272-278 Link Here
272
     * disposed.
183
     * disposed.
273
     */
184
     */
274
    public void dispose() {
185
    public void dispose() {
275
    	unhookPageTransitionListener();
276
        // notify pages
186
        // notify pages
277
        for (int i = 0; i < pages.size(); i++) {
187
        for (int i = 0; i < pages.size(); i++) {
278
            ((IWizardPage) pages.get(i)).dispose();
188
            ((IWizardPage) pages.get(i)).dispose();
Lines 442-448 Link Here
442
     */
352
     */
443
    public void setContainer(IWizardContainer wizardContainer) {
353
    public void setContainer(IWizardContainer wizardContainer) {
444
        container = wizardContainer;
354
        container = wizardContainer;
445
        hookPageTransitionProvider();
446
    }
355
    }
447
356
448
    /**
357
    /**
(-)src/org/eclipse/jface/dialogs/PageChangingEvent.java (+85 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2007 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
 *     Chris Gross (schtoo@schtoo.com) - initial API and implementation for bug 16179
10
 *     IBM Corporation - revisions to initial contribution
11
 *******************************************************************************/
12
package org.eclipse.jface.dialogs;
13
14
import java.util.EventObject;
15
16
import org.eclipse.core.runtime.Assert;
17
18
/**
19
 * <p>
20
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
21
 * part of a work in progress. There is a guarantee neither that this API will
22
 * work nor that it will remain the same. Please do not use this API without
23
 * consulting with the Platform/UI team.
24
 * </p>
25
 * 
26
 * Event object describing a dialog page in the process of being changed.
27
 * 
28
 * @since 3.3
29
 */
30
public class PageChangingEvent extends EventObject {
31
32
33
	private static final long serialVersionUID = 1L;
34
	
35
	private Object currentPage;
36
	
37
	private Object targetPage;
38
	
39
	/**
40
	 * Public field that determines if the page change will complete successfully.
41
	 * Default value is <code>true</code>.
42
	 */
43
	public boolean doit = true;
44
45
	/**
46
	 * Creates a new event for the given source, selected page and direction.
47
	 * 
48
	 * @param source
49
	 *            the page changing provider (the source of this event) 
50
	 * @param currentPage
51
	 *            the current page. In the JFace provided dialogs this will be
52
	 *            an <code>IDialogPage</code>.
53
	 * @param targetPage
54
	 *            the target page. In the JFace provided dialogs this will be
55
	 *            an <code>IDialogPage</code>.
56
	 */
57
	public PageChangingEvent(Object source, Object currentPage, Object targetPage) {
58
		super(source);
59
		Assert.isNotNull(currentPage);
60
		Assert.isNotNull(targetPage);
61
		this.currentPage = currentPage;
62
		this.targetPage = targetPage;
63
	}
64
65
	/**
66
	 * Returns the current page.
67
	 * 
68
	 * @return the current page. In dialogs implemented by JFace, 
69
	 * 		this will be an <code>IDialogPage</code>.
70
	 */
71
	public Object getCurrentPage() {
72
		return currentPage;
73
	}
74
75
	/**
76
	 * Returns the target page.
77
	 * 
78
	 * @return the target page. In dialogs implemented by JFace, 
79
	 * 		this will be an <code>IDialogPage</code>.
80
	 */
81
	public Object getTargetPage() {
82
		return targetPage;
83
	}
84
85
}
(-)src/org/eclipse/jface/dialogs/IPageChangingListener.java (+39 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2007 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
 *     Chris Gross (schtoo@schtoo.com) - initial API and implementation for bug 16179
10
 *     IBM Corporation - revisions to initial contribution
11
 *******************************************************************************/
12
package org.eclipse.jface.dialogs;
13
14
/**
15
 * <p>
16
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
17
 * part of a work in progress. There is a guarantee neither that this API will
18
 * work nor that it will remain the same. Please do not use this API without
19
 * consulting with the Platform/UI team.
20
 * </p>
21
 * 
22
 * A listener which is notified when the current page of the multi-page dialog
23
 * is changing.
24
 * 
25
 * @see PageChangingEvent
26
 * @since 3.3
27
 */
28
public interface IPageChangingListener {
29
	
30
	/**
31
	 * Notifies that the current page is changing.  The doit field of the
32
	 * PageChangingEvent can be set to false to prevent the page from changing.
33
	 * 
34
	 * @param event
35
	 *            event object describing the change
36
	 */
37
	public void handlePageChanging(PageChangingEvent event);
38
39
}

Return to bug 168888