Netbeans re-open (Java) file at last viewed position - java

Netbeans always opens (Java) files from the top. However, I want to open them at the last viewed position because it is likely that I have to continue editing near this position (see also Locality of reference). Furthermore, it makes sense to continue navigation at this place because it is where I left and so I have this relatively fresh in my mind. Thus, it gives me orientation. Finding the last viewed position can be time consuming.
Some other editors, e.g., Visual Studio Code show the last viewed position when opening a file. This little change helps me a lot to navigate and edit code in re-opened files. I once asked the same for Eclipse but now I have to use Netbeans.
Similar behaviour can be observed in modern browsers. Scroll down a page, close the tab, reopen the tab from the history. The page will be opened on the same scroll position where you have left.
Is it possible to get the same behavior in Netbeans, i.e., re-open files at the last viewed position? I am using Netbeans 11.2.
Steps to reproduce in Netbeans:
Open a file, scroll down in that file and select some text, close the file, click on "file > open recent file > [THE FILE]" in the menu bar.
Now, the selection and scroll pos is gone but I want to continue where I have left the file.

Related

Detect open folder in Java (JNativeHook)

I'm using JNativeHook to detect drags and clicks outside a JFrame in my program and it's running perfectly. The thing is I need a way (either using JNativeHook or anything else) to check if a folder is opened in my explorer (Finder for Mac) so that I can move a file to this opened folder. JNativeHook doesn't seem to have the option of detecting on what program or window was the click made.
I expect the output of the code I'm looking for to return the path of open folders in my system explorer so that I can move files to this path.
You will not be able to detect if explorer is opened to a particular folder. There are API's to detect things like the window under the cursor and get information like the title, however, if explorer is not displaying the path in the title, it will be very hard to detect without traversing the application components and finding the address bar of the window. See WindowFromPoint and GetWindowTextA for a staring point. It should work fine under JNA and can be combined with the coordinates returned from JNativeHook.

Eclipse tabs closage within a project only

Most of time I work with more opened projects at once which results in the overcrowded and fuzzy set of opened cross-projects tabs at once. Suddenly I realize I have found what I need and I want to close all the tabs belonging to a project. Is there a way to comfortably close all the project related opened tabs without closing a project itself?
Example
I have opened two projects A and B. I would like to close all the clases under the B project only, i.e. (B1.java, B2.java ... B5.java).
Why don't you want to close the whole project and open to get rid of these tabs?
I want to keep the project opened to see its structure and opened packages with their content. Although my example above is simple, let's assume I don't want to close the project and walk through a broadly branched tree to find a relevant package agian. The only I need is to close the currently opened tabs of the other project to be used soon or later.
Close them manually, huh?
Eclipse has an amazing feature that the each tab size is different based on the length of the class/file name - the closing of more of tabs at row is still about wasting time of finding the x button. The even more stupid is the expandable list on the right side of tabs which items have no x button at all so I can't close the tabs directly from it.
So, does exist a way?
The simple answer is no, this is not possiable. To close all the tabs you can:
In the file menu(File>>Close All), click the close All item. Eclipse will close all the existing tabs.
This is quite a niche requirement, this could be quite a nice opportunity to build a Ecplise Java Plug-in.
I would suggest using "Tasks" or "Mylyn". When you move from task "A" to task "B", it will replace all the editor tabs for project "A" with the last editor tabs you had open for project "B".

IntelliJ project files suddenly broken

I've been working on a project in IntelliJ IDEA for about two months now. Today, when I fired up the IDE, which would usually open project straight up, IntelliJ took unusually long time to load, and when it did open the project, the main .java file displayed a long line of spaces and nothing else, instead of the code that was there before. The .iml file, the only other thing in the project, was fine. An error message was on the top:
"This document contains very long lines. Soft wraps were forcibly enabled to improve editor performance."
Trying to edit the document results in the entire program freezing and becoming unresponsive. What the hell happened? It was fine one day and then just did this, how do I get my project back and how do I prevent this?
Solved in the comments below the question; thought I might as well post a dummy answer and mark this as resolved.
EDIT: Solution written out.
Right click on file > Local History > Show History
Find any suspicious changes in the list on the left. Be especially on lookout for "External changes", as those can indicate crashes and sudden power-outs. Alternatively, look for times when you remember your computer crashed or power went out while IntelliJ was open.
Revert the changes(curved purple arrow in the upper left corner). Restart the IDE if it's going slow. Everything should work properly now.

Cannot view working sets Eclipse

Once upon a time I used Eclipse and I discovered this wonderful thing called working sets.
Now I am using Eclipse Luna and it looks like I have to relearn all about Working Sets again. Because nothing works like before.
On my journey to relearn all about working sets, some folks said that I should go to Customize Perspective.. and add the window working command group. I did that.
Then I created three working sets which each contained different projects. It kind of looks like this :
Now, I thought, this is where the fun begins.
Excitedly, I navigated to the Window menu and selected all three working sets.
Astonishingly nothing happened. I used to be able to see multiple working sets at the same time. What happened?
If you want to see the projects split in to Working Sets in the Project Explorer view you need to open the Project Explorer view menu (the small down arrow at the top right of the view) and select 'Top Level Elements > Working Sets'

In Intellij-IDEA 13, what happened to the tool window buttons that version 12 had?

I installed the community edition of Intellij-IDEA 13 and I lost the tool window buttons on the right, left and bottom. Here's an image of the buttons on the right in Intellij-IDEA 12:
What happened to these? I can get them to pop up by going to View -> Tool Windows -> <Pick One>, but if I close them, I have to go back to the menu to get it to pop up. This isn't that big of a deal because there are also short cuts attached to some of them. But, I use the "Maven" one frequently, and there's no shortcut attached for that one.
Were these tool window buttons replaced with something better that I haven't discovered yet? If not, is there a way to get these buttons back?
Such buttons are invisible by default from left and right side. Click here if you want make them visible: And click again and they will disappear.
Maybe this will help:
http://www.jetbrains.com/idea/webhelp/intellij-idea-tool-windows.html
There's a button that will bring them right up without resorting to the menu selection.
Whilst the tool window buttons are not visible, you can double-tab alt to see them temporarily (the 3 borders containing them pop up), and whilst still holding down alt you can hit the relevant key (e.g. 1 for Project) to choose one.
Similarly, you can use ctrl-tab and a number to focus a tool window.
I commonly have tool windows visible on my desktop pc and not visible on my laptop (where screen space is limited).

Categories

Resources