Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLOSED] Add/expose isVisibile, show, and hide methods for SidebarView object #1172

Open
core-ai-bot opened this issue Aug 29, 2021 · 6 comments

Comments

@core-ai-bot
Copy link
Member

Issue by danilocelic
Thursday Jun 28, 2012 at 15:18 GMT
Originally opened as adobe/brackets#1187


The /project/SidebarView object exposes a toggle() method, but if other code wants to perform a show or hide, there is no way to choose to show or hide it based on some other condition (for example going into or out of a zen or focus mode) without using code that hides the sidebar via CSS which I'd like to avoid.

If there were dedicated show and hide methods, a developer could call only the specific functionality that is required rather than pulling from preferences as might currently need to be done, which might have its own perils if defaults for preference access are not kept in sync.

There is already a private variable named "isSidebarClosed" (not prefixed with _ in case it matters) that could be exposed in order to determine if you should even call the show or hide method (to prevent unnecessary code execution), or perhaps the show and hide methods themselves could only perform their action when appropriate.

@core-ai-bot
Copy link
Member Author

Comment by johannesboyne
Friday Jun 29, 2012 at 14:34 GMT


hey,
I come upon it just some minutes ago. Nice coincidence. You can perform a CommandManager.execute given the Commands ID as attribute.
Like this:

CommandManager.execute(CommandManager.get(Commands.VIEW_HIDE_SIDEBAR)._id);
This hides and shows the sidebar.

greetings

@core-ai-bot
Copy link
Member Author

Comment by danilocelic
Friday Jun 29, 2012 at 14:49 GMT


Yes, I am aware of that code, and it does exactly the same thing as the SidebarView.toggleSidebar() method I mentioned in my initial post; however if you want to specifically close the side bar and you call this code when it's already closed it'll open up. I've hacked together some code that adds a show and hide method as well as expose the isSidebarClosed private variable, when I get GIT installed and configured I'll try to do a pull request to get it into Brackets (if it's something that others would want to have)

@core-ai-bot
Copy link
Member Author

Comment by tvoliter
Friday Jun 29, 2012 at 22:49 GMT


Note that Commands objects have an execute() function so you can use this slightly shorter form: CommandManager.get(Commands.VIEW_HIDE_SIDEBAR).execute();

@core-ai-bot
Copy link
Member Author

Comment by pthiess
Tuesday Jul 17, 2012 at 17:37 GMT


Reviewed

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Saturday Mar 30, 2013 at 15:55 GMT


Submitted a pull request to fix this bug: adobe/brackets#3297

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Wednesday May 15, 2013 at 23:12 GMT


@danilocelic Fixed. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant