Have Eclipse open file when project is opened - eclipse

I have not seen this asked anywhere, so I was wondering if it's possible to configure Eclipse to open a specific file whenever a project is opened. For instance, all of my projects have a /src/main.c file that is the main code I typically edit. It would be fantastic if Eclipse would auto open it.
Does anybody know if this is possible? Thanks.
EDIT:
I should specify that if I'm working in Eclipse, close the project with Eclipse still running, and then re-open the project, I want the /src/main.c file to be opened.

Yes it is possible. All you need to do is one time open the file using
File>>open File>>
Then dont close that file let it be open and close eclipse and open eclipse again. you can see that file opened already in eclipse.

Do you create this file manually? From the first time you create it, just leave it open when you close Eclipse. The next time you start it, the file should open automatically. In fact it will open all files which were open at the end of the previous session.

Related

Eclipse - files open with no tab title or and empty content window

I just installed Eclipse on a computer and it has been working fine for the past few days. However it suddenly stopped working this morning.
When I double click a file in the File Explorer to open it, nothing happens - a new tab is opened, but the tab has no title, just a button to close the tab. The "contents" of the tab is just a light blue screen, with no text.
I have tried the following procedures, with no success:
Right click > Open with > various Eclipse editor
Reset perspective (I am in Java EE perspective)
Change perspective to Java
Opening different file formats (.java, .properties, .xml, etc)
F3 and Ctrl-Shift-T
Creating a new project and opening a file from there
Restarting, cleaning workspace
When I open a different workspace, the files open as usual, but I still want to use my old workspace.
I am using Eclipse JEE Oxygen.
Doing a re-install fixed the problem.
Try to create a new workspace and put all your projects there from the old one.
If it does not work, it's likely that there is an error in one of the projects, try to find it, delete the project from the new workspace 1 and try to open the file, repeat it until the file opens, if you make a mistake in 1 of the projects, then you can create new classes. and copy there codes from the old ones.
P. S. If nothing works, you can download INTELIJ and open your workspace there (generally Intelij is more comfortable than Eclipse in my opinion)

Sublime Text 2 edited file-changes does not show when refreshing browser in Maven project

I am having problems when editing template-files(HTML-files) in my Maven-project. I have made the Maven-project an Eclipse-project with the command "mvn eclipse:eclipse" (if it matters). I am using the Apache Velocity Engine as template engine for this project.
The problem arises when I'm editing the files in Sublime, and then save the file and refresh the browser. The changes does not show! If I however open the template file in Eclipse, just open it, I can even just open and close it right away, and THEN refresh the browser, the changes will show.
I have done a test to see if this problem occurs on other simple projects as well, and with a single HTML-file and a simple http-server, the work I save in Sublime shows as normal.
Does anybody know what is happening here? Am I bound to keep on using Eclipse as a HTML-editor? :( Does the Eclipse project files prevent me from using other editors? Why are the changes only showing when I open the files in Eclipse?
Any help is greatly appreciated!
In order for the changes to take place you have to right-click the file in Eclipse explorer tab and choose "refresh" in order for the (static) changes to be reloaded to Apache. For dynamic changes you'll need to restart apache or use a plugin such as JRebel.
Eclipse copies the files to the "target"-folder in the webapp. Sublime(and others) does not do this automatically, so you need to do this manually, or by a plug-in that will copy the files on save.

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.

How to recover Java file from Eclipse Project that damaged by getting power off?

it happens with me that, I am working on a project with Eclipse. And Suddenly power gone.
And after some times while power come back and i open the project in eclipse, i found my all code gone. and see the Screen with error like below image:
So Please what wrong with that Eclipse ? How to recove that java file from eclipse.
If i go to that file localy and open that file it open in Word with many pages. but with no text.
try the eclipse's local history..
right click the file -->replace with-->previous from Local History.
Open the file in Eclipse editor -> right click -> Team -> Show Local History“
View the result in ‘History View’ and chose the last best state of your file.
Yeah ,and also you can try for some method restore,Right Click in editor->Local History->Replace with..
THis will help to get back the previous changes u made...
Get the previous file back from the cache with help of eclipse's local history.
Right click on the damaged file -->Replace with-->Previous from Local History.

Open file in eclipse on mac 10.6

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.