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 11657 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]
Updated patch
64937.txt (text/plain), 12.62 KB, created by
Tod Creasey
on 2004-06-07 09:53:26 EDT
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Tod Creasey
Created:
2004-06-07 09:53:26 EDT
Size:
12.62 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 7 Jun 2004 13:49:44 -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.87 >diff -u -r1.87 ProgressManager.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 7 Jun 2004 12:50:31 -0000 1.87 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java 7 Jun 2004 13:49:45 -0000 >@@ -821,8 +821,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 7 Jun 2004 13:49:45 -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.19 >diff -u -r1.19 ProgressMonitorFocusJobDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 4 Jun 2004 15:22:18 -0000 1.19 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java 7 Jun 2004 13:49:45 -0000 >@@ -348,7 +348,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.16 >diff -u -r1.16 ProgressMonitorJobsDialog.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 4 Jun 2004 15:22:19 -0000 1.16 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java 7 Jun 2004 13:49:45 -0000 >@@ -9,7 +9,16 @@ > **********************************************************************/ > 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.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.IContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerSorter; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >@@ -22,12 +31,6 @@ > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Shell; >-import org.eclipse.jface.dialogs.IDialogConstants; >-import org.eclipse.jface.dialogs.ProgressMonitorDialog; >-import org.eclipse.jface.operation.IRunnableWithProgress; >-import org.eclipse.jface.viewers.IContentProvider; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.viewers.ViewerSorter; > /** > * The ProgressMonitorJobsDialog is the progress monitor dialog used by the > * progress service to allow locks to show the current jobs. >@@ -40,7 +43,17 @@ > private int viewerHeight = -1; > Composite viewerComposite; > private Button detailsButton; >+ >+ //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; > >+ private boolean alreadyClosed = false; >+ private IProgressMonitor wrapperedMonitor; >+ > //Cache initial enablement in case the enablement state is set > //before the button is created > protected boolean enableDetailsButton = false; >@@ -236,10 +249,11 @@ > super.run(fork, cancelable, runnable); > } > /** >- * Set the enable state of the details button now or >- * when it will be created. >- * @param enableState a boolean to indicate the preferred' >- * state >+ * Set the enable state of the details button now or when it will be >+ * created. >+ * >+ * @param enableState >+ * a boolean to indicate the preferred' state > */ > protected void enableDetails(boolean enableState) { > if (detailsButton == null) >@@ -247,4 +261,184 @@ > else > detailsButton.setEnabled(enableState); > } >+ >+ /** >+ * 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() { >+ //We want to open on blocking too >+ 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) { >+ checkTicking(); >+ 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