Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 58151 Details for
Bug 168888
[Wizards] PageTransition classes may need rename/reorg
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
proposed patch to replace fix for bug 16179
16179-168888.txt (text/plain), 24.18 KB, created by
Karice McIntyre
on 2007-02-02 15:49:54 EST
(
hide
)
Description:
proposed patch to replace fix for bug 16179
Filename:
MIME Type:
Creator:
Karice McIntyre
Created:
2007-02-02 15:49:54 EST
Size:
24.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/dialogs/IPageTransitionProvider.java >=================================================================== >RCS file: src/org/eclipse/jface/dialogs/IPageTransitionProvider.java >diff -N src/org/eclipse/jface/dialogs/IPageTransitionProvider.java >--- src/org/eclipse/jface/dialogs/IPageTransitionProvider.java 4 Oct 2006 14:32:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,55 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Chris Gross (schtoo@schtoo.com) - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jface.dialogs; >- >-/** >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >- * >- * Minimal interface to a page changing provider. Used for dialogs that >- * transition between pages. >- * >- * @since 3.3 >- */ >-public interface IPageTransitionProvider { >- /** >- * Returns the currently selected page in the dialog. >- * >- * @return the selected page in the dialog or <code>null</code> if none is >- * selected. The type may be domain specific. In the dialogs >- * provided by JFace, this will be an instance of >- * <code>IDialogPage</code>. >- */ >- Object getSelectedPage(); >- >- /** >- * Adds a listener for page changes in this page changing provider. Has no >- * effect if an identical listener is already registered. >- * >- * @param listener >- * a page transition listener >- */ >- void addPageTransitionListener(IPageTransitionListener listener); >- >- /** >- * Removes the given page changing listener from this page changing provider. >- * Has no effect if an identical listener is not registered. >- * >- * @param listener >- * a page transition listener >- */ >- void removePageTransitionListener(IPageTransitionListener listener); >- >-} >Index: src/org/eclipse/jface/dialogs/PageTransitionEvent.java >=================================================================== >RCS file: src/org/eclipse/jface/dialogs/PageTransitionEvent.java >diff -N src/org/eclipse/jface/dialogs/PageTransitionEvent.java >--- src/org/eclipse/jface/dialogs/PageTransitionEvent.java 4 Oct 2006 14:32:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,110 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Chris Gross (schtoo@schtoo.com) - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jface.dialogs; >- >-import java.util.EventObject; >- >-import org.eclipse.core.runtime.Assert; >- >-/** >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >- * >- * Event object describing a dialog page being changed. The source of these >- * events is a page changing provider. >- * >- * @see IPageTransitionProvider >- * @see IPageTransitionListener >- * @since 3.3 >- */ >-public class PageTransitionEvent extends EventObject { >- >- >- private static final long serialVersionUID = 1L; >- >- /** >- * The selected page. >- */ >- protected Object selectedPage; >- >- /** >- * The type of action that caused the page change event to be fired. >- */ >- protected int type; >- >- /** >- * Constant describing a backward page navigation >- */ >- public static final int EVENT_BACK = 1; >- /** >- * Constant describing a forward page navigation >- */ >- public static final int EVENT_NEXT = 2; >- >- /** >- * Public field that determines if page change will continue. >- */ >- public boolean doit = true; >- >- /** >- * Creates a new event for the given source,selected page and direction. >- * >- * @param source >- * the page changing provider >- * @param selectedPage >- * the selected page. In the JFace provided dialogs this will be >- * an <code>IDialogPage</code>. >- * @param eventType >- * indicates the action that triggered the page change >- */ >- public PageTransitionEvent(IPageTransitionProvider source, Object selectedPage, >- int eventType) { >- super(source); >- Assert.isNotNull(selectedPage); >- Assert.isTrue(eventType == EVENT_BACK || eventType == EVENT_NEXT); >- this.type = eventType; >- this.selectedPage = selectedPage; >- } >- >- /** >- * Returns the selected page. >- * >- * @return the selected page. In dialogs implemented by JFace, >- * this will be an <code>IDialogPage</code>. >- */ >- public Object getSelectedPage() { >- return selectedPage; >- } >- >- /** >- * Returns the page change provider that is the source of this event. >- * >- * @return the originating page change provider >- */ >- public IPageTransitionProvider getPageTransitionProvider() { >- return (IPageTransitionProvider) getSource(); >- } >- >- /** >- * Returns a integer constant indicating the action that triggered the >- * change request. >- * >- * @return constant indicating the action that triggered the page change >- */ >- public int getType() { >- return type; >- } >- >-} >Index: src/org/eclipse/jface/dialogs/IPageTransitionListener.java >=================================================================== >RCS file: src/org/eclipse/jface/dialogs/IPageTransitionListener.java >diff -N src/org/eclipse/jface/dialogs/IPageTransitionListener.java >--- src/org/eclipse/jface/dialogs/IPageTransitionListener.java 4 Oct 2006 14:32:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,39 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Chris Gross (schtoo@schtoo.com) - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jface.dialogs; >- >-/** >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >- * >- * A listener which is notified when the current page of the multi-page dialog >- * is changing. >- * >- * @see IPageTransitionProvider >- * @see PageTransitionEvent >- * @since 3.3 >- */ >-public interface IPageTransitionListener { >- >- /** >- * Notifies that the selected page is changing. The doit field of the >- * PageTransitionEvent can be set to false to prevent the page from changing. >- * >- * @param event >- * event object describing the change >- */ >- public void pageTransition(PageTransitionEvent event); >- >-} >Index: src/org/eclipse/jface/wizard/WizardDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java,v >retrieving revision 1.57 >diff -u -r1.57 WizardDialog.java >--- src/org/eclipse/jface/wizard/WizardDialog.java 4 Oct 2006 14:32:18 -0000 1.57 >+++ src/org/eclipse/jface/wizard/WizardDialog.java 2 Feb 2007 20:40:10 -0000 >@@ -16,6 +16,7 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.ListenerList; >@@ -24,16 +25,14 @@ > import org.eclipse.jface.dialogs.IMessageProvider; > import org.eclipse.jface.dialogs.IPageChangeProvider; > import org.eclipse.jface.dialogs.IPageChangedListener; >-import org.eclipse.jface.dialogs.IPageTransitionListener; >-import org.eclipse.jface.dialogs.IPageTransitionProvider; >+import org.eclipse.jface.dialogs.IPageChangingListener; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.dialogs.PageChangedEvent; >-import org.eclipse.jface.dialogs.PageTransitionEvent; >+import org.eclipse.jface.dialogs.PageChangingEvent; > import org.eclipse.jface.dialogs.TitleAreaDialog; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.operation.ModalContext; > import org.eclipse.jface.resource.JFaceResources; >-import org.eclipse.core.runtime.Assert; > import org.eclipse.jface.util.SafeRunnable; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >@@ -75,7 +74,7 @@ > * </p> > */ > public class WizardDialog extends TitleAreaDialog implements IWizardContainer2, >- IPageChangeProvider, IPageTransitionProvider { >+ IPageChangeProvider { > /** > * Image registry key for error message image (value <code>"dialog_title_error_image"</code>). > */ >@@ -142,7 +141,7 @@ > > private ListenerList pageChangedListeners = new ListenerList(); > >- private ListenerList pageTransitionListeners = new ListenerList(); >+ private ListenerList pageChangingListeners = new ListenerList(); > > /** > * A layout for a container which includes several pages, like >@@ -336,10 +335,6 @@ > return; > } > >- // If page transition unsuccessful, do not change the page >- if (!doPageTransition(PageTransitionEvent.EVENT_BACK)) >- return; >- > // set flag to indicate that we are moving back > isMovingToPreviousPage = true; > // show the page >@@ -769,10 +764,6 @@ > return; > } > >- // If page transition unsuccessful, do not advance the page >- if (!doPageTransition(PageTransitionEvent.EVENT_NEXT)) >- return; >- > // show the next page > showPage(page); > } >@@ -785,10 +776,9 @@ > * @return <code>true</code> if page transition listener completes > * successfully, <code>false</code> otherwise > */ >- private boolean doPageTransition(int eventType){ >- PageTransitionEvent e = new PageTransitionEvent(this, getCurrentPage(), >- eventType); >- firePageTransitioning(e); >+ private boolean doPageTransition(IWizardPage targetPage){ >+ PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(), targetPage); >+ firePageChanging(e); > // Prevent navigation if necessary > if (e.doit == false){ > return false; >@@ -1057,6 +1047,11 @@ > } else { > isMovingToPreviousPage = false; > } >+ >+ // If page transition unsuccessful, do not advance the page >+ if (!doPageTransition(page)) >+ return; >+ > //Update for the new page ina busy cursor if possible > if (getContents() == null) { > updateForPage(page); >@@ -1400,34 +1395,26 @@ > } > } > >- /* >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >+ /** >+ * Adds a listener for page changes in this page changing provider. Has no >+ * effect if an identical listener is already registered. > * >- * (non-Javadoc) >- * @see org.eclipse.jface.dialogs.IPageChangingProvider#addPageChangingListener(org.eclipse.jface.dialogs.IPageTransitionListener) >+ * @param listener >+ * a page transition listener > */ >- public void addPageTransitionListener(IPageTransitionListener listener) { >- pageTransitionListeners.add(listener); >+ public void addPageChangingListener(IPageChangingListener listener) { >+ pageChangingListeners.add(listener); > } > >- /* >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >+ /** >+ * Removes the given page changing listener from this page changing provider. >+ * Has no effect if an identical listener is not registered. > * >- * (non-Javadoc) >- * @see org.eclipse.jface.dialogs.IPageChangingProvider#removePageChangingdListener(org.eclipse.jface.dialogs.IPageTransitionListener) >+ * @param listener >+ * a page transition listener > */ >- public void removePageTransitionListener(IPageTransitionListener listener) { >- pageTransitionListeners.remove(listener); >+ public void removePageChangingListener(IPageChangingListener listener) { >+ pageChangingListeners.remove(listener); > } > > /** >@@ -1444,15 +1431,15 @@ > * > * @param event a selection changing event > * >- * @see IPageTransitionListener#pageTransition(PageTransitionEvent) >+ * @see IPageChangingListener#handlePageChanging(PageChangingEvent) > */ >- protected void firePageTransitioning(final PageTransitionEvent event) { >- Object[] listeners = pageTransitionListeners.getListeners(); >+ protected void firePageChanging(final PageChangingEvent event) { >+ Object[] listeners = pageChangingListeners.getListeners(); > for (int i = 0; i < listeners.length; ++i) { >- final IPageTransitionListener l = (IPageTransitionListener) listeners[i]; >+ final IPageChangingListener l = (IPageChangingListener) listeners[i]; > SafeRunnable.run(new SafeRunnable() { > public void run() { >- l.pageTransition(event); >+ l.handlePageChanging(event); > } > }); > } >Index: src/org/eclipse/jface/wizard/Wizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java,v >retrieving revision 1.15 >diff -u -r1.15 Wizard.java >--- src/org/eclipse/jface/wizard/Wizard.java 22 Nov 2006 15:43:23 -0000 1.15 >+++ src/org/eclipse/jface/wizard/Wizard.java 2 Feb 2007 20:40:10 -0000 >@@ -15,9 +15,6 @@ > > import org.eclipse.core.runtime.Assert; > import org.eclipse.jface.dialogs.IDialogSettings; >-import org.eclipse.jface.dialogs.IPageTransitionListener; >-import org.eclipse.jface.dialogs.IPageTransitionProvider; >-import org.eclipse.jface.dialogs.PageTransitionEvent; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.JFaceResources; > import org.eclipse.swt.graphics.Image; >@@ -57,7 +54,7 @@ > * <code>IWizardPage</code>. > * </p> > */ >-public abstract class Wizard implements IWizard, IPageTransitionListener { >+public abstract class Wizard implements IWizard { > /** > * Image registry key of the default image for wizard pages (value > * <code>"org.eclipse.jface.wizard.Wizard.pageImage"</code>). >@@ -136,92 +133,6 @@ > page.setWizard(this); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.IPageTransitionListener#pageTransition(org.eclipse.jface.dialogs.PageTransitionEvent) >- */ >- public void pageTransition(PageTransitionEvent event) { >- int eventType = event.getType(); >- if (eventType == PageTransitionEvent.EVENT_NEXT) { >- event.doit = doNextPressed(); >- } >- else if (eventType == PageTransitionEvent.EVENT_BACK){ >- event.doit = doBackPressed(); >- } >- } >- >- /** >- * Add the listener that gets notified when a page is transitioning. >- */ >- private void hookPageTransitionProvider(){ >- IPageTransitionProvider provider = getPageTransitionProvider(); >- if (provider != null) >- provider.addPageTransitionListener(this); >- } >- >- /** >- * Remove the listener that gets notified when a page is transitioning. >- */ >- private void unhookPageTransitionListener(){ >- IPageTransitionProvider provider = getPageTransitionProvider(); >- if (provider != null) >- provider.removePageTransitionListener(this); >- } >- >- /** >- * Return the wizard container that facilitates the page transition events. >- * >- * @return IPageTransitionProvider the page transition provider >- */ >- private IPageTransitionProvider getPageTransitionProvider(){ >- IWizardContainer container = getContainer(); >- if (container instanceof IPageTransitionProvider){ >- return (IPageTransitionProvider)container; >- } >- return null; >- } >- >- /** >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >- * >- * This method is called when the next button of the wizard container is >- * pressed. This method should be overridden when validation of a wizard >- * page should be done upon page completion, rather than at the widget >- * level. >- * >- * @return <code>true</code> if the next page should be shown, >- * <code>false</code> otherwise >- * @since 3.3 >- */ >- protected boolean doNextPressed(){ >- return true; >- } >- >- /** >- * <p> >- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >- * part of a work in progress. There is a guarantee neither that this API will >- * work nor that it will remain the same. Please do not use this API without >- * consulting with the Platform/UI team. >- * </p> >- * >- * This method is called when the back button of the wizard container is >- * pressed. This method should be overridden when validation of a wizard >- * page should be done upon page completion, rather than at the widget >- * level. >- * >- * @return <code>true</code> if the previous page should be shown, >- * <code>false</code> otherwise >- * @since 3.3 >- */ >- protected boolean doBackPressed(){ >- return true; >- } >- > /** > * The <code>Wizard</code> implementation of this <code>IWizard</code> > * method does nothing. Subclasses should extend if extra pages need to be >@@ -272,7 +183,6 @@ > * disposed. > */ > public void dispose() { >- unhookPageTransitionListener(); > // notify pages > for (int i = 0; i < pages.size(); i++) { > ((IWizardPage) pages.get(i)).dispose(); >@@ -442,7 +352,6 @@ > */ > public void setContainer(IWizardContainer wizardContainer) { > container = wizardContainer; >- hookPageTransitionProvider(); > } > > /** >Index: src/org/eclipse/jface/dialogs/PageChangingEvent.java >=================================================================== >RCS file: src/org/eclipse/jface/dialogs/PageChangingEvent.java >diff -N src/org/eclipse/jface/dialogs/PageChangingEvent.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/dialogs/PageChangingEvent.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,83 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Chris Gross (schtoo@schtoo.com) - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jface.dialogs; >+ >+import java.util.EventObject; >+ >+import org.eclipse.core.runtime.Assert; >+ >+/** >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is a guarantee neither that this API will >+ * work nor that it will remain the same. Please do not use this API without >+ * consulting with the Platform/UI team. >+ * </p> >+ * >+ * Event object describing a dialog page being changed. >+ * >+ * @since 3.3 >+ */ >+public class PageChangingEvent extends EventObject { >+ >+ >+ private static final long serialVersionUID = 1L; >+ >+ private Object currentPage; >+ >+ private Object targetPage; >+ >+ /** >+ * Public field that determines if page change will continue. >+ */ >+ public boolean doit = true; >+ >+ /** >+ * Creates a new event for the given source,selected page and direction. >+ * >+ * @param source >+ * the page changing provider >+ * @param currentPage >+ * the current page. In the JFace provided dialogs this will be >+ * an <code>IDialogPage</code>. >+ * @param targetPage >+ * the target page. In the JFace provided dialogs this will be >+ * an <code>IDialogPage</code>. >+ */ >+ public PageChangingEvent(Object source, Object currentPage, Object targetPage) { >+ super(source); >+ Assert.isNotNull(currentPage); >+ Assert.isNotNull(targetPage); >+ this.currentPage = currentPage; >+ this.targetPage = targetPage; >+ } >+ >+ /** >+ * Returns the current page. >+ * >+ * @return the current page. In dialogs implemented by JFace, >+ * this will be an <code>IDialogPage</code>. >+ */ >+ public Object getCurrentPage() { >+ return currentPage; >+ } >+ >+ /** >+ * Returns the target page. >+ * >+ * @return the target page. In dialogs implemented by JFace, >+ * this will be an <code>IDialogPage</code>. >+ */ >+ public Object getTargetPage() { >+ return targetPage; >+ } >+ >+} >Index: src/org/eclipse/jface/dialogs/IPageChangingListener.java >=================================================================== >RCS file: src/org/eclipse/jface/dialogs/IPageChangingListener.java >diff -N src/org/eclipse/jface/dialogs/IPageChangingListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/dialogs/IPageChangingListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Chris Gross (schtoo@schtoo.com) - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jface.dialogs; >+ >+/** >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is a guarantee neither that this API will >+ * work nor that it will remain the same. Please do not use this API without >+ * consulting with the Platform/UI team. >+ * </p> >+ * >+ * A listener which is notified when the current page of the multi-page dialog >+ * is changing. >+ * >+ * @see PageChangingEvent >+ * @since 3.3 >+ */ >+public interface IPageChangingListener { >+ >+ /** >+ * Notifies that the current page is changing. The doit field of the >+ * PageChangingEvent can be set to false to prevent the page from changing. >+ * >+ * @param event >+ * event object describing the change >+ */ >+ public void handlePageChanging(PageChangingEvent event); >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 168888
:
58151
|
58152
|
60561
|
60627
|
60628
|
60962