Preventing Eclipse from opening external program inside Eclipse editor - eclipse

I have an Excel file in the directory of my Eclipse project. When I double-click that file in the Package Explorer, Eclipse opens an instance of Excel as a new tab inside its editor window to the right.
Unfortunately this seems to be quite a buggy setup if there is another instance of Excel open outside of Eclipse:
I can't bring the other instance into the foreground and thus I can't use it any more
Excel lost a bunch of changes that I saved inside the editor window in Eclipse
So, I would really like to prevent Eclipse from opening Excel- (and possibly other) files inside a tab of the Eclipse editor. They should always open in a separate program (just as if I had opened the file from Windows Explorer). Is this possible?

Go to Window >> Preferences >> General >> Editors >> File Associations, click 'Add' right to the File Types list, add .xls, OK.
Now select .xls from the list, click 'Add' right to the Associated editors list, select External Programs Check Box, select Microsoft Excel, OK.

You can tell Eclipse to open Word, Excel, PDF etc. with the default external Editor in general, without adding *.doc, *.docx, *.xls, *.xlsx etc. to the File Associations:
Window => Preferences => General => Editors
Uncheck "Allow in-plcae system editors"
Source: "Prevent in-place OLE editors" of Eclipse Tips and Tricks

Right click on Excel file -> Open With -> System editor
After the first time, Eclipse will remember that that Excel file needs to be opened with the system editor.

Related

Eclipse - Can't View or Open Java files in Package Explorer to Editor

I clicked something or accidentally drug a file that was open in the editor and now it is no longer displayed.
If I double click on the file in Package Explorer it doesn't show in the editor like it used to. I have looked all over and can't figure out how to get this file back in the editor.
I thought clicking File - Open File would do it but that displays an open file dialog.
Another way to simulate this is to put the cursor in the editor for an open file and select File - Close. This closes the file but then if you double click on the file in the Package Explorer it doesn't open it in the editor anymore. How do I get these files to display in the editor again?
I also tried right clicking on the file and selecting "Open". This does not display in editor either.
I also tried right clicking and selecting "Open With Java Editor". This does not work either.
If I clicke "File" and then the name of the file in the MRU list . This does not work either.
Also, double clicking a file in Package Explorer fails to open any file. The file shows in the File MRU list but does not display in editor. Can not figure this out.
Also, if I select "Back to" or "Forward to" arrows on toolbar, it tracks the file in the Package Explorer by highlighting it but the file does not display in an editor like it used to.
Also, I have tried "File Open" browsing to the physical location and selecting it but that does not display in the editor either.
I had to open a new window (Window - New Window) and then Reset Perspective (Window - Reset Perspective) to get the editor back. Not sure why but I lost some of my perspective settings doing this.
In Package Explorer, instead of double-clicking on the file, try to right-click it and you should get several "Open with..." options; choose the one that matches the editor in which you want the file to open.
Your choice will also be saved as the default, so the next times you can just double-click and it will open in that same editor.
If you are customizing the perspective, then saving perspective could be a safer option to avoid such glitches.
PFB the link on how to save a perspective:
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-43e.htm

Open sublime text editor into eclipse

Is there a way to open the Sublime Text Editor into Eclipse to edit HTML, JavaScript and CSS?
The idea is to use only the Text Editor without project explorer.
If this isn't possible, is there a plugin that does what I said?
I would have just left this as a comment but I can't. First off, why is using the project explorer a problem?
Next, I know with Sublime Text 2 & 3 you have the ability to view/edit a file in two places simultaneously, just go File > New View into File. In Eclipse you can go Window > New Window. Alternatively you can import a project/file into eclipse or sublime. Either of these will bring in the project explorer (unless you import one file or something).
You might want to have a look at Subclim + Eclim.
I had to open the files via "Project Explorer -> Open With -> External -> sublime" to get the files refreshed right away (e.g. for a running webapp). But other from that, it's quite nice.

Only one editor per file in eclipse?

Eclipse PDE documentation claims:
You can think of the input object as the document or file that is
being edited. Changes made in an editor are not committed until the
user saves them.
Only one editor can be open for any particular editor input in a
workbench page. For example, if the user is editing readme.txt in the
workbench, opening it again in the same perspective will activate the
same editor. (You can open another editor on the same file from a
different workbench window or perspective).
Obviously it is possible to open a file using different editors - for example .java file using default java editor, and then text editor (by 'open with'). Is this part of the documentation wrong? Or is IEditorInput different for these two editors? I'm just wondering.
It was like that originally, and I think their point was double-clicking on an already open file will just bring it to the front, not open a new editor with the same information. Tht's still true, but that's not the whole truth :-)
I believe that section needs to be expanded, as I'm pretty sure the capability you refer to has been there for years as well. There's a "New Editor" entry in the editor tab context menu that allows you to open the same file in the same type of editor too.

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

how to make a file to open in a particular editor in eclipse?

I have many types of file in my eclipse workspace, so i want some files to be open in a particular editor. say a war or a jar with winrar. sql with some eql developer, xml,s with xml editor etc how to set that? so that whenever i open them, they should open a assigned editor.
there is an entry in the eclipse preferences that associates file types with editors. You select your file type (e.g *.html) and assign it one of your installed editors.
On Mac OS, the preference you want is:
Preferences -> General -> Editors -> File Associations.
Goto
Window-Preferences
then
General->Editor->fileAssociations navigation
then
select or add the extension in the right top dialog
then click add on the right bottom dialog, select the appropriate application and save :-)
You want to add an entry in the Preferences for General->Editors->File Associations.