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 99829 Details for
Bug 226052
[ui] - first filter text keystroke in available IU list can hang UI if no repos have been loaded
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.
[patch]
patch for delaying the synchronous setting and disabling the available page
bug226052.patch (text/plain), 5.79 KB, created by
Susan McCourt
on 2008-05-12 17:37:50 EDT
(
hide
)
Description:
patch for delaying the synchronous setting and disabling the available page
Filename:
MIME Type:
Creator:
Susan McCourt
Created:
2008-05-12 17:37:50 EDT
Size:
5.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.ui >Index: src/org/eclipse/equinox/internal/p2/ui/dialogs/DeferredFetchFilteredTree.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DeferredFetchFilteredTree.java,v >retrieving revision 1.5 >diff -u -r1.5 DeferredFetchFilteredTree.java >--- src/org/eclipse/equinox/internal/p2/ui/dialogs/DeferredFetchFilteredTree.java 7 May 2008 23:28:40 -0000 1.5 >+++ src/org/eclipse/equinox/internal/p2/ui/dialogs/DeferredFetchFilteredTree.java 12 May 2008 21:36:15 -0000 >@@ -10,6 +10,7 @@ > import org.eclipse.equinox.internal.provisional.p2.ui.viewers.DeferredQueryContentListener; > import org.eclipse.equinox.internal.provisional.p2.ui.viewers.DeferredQueryContentProvider; > import org.eclipse.jface.action.MenuManager; >+import org.eclipse.jface.dialogs.ControlEnableState; > import org.eclipse.jface.dialogs.PopupDialog; > import org.eclipse.jface.resource.JFaceResources; > import org.eclipse.jface.viewers.TreeViewer; >@@ -34,7 +35,6 @@ > * > */ > public class DeferredFetchFilteredTree extends FilteredTree { >- private static final long FILTER_DELAY_TIME = 200; > private static final String WAIT_STRING = ProvUIMessages.DeferredFetchFilteredTree_RetrievingList; > > ToolBar toolBar; >@@ -49,6 +49,7 @@ > String savedFilterText; > Job loadJob; > WorkbenchJob filterJob; >+ ControlEnableState enableState; > > class InputSchedulingRule implements ISchedulingRule { > Object input; >@@ -175,8 +176,9 @@ > contentProvider.setSynchronous(false); > > if (showFilterControls && filterText != null && !filterText.isDisposed()) { >- filterText.setText(getInitialText()); >- filterText.selectAll(); >+ // We cancelled the load and if it was in progress the filter >+ // would have been disabled. >+ restoreAfterLoading(getInitialText()); > } > } > >@@ -192,6 +194,8 @@ > filterJob = super.doCreateRefreshJob(); > filterJob.addJobChangeListener(new JobChangeAdapter() { > public void aboutToRun(final IJobChangeEvent event) { >+ final boolean[] shouldLoad = new boolean[1]; >+ shouldLoad[0] = false; > display.syncExec(new Runnable() { > public void run() { > String text = getFilterString(); >@@ -202,49 +206,53 @@ > // load job to complete before continuing with filtering. > if (text == null || (initialText != null && initialText.equals(text))) > return; >- if (!contentProvider.getSynchronous()) { >+ if (!contentProvider.getSynchronous() && loadJob == null) { > if (filterText != null && !filterText.isDisposed()) { >- filterText.setEnabled(false); >- filterText.setCursor(display.getSystemCursor(SWT.CURSOR_WAIT)); >- savedFilterText = filterText.getText(); >- filterText.setText(WAIT_STRING); >+ disableWhileLoading(); >+ shouldLoad[0] = true; > } >- event.getJob().sleep(); >- scheduleLoadJob(); >- event.getJob().wakeUp(FILTER_DELAY_TIME); >- contentProvider.setSynchronous(true); > } > } > }); >- } >- >- public void done(IJobChangeEvent event) { >- display.asyncExec(new Runnable() { >- public void run() { >- restoreFilterText(); >- } >- }); >- } >+ if (shouldLoad[0]) { >+ event.getJob().sleep(); >+ scheduleLoadJob(); >+ } > >- public void awake(IJobChangeEvent event) { >- display.asyncExec(new Runnable() { >- public void run() { >- restoreFilterText(); >- } >- }); > } > }); > filterJob.setRule(getFilterJobSchedulingRule()); > return filterJob; > } > >- void restoreFilterText() { >+ void disableWhileLoading() { >+ // We already disabled. >+ if (enableState != null) >+ return; >+ // TODO Knowledge of our client's parent structure is cheating >+ // but for now our only usage is in one particular widget tree and >+ // we want to disable at the right place. >+ if (parent != null && !parent.isDisposed()) { >+ enableState = ControlEnableState.disable(parent.getParent()); >+ } >+ if (filterText != null && !filterText.isDisposed()) { >+ filterText.setCursor(display.getSystemCursor(SWT.CURSOR_WAIT)); >+ savedFilterText = filterText.getText(); >+ filterText.setText(WAIT_STRING); >+ } >+ >+ } >+ >+ void restoreAfterLoading(String filterTextToRestore) { > if (filterText != null && !filterText.isDisposed() && !filterText.isEnabled()) { >- filterText.setText(savedFilterText); >- filterText.setEnabled(true); >+ filterText.setText(filterTextToRestore); > filterText.setCursor(null); > filterText.setFocus(); >- filterText.setSelection(savedFilterText.length(), savedFilterText.length()); >+ filterText.setSelection(filterTextToRestore.length(), filterTextToRestore.length()); >+ } >+ if (enableState != null && parent != null && !parent.isDisposed()) { >+ enableState.restore(); >+ enableState = null; > } > } > >@@ -259,7 +267,8 @@ > } > > void scheduleLoadJob() { >- cancelLoadJob(); >+ if (loadJob != null) >+ return; > loadJob = new Job(WAIT_STRING) { > protected IStatus run(IProgressMonitor monitor) { > if (this.getRule() instanceof InputSchedulingRule) { >@@ -275,6 +284,21 @@ > return Status.OK_STATUS; > } > }; >+ loadJob.addJobChangeListener(new JobChangeAdapter() { >+ public void done(IJobChangeEvent event) { >+ if (event.getResult().isOK()) { >+ contentProvider.setSynchronous(true); >+ display.asyncExec(new Runnable() { >+ public void run() { >+ restoreAfterLoading(savedFilterText); >+ } >+ }); >+ if (filterJob != null) >+ filterJob.wakeUp(); >+ } >+ loadJob = null; >+ } >+ }); > loadJob.setSystem(true); > loadJob.setUser(false); > loadJob.setRule(getFilterJobSchedulingRule());
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 226052
:
99141
|
99161
|
99174
| 99829