Bug 565056 - Eclipse executes BAT files instead of editing them
Summary: Eclipse executes BAT files instead of editing them
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-08 09:31 EDT by David Balažic CLA
Modified: 2020-07-12 12:12 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Balažic CLA 2020-07-08 09:31:41 EDT
Eclipse IDE for Enterprise Java Developers (includes Incubating components)

Version: 2020-06 (4.16.0)
Build id: 20200615-1200



When trying to open a BAT file in Eclipse, for editing, it is executed instead.



Windows 10, Java 11.0.7

PS: there is also an error reported in Eclipse at the same time:

An internal error occurred during: "Search Marketplace for compatible editors (*.bat)".
java.lang.NullPointerException
Comment 1 Rolf Theunissen CLA 2020-07-11 15:05:42 EDT
This is kind of expected behavior. By default Eclipse will try to open a file with  an file extension that is not associated within eclipse with the registered 'System Editor'.

Go to: Window > Preferences > General > Editors > File Associations
Either change the default for 'Open unassociated files' or register the .bat extension.

Also you could right-click on a file and choose 'Open With...' to use a text editor.

However, what is strange behavior, is that Eclipse uses the default 'Open' association instead of the 'Edit' association. That is, Eclipse should trigger the edit action, not the execute action.

Do you have a stacktrace for the NPE?
Comment 2 David Balažic CLA 2020-07-11 15:38:30 EDT
The error log has this:

java.lang.NullPointerException
	at org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.orderNodesByTagSubExtensionCount(DiscoverFileSupportJob.java:126)
	at org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.run(DiscoverFileSupportJob.java:87)
	at org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.run(DiscoverFileSupportJob.java:70)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Comment 3 Rolf Theunissen CLA 2020-07-12 11:16:01 EDT
(In reply to David  Balažic from comment #2)
> The error log has this:
> 
> java.lang.NullPointerException
> 	at
> org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.
> orderNodesByTagSubExtensionCount(DiscoverFileSupportJob.java:126)
> 	at
> org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.
> run(DiscoverFileSupportJob.java:87)
> 	at
> org.eclipse.epp.internal.mpc.ui.discovery.DiscoverFileSupportJob.
> run(DiscoverFileSupportJob.java:70)
> 	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

This one is reported (and fixed) in Bug 564534.
Comment 4 Rolf Theunissen CLA 2020-07-12 12:12:06 EDT
Also extensions for which only an edit command is registered do not work correctly, see Bug 534441.

Moving to SWT for further investigation.