Aptana/Eclipse: How do I make a project that uses existing files on my filesystem, instead of copying? - eclipse

I want to create a project that uses source files already on my filesystem, but the IDE always wants to create a directory and make a second copy of all the source.
This has always annoyed me about Aptana and Eclipse, is there a workaround for this?

I am using Aptana Studio 3 on my mac and the way I do it is:
Click on File
Select Import from the dropdown menu
Select the General tab and open it, you will see the option Existing Folder as New Project
Select it and click on Next
On the next page select the folder where you have the old project files, name the new project(if you want to change it). You can also select the languages that you have used on the project.
Click Finish and you are set to go.

One small addendum, the existing folder doesn't actually need to be in your workspace. I have several projects in my workspace but also several located elsewhere for assorted reasons.

have the files in a directory under your workspace
use "create project" and change the default folder to the one created above.

I too wasn't aware of how to do this..
But i tried this way and it worked..
Step 1: Try to create new workspace with the name and location as you wish
Step 2: click new->Java Project
Step3: In the create a Java Project Window select the option for Creating from existing Resource" and select the resource you want
Step4: You can see the project name as automatically set by itself based on the folder containing the project that you select.
Step5: click finish
Step 6: I guess, you need to open Navigator view(Window->show view-> navigator) for best viewing
Hope this works gud.. Post here if its not working,..

There is a checkbox named "Prompt for workspace on startup". It's in Window -> Preferences -> General -> Startup and Shutdown -> Workspaces. If you check this, on next Aptana startup you will be prompted to define a new Default workspace directory which would be your default projects folder.

There is also another way to do that.
Create an empty project (right-click in the Project Window and go to "New->Project" and then "General->Project" and click "Next", after that type in a project name and click "Finish").
Add a new connection to this project (right-click on "Connections" and then "Add New Connection"). The "Source" should be your project and the "Destination" should be the type "Filesystem" with a folder of your choice.
Finished.
I only use that method in very rare cases, as example, if u need a simple file-reference of any folder on your harddrive or if you need an overall file-reference to your workspace folder which contains all project folders, etc..

This answer by no means solves the issue above in Aptana but if you are in a rush, try using FreeCommander http://www.freecommander.com. It is a dual pane file manager with a slew of options. I have been using it for almost 3 years and there is never a day I don't use it.
What I did for now, is I allowed Aptana to create a folder in the workspace at the same level as the original folder I would like to use. Using FreeCommander I then have the original (src) folder in one pane with the new folder (dst) in the other pane.
I then manually copy (F5) or use FreeCommander's built in sync function (Alt + s) so that both folders have the same contents at all times.
Again, not the right answer but a workaround as work needs to be done. Cheers.

Related

Eclipse: "Find All References" ignore target directory

Is there any way to limit the search for "Find all References" in Eclipse so that it ignores files in the target directory. This is not the same as the answer from this question: Limit “Find References” in Eclipse to only references from my code. That answer only works for text search. I want all references to a particular variable.
Maven Java project?
If the target folder is properly set as Default output folder in the project's properties > Java build path > Source you should be fine.
Source: just tested on Eclipse Indigo (I've tried Ctrl+Shift+G on both classes and variables); the search is limited to src/main and src/test.
Try:
Go to Window->Customize Perspective. In Command And Groups Availability tab enable Window Working Set option if not enabled. Click OK
Go to Window->Working Sets->Edit. A dialog will pop up. Click NEW button
A dialog will pop up. Select Resource option in that. Click Next Button
Click on Select All Button. Deselect the target folder. Enter the name for this working set say "Exclude target folder".
Open the source file in editor. Keep cursor on a variable. Right on that variable
Go References->Working set->Exclude target folder
By this you can also exclude some files along with folders. One drawback in this is that you have to manually deselect each and every files and folders to exclude.
Right-click and select properties and then check the derived check-box. Done.
This works for the target directory and any other directories and files you want to exclude from searches and your normal workflow since the IDE will view these derived resources as resources that are not original data, and can be recreated from their source files.

Eclipse project already exists

I deleted a project in my workspace, then tried to create a new project with the same name. Eclipse told me that it overlaps the location of another project (the one I just deleted). How do I fix this?
This is what I did.
Go to Window --> Show View --> Project Explorer
Then right click on the project name that you want to delete and Click Delete.
In the dialogue box, check 'Delete Project Contents on disk'
It worked. I was able to create the project with same name again.
I had the same problem with the IBM Integration Toolkit, which is based on Eclipse. The problem also occurs in Android Studio, which is also based on Eclipse. crazyscot seems to have the right answer at A project with that name already exists in the workspace eclipse and his solution worked for me.
You need to open up the Project Explorer view (it may already be open) and delete the project from within there.
Go to Window >> Preferences >> General >> startup and shutdown >> workspace
theen select Recent work space then click Remove and close the program and open it again
You have to manually delete the project folder from your "workspace" directory (wherever you have defined it to be).
there will be a file .project xml file in the project and its content looks like
<projectDescription>
<name>ProjectName</name>
.
.
.
</projectDescription>
here ProjectName is the name of project you can change it to whatever you want.
First you create a project in some other location with the same name of your project as before.
Now delete this project by right clicking on project > Delete.
Do not check the dialog "Delete Project Contents on Disk".
Now you move your newly created project through file manager to the original location(location where you are not able to import your project).
Then import the project from the newly moved location(location where you are not able to import your project).
After deleting the project from Eclipse IDE(Project Explorer), remove it from work space folder as well. Workspace folder path - C:\Users\username\workspace (it can be different for your system).
try moving the project and try importing
go to tab window>preferences>search workspace> then make sure in last / is not in your recent workspace. Example-:/var/www/html
your url should like above.
With the same problem, I did a text search and found an XML file containing the name of the project.
I had copied the project from another project. Let's say that I copied project A to project B. Although the XML file in the new project (B) was named for project B, it had an entry which still referred to project A. When I edited it, the problem went away.
Simply remove the .classpath and .project files and try.
Go to create new project. Once there, select the project type. Mine was PHP project. The new PHP project screen will popup. There, click create a new project and give the project name which you used before. Then press finish.
If you need a 100% risk-free strategy, just right click the project and select 'export', and put it back where it was. Then, you can either continue using the project in your current directory (with no more popups) or switch over to the directory you were working in before. The side effect of the former is that you will have a duplicate project taking up a small amount of space. If anything, finish up what you need to do in the current directory, then pull (via git) from the original directory. Or, delete the project in the current directory, and import from the original directory to the target directory for the second time - though now, since it is the proper way, the issue will be resolved.
I met this problem just and I just figure out the main reason cause this problem is your copying pom.xml from another already existing project in your workspace.
So the way is find the pom.xml in your project folder and rename <name>conflicted Project name</name>.
In 2021, Using Ubuntu 20 here is simple way to remove it.
In Eclipse main Menu
Window -> Preferences
In the search type recent workspaces
Select and delete the project. click apply changes
Removing a project from an Eclipse workspace does not delete the files by default. You have to check a checkbox for that. This is a Good Thing. As you have not checked the checkbox, you have to delete the files manually using e.g. a file manager.
Note that there are files starting with . in an Eclipse project directory, such as .project. They are considered hidden files on Unices.
go to the folder and delete the file .project. This worked for me.

Eclipse won't show files in package explorer

I don't know what went wrong, because this was working before, but all of the sudden I don't have any files in my eclipse package explorer.
The workspace path appears to be correct and the file permissions are correct.
Can anyone think of what's wrong?
Refresh the project
If that does not work, close and open the project again.
I had the same problem (Probably caused when I cancelled a copying to my Dropbox folder)
I only needed to click File → Import → General → Existing Projects into Workspace and select the missing projects in the window that appeared.
Workaround
Create a blank workspace
Navigate to (File > Switch to workplace > Other)
Clik Browse > Make new folder
Click Ok in browse window
Click ok in create workspace window
Import your existing project into the new workspace
Navigate to File > Import
Click General > Existing project into workspace
Click Next
Browse and select your previous project
Click on Finish
Congrats! Now you can see your project in the package explorer by importing it.
Project Explorer -> click on "View Menu"
-> Top Level Elements -> Click on "Projects"
Don't know what causes the problem, but found a way to get the files back into the package explorer.
If you go into the path of your workspace and find your projects, then you can pack them all into a zip archive file, and from this zip archive file you can import your projects again by using the File → Import → General → Existing Projects into Workspace menu.
I don't know what causes the problem, but in my case I think it have something to do with me having my workspace in a dropbox folder.
ps. I don't know if you actually can take more than one project into one zip file and make it work, I have only tried it with one project pr. ZIP-file, but it shouldn't matter.
In 2020 on OSX I just went to Project -> Refresh and wham! my files appeared.
I had started the wrong installation of eclipse. When I started the correct installation my code showed up fine. I have both C++ and Java EE installs.
Just refresh all the projects, you able to see all missed files after you import from a workspace.
1) Make sure that you use the right workspace.
2) Choose your "workspace"-Folder "/YourWorkspace",
NOT your project folder"/YourWorkspace/yourProject"
Alternatively delete your project from your
"YourWorkspace>/.metadata/.plugins/org.eclipse.core.resources/.projects/PROJECTNAME/.location"
and restart.
Hope this helps
I had the same problem. I was not able to see the imported files in Eclipse, but there were visible in File Explorer.
After a while, I noticed that all the files were imported. They had their names changed from myFile.class to ._myFile.class.
I deleted all the imported files from my workspace by using File Explorer.
By using the same File Explorer, I copy-pasted the folders/files in the workspace.
Then in Eclipse, I refreshed the project (F5 or click-right -> Refresh or File -> Refresh)
I faced the same issue and the reason was that I choose double click on Eclipse Icon, then I need to choose Work Space.
Here I made mistake. You do not need to select folder in which has all your project files
e.g //Desktop//User//Selenium//S1A//all files related to project
In that case for workspace you choose //Desktop//User//Selenium, import your project by clicking Import for eclipse 2020 and choosing File path //Desktop//User//Selenium//S1A.
may be a rare case like in mine, but if you played with colors this may be an issue and especially, if you changed theming and did not restart, which may correct some problematic visual stuff.
Import>Existing Projects into Workspace> Select root directory> Select the folder
The solution that helped me:
create a new folder (=Java-Package) with a new name. I used the System-Filemanager.
copy the disappearing files to the new folder (=Java-Package).
correct the links (JavaCommand 'import') to the new folder.
delete the old files and the old folder.
As the problem happened in my case:
I am using Eclipse IDE 2021-12 (4.22.0) for my Java project.
After importing an existing Project into Workspace all was fine.
While building the project, same files disappeared from the 'Project Explorer'-Tree.
These files still do exist as the System-File-Explorer shows. So no file got deleted. But no more listed.
After Refresh (F5) most of the files got listed again in the 'Project Explorer'-Tree.
Without doing anything an Eclipse background process let files again disappear from the 'Project Explorer' - Tree. Compilation of the project leads to missing files.
Sometimes 3 files disappeared. Some seconds later more files disappeared. Sometimes it leads to an empty Java-Package.
This disappearance of some files happened without any input from me. It was done by the Eclipse background process. It felt like watching a movie.
What does not help in my case: Restarting of eclipse, Close and Open the project, editing the files.
In my case, the problem was due to an unwanted nested project in a subfolder. There is a pre-set filter that hides folders in that case.
For some reasons, the sub project was not shown in Project Explorer.
My solution :
delete the project (without deleting project contents on disk)
import existing projects into workspace, and do not import nested project.
You might have filtered the resource out of the project.
Select the project, right click, choose properties.
Under Resource, choose "Resource filters" - check that the name of the folder or the files was not filtered in the list under "Exclude all" (if there is one)

