|
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 |
} |