I have been using Eclipse for a long time, the feature that is less known but very useful is the Scrapbook Page, that allows you to execute sections of the Java code without having them to be complete classes. For example, if I need to execute this simple for-loop I can do this by creating a scrap page (File->New->Other->Scrapbook Page) and then typing the following and they pressing the "Execute the Selected Text" or Ctrl-U will execute the code directly
for (int i=0; i < 10; ++i)
{
System.out.println("Here is the scrapbook page line: " + i);
}
Please post other less known but useful features that are available with eclipse. I know that there are entries in SO that mention the useful shortcuts available in eclipse, however this one is about forgotten or less known features
The plugin Spy (Alt+Shift+F1) is certainly one not very advertised.
Yet if you have any question about "how I develop a feature X looking like the one in eclipse", it can be very useful to quickly locate the right eclipse java source which does implement that feature!
(source: willianmitsuda.com)
See also this Guide to eclipse3.5:
The Plugin Spy gives you easily information about the running UI.
Press Alt+Shift+F1 to get information about the current running Eclipse plugin / data types / screen.
This way you can get immediately access to the plugin which is currently running.
(source: vogella.de)
Eclipse 3.5 introduced the possibility to check which plugin contributed a menu. Press "Alt+Shift+F2" and select a menu to see who is contributing this menu
(source: vogella.de)
I like the fact, that you don't necessarily need to create a new class by using New->Class, when having the class source somewhere in the clipboard. You can simply select the destination package and paste the clipboard content.
Related
One thing that I've found incredibly useful, especially when working with code that I haven't written myself, is when tooltips can show me the comments, and syntax highlighting for a given variable/value/function/method/etc. It wastes time having to go to the implementation itself to read the comments and then come back.
Visual Assist X for Visual Studio does this, here's an example I found:
Notice the comments at the bottom of the image, and syntax highlighting applied to the tooltip itself.
I'm hoping IntelliJ IDEA does this, or at least that a plugin for it does. Any help is much appreciated.
Background info: I'm using IntelliJ IDEA 11, particularly for Scala.
Ctrl + Q will show you ScalaDoc for the the thing you have under cursor. More info
You can also use Ctrl + Shift + I to quickly view the definition of that thing. More info
You can also find useful Ctrl + P - it shows parameter list for the function you are calling and your progress so far (in bold). I find it very helpful when I writing method calls. More info
In order to make it work, you need to attach sources and/or javadocs to you library dependencies. You can make in module settings (dependencies tab). Just double click on the library dependency and you will see options that allow you to attach sources and javadocs. They are normally distributed as JAR and ZIP files or you can also simply point them to some directory in you file system.
The Eclipse content assist for PHP (and I'm assuming for other types as well) isn't using the currently active working set - it's searching ALL files in the project. How do I change it to only use the active working set?
When doing a Ctrl+Shift+R search, it was also looking for all files in the project (not what I wanted), until I clicked the small black triangle in that window and selected the working set I wanted it to use. Now it successfully only shows the files that match my search string in the working set. However, this doesn't change anything in the autocomplete content assist feature (i.e. doing a Ctrl+Space to complete the name of a function or variable). Is there any way to accomplish this?
I'm using Eclipse Indigo release, so it's very recent.
I'm afraid it's not possible the way you put it. Eclipse Working Sets just give you a way to organize your projects.
However you may want to take a look at Mylyn, which is fully integrated with Eclipse platform. Here and here is a nice overview of what you can do with Mylyn. But briefly, what it allows you to do is to create a task and maintain a context associated with it. This way, only the relevant files will be displayed in Project Explorer and autocomplete would suggest you only task-focused options.
I want to make a tool like this:
"java.is.Good.toString()" I want to search this String and jump to the Good.toString() method body.
how to active this?
I can read sourcecode of eclipse, but know nothing about eclipse plugins development, so please give me some guide just like:
THE KEY METHOD
org.eclipse.jdt.core.search.MethodDeclarationMatch
[I can't find where to turn a String path to a JavaElement for search]
THE KEY SAMPLE
[I can't find the eclipse "navigate->open declaration" sourcecode]
try eclipse plug-in spy tools to find existing function codes and description.
As the jdt, there are many api for users to do such things like find a JavaElement by string name.
However, it's a pity that few people are familiar to this part and all depends on you.
Good luck.
The same functionality (Open Type under Cursor, Open File under Cursor) gives plugin called AnyEdit Tools (update site: http://andrei.gmxhome.de/eclipse/). Look into its sources or just use it.
P.S. Useful hotkeys for plugin development/hacking:
Shift+Alt+F1 - Plugin Selection Spy, shows detailed information about current window/editor/selection (contributing plugin, classes, selection etc.)
Shift+Alt+F3 - Show Contributing Plug-in, shows which plugin has contributed active window
is there any way, to enable a dropdown list of methods or functions, on the Editor Toolbars of NetBeans 7, like VS does? , i mean the toolbar that is inside on the tab of each file when you are editing a code, that has some options like, "last edit, next breakpoint, next bookmark, ..."
In VS is really helpful this feature, to jump of functions o methods more quickly, i know that netbeans has the navigator, but sometimes this help more
Greatings
is there any way, to enable a dropdown list of methods or functions,
on the Editor Toolbars of NetBeans 7, like VS does?
There is no way provided by standard NetBeans IDE offering or certified plugins available in NetBeans Update center, but a NetBeans plugin can be written for doing what is expected in your question. Has it been done? In my opinion no, as no one asked till now. Now that you have asked someone may think of developing such a plugin.
Best way to expedite such request and feature to be added to NetBeans is to add a Request for Enhancement in the NetBeans issue tracker.
In VS is really helpful this feature, to jump of functions o methods
more quickly, i know that netbeans has the navigator, but sometimes
this help more
There are many ways to reach specific methods in NetBeans IDE. You have already listed one and that is Navigator. Others include GoTo Type [CTRL+O] and GoTo Symbol [CTRL+ALT+SHIFT+O]
I'm a recent semi-convert to Eclipse after 20 years of using vi and gvim. One of the things I miss about gvim is that I could cut a bunch of different snippets of code into named buffers, and paste them at will when doing something like repeating a common idiom. For instance I'd have it so "ap would paste
DatabaseHandle handle = null;
try
{
handle = DatabaseConnectionPool.newHandle();
and then "bp would paste
handle.commit();
}
finally
{
handle.rollback();
DatabaseConnectionPool.returnHandle(handle);
}
And I could repeat both of them over and over in the course of a day. In an answer to another question, somebody mentioned that you could "manage code snippets" in Eclipse, but didn't mention how. So now I'm asking: how do you manage code snippets in Eclipse?
You might want to store those two snippets into a code template, as explained in this tutorial.
And do not forget about the possibility to quickly execute any kind of java code snippets in a scrapbook (not exactly what you want, but it can come in handy at times)
Newtopian adds (in the comments)
In fact templates become much more powerful by adding variables and tabstops within, so your example above would become dbHandle ctrl+space. It would copy snippets from both parts and place your cursor right in the middle.
Eclipse also offers something very similar to the templates feature described by VonC called (would you believe) snippets. Window > Show view > Snippets.
To add a new snippet category: Right click in the Snippets window and click Customize...
Click New > New Category. Enter a category name if necessary (e.g. "Java"). Click Apply.
With your chosen category selected, click New > New Item. Enter your snippet.
To use a snippet, put the cursor where you want to insert the snippet, then double click on a snippet in the Snippets window.
I ran into the Snip2Code plugin recently.
It did the job, and I can collect and search snippets in a quick way.
Well a picture worths a thousand words, what about this one?
The question is old but the link of the answere is older ;)
Here is a nice tutorial:
http://www.dansshorts.com/post/creating-snippets-in-eclipse
I have used snippets in some IDEs, like Dreamweaver and Homesite, an old Coldfusion IDE. I also use a lot of snippets in MySQL Workbench - where i type a lot of SQL, very handy there.
I am now using Eclipse Java EE IDE for Web Developers Version Indigo Release and found the snippets panel in Window|Show View|Other...|General|Snippets. I was able to manipulate it and figure out how to add the code I wanted as snippets and how to use it efficiently.
Use Eclipse Snipmatch (Part of Eclipse for Java Developers Package).
Works very well for Java code snippets but also works for any other language like HTML, ABABP, PHP etc.
You can convert any code fragment from your editor directly to a code template. Highlight the code you'd like to convert to a snippet, context menu "create snippet", complete the form and done.
snippets can be shared via Git repositories with your team members
Manual:
https://www.eclipse.org/recommenders/manual/#snipmatch
Installation:
https://marketplace.eclipse.org/content/snipmatch