Save open files (session) in NetBeans - netbeans

I would like to save actually open files (tabs) and revert session (group of files) next time. Is there any options in NetBeans IDE 7.1.2? I know that NetBeans save automatically list of files that were opened when I quit the IDE. How to save opened files and switch between sessions?

You are looking for Project Groups. Take a look at the File > Project Group menu.
There you can create Project Groups that defines a list of opened projects. You can then switch from groups and the chosen projects will be opened/closed.
Netbeans saves the list of opened files per project so:
if your groups do not share projects, you'll get the behaviour you want.
if your groups share projects, the files opened in theses projects will follow you when switching between the groups.
<3 Netbeans

Try Tab Groups.
In Netbeans (at least in version 7.3.1), click:
Window > Configure Window > New Document Tab Group
Now, open a new file and it should open in a separate window.
Then, you can toggle the Maximize Window / Restore Window buttons to switch between your windows / tab groups.
Restore Window Button
Maximize Window Button
This is a convenient way to switch between sets of files, although you technically aren't saving these sets as you asked in your question. It does remember these tab groups when you close and reopen Netbeans, though.

Related

How do I stop VSCode from the Side Bar moving to the folder that the current file is in?

In Visual Studio Code, whenever I close a file, the next open file becomes active in the editor and the Side Bar moves to that file's location in the folder structure. This is usually not the behavior I want. I often want to open another file in the same location as the one I just closed, but now my Side Bar has shifted around to what could be a totally different place in a large project.
I like the behavior of the main Visual Studio product where the Solution does not automatically shift. Instead, if I want to see where in the solution a file is, I can use a keyboard shortcut to move there ("Find File in Solution"), instead of automatically moving there every time the active file changes.
Is there any way to change/disable this functionality in VSCode?
The is an option explorer.autoReveal in settings (either user or workspace) which controls if the explorer should automatically reveal files when opening them.
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Add a new "explorer.autoReveal": false setting to the User Settings document on the right if it's not already there. This is so you aren't editing the Default Setting directly, but instead adding to it.
Save the User Settings file.
in Version: 1.42.1
Open VS User Settings (Preferences > User Settings).
Search for "explorer auto reveal" without quotes.
Now uncheck the checkbox.
There is a new setting in v1.46 that will select the files in the explorer but not scroll to reveal them:
We have introduced a new value focusNoScroll to the
explorer.autoReveal setting. For this value Explorer will
automatically select files when opening them but will not reveal them.
from v1.46 release notes.
So that setting will highlight the active editor in the explorer but not scroll to it.

Force eclipse to open files in a different tab

I would like that each time I open a reference to another file, Eclipse will be forced to open the file in a different editor, even if the current editor has already a tab with that file.
The motivation is that I hate when I click CTRL+Left Click (or just F3) to open a reference to a variable/function/class and such... it uses my current editor to open the file, drives me nuts because I have 6 different editors open in my workspace, and I would highly like them to be utilized.
An image for illustration, in this image Eclipse is open with 4 different editors.
Any ideas?
To me it sounds like this is what you like to do:
Eclipse: Files opened by multiple searches using same editor tab
"Disable the option
Preferences > General > Search > Reuse editors to show matches"
Although this will not open a second tab for an already opened file.
Sounds like you might have limited the number of open editors in your preferences, causing them to be recycled.

Can Eclipse hold multiple different 'Compare' windows at the same time?