In Eclipse, how to copy an existing project to another project?

In Eclipse, I have one existing project, A. Right now, I have just created another project, B, which is empty. Is it possible to copy all the files of project A, including its source code and related libraries to project B? There are a lot of involved libraries in project A. How to do this copying process correctly to ensure the copied files can still be compiled?
This question appears in Google search as top result for query "copy project in eclipse".
To copy project in Eclipse:
1) right click on project in Package Explorer view;
2) choose Copy;
3) right click on free place in Package Explorer view;
4) choose Paste;
5) enter new name in the prompt window.
To answer actual question, the best way is to delete project B and after -- copy project A as explained above and give it name B.
Close Eclipse
Copy the folder of existing project to anywhere on your disk.
Start Eclipse. Turn off the automatically build.
In the Eclipse do Refactor / Rename to the new project name. (If it connected to CVS/SVN disconnect before rename.)
Import back the old project from place where you copied in the second step.
Turn on the automatically build.
Enjoy them!
You can Import the project
OR
Assuming both project A and B are of same type:
You can copy the contents of src folder as it is.
For the libraries, just go to the build path and add them in the ssame way you did for project A.
Since B is empty, you can just copy project A in the Package Explorer and name the copy B.
Create a duplicate/copy of an existing project (in the workspace).
Then in Eclipse, click file->import
Select import existing projects into workspace
Check the radio button "Select root directory"
Browse your project (the new file you copied in workspace in step 1)
Done!
In the project Explorer, right click your old project, click "Copy", right click again click on "Paste" this time, change the default given name "Copy of My_Old_Project" to any of your choice, after the copy is done, go to the "Search" tab in Eclipse, then to --> "Search", on the File Search, type the old name of your project, make sure that your scope is only "Enclosing project", change all occurrences into the new name, run the project, you are all set...
only thing I noticed about this is that the url will still be of the old project.
For a Gradle project, I had to add two extra steps to mOna's answer, which I will copy for completeness.
Create a duplicate/copy of an existing project (in the workspace).
Then in Eclipse, click file->import
Select import existing projects into workspace
Check the radio button "Select root directory"
Browse your project (the new file you copied in workspace in step 1)
Edit .project file and change the and the to match the new project.
Edit settings.gradle and change rootProject.name to match the new project.
I assume that the renaming in some of the above answers does step 6, but I couldn't get it to work. No matter what I tried, without those extra steps the code looked ok but dependencies were not handled correctly and errors appeared everywhere. I was even able to run gradle on my project from the command line and it "built", but was actually building the old project.
Eclipse has a option in file menu like import existing projec.From that you can import the existing project with all content.I hope this is the solution that you are looking for.

