How do I *PREVENT* a Windows batch file from executing in Eclipse? - eclipse

On Windows in Eclipse, when I double click on a batch file name in navigator, or even a repo browser, the batch file opens in a command window and is executed.
How do I make the default double-click behavior to open in an editor instead?
Note that I can select "open in text editor", but if I choose "open in system editor", that too causes it to execute.
I honestly googled for this, but only found "how to run", and no explanations of "how NOT to run". I can't imagine this hasn't been asked before, but I couldn't figure out the incantation.
[Editorial comment: there are tons of references describing how to run a batch file, implying its difficult to do or figure out. Its odd that mine appears to behave that way out of the box.]

Open the Preferences and go to 'General > Editors > File Associations'.
If there is an association in the list for *.bat change the association to be 'Text Editor'.
If there is no association change the setting for 'open unassociated file' at the bottom of the preference page to be 'Text Editor'. Alternatively, if you don't want to change the 'no association' setting, add a new file association for *.bat
Note that if you have used 'Open With' on a file that choice is remembered and used in future.

Related

Eclipse: Prevent "File Search" from opening different files in the same tab

When I use the File Search option in Eclipse, when I get multiple results and I'm not sure about which file is the one I am looking for, I open a couple of them. However, File Search option "shares" the same tab and when opening the second file, it replaces the file that was opened first.
Is there a way to prevent this behaviour and get each file to open in its own tab?
In 'Preferences' go to the 'General > Search' page.
The 'Reuse editors to show matches' option controls using a single / multiple editors for search results.

PowerShell Setting up a folder to open in

My teacher gave me this instruction : "To set-up the default folder for PowerShell to open in, right click the PowerShell icon in the tool tray and select Properties. In the Properties dialog box and in the Start in: text box enter the path to the new directory “C:\Users\Administrator\MyScripts”, then click OK."
However when I go into the properties tab I do not see what he is talking about :( .
This is what I see:
How do I I Do what he wants?
Your teacher is asking you to change the properties of the executable. You are currently looking at the PowerShell console properties.
As you can partially see mine is located:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
By "tool tray" I assume your teacher meant the Windows taskbar and by "to set-up" I assume he/she meant "to set up"1:
If you:
right-click the PowerShell icon in the taskbar, you get a shortcut menu,
in which you can right-click the first entry in the last section to edit the properties of the shortcut file that started the application:
The resulting dialog will show you the desired Start in: field, which determines that shortcut file's startup folder:
Enter the desired startup folder (C:\Users\Administrator\MyScripts in your case), and click OK.
To determine the shortcut file's own location, switch to the General tab of the dialog and inspect the Location: field.
If you haven't yet pinned PowerShell to your taskbar, the Location: field probably contains C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell.
The shortcut file's own name is Windows PowerShell.lnk, though the .lnk extension is typically hidden.
In other words: by default, the shortcut file's full path is C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell\Windows PowerShell.lnk.
In general, shortcut files (*.lnk) store properties such as executable location, startup folder, initial window state, and shortcut key.
As for what you've tried:
As Matt states in his answer, you've invoked the Properties dialog for the open PowerShell console window via its system menu (windows menu), which allows you to persistently change window properties, but not the startup folder.
1 "To set up" is a phrasal verb - no punctuation needed, and not to be confused with the noun derived from it, "setup".

Preventing Eclipse from opening external program inside Eclipse editor

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.

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.

Netbeans: how to change the default tool which opens .txt file?

I was living in peace and netbeans used to open text files in the netbeans editor. Then one fine day I wanted to open 1 of the text files in a web browser (to render some html, and I didn't want the headache of making a new html file. Yup, yup, I know I was being a fool). So I right clicked the file from inside netbeans and chose an 'open as' option and used treat file as "html/text" expecting it will open in the browser. And to my surprise the browser did come up and tried opening the file. But then all the text files now always open the browser and none of them get opened in the netbeans editor, no matter how hard I try, and netbeans no longer shows the 'open as' option when right clicking the text files.
Can some one suggest some way to fix this ?
Try going to Tools->Options then click Miscellaneous and then the files
tab. There should be an associations editor you can use to change this.