Like in the topic - is there any default way or any plugin that lets you have multiple 'Compare' windows open and active at the same time? I find it very frustrating that while doing changes to few files at the same time, I can't have active 'Compare' window for each of them, to see my changes/original code.
I would use Window -> New Window, rerun Team -> Show History and then compare another file.
A compare window in Eclipse is placed inside a normal editor tab.
You can have several editor tabs, including compare windows, visible at the same time. To do this just drag the editor tab (the one on the top with the editor name) to somewhere inside the editor area. The editor area will get split in two, each one displaying one editor.
This works with more than two editors also.
If you find that you need more space for the compare windows because other views take up much space you can maximize the editor area by pressing Ctrl+M while the editor area has focus.
Example:
Go to preferences -> team -> General Team Preferences. For me, the "Reuse open compare editors when opening comparisons" was already checked by default. I unchecked that and now I can have multiple file comparison windows open! (I'm using Eclipse Oxygen.3a -- 4.7.3a)

How to navigate through a lot of files in Eclipse without opening them

In some popular code editors and IDEs such as Sublime Text and Xcode, we can swiftly navigate through lots of code files by a single click without opening them. This is an advantage when we look into many parts of the code base scattered across the projects but nevertheless want to avoid opening too many tabs, which affects performance on slow machines. Does anyone know such a "navigating-without-opening" functionality in Eclipse?
I understand that Eclipse does provide a lot of useful shortcut keys to switch between opened tabs and classes in the project, but what I am looking for is the functionality whereby I can switch between files without opening them in a new tab by a single click (and preferably open specific files by double clicks when we want to keep them opened in new tabs).
EDIT:
I am not searching specific classes or methods. Rather, I would like to peek project files one by one to grasp the structures of the application which contains hundreds of files. In Sublime Text and Xcode, unlike in Eclipse, when one clicks file names in the project explorer only once, the files get opened in a "temporary tab" which automatically closes when we single-click another file. For example, in the following screenshots, when I single-click ToDoListPane.java in Sublime Text or CNBackgroundView.h in Xcode, the files are opened in new temporary tabs, but once another file such as HelloWorldSpring.java or CNAppDelegate.m is clicked once, then the contents in the temporary tabs are switched to those of HelloWorldSpring.java or CNAppDelegate.m without additional tabs being created.
Use Ctrl+Shift+R to search files by name (pattern).
If you know a string that is inside of the files you seek, you can use Search -> File Search (there is a button in the toolbar for that).
Related:
http://www.vogella.com/tutorials/EclipseShortcuts/article.html
http://eclipse.dzone.com/news/effective-eclipse-shortcut-key
http://www.shortcutworld.com/en/win/Eclipse.html
[EDIT] For exploring unknown code, try the "Java Browsing Perspective", it's optimized for this use case.
As for "slow performance", I have often more than 99+ files open without a big impact on performance.
As a quick way to close tabs, you have several options:
Click anywhere in the tab with the middle mouse button to close it.
Use Ctrl+W to close the current tab
Use the tab's context menu to close it, close all tabs or close all other tabs.

How do I compare two files using Eclipse? Is there any option provided by Eclipse?

How do I compare two files using Eclipse?
(Currently I am using WinMerge.)
To compare two files in Eclipse, first select them in the Project Explorer / Package Explorer / Navigator with control-click. Now right-click on one of the files, and the following context menu will appear. Select Compare With / Each Other.
Just select all of the files you want to compare, then open the context menu (Right-Click on the file) and choose Compare With, Then select each other..
If one or both of the files you wish to compare isn't in an Eclipse project:
Open the Quick Access search box
Linux/Windows: Ctrl+3
Mac: ⌘+3
Type compare and select Compare With Other Resource
Select the files to compare → OK
You can also create a keyboard shortcut for Compare With Other Resource by going to Window → Preferences → General → Keys
Other than using the Navigator/Proj Explorer and choosing files and doing 'Compare With'->'Each other'... I prefer opening both files in Eclipse and using 'Compare With'->'Opened Editor'->(pick the opened tab)...
You can get this feature via the AnyEdit eclipse plugin located here (you can use Install Software via Eclipse->Help->Install New Software screen):
http://andrei.gmxhome.de/eclipse/
If your compairing javascript you might find it not displaying.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820
Here is a workround...
Window > Preferences > Compare/Patch > General Tab
Deselect checkbox next to "Open structure compare automatically"
Compare with Other Resource – The Easy Way using Eclipse (no additional plugin required)
To assign a keyboard shortcut to the feature, go to Window > Preferences > General > Keys, look for the command Compare with Other Resource and assign it to a keyboard shortcut of your liking. See How to manage keyboard shortcuts in Eclipse for more details on configuring shortcuts.
Tip: Alternatively, you could press Ctrl+3 (for Quick Access) and search for Compare with Other Resource. This way you don’t have to configure a shortcut but you’ll have to search for the command every time in Quick Access.
Once the shortcut is assigned, you need to select the source file from the Package Explorer, Project Explorer or Navigator. The easiest way to do this from an open editor is to assign a shortcut to instantly show the file in the Package Explorer or, if it’s not open, to open it quickly using the keyboard.
Now press the keyboard shortcut you assigned to Compare with Other Resource and the following (non-modal) dialog should appear:
Troubleshooting: If the dialog doesn’t appear, it’s probably because you haven’t selected a file in either the Package Explorer or another view that allows file selection. Make sure a file is selected and make sure you haven’t selected the class in the Package Explorer rather than the actual Java file.
Now you can select the second file in the Package Explorer and drag and drop it onto the dialog. Click OK and the comparison editor should display, comparing the two selected files.
Tip: See the post on using shortcuts for common SVN commands for tips on how to navigate the comparison editor with the keyboard.
Comparing External Files
Using the Compare with Other Resource dialog, you can compare a workspace file with an external file or even compare two external files with each other.
Comparing a workspace file with an external file is easy: Once you’ve opened the dialog from a selected file, instead of dragging and dropping another workspace file, tick External File in the Right pane and then Browse to a file on your filesystem.
To compare two external files, you have to start the dialog again from a selected workspace file (choose an arbitrary file). Once open, select External File in the Left pane and Browse to your file then do the same for the Right pane.
Please refer this page for more details: http://www.eclipseonetips.com/2013/09/19/compare-two-workspace-or-external-files-in-eclipse/
If you have Beyond Compare installed, the ContextQuickie eclipse plugin has an option to enable it to be selected from the context menu displayed when you right-click a file.
Install from:
https://github.com/ContextQuickie/ContextQuickie/wiki/Installation
After install, activate Beyond Compare menu items via Window->Preferences->Context Quickie->check 'Enable Beyond Compare'.