Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Issue #2076: Two indistinguishable events for different cases of working set reordering #4450

Merged
merged 3 commits into from
Jul 23, 2013
Merged

Issue #2076: Two indistinguishable events for different cases of working set reordering #4450

merged 3 commits into from
Jul 23, 2013

Conversation

TomMalbran
Copy link
Contributor

Fix for #2076

With this, now both drag and drop reorder and the context menu sort methods trigger the same workingSetSort event and drag and drop uses it in a way that it doesn't redraw the DOM.

It would have been pretty easy to remove the workingSetDisableAutoSorting event and just use the workingSetSort event to cancel the automatic sorting, but since pull request #4437, save as can sometimes trigger a workingSetSort event, which would disable the automatic sort in some unwanted situations.

@peterflynn Could you take a look as this solution? I think this is what you wanted :)

@ghost ghost assigned peterflynn Jul 15, 2013
@TomMalbran
Copy link
Contributor Author

I think that it will be best if we make a new workingSetRefresh event for Save As and then get rid of workingSetDisableAutoSorting and just use workingSetSort to disable the auto sorting.

@peterflynn
Copy link
Member

@TomMalbran Thanks for jumping on this!

Two things I think could make this cleaner:

  • Trigger "workingSetSort" directly from DocumentManager.swapWorkingSetIndexes(). That eliminates the need for triggerWorkingSetSort().
  • In WorkingSetView._handleWorkingSetSort(), use an internal guard flag to avoid unneeded _rebuildWorkingSet() calls -- i.e., set the flag before calling swapWorkingSetIndexes() and clear it afterward, and check the flag in _handleWorkingSetSort(). That eliminates the need to pass around a suppressRedraw flag (especially I'd prefer to keep the event itself free of flags that are meaningful only to one specific listener, if possible).
  • Bonus third item :-) ... I think if you used a similar guard-flag approach in WorkingSetSort, you could eliminate the need for the "workingSetDisableAutoSorting" event.
    [edit: Oops, except for the point you made in PR Alternate fix for #4484 (Working set broken after Save As / save untitled outside project) #4523... we can't actually eliminate that event as long as addToWorkingSet() still uses "workingSetSort" for non-sorting cases. So we can skip this bullet for now.]

@TomMalbran
Copy link
Contributor Author

@peterflynn

  • Sure will fix 1 and 2.
  • For the third point: My current problem is that Save As sometimes triggers a workingSetSort. So I'll need to know when is triggered by Save as, vs a sort method. If Save As didn't use it, then I would have no problems in removing workingSetDisableAutoSorting. Should we just change Save As to use a new event? If someone wants to listen to workingSetSort events, they might get one sent when no reordering was done.

@TomMalbran
Copy link
Contributor Author

@peterflynn Fixes pushed. I added a few extra JSDoc fixes too.

As you noticed I couldn't get rid of the workingSetDisableAutoSorting yet. Once is no longer used by Save As, the changes to removed are trivial.

@peterflynn
Copy link
Member

@TomMalbran Looks great! Merging now...

peterflynn added a commit that referenced this pull request Jul 23, 2013
Better fix for #2076: Two indistinguishable events for different cases of working set reordering. Now listening for a single event is enough to track all working set reordering.
@peterflynn peterflynn merged commit 830c83c into adobe:master Jul 23, 2013
peterflynn added a commit that referenced this pull request Jul 23, 2013
* Fix exception thrown when File > Save As invoked with nothing open
* Update docs for working set events to reflect PR #4450
@TomMalbran TomMalbran deleted the tom/issue-2076-take2 branch July 23, 2013 20:11
peterflynn added a commit that referenced this pull request Jul 30, 2013
…eanups

* origin/master: (30 commits)
  turn off optimization in acorn (but not acorn_loose right now)
  cleanup unit test prefs
  temporarily switch to my tern
  Revert "Revert "Workaround for the Tern crash.""
  Update README.md
  Work around #4554 (Extension Manager font is hard to read on Windows), which is a Chromium bug, by avoiding the lightest font-weight on Win. Lighten the text slightly so it's still a little muted, like the design looks on Mac and with older CEFs on Win.
  Revert "Workaround for the Tern crash."
  Updated by ALF automation.
  Re-add toolbar hover. Fix some button appearance issues.
  Updated by ALF automation.
  * Fix bug #4548 - remove Save As from folder tree context menu * Fix exception thrown when File > Save As invoked with nothing open * Update docs for working set events to reflect PR #4450
  integration tests for registerInlineEditProvider
  Fixes after review
  JSDoc fixes.
  Fix for extensions compare
  show error message and add safety check
  For #4535, show error message but not 'remove' link for bad extension in dev folder
  Refactor provider callback for export
  Generalize registerInlineEditProvider and registerInlineDocProvider to take an optional priority parameter
  change upper limit to 16000
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants