Eclipse recent files - java

Is there any list of recently opened files in eclipse?
If yes then is there also any shortcut for it?
Frequently I close classes in editor because there are too many of them opened. But in a few minutes I need them again. Maybe you solve this problem differently?
Thanks!

Probably your best option is to use "Quick Switch Editor" (Ctrl+E) but it displays the opened files only. There you have quick list along with filtering by starting to type first chars of file name. To make it useful, you may increase the size of opened files/windows before closing - Window->Preferences->General->Editors->Number of opened editors before closing. After you reach this threshold the oldest file open is closed in order to make room for newly open one.
The list of the files recently opened is displayed in File menu, just before the Exit menu option.
There you'll find the already open and last closed files.
If you want to use it extensively then you should probably increase the size of the items - Window->Preferences->General->Editors->Size of recently opened files list. You can quickly invoke one of last 9 filed with Alt+F,[Digit].
A drawback of third option "Open Resource" (Ctrl+Shift+R) is that the default list looks sorted, so it is not based on the most recent date of use. Also "Open Type" (Ctrl+Shift+T) has a long listing over time and you should enter part of the name to get a shorter match.
My initial comment is based on Eclipse 4.3 Kepler and is applicable to current latest Eclipse (4.5 Mars) too.

If you click on the File menu, you would see the list of recently used files. By default there are four of them. To increase the no, goto Window-> Preferences-> General -> Editors. You can set to as many as 15

If you know the class name you can use Ctrl+Shift+T (for classes) or Ctrl+Shift+R fo any other resource file. You don't have to type full name just the uppercase letters. Eclipse shows recently opened file in topmost section and other files in the lower section.
You can also use Ctrl+Q to goto last edit location.
For a complete list of shortcuts goto Help>KeyAssist. Also checkout Tips and Tricks under the same menu.

I'm using CTRL + F6.
Unfortunately it is not possible to use "regular expressions" as for CTRL + O, but I think this is what are you looking for.

You can either use the "last edit location" shortcuts on the toolbar (the yellow arrows, alt+left) if you wish to reopen a recently edited file, or use the short list of recently opened under the "File" menu (right above "exit")

I created a plugin called "RecentEditors" that shows a list of recently closed files, sorted by close time (so the last closed editor is at the top). There is also a command (and keyboard shortcut) to directly re-open the last closed editor.
You find the plugin on the Eclipse Marketplace, and GitHub.

Related

Java JNLP download loop

We have a JNLP file that on some computers gets stuck in a download loop.
When the download it started the user is presented with an "Open" or "save" option and no matter which they choose it seems to start a new download and present them with the same 2 options.
It seems to only happen on Windows 10, though not always.
Java version is 8 update 161
The same thing appears to happen in Edge, Firefox, and Chrome.
Supposedly it was resolved one time by going into java configurations, and deleting temporary internet files, however I have not been able to replicate this issue.
Has anyone experienced this sort of thing? I tried searching around a bit online but nothing seems to match. This is the first time I've made an account to ask a question, please let me know if you think there is any other relevant data I should provide.
I figured this out. It seems users had associated the .jnlp file to "Open with" a browser, as a result any time they tried to open a .jnlp file they had downloaded the browser treated the file like a new download. We simply needed to re-associate the "open with" to point at the javaws.exe.
The piece that helped clarify this was realizing that the files were in the downloads folder, so they were downloading. They must have just chosen a poor association at some point.

Eclipse - is it possible to jump to a particular package?

Say i'm looking at some file, and i'd like to see if there are similar files in a different package. I don't really know what the different files might be called - they were coded by different people, so could well be named differently.
I do know they're probably in a package of roughly the same name - for example, if i'm looking at a file in the com.sandwiches.ham.artisan package, and i think there should be a similar (although, in this case, sadly unrelated) file in the com.sandwiches.avocado.artisan package, what is the fastest way to jump to said package and check it out?
I'm fed up of scrolling through reams of artisan sanwiches, its making me hungry.
Well, no matter what, you are going to have to do some typing. There is a Go-to navigation item for packages, its just not bound to any quick keys. To bind it to a key combination of your choice, do the following:
Eclipse->Preferences, and type in Keys as your filter.
Search for the Go To Package command, click on the Binding entry field, and type whatever keys you want to use for the keybindings (in my screenshot I have it set to Command-Shift-0). Then click OK to save and close the preferences dialog.
After that, typing your chosen key bindings will bring up a package explorer that lets you type in whatever package you want and navigate to it.
From the Breadcrumb (press Alt+Shift+B to open it) it is quite quick to navigate your way through the sandwich menu ehm I meant packages structure...
Ctrl + Shift + R its a good shortcut to find files in every package in your proyects, i use it everytime... hope it help...

content assist does not work in Eclipse

When I am typing Ctrl-Space in Java file in Eclipse June, I am getting "no proposals". Meanwhile, if I do Edit->Content Assist->Java Proposals I have normal proposals list.
I.e. default proposals are not Java by some reason.
What it can be and how to setup?
This happened to me at some point when I upgraded to Eclipse Kepler. Go to your Preferences. The appropriate page should be Java -> Editor -> Content Assist -> Advanced.
There are two lists of proposal types. Checking a type in the first list allows that proposal to appear automatically when it detects you pressing the trigger key. If it can't find any assist options in any of the checked proposal types, the Content Assist box will not appear.
Checking a type in the second list allows that proposal type to appear in the Content Assist box when it is already on screen, accessed by pressing the command to cycle the current proposal type. You can even change the order of appearance.
To solve your problem, at the very least, make sure Java Proposals checked in the first list (Technically, you can have it checked in only the second, but that means you'd need to manually bring up Content Assist and cycle to Java each time). Once checked, it should be automatically chosen as the default Content Assist for .java files.

Searching for a particular string in 5000+ text files.

I solve bugs for a product. The customer has sent a bundle of log files. I am required to search for a particular string in these log files. The number of log files is more than five thousand.
I cannot use grep because I am working on a windows machine.
What are my options here ? I was thinking about writing a program in java where I open every text file in a directory and search for a particular pattern. But I could not find a api where i can open every file one after the other.
Can you please suggest me a solution. I can also code in C++ or C# is somehow a solution can be built there.
I would suggest installing Cygwin and using grep
If you need to do this only manually, then just install any decent editor (my suggestion would be http://notepad-plus-plus.org/), and use its find-in-files function.
How about using findstr command from command prompt.
Perl. It takes about three lines of code to search every file in a directory for a string. You can learn enough Perl to do that in half an hour.
This works in Windows XP. I don't know about the more current versions.
Click on the Windows Start Button
Click on Search
A new window will open. On the bottom left, click on "Click here to use Windows Search Companion"
Another window will open.
In the text box labeled "A word or phrase in the file" type in what you're looking for.
In the combobox labeled "Look in", at the very bottom, select "browse..." and select the folder with all the log files.
Click "Search"
Wait for the results...
Note: there are 2 search programs. The first one only finds things that have been indexed, which is why you should use the second search program instead.
Good luck!
Consider VIM editor which is awesome when working with huge files. You can use it under Cygwin, and you can use on Windows. Use cheat sheets to learn it quickly.

What are the common tricks in eclipse when working with jsp files?

I looked through this list of “Hidden” features/tricks for Eclipse?", but it doesn't have anything for web-developement (jsp). A very useful list of tricks for a general eclipse user!
I work with jsp pages in Eclipse Ganymede, and I would like to find out a list of shortcuts commonly used to facilitate development. I always seem to struggle with the following, among other issues:
always traverse a directory tree to find a file (no Ctrl-shift-t just like java classes)
search is always ends up with either ctrl-f or searching the entire project
I would appreciate if you guys list tricks for eclipse, specifically for web-development (jsp/tomcat)
I am a noob, so don't hesitate to list anything even if you think it is TOO NOOB!!!
Thanks
my favorite:
ctrl + shift + r will open a resource dialog like the type dialog
Refer 30 Useful Eclipse Keyboard Shortcuts for Java Programmers for more.
First of all, be certain you use the Java EE version of Eclipse.
Edit:
Use Ctrl-Shift-R to locate a given resource (also known as "file").
You can use F3 on java identifiers in <%...%> to go to their definition.
The best tip I can give you is to learn JSF or similar so your JSP files only contain tags, and not java snippets.
I use the MyEclipse plugin. I have been very happy with it and it has a lot of jsp support.
MyEclipse
Get the Web Tools Platform plugin. I think it's included by default in the Jave EE edition of Eclipse, but you can also install it separately. To see if it's installed in your Eclipse, open the Help|About screen and look for a "WTP" icon.
It doesn't provide any web-specific shortcuts, but it will give you syntax highlighting and some auto-completion for HTML and CSS files, and for JSP files, enable many of the navigation features that you're used to from Java editing. (Such as Ctrl+Space to import a class and F3 to see its definition.)
Regardless of whether you have WTP installed or not:
Use Ctrl+Shift+R to open files; this works much like Ctrl+Shift+T for opening classes.
Use Ctrl+H to search the whole of your project, or parts of it. If you pick the "File search" tab, you can specify file patterns (such as *.jsp) to search in. If you click on a folder in the Package Explorer, you can select "Selected resources" from the "Scope" box to search only in that folder (and its sub-folders).

Categories

Resources