views:

17

answers:

2

I have a deceivingly (at least for me) simple problem. I want to open a file in eclipse FROM Mac's finder. Whenever I try, I get the alert that Eclipse cannot open that file. Yet, from within Eclipse I can open the file, either by double clicking it in the Explorer/Navigator window or going file/Open File ...

At the end of the day, I want to be able to open a file in Eclipse by specifying the path name to that file.

Eclipse build id: Build id: 20100218-1602, with IDE for PHP Developers installed

+1  A: 

I think that is imposible in Eclipse.

For separated files you can use "textmate", it's fast and powerful.

Mladjan Antic
Yeah, I've heard people complain about this on Windows for a long time now. Personally I dont know what reason you could possibly have for opening a file from the Finder/Explorer in Eclipse. It doesnt really make sense to me... Without the context of the project in Eclipse its a lot of weight to load for no good reason.
prodigitalson
When an exception is thrown, I would like to grab a path from the stack trace and fire up the file in eclipse with it.
waigani
+1  A: 

Yes, this is something that should be simple, but it is not. The reason is that Eclipse uses the workspace as a way to abstract from the filesystem. The workspace is often similar to, but different from the file system. For one thing, only files within a certain project in the workspace are really known by Eclipse. Another difference is that a single file in the file system can be linked into the workspace and appear multiple times.

All this is to say that since the mapping from the file system to the workspace is not one-to-one, it is not easy to open any arbitrary file in the file system into your Eclipse instance.

That being said, it is possible to drag and drop a file from the finder into the editor pane. Eclipse will then attempt to open the file using whatever is the default editor for that file type.

So, dragging and dropping a Java file will open a Java editor for it (even if the file is not in the workspace), but dragging and dropping an HTML file will open it in whatever browser is set as Eclipse's default.

Andrew Eisenberg