Any useful netbeans shortcuts? - netbeans

Anyone knows any useful Netbeans shortcuts? in eclipse for example, i used to type sysout and press CTRL+Space, anyone knows any equivalent shortcuts? Thanks in advance ;D

What you are looking for is called Code Templates. You can find them under Tools / Options / Editor / Code Templates. There you find a (quite extensive) list of code templates that already comes out of the box but you can also define your own.
If you type in NetBeans for example psvm and press than the tab-key NetBeans will generate
public static void main(String[] args) {
}
for you.

Related

get all the classes with main method in Eclipse Java project

I'm working on an Eclipse plugin to help people manage their project.
Is there a way to list all the classes with the main method under a project by Java code?
I think the best practise is to use only keyboard.
Create new java class with Ctrl+n
on dialog box, enter its (class) name
use (left)Alt+v to easily tick checkbox for - public static void main(String[] args)
then press [enter] Finish and voila class is ready

Netbeans IDE Code Snippet Keybinding

I'm not sure if this is possible and if this is the right place to ask, but I'd like to give it a try. I'm currently trying Netbeans IDE, coming from Dreamweaver.
In Dreamweaver I can create Code Snippets and bind a key to them. So for example marking a text and pressing CTRL+B then, surrounds the text with the [strong] tag. Or I created a snippet, when I press SHIFT+CTRL+B it adds a [br /] tag at the position of the cursor.
I could not find a way to do this in Netbeans so far. Does anyone know if this is possilbe, and if, how to achieve this?
There is a Plugin available for that,
Go to Tools->plugins and try out TagMyCode
https://tagmycode.com/
I've been using it for quite some time, there is a library of public snippets and the doc is really helpful.

Command shortcut in intellij-idea

In eclipse by typing "main" and pressing Ctrl+Space you can generate main method, and there are lots of other shortcuts like this.
Is there anything like this in intellij-idea? and how can I assign them?
Depending upon your key configuration, you can type ⌘J for the Templates.
Also see: What are the most useful Intellij IDEA keyboard shortcuts?
Yes, just type sout and press tab button the main method with complete signature will be generated for you.
By default configuration shortcut for public static void main(String args[]) is:
psvm + TAB
psvm stands for Public Static Void Main

HOW TO USE THE CLASS OF "openPerspectiveMenu" IN A CLASS?

I want to develope plug-ins in eclipse,the function of the plug-ins is when right-click menu the button opens a perspective.I find the class which is "openPerspectiveMenu" has not been used,please tell me the alternative.
thank you!
The way to open a perspective programmatically is to call:
IWorkbench.showPerspective(String perspectiveId,
IWorkbenchWindow window)
throws WorkbenchException
Javadoc here.
See http://wiki.eclipse.org/FAQ_How_do_I_show_a_given_perspective%3F for details.

Open Implementation (type hierarchy) functionality in NetBeans?

When I have Java code like this:
someInterface.someMethod();
how do I get Netbeans to show me which classes have implementations of someMethod() (not the interface).
In Eclipse this is done with Ctrl+T, but pressing Ctrl+T on the method did nothing in Netbeans 6.5 and I can't where the type hierarchy functionality is in Netbeans 6.5.
Thanks.
I find that Ctrl+Alt+B works perfectly. :)
This functionality already exists in Netbeans: Alt+F7, check 'Find All Subtypes', and click OK. Thanks to tkellerer for pointing this out on the Netbeans forums
http://forums.netbeans.org/viewtopic.php?p=49638#49638
This is widely overlooked functionality in Netbeans, perhaps because there is no key binding for it, so I've changed my enhancement request to add a key binding for the sequence "Alt+F7, check 'Find All Subtypes', and click OK"?
To get a hierarchy similar to the type hierarchy in Eclipse, right click on the class name, select Navigate, and then Inspect Hierarchy. The keyboard shortcut for this is ALT+SHIFT+F12. By default, it shows you parents of the selected class or interface. However, you can view descendants by using the Filters at the bottom left side. I believe the Show Subtype Hierarchy filter (also toggled by using CTRL+B) is what you want.
This is accurate in NetBeans 6.7.1. I'm going to assume it is similar in 6.5.
It turns out that there is no comparable functionality in Netbeans. You can read about it here:
http://forums.netbeans.org/viewtopic.php?p=49355#49355
I've also filed an enhancement request here, which you can vote for:
http://www.netbeans.org/issues/show_bug.cgi?id=172830
If you want to see this added to Netbeans please vote for it.
Hey, someone has implemented a module to do this, and it works in Netbeans 6.5.1 - perfect for you. I'm hanging out to see an equivalent for 6.7.1. Maybe they should add it to 6.8!
http://wiki.netbeans.org/JavaGoToImplementation
Go To Implementation is built in for recent versions of NetBeans. Look in the Navigate context menu.