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

Close Others extension improvements. #5497

Closed
wants to merge 8 commits into from
Closed

Close Others extension improvements. #5497

wants to merge 8 commits into from

Conversation

sathyamoorthi
Copy link
Contributor

PR #4590 follow up.

1.Small fix added to retain Current Document after closing list of files.
2.Code added to dynamically add / remove context menus based working set file selection.

CC: @JeffryBooher

@ghost ghost assigned JeffryBooher Oct 14, 2013
@@ -126,16 +126,25 @@ define(function (require, exports, module) {

function runCloseOthers() {
var ws = DocumentManager.getWorkingSet(),
e = new jQuery.Event("contextmenu"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why jQuery instead of $ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. let me modify it. If there is any other changes, please do let me know.

@sathyamoorthi
Copy link
Contributor Author

@JeffryBooher Hi, I did the changes that you had mentioned. Does it need any other changes?

$(workingSetCmenu).on("beforeContextMenuOpen", function () {
var targetIndex = dm.findInWorkingSet(dm.getCurrentDocument().file.fullPath),
closeOthers = (dm.getWorkingSet().length > 1),
closeOtherAbove = (targetIndex > 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency -- you should name this closeOthersAbove -- you have closeOtherAbove

@iwehrman
Copy link
Contributor

Drive-by comment, since it looks like you're cleaning up changes introduced with the Close Others extension: modifying the fullPath of a FileEntry, as in bd4018d, is not good. In the future, this will be enforced and will cause an exception. I cleaned this up in a separate branch here bd967ff; you might want to incorporate something similar into master.

@sathyamoorthi
Copy link
Contributor Author

@JeffryBooher Changed that. Sorry i failed to see it.

@iwehrman I did the change that you have proposed. But just curious, why do you think it would cause error? I think, if newFile had changes other than filePath, we will miss them. Is that a reason?

@iwehrman
Copy link
Contributor

Yes, also other clients would like to be notified when file paths change, so just rewriting the path is not sufficient. Also some clients might maintain sets of files that are keyed by path, and changing the path of the underlying file without notifying them could cause problems. And, as I said, we're working on changes, which are coming soon, to the filesystem infrastructure such that rewriting the path will cause an explicit error.


runs(function () {
expect(DocumentManager.getCurrentDocument()).not.toBe(null);
});
}

it("Close others", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you fix the tabs in this block. lines 156-159 are misaligned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is funny issue. It looked good in Brackets and Submlime but not in github. I deleted and recreated those lines to fix this.


`pageX` and `pageY` can be any number. our only intention is to open context menu. but it can open at anywhere.
*/
cm.open({pageX: 0, pageY: 0});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeffryBooher @redmunds. I replaced triggering contextmenu event with contextmenu.open. Hope you may like it this time.

@peterflynn
Copy link
Member

We had ported some of these changes to the filesystem branch (to fix the code that modifies fullPath), and I think we may have found a bug in that part. To avoid conflicts, we should probably wait until that's sorted out and the filesystem stuff lands before merging this.

peterflynn added a commit that referenced this pull request Nov 1, 2013
* 'Close Others' with one unsaved file did nothing (after choosing to
save) -- this was a merge error in doSave().
* 'Close Others' with multiple unsaved files doesn't close working set
items that have never been opened yet (after choosing to save) -- appears
to be a bug in the code we copied from PR #5497 (saveFileList() &
_doCloseDocumentList() were not on the same page about the list of files
meant that was returned from saveFileList()). Added a note in the PR.

Also rename 'savedFiles' vars to avoid confusion over whether they include
files that weren't dirty. And improve docs.
@peterflynn
Copy link
Member

See fa8c824 for details.

@sathyamoorthi
Copy link
Contributor Author

Sure. Let me know once you merge filesytem branch.

@JeffryBooher
Copy link
Contributor

@sathyamoorthi you might want to merge off of that file system branch to see how things are progressing and to make your merge as seamless as possible. Closing this pull request until you've had a chance to look at the changes coming in the new File System API and you can re-open when it's ready.

@sathyamoorthi
Copy link
Contributor Author

@JeffryBooher i gave simple PR #5866 to fix #5800. Let me give other improvements in separate PR once they merge filesystem branch into core. So we can have minimum guarantee to solve that issue in next sprint.

What do you think?

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.

6 participants