Open file in eclipse on mac 10.6 - eclipse

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

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.

I think that is imposible in Eclipse.
For separated files you can use "textmate", it's fast and powerful.

Related

Edit existing directory in eclipse

This might be a dumb question, but I have a project I am trying to edit a few files for and using eclipse 4.20.0 as an IDE.
When I try to import the directory in eclipse, it creates a completely separate eclipse workspace directory and stores the files in there for my editing. (When I make changes, files in the eclipse workspace directory are changed, but not the original directory)
Is there a way to open the original directory in Eclipse and edit files directly in there? Or am I going to have to work inside the directory eclipse created and then manually move the files over every time to test them again?
I swear I've done this before, but it's been a few years so I might just be importing the directory wrong.
If you are only making a couple changes, just clicking on the .java class you need in your explorer and "Open With... -> Eclipse IDE" will allow you to edit the specific file without opening up a new project. If you are trying to open the project and work on all the files at once, File > Open Projects from File System usually works pretty well on eclipse. If you are opening another eclipse project, just click on the folder where the .project is stored when opening, not necessarily clicking into the folder itself.

Open external files with eclipse ---> Error: "The default workspace is in use or cannot be created"

I need to open certain files (.java, .js, .html ...) with eclipse but when I try to do it I get the following error:
"The default workspace is in use or cannot be created"
How can I solve? Thank you.
Usually you have to import projects to meaningfully use your files.
Otherwise, you just get a, for example, .java or .class file that you cannot do anything.
If you are importing an existing project, check this link: https://www.360logica.com/blog/how-to-import-a-java-project-into-eclipse-ide/
Another option is, copying and pasting your existing file in the workplace folder that eclipse points to. Then go into eclipse and create a new project with the exact same name. At this point, eclipse should recognize the project and show it in the left project explorer window.
I have my project/s on Eclipse with obviously my workspace/s. If for example I have the ide open because I'm working on a workspace I can not open external files. I would like them instead to open up in my current work area.

eclipse - how to open a text-like file type if it's registered with another application

I like using Eclipse to open up certain text-based files that are huge - 140MB - because unlike notepad++, Eclipse can open larger files.
With notepad++, I could drag-drop a file into an open instance and it'd open it. With Eclipse, whether I do File>Open file or drag-drop, it still pops-open the Windows 10 Please select an application to open the file-type
QUESTION
How can I force Eclipse to open them even if they are registered to be opened by another application?
You can select the editor to open files in with a right click.
Text Editor is eclipse, System Editor is whatever your OS chooses.
I believe default editor is what eclipse chooses based on the extension (Text editor vs. System Editor)

How to clean window history in Eclipse

Right now I'm having this issue in Eclipse where I have an XML file open that's really big in which it almost crashes Eclipse. However this file being opened is saved in my window history, therefore I restart eclipse, it tries to open this massive file again. How do I clear the opened window history in eclipse?
I would prefer not having to clear my workspace entirely as I have mylyn data I want to keep. I've tried using Eclipse clean but this doesn't seem to do anything related to opened windows.
Your workbench information are saved in this file in your workspace:
.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
or depending on your eclipse version:
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
You can delete it and eclipse will recreate the file, you can also try to edit it, but it's a big file and may be hard... Deleting this file all workbench related settings are lost but your projects stays intact.
Go to Preferences and search for 'workspace'. You will see the list of workspaces that you can delete.
Some alternatives:
Move or rename the offensive file so that eclipse is unable to open it.
File->Switch Workspace->Other to load a new workspace copying your workbench layout.
Just some thoughts, my experience is closing a file and then the program means that the program will not attempt to open the file once launched again.

The Java files opened by Eclipse's menu "open file"does not auto-build

Eclipse has a nice feature that builds your codes on the fly.
However, for some reason, I have had a source .java developed in Emacs under some directory, say, ˜/mycode. Now I want to use the auto builds functionality of Eclipse, but I do prefer to develop the .java file under its original ˜/mycode directory. So apparently, I CANNOT use "import" of Eclipse because that means the file will be henceforth developed under some Eclipse Workspace.
This is the reason why I have to use Eclipse's menu's "open a file" to open my file from ~/mycode.
Then the problem comes, no more auto-build for this .java file!! For example, if I write one line like "abcd;;;;;" I will not get this line underlined by the syntax checker of Eclipse.
In summary, I would like to continue developing a code under its original directory, and also benefit from the auto-build functionality of Eclipse. What can i do? Thanks.