ProjectConfigurable is receiving wrong project in constructor

Hi, I have a projectConfigurable class defined in this way inside plugin.xml:

<projectConfigurable instance="com.myplugin.ui.forms.MypluginSettingsForm"></projectConfigurable>


And the constructor for that class is receiving the Project:

public MypluginSettingsForm(@NotNull final Project currentProject)
    {


this is working fine for almost all the users, but for some users (Mac users only I think) the Project parameter is wrong sometimes, that is, is not sending the current project but is sending something like:

Project (Default) Default (Template) Project
(project var converted to string)

Does anybody know why could this be happening and how can I solve/prevent that?

Thanks !!

6 comments
Comment actions Permalink

There is nothing wrong about that project, and you don't need to do anything to solve or prevent this. Your Configurable will receive the default project in its constructor if the user invokes the File | Other Settings | Default Settings action.

0
Comment actions Permalink

Where is that option?
I can see only my plugin inside "other settings"
and what should I do when I receive a default project anyway? I can't work with that, because I need the current project in my settings...

0
Comment actions Permalink

Updated the action name.

What exactly do you need the project for? The default project is also a project that can be used normally with most APIs.

0
Comment actions Permalink

I don't understand the question, I mean, is not logical to use the project for the project settings?
The settings for my plugin are dependent on the project, I need to read file paths from the current project etc, I don't need general default settings.

The weird thing is this is working for almost all the users, but some users are receiving this "dafault" project, and I can't reproduce this, could you please give me some clue to replicate this behavior if is a normal thing from PhpStorm? and could you give me some hint about how to prevent using the default project in my settings? my settings have sense only for the current project...

I can't fine the option/action you are mentioning (attaching image)

EDIT: sorry, yes, when I use File > Default settings. I can see the project is the Default Project. Can I avoid showing my form in this situation?



Attachment(s):
filesettings.png
0
Comment actions Permalink

When you register your configurable in plugin.xml, you can add nonDefaultProject="true" attribute. Then the configurable will not be shown in the default project settings.

0
Comment actions Permalink

Hi Dmitry, thanks for the tip, but is not working, I have added that and my constructor is executed anywhere when I use File > Default Settings, and receiving the Default Project...
Any idea if this is a bug?

Also there are some users saying that they don't have the option File > Settings, only "Default settings" (this happens in Mac and Linux). Is this a bug?



Attachment(s):
PhpStorm File Menu.png
0

Please sign in to leave a comment.