Intellij new Java Class opening a different dialog than usual - intellij-idea

When creating a new java class via new -> Java Class while using IntelliJ IDE, a random Dialog started appearing, and I can't find how to disable it.
This is the strange dialog that started showing, a sort of a wizard. Clicking the help button get's me There is no help for this dialog message.
How can I disable this window in the Intellij IDEA?

I too had the same problem, the exact same dialog. In my case, it actually ended up not being a bug, but IJ acting properly (kinda).
TL;DR: The template code for creating a "Class" object got automagically changed after an IJ update so that it would prompt for answers from the coder when creating a new class file. Changing it back in "Settings/File and Code Templates" to the default template code removes the problem, as the default template code does not use any variables that are prompted for upon class object creation (ex.: ${IMPORT_BLOCK}).
Long version ...
Bring up the Settings dialog for IJ, and in the search field type "template", and then select the "File and Code Templates" option. You'll see on the right side of the dialog the "Editor > File and Code Templates" area. If you select "Class" from the list of template types, to the right of that list of template types you'll see the template used when you create a class ...
Now I don't know why, but after a particular IJ update some months back, via their Toolbox app, the default template text/code was different, so that it looked like this ...
... and that latter template code/text caused the second dialog to appear that you see.
To fix the problem, highlight the "Class" template from the list, then click on the "Reset to Default" button that appears below the Files/Includes/Code/Other tabs (looks like a piece of paper with a 180 degree curving arrow on top of it), so that the template text goes back to what I have showing in the first screenshot, and then select the OK button.
Assuming your "default" template for the Class template is not corrupted/bad, you should no longer see the dialog that you asked about.

Go to Settings/File and Code Templates -> class and change it to:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
}
You can also try hitting the reset to default button, as Adrian Romanelli suggested.

Related

Can I customize the "New File" menu in PhpStorm?

I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.
I tried using Appearance & Behaviour -> Menus & Toolbars but that didn't work for me.
Do you know that you can use the universal PHP Class entry and just change the type of the object (and therefore the file template) there? That can be done right away when typing the file or class name -- just use Arrow Up / Down keys:
(GREEN rectangle area is where that Up / Down key will work; RED rectangle shows my custom file templates)
P.S. The template for PHP Enums is also there, it just the screenshot was taken in a project with PHP 8.0 language level (need 8.1 for enums to appear).
P.P.S. The IDE will remember the last used template when you invoke this dialog again.
https://www.jetbrains.com/help/phpstorm/creating-php-classes.html
You can add new entries to this menu by creating custom File Templates at Settings/Preferences | Editor | File and Code Templates
https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html
Here are my test custom file templates:
And this is how they appear in that menu:
Customizing this menu (removing items, changing their order)
This is not possible at the moment. https://youtrack.jetbrains.com/issue/IDEA-143090 -- watch this ticket (star/vote/comment) to get notified with any progress.

Refactored "MySettings" to "Settings" on accident. Cannot revert back to normal

I was trying to troubleshoot why my default settings. Settings values weren't updating. Visual Studio showed me a recommended fix of refactoring "MySettings" to "Settings" and now every reference to My.Settings is broken and the word settings has turned green (used to be white).
I tried just hitting the undo button, and then closing without saving. But it didn't fix anything. Makes me think it isn't a project issue but a VS2016 issue.
My.Settings.ActiveDrive = My.Settings.Default.ActiveDrive
My.Settings.Save()
This is the code I was altering. I was trying to error proof my code and reset the value to the default to simulate a new user with no saved settings yet. Then I switched Settings to MySettings to see if that'd do anything and VS asked if I wanted to refactor MySettings to just Settings. I said yes... And now the code is broken.
I just want Settings to go back to normal. The way it worked before I hit "refactor MySettings".
I was actually able to figure it out.
For anyone out there that runs into this issue in the future (Since I found 0 results on google about this), you simply go to your solution explorer in the top right, click the drop down icon next to Settings.settings, double click on Settings.Designer.vb, ctrl+f and search for "settings" and rename any class designated "Settings" result back to "MySettings". Don't rename the other "Settings" appearances otherwise it'll break again.
Then your code will go back to having a read-only "settings" option and a class option called "MySettings".

PhpStorm does not highlight unimported classes

I'm using PhpStorm 2016.2 and recently I've noticed that it has stopped highlighting errors when a class is not imported from any namespace.
Let's say a namespaced class and inside I have a call like this:
$user = User::findOne(123);
In order for the above to work, I would need to do use common\models\User. But there is no error highlight and if I try to execute the code, it would of course fail. I'm confident that previously I got such errors highlighted. I'm not sure however when that happened - since update to 2016.2 or after doing something unintended.
You can follow the below steps to highlight the undefined/unimported class in phpstorm.
Go to preferences tab, choose inspections from Editor.
From the lists, choose php.
Under that, tick the Undefined class and click Apply and Ok.

eclipse workbench selections

I have written one code for getting the source and selected of the part of the eclipse. If we click on the view or editor it will display the object and if we select something it will displayed the selected item.The same way is it possible to get for dialogues and others actions. For example if I click on one dialog it should the dialog name or object. The same way for whate ever object i clicked on the wokbench its hould whats the object.including actions. Following is my code.
private ISelectionListener listener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) {
System.out.println(sourcepart, selection);
}
};
I got the for the commands. we can use IExecutionListener for the what ever the command they have attached to the workbench. Now I want for actions,dialogues,etc..
The short answer: it's a lot of work.
Have a look at Plug-in Spy code (ALT+SHIFT+F1). It looks at SWT events and uses the widget in the event as a starting point. It then has to use its knowledge of how various structures are constructed (views, wizards dialogs, preference dialogs, property dialogs, editors, menus, toolbars) to figure out if there is any useful information.
To do something similar, you would have to look at what builds a specific dialog, or action, and try and figure out how to extract that information. Repeat for each dialog that you care about.
See org.eclipse.pde.internal.runtime.spy.SpyFormToolkit and surrounding classes in org.eclipse.pde.runtime.

How to launch an SP 2010 Dialog Window Maximized

I have modified EditForm.aspx of a list in SharePoint 2010. I need to launch the dialog window (that's what EditForm.aspx seems to be launched as) maximized, but I haven't been able to find the correct setting to tweak.
A quick web search suggests to use the showMaximized:true style setting, but I am unable to find the element in EditForm.aspx to apply this attribute to.
If you want to remove ALL dialogs from a list, go to:
list settings -> advanced -> dialog -> turn them off
But if you just want to change the edit button, you will probably have to create a new edit <CustomAction> that uses javascript, see this example:
http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx
Its for a different button, but you should get the idea.
And then you will need to build a <HideCustomAction> to hide the original edit button
Check this : http://www.wawawum.com/blog/post.aspx?id=66a5aed2-f530-4687-bd42-1ef0fb379544
Add a Content Editor WebPart to your EditForm, then put the code found in this blog to maximize the Dialog when opening it.
Works very well for me.