[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[Subclipse-dev] why are there so many calls to BusyCursor.showWhile?

From: Johan Compagner <jcompagner_at_gmail.com>
Date: 2006-05-07 13:58:14 CEST

Because in many places this is called in the event thread itself (as far as
i can see)
And then showing a busy cursor doesn't make sense because that one isn't
drawn at all because the event thread is blocked

I notice this when i want to make a remote folder on sourceforge. This can
take a while and the current code:

try {
            SVNUIPlugin.runWithProgress(getContainer().getShell(), false
/*cancelable*/, new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) throws
InvocationTargetException {
                    try {
                        ISVNRemoteFolder parentFolder =
mainPage.getParentFolder();
                        parentFolder.createRemoteFolder(
mainPage.getFolderName(),commitCommentPage.getComment(),monitor);
                    } catch (SVNException e) {
                        throw new InvocationTargetException(e);
                    }
                }
            });
        } catch (InterruptedException e) {
            // operation canceled
        } catch (InvocationTargetException e) {
            SVNUIPlugin.openError(getContainer().getShell(),
Policy.bind("exception"),
null, e.getCause(), SVNUIPlugin.PERFORM_SYNC_EXEC); //$NON-NLS-1$
            return false;
        }

just blocks the even thread. So everything gets white or gray when i move to
another window or try to click on the window

i changed the code to this:

try {
            final String folderName = mainPage.getFolderName();
            final String comment = commitCommentPage.getComment();
            IRunnableWithProgress runnable = new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) throws
InvocationTargetException {
                    try {
                        ISVNRemoteFolder parentFolder =
mainPage.getParentFolder();
                                parentFolder.createRemoteFolder
(folderName,comment,monitor);
                    } catch (SVNException e) {
                        throw new InvocationTargetException(e);
                    }
                }
            };
            new ProgressMonitorDialog(getShell()).run(true, false,
runnable);
        } catch (InterruptedException e) {
            // operation canceled
        } catch (InvocationTargetException e) {
            SVNUIPlugin.openError(getContainer().getShell(),
Policy.bind("exception"),
null, e.getCause(), SVNUIPlugin.PERFORM_SYNC_EXEC); //$NON-NLS-1$
            return false;
        }

and the progressmonitor popups up. And now the ui is being kept responsive..

Shouldn't all remote operations be exeucted in the background (blocking the
foreground with a dialog or not that depends on the operation)

johan
Received on Sun May 7 13:58:18 2006

This is an archived mail posted to the Subclipse Dev mailing list.