Copy files from search tab in eclipse 3.4 - eclipse

I just want to copy list of files displayed in eclipse search tab,
When i try using right click copy and paste into some folder it does not work.It actually copies the file location rather than the file itself

There is no direct way to do this. What you can do is:
Double click on the entry in the search tab
F12 to switch to the editor
Ctrl+Alt+W to select the file in the navigator view
Drag the file from there to the place where you want it
Too tedious? Then open a command prompt or shell and use the file location there.

If you need file locations then use Eclipse search csv export plugin.
If want to copy the whole file(s) into a folder then refer #Aaron Digulla answer(Its applicable to single file). In case of multiple files. Press Ctrl + A to select all search results in search view. Right click on the selection. Choose Show In > Package Explorer. Drag file(s) to a folder in any file explorer.

Related

vscode: Search in a directory which is outside the workspace

I want to search in a directory which is outside my workspace.
Steps:
I open a file which is outside my workspace.
Now I want to search in the directory which contains this file.
I use "Reveal in Explorer" and try to use the breadcrumbs, but I see no way to search in the directory.
I use Go, but AFAIK this should not matter for this question.
As it happens another extension I wrote makes this pretty easy: Find and Transform.
It adds three context menu entries:
Search in this Folder
Search in this File
Search in the Results Files (if there has been a previous search with results)
You can right-click on any tab or editor body and select Search in this Folder and it will populate the files to include input box of a search with that file's parent folder path.
And if you have any text selected, the query field will be populated with that selection (even if it is just a cursor in a word).
You could also just right-click on that tab and chose Copy Path, paste that into the files to include input of a Search and then delete the last part of the path back to the folder.

Eclipse open all files in project

How can I open all source code files in a eclipse project at once? It takes too long to open all files in large projects by expanding out the packages and clicking on all the files.
I would like to know how to do this so I can ctrl+e to classes quickly.
It is not a good way to keep open all source files in a project because a project may have hundreds of source files. There is NO direct way to open all source files in eclipse.
However you can do it in two ways:
Using open resource dialog:
Create a working set which includes your project. Refer this.
Press Ctrl+Shift+R and select the your working set(Click on the downward pointed triangle button)
Type *.java in the text box. Dialog will list all java files in your project. Press Ctrl+A to select all files. Click on open button.
Using search dialog:
Select your project in Package explorer/Navigator/Projects view.
Press Ctrl+H. Go to File search tab. Leave "Containing text:" as blank. In File name patterns text box enter *.java. In scope section choose Selected resource option. Press search button. All source files will be displayed in search view.
Change the view layout of Search view to Show as list(In search view toolbar click on the downward pointed triangle button)
Press Ctrl+A to select all results. Right click and select open option.

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'.

Is there a way to create an action in eclipse to export my jar to a certain directory?

Is there someone to configure a one click or one key action to export my build product to a certain directory? I'm coming from Visual Studio where I can set the output directory and press F6 to do this.
You can right click on project. Export... Then click on Java/Jar file and next. You will se something like this. Specify output filename, and on the next screen click on save description ( see pictures below ). Then after you saved jardesc to the project root, right click and "Create JAR" command. Two click, not one (if you check overwrite in first screen). If you want to automate with a shortcut, try the plugin in this answer.

Eclipse: Get location of the current file?

If I've got a file open in Eclipse, how can I figure out where it is on the filesystem?
For example, in Vim I would use :pwd.
Use the Eclipse menu:
File->Properties
or the shortcut:
Alt-Enter
You should be able to see the Location associated with the Resource
Just hit Alt-Enter.
The other solution ("File-->Properties" or "Alt+Enter") didn't work for me.
I use:
Right Click (in current editor) --> Show In (shortcut: Alt+Shift+W) --> Project Explorer
This shows in Project Explorer the location of the file. If the file is a class in a referenced library, the dependency tree is automatically opened.
What you're looking for is the 'Properties' dialogue for the current file. This can be activated in two ways:
Selecting from the menu: File -> Properties
Using the shortcut: Alt + Enter
This gives you a dialogue which contains both the full path of the document, as well as the relative path from the workspace root.
The dialogue can be quite handy: it allows you to highlight and copy the file path.
Linking to Project Explorer won't work if you have many files - it will select the right file in the list, but it won't "scroll" to that portion so it is visible.
You'd have to manual scroll the Project Explorer view to see where the file is. It could also be nested so deeply that the full location will be obscured by truncation.
Another way to quickly (keyboard-free) see the path is to hover over the file type icon (on top of the open editor window).
Eclipse also has the ability to link the explorer view with the current file, so that whenever you change a file, it is expanded and selected in the explorer view.
Just look for the following image at the top of the view: