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

Improvements to Close Others #7038

Merged
merged 5 commits into from
Mar 4, 2014

Conversation

marcelgerber
Copy link
Contributor

As mentioned in #6020 (comment), I just did some improvements to the Close Others extension:

  • Removed the DocumentCommandHandlers module - it wasn't used
  • Renamed modules (beginning with an uppercase char) and vars (camelCase) to match the Brackets standard
  • Using the handler beforeContextMenuOpen

Unit tests still passing.
@JeffryBooher

}
}
}

if (settings.close_below) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about either removing these parts (settings) completely or replacing them with the new preferences system, but I wanted to hear your opinion first.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking the same. I think it might be cool to use the preference system, since this settings seem hard to edit.

@marcelgerber
Copy link
Contributor Author

I just added another commit to address these nits and use the PreferencesManager instead of the settings file.
It works, but I don't think it's the best solution. Could you take another look?

working_set_cmenu.addMenuItem(close_below, "", Menus.AFTER, Commands.FILE_CLOSE);
function prefChangeHandler() {
// it's senseless to look prefs up for the current file, instead look them up for the current project
var enabled = prefs.get("enabled", PreferencesManager.CURRENT_PROJECT),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that we need an additional enabled pref. It doesn't make much sense to have the menu items, but the commands disabled. If you want to disable them, you can just disable all the other menus.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't ever happen to have the menu entries but not the commands (we need the commands to register menu entries). I added this pref to make disabling the whole thing easier.
But I can remove it if you want me to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right... i still think is not needed since is just 3 preference to mark as false, which is not that much code:

{
    "closeAbove": false,
    "closeBelow": false,
    "closeOthers": false
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually it is:

{
    "closeOthers.closeAbove": false,
    "closeOthers.closeBelow": false,
    "closeOthers.closeOthers": false
}

Do you think like this it might be better?

{
    "closeOthers.above": false,
    "closeOthers.below": false,
    "closeOthers.others": false
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's better. Changed, thanks.

@marcelgerber
Copy link
Contributor Author

Adressed all comments.

@TomMalbran
Copy link
Contributor

It looks good. Will wait and see if @JeffryBooher has any input for this.

@JeffryBooher
Copy link
Contributor

Looks good to me...merging

JeffryBooher added a commit that referenced this pull request Mar 4, 2014
@JeffryBooher JeffryBooher merged commit 1ee81ee into adobe:master Mar 4, 2014
@marcelgerber marcelgerber deleted the improve-close-others branch March 9, 2014 16:01
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.

3 participants