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

Fixes #50: adds hard mode #90

Merged

Conversation

mirkoalicastro
Copy link
Collaborator

Fixes: #50 .

Adds hard mode that needs to be closed to continue using the IDE.

@halirutan
Copy link
Owner

I'll start with the things I don't like because otherwise, I think it's just great.

I believe even in hard mode, the "Do you want to create a shortcut?" notification should be a simple balloon. We want to educate people to use shortcuts and if they want it hard, they can get it but there are a lot of actions even I would never consider using a shortcut for. We don't want to annoy people by asking with a dialog over and over again.

That brings me to my second point. I was thrown off that in the tips dialog the "Edit" button was the default one, so I looked into it. After a while, I was thinking who are we trying to teach people shortcuts and require them to use the mouse to close a dialog? :)

So why don't we remove all buttons from the dialog and let the user use the very same shortcut they were supposed to press to actually close the dialog? I played around with de.halirutan.keypromoterx.KeyPromoterDialogFactory#tipDialog introducing this:

            @Override
            protected JComponent createSouthPanel() {
                final JComponent result = super.createSouthPanel();
                final Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
                final Shortcut[] shortcuts = activeKeymap.getShortcuts(action.getIdeaActionID());
                new DumbAwareAction() {
                    @Override
                    public void actionPerformed(@NotNull AnActionEvent e) {
                        close(OK_EXIT_CODE);
                    }
                }.registerCustomShortcutSet(new CustomShortcutSet(shortcuts), result, getDisposable());

                return result;
            }

But it doesn't work if there isn't at least one button and I'd need to look into DialogWrapper in detail.

@mirkoalicastro
Copy link
Collaborator Author

mirkoalicastro commented Feb 16, 2022

I'll start with the things I don't like because otherwise, I think it's just great.

I believe even in hard mode, the "Do you want to create a shortcut?" notification should be a simple balloon. We want to educate people to use shortcuts and if they want it hard, they can get it but there are a lot of actions even I would never consider using a shortcut for. We don't want to annoy people by asking with a dialog over and over again.

That brings me to my second point. I was thrown off that in the tips dialog the "Edit" button was the default one, so I looked into it. After a while, I was thinking who are we trying to teach people shortcuts and require them to use the mouse to close a dialog? :)

So why don't we remove all buttons from the dialog and let the user use the very same shortcut they were supposed to press to actually close the dialog? I played around with de.halirutan.keypromoterx.KeyPromoterDialogFactory#tipDialog introducing this:

            @Override
            protected JComponent createSouthPanel() {
                final JComponent result = super.createSouthPanel();
                final Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
                final Shortcut[] shortcuts = activeKeymap.getShortcuts(action.getIdeaActionID());
                new DumbAwareAction() {
                    @Override
                    public void actionPerformed(@NotNull AnActionEvent e) {
                        close(OK_EXIT_CODE);
                    }
                }.registerCustomShortcutSet(new CustomShortcutSet(shortcuts), result, getDisposable());

                return result;
            }

But it doesn't work if there isn't at least one button and I'd need to look into DialogWrapper in detail.

Thanks for your feedback @halirutan !
I like the idea of having the dialogs only for already-existing shortcuts. And we can keep the balloon notifications to ask users if they want to create new shortcuts.
Also, it'd be great if the users can close the dialogs using the same shortcut they were supposed to press. I find this very educative.
I made the changes. I had to implement the DialogWrapper#getPreferredFocusedComponent to let the shortcut close the dialog without buttons. It looks to work 🙂

@halirutan Let me know in case you see room for improvement

@halirutan halirutan changed the base branch from master to beta February 26, 2022 01:42
@halirutan
Copy link
Owner

Sorry for being so painfully slow to answer. Work is crazy. I'll merge your PR to the beta branch. With that, we can publish it and not get the whole power of 2k downloads per day if we overlooked something.

Also, you might have noticed that you're doomed to be a collaborator now. You did a solid job so far and in case we need to fix something in the hard mode, working will be much easier. I hope this is OK.

@halirutan halirutan merged commit 540bd46 into halirutan:beta Feb 26, 2022
@mirkoalicastro
Copy link
Collaborator Author

Sorry for being so painfully slow to answer. Work is crazy. I'll merge your PR to the beta branch. With that, we can publish it and not get the whole power of 2k downloads per day if we overlooked something.

Looks like a great idea to me!

Also, you might have noticed that you're doomed to be a collaborator now. You did a solid job so far and in case we need to fix something in the hard mode, working will be much easier. I hope this is OK.

Sure, I'll be available to work on it in case.

Thank you and take care.

@johanvergeer
Copy link

Hi all,

I wanted to take a look at the hard mode, but I see that it is in the beta branch, and I have no idea what the correct way is to install from that branch, could someone help me out with that?

@mirkoalicastro
Copy link
Collaborator Author

Hi all,

I wanted to take a look at the hard mode, but I see that it is in the beta branch, and I have no idea what the correct way is to install from that branch, could someone help me out with that?

Hi @johanvergeer. Sorry for my delay. I had a look at it, and indeed the beta version is not publicly available.
@halirutan Should it be released in the marketplace with the beta tag?

@halirutan
Copy link
Owner

Sorry for the late reply. It's always lovely how work and projects disturb the fun things :)

I'd say we just release it to the official channel. I haven't experienced any weird issues or bugs so far. I hope I manage to take care of it this week.

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

Successfully merging this pull request may close these issues.

Add hard time option
3 participants