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 11591 Details for
Bug 64937
[Progress] Using IProgressService.busyCursorWhile() from modal dialogs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for busyCursorWhile
64937.txt (text/plain), 11.26 KB, created by
Tod Creasey
on 2004-06-04 09:42:30 EDT
(
hide
)
Description:
Patch for busyCursorWhile
Filename:
MIME Type:
Creator:
Tod Creasey
Created:
2004-06-04 09:42:30 EDT
Size:
11.26 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java,v >retrieving revision 1.28 >diff -u -r1.28 BlockedJobsDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java 3 Jun 2004 14:16:23 -0000 1.28 >+++ Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java 4 Jun 2004 13:40:16 -0000 >@@ -201,7 +201,7 @@ > public IStatus runInUIThread(IProgressMonitor monitor) { > if (singleton == null) > return Status.CANCEL_STATUS; >- if (ProgressManagerUtil.rescheduleIfModalShellOpen(this)) >+ if (ProgressManagerUtil.rescheduleIfModalShellOpen(this,null)) > return Status.CANCEL_STATUS; > singleton.open(); > return Status.OK_STATUS; >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java,v >retrieving revision 1.86 >diff -u -r1.86 ProgressManager.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 27 May 2004 18:36:21 -0000 1.86 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 4 Jun 2004 13:40:16 -0000 >@@ -823,8 +823,9 @@ > public IStatus runInUIThread(IProgressMonitor monitor) { > setUserInterfaceActive(true); > >- if (ProgressManagerUtil.rescheduleIfModalShellOpen(this)) >+ if (ProgressManagerUtil.rescheduleIfModalShellOpen(this,dialog)) > return Status.CANCEL_STATUS; >+ dialog.setOpenOnRun(true); > dialog.open(); > return Status.OK_STATUS; > } >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java,v >retrieving revision 1.19 >diff -u -r1.19 ProgressManagerUtil.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java 3 Jun 2004 15:32:03 -0000 1.19 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java 4 Jun 2004 13:40:16 -0000 >@@ -201,16 +201,29 @@ > } > /** > * If there are any modal shells open reschedule openJob to wait until they >- * are closed. Return true if it rescheduled, false if there is nothing >- * blocking it. >+ * are closed. If the operation in jobsDialog is running then open >+ * regardless as it is not being blocked by the jobs dialog. >+ * Return true if it rescheduled, false if there is nothing blocking it. > * > * @param openJob >- * @return boolean. true if the job was rescheduled due to modal dialogs. >+ * @param jobsDialog The dialog that is running a job. If it is still >+ * ticking then open away as it is not being blocked by the open dialog. >+ * May be <code>null</code>. >+ * @return boolean. true if the job was rescheduled due to modal dialogs >+ * or if it should not open at all as the operation is done. > */ >- public static boolean rescheduleIfModalShellOpen(Job openJob) { >+ public static boolean rescheduleIfModalShellOpen(Job openJob,ProgressMonitorJobsDialog jobsDialog) { > Shell modal = getModalShell(); > if (modal == null) > return false; >+ >+ //If ticks are going on don't block. >+ if(jobsDialog != null){ >+ if(jobsDialog.isAlreadyClosed())//Just abort if it is closed >+ return true; >+ if(jobsDialog.isTicking())//open if it is still alive >+ return false; >+ } > > //try again in a few seconds > openJob.schedule(PlatformUI.getWorkbench().getProgressService() >@@ -288,7 +301,7 @@ > end.x += windowLocation.x; > end.y += windowLocation.y; > RectangleAnimation animation = new RectangleAnimation(internalWindow >- .getShell(), startPosition, end); >+ .getShell(), startPosition, end, 250); > animation.schedule(); > } > >@@ -311,7 +324,7 @@ > region.x += windowLocation.x; > region.y += windowLocation.y; > RectangleAnimation animation = new RectangleAnimation(internalWindow >- .getShell(), region, endPosition); >+ .getShell(), region, endPosition, 250); > animation.schedule(); > } > } >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java,v >retrieving revision 1.18 >diff -u -r1.18 ProgressMonitorFocusJobDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 27 May 2004 17:15:01 -0000 1.18 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 4 Jun 2004 13:40:16 -0000 >@@ -347,7 +347,7 @@ > return Status.CANCEL_STATUS; > > //now open the progress dialog if nothing else is >- if(ProgressManagerUtil.rescheduleIfModalShellOpen(this)) >+ if(ProgressManagerUtil.rescheduleIfModalShellOpen(this,ProgressMonitorFocusJobDialog.this)) > return Status.CANCEL_STATUS; > > //Do not bother if the parent is disposed >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java,v >retrieving revision 1.15 >diff -u -r1.15 ProgressMonitorJobsDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 27 May 2004 14:54:04 -0000 1.15 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 4 Jun 2004 13:40:16 -0000 >@@ -9,6 +9,9 @@ > **********************************************************************/ > package org.eclipse.ui.internal.progress; > import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IProgressMonitorWithBlocking; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; >@@ -34,16 +37,28 @@ > */ > public class ProgressMonitorJobsDialog extends ProgressMonitorDialog { > private NewProgressViewer viewer; >+ >+ //These are booleans that are used to check if the runnable in >+ //the receiver is still progressing. When watchingTicks is true >+ //and change to task name or incrementing of values will set >+ //tickOccured to true. >+ private boolean watchingTicks = false; >+ private boolean tickOccured = false; >+ > /** > * The height of the viewer. Set when the details button is selected. > */ > private int viewerHeight = -1; > Composite viewerComposite; > private Button detailsButton; >+ protected IProgressMonitorWithBlocking wrapperedMonitor; > > //Cache initial enablement in case the enablement state is set > //before the button is created > private boolean enableDetailsButton = true; >+ >+ //Keep track of whether or not this was already closed. >+ private boolean alreadyClosed = false; > /** > * Create a new instance of the receiver. > * >@@ -236,5 +251,154 @@ > detailsButton.setEnabled(false); > } > super.run(fork, cancelable, runnable); >+ } >+ >+ >+ /** >+ * Return true if bother watchingTicks and ticksOccured is true. >+ * If not watchingTicks already start after this is called. >+ * @return boolean <code>true</code> if tickOccured has been set. >+ */ >+ public boolean isTicking(){ >+ >+ if(watchingTicks){ >+ if(tickOccured){//If we have the tick reset the state >+ watchingTicks = false; >+ tickOccured = false; >+ return true; >+ } >+ return false; >+ } >+ watchingTicks = true; >+ return false; >+ } >+ >+ /** >+ * Create a monitor for the receiver that wrappers the superclasses monitor. >+ * >+ */ >+ public void createWrapperedMonitor() { >+ wrapperedMonitor = new IProgressMonitorWithBlocking(){ >+ >+ IProgressMonitor superMonitor = ProgressMonitorJobsDialog.super.getProgressMonitor(); >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int) >+ */ >+ public void beginTask(String name, int totalWork) { >+ superMonitor.beginTask(name,totalWork); >+ checkTicking(); >+ } >+ >+ /** >+ * Check if a tick occurred. >+ */ >+ private void checkTicking() { >+ if(watchingTicks) >+ tickOccured = true; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#done() >+ */ >+ public void done() { >+ superMonitor.done(); >+ checkTicking(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double) >+ */ >+ public void internalWorked(double work) { >+ superMonitor.internalWorked(work); >+ checkTicking(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled() >+ */ >+ public boolean isCanceled() { >+ return superMonitor.isCanceled(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean) >+ */ >+ public void setCanceled(boolean value) { >+ superMonitor.setCanceled(value); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String) >+ */ >+ public void setTaskName(String name) { >+ superMonitor.setTaskName(name); >+ checkTicking(); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String) >+ */ >+ public void subTask(String name) { >+ superMonitor.subTask(name); >+ checkTicking(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitor#worked(int) >+ */ >+ public void worked(int work) { >+ superMonitor.worked(work); >+ checkTicking(); >+ >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#clearBlocked() >+ */ >+ public void clearBlocked() { >+ if(superMonitor instanceof IProgressMonitorWithBlocking) >+ ((IProgressMonitorWithBlocking) superMonitor).clearBlocked(); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#setBlocked(org.eclipse.core.runtime.IStatus) >+ */ >+ public void setBlocked(IStatus reason) { >+ if(superMonitor instanceof IProgressMonitorWithBlocking) >+ ((IProgressMonitorWithBlocking) superMonitor).setBlocked(reason); >+ >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.ProgressMonitorDialog#getProgressMonitor() >+ */ >+ public IProgressMonitor getProgressMonitor() { >+ if(wrapperedMonitor == null) >+ createWrapperedMonitor(); >+ return wrapperedMonitor; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.ProgressMonitorDialog#close() >+ */ >+ public boolean close() { >+ boolean result = super.close(); >+ if(result){//As this sometimes delayed cache if it was already closed >+ alreadyClosed = true; >+ watchingTicks = false; >+ } >+ return result; >+ } >+ /** >+ * Return <code>true</true> if the close() method was already called. >+ * @return the closed state >+ */ >+ public boolean isAlreadyClosed() { >+ return alreadyClosed; > } > }
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 64937
:
11591
|
11606
|
11607
|
11620
|
11657
|
11663