Moving project to another folder in Eclipse

I generally have my working projects sitting on folders on my Desktop. When they are completed I just move them to a c:\dev\. The thing is I'm doing it in a rather archaic way.
1. move project files
2. delete project on Eclipse
3. create new project on Eclipse on the new location
How to you guys move projects around?
If I could alter the: File -> Properties -> Resource -> Location path it would be dead simple!
Example move:
c:\user\desktop\project_123
c:\dev\project_123
Right click on the Eclipse project in the Package Explorer, select Refactor, then select Move... In the dialog that comes up, enter or navigate to the new location and click OK. This will also preserve your CVS or other SCM metadata, but will also bring all your modifications as well, and you won't lose any memberships in Working Sets, launch configurations, or other things that Eclipse associates with your project.
Use Eclipse's Move menu item
Open Navigator view, right click on your project and click Move. Then select the destination directory.
Navigator View > Right Click > Move
Note it doesn't seem to work in Package Explorer (at least not in Neon). The move dialog from Package Explorer is different, so use the Navigator window.
I don't know whether eclipse has made modifs since the date of this post...
In my case I had moved a project folder manually and I wanted Eclipse to open the project on this new location. This is what I did (and it seems to work).
(I'm using eclipse "helios" v 3.6.2)
File menu | Import ...
General | Existing projects into Workspace
Select root directory = top directory of your project on the new location
Finish
I rarely have any projects in Eclipse that aren't under source control, so all I would need to do is check the project out in the new location.
If you don't have source control, Eclipse works with CVS rather well out of the box, and it's pretty simple to setup CVS to run locally without a server: http://www.tortoisecvs.org/faq.html#cvsinit
WHEN EVERYTHING ELSE FAILS:
Copying an Eclipse project from one directory (let's call it old_dir) to another directory (let's call it new_dir):
Open Eclipse and specify the copied working directory in your new_dir.
Once it opens the project in the this new_dir, the projects listed under Project Explorer Tab might still be the ones contained in the old_dir (you can check it by right clicking each and following through: "Resource -> Linked Resource" to see the Path Variables values). Thus, they have to be removed from this work space. Delete the Nios 2 Application Project and the BSP Project from the Project Explorer Tab by right clicking on it and selecting Delete option which will pop a new window. In the pop-up window, make sure that the Delete project contents on disk check box is UNCHECKED before clicking OK to delete the Projects. Otherwise, it will delete it from the old_dir where you copied the project from.
Right click in the Project Explorer Tab Area → Import → General → Existing Projects into Workspace and add the copied Nios2 Application Project and the BSP Project from the new_dir.
Right click in the Project Explorer Tab Area → Index → Rebuild, otherwise the Nios2 Application Project will not be able to use the includes provided by the BSP Project.
Click on Project → Clean → OK to clean and rebuild the whole project.
When using console to talk to the NIOS, make sure elf's path is updated to the new project directory as well!
Right click on your project->copy.
right click in project explorer free space and right click->pase.
chose new folder and project name.
I copied the whole project to a new directory. After setting Eclipse to the new workspace it recognises the project instantly. Thus it was nothing further to do. I use Eclipse IDE for C/C++ Developers, Version Luna Service Release 2 (4.4.2).
For Eclipse Oxygen, to move a Java project, djb's accepted answer works well (in my experience just now), except having read comment by Basic May 14 '12 at 9:27, I tried to add my project XMLDiff to C:...\SVN\trunk\Internal Projects, and I got a failure with the rather cryptic message:
Problems encountered while moving resources.
Resource already exists on disk.
I had to move the project to C:...\SVN\trunk\Internal Projects\XMLDiff by creating a new folder, XMLDiff, in the browse dialog, and the result was C:...\SVN\trunk\Internal Projects\XMLDiff, not C:...\SVN\trunk\Internal Projects\XMLDiff\XMLDiff.
So this must have changed between Basic's experience in 2012 and Eclipse.3.
For Eclipse Oxygen
Project Properties -> Resource -> Linked Resources -> Linked Resources (Tab)