Using file templates in IntelliJ - intellij-idea

I'm quite confused when it comes to file templates in IntelliJ. Basically, when I right click anything and hover my mouse over to New, I can see the usual file templates like Java Class, HTML File and so on. I downloaded Scala plugin and I can see Scala templates (Scala Class, Scala Object, etc.) if I go to Edit File Templates, but I can't actually use/see them in the New menu. Is there a way to modify what I see in the New menu? I'd like to be able to create Scala classes.

Go to Settings -> Menus and Toolbars
There you will see many type of menus. You need edit the menu you want the files to be displayed. Most Probably "Project View Popup Menu".
Click on "Add After" button on right. There you choose the file form plug-ins or other category to be displayed.
I added "Show Bytecode" to meny well it does not make sense here. You can add files from scala plugin like that.
You can restore to Defaults if you mess up easily by clicking on
"Restore All Defaults" button.

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.

Can I use the module structure (collapse Java package paths) for the Project Pane -> Changed Files view in IntelliJ?

When I use the "Project Pane -> Project" view in IntelliJ, my Java package paths are collapsed based on the Modules in my Project Structure (e.g. com.company.project). I would like to use IntelliJ for code reviews, so I've checked out the changes locally and am looking at the "Project Pane -> Changed Files" view, but this doesn't pick up the project structure, so each folder takes an extra line. Can I get the best of both worlds here?
I figured this out with the help of this answer about expanding the folders (which I also wanted to do) How to expand folded package chain in Intellij IDEA?
Right click on "1:Project" to see the options for the project pane and then check "Flatten Packages".

How can I make qtcreator change the Project view when I open a new cpp file

There is this feature that IDEA IntelliJ has: when a new file is opened the Project tree (view) automatically jump to the file opened (handy when you follow a function defined in some other file).
I'd like to know if qtcreator provide this option
Surprised how hard it is to find the answer, since the button isn't hugely obvious.
The button you want is at the top of the Project pane, between "filter" and "split". Tooltip says "synchronize with editor".

What is the use of autoscroll to source and and autoscroll from source features in Intellij IDEs?

I was looking for how to show the open files in project view and found theses two features, I want to know what does the above mentioned features do?
Explaining this simply,
Autoscroll to Source
Whenever you click on a file name in the Explorer Window, the file will be brought into focus on the editor. If the file is not open, it will be opened.
Autoscroll from Source
If you select a file in the Editor, that fill will be scrolled to and highlighted in the Project Explorer.
From the manual,
Autoscroll to Source
If this option is on, IntelliJ IDEA automatically navigates from a file (or a class member) selected in the Project tool window to the corresponding source file (or its fragment) in the editor. If the corresponding file is not currently open, it will open automatically.
Autoscroll from Source
If this option is on, IntelliJ IDEA automatically navigates from a file in the editor to the corresponding node (file, class, field, method, etc.) in the Project tool window.
https://www.jetbrains.com/idea/help/project-tool-window.html

Editor context Menu - Eclipse-RCP

I have an Eclipse RCP application. I have created an Editor. There are few context menu (default), when I right click on the Editor. I have not created these menus.
Please let me know, How to remove the context menu of the Editor?
It needs different approach by which editor you extends.
Let me know What you extends, than I can answer more efficient one.
In general way:
IWorkbenchParSite#registerContextMenu(...) will be used, So find where calls that, override it. It is not recommend. Because by doing this, Menu Extensions which is contributed for your editor will not work anymore.
If you mean the system menu that appears on editor tabs and view tabs, that menu is provided by the presentation (2.1, Classic, Default, etc). There is no tweak to simply modify it.
The 2 ways to remove it would be:
write your own presentation, using
the
org.eclipse.ui.presentations.StackPresentation
API and matching extension point.
Writing a presentation is a involved
undertaking.
Change the internal classes in the
org.eclipse.ui.workbench plugin
and patch that plugin in your RCP
app.
If you use Text or StyleText you will get the system default menu (cut,copy,paste, maybe something about encoding or input). If you are not going to supply your own menu, simply create an empty SWT Menu and set it:
Menu emptyMenu = new Menu(text);
text.setMenu(emptyMenu);
Eclipse also has a text editing framework, if you need more than a basic text box you should check it out. http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors