How to link files to package explorer in Eclipse? - eclipse

I know there is a way to tell the editor window in Eclipse to link to the corresponding files. Say when you're on a file in the editor, it would be located in its corresponding project in the Package Explorer.
It shouldn't take more than enabling one option, but I am not able to find out where it is.
It's a very handy thing which avoids confusion as to which file belongs to which project, if you have files with the same name in multiple projects.
Could anyone tell me where the option is located and how I can enable it again?

Package explorer has an icon named 'Link with editor'. You can locate this way your currently editing file in Package Explorer view.
Alternatively, when you are editing, you may press Alt+Shift+W and choose Package Explorer to locate your file in Package Explorer.

Related

Why is Eclipse not showing me my sub folders?

It was showing me subfolders yesterday but now it's not. I just imported a project into Eclipse.
If I look at "main" and "test" in the windows file explorer. I can clearly see that they contain subfolders
I tried closing it and starting it again but that didn't work
One possibility is that main and test are configured to be source folders in Eclipse. Source folder don't show up in their normal file system location, but instead at the top level of the project.
I guess yours don't because you don't seem to see them.
It's hard to figure out why these folders don't show up. Here is some things to try:
Verify that you are using the Package Explorer view, not Navigator or Project Explorer.
Go to the Filters configuration dialog in Package Explorer (see image below) and uncheck all filters.

Eclipse projects are not visible in workspace folder

The weird part is I can see my projects through package explorer.
I can also export them.
But when I want to access them elsewhere e.g windows explorer, they are not there.
All I see is .metadata folder.
An unexpected shutdown of the system occurred not too long ago.
Edit: When I switched the workspace, created and opened a project, they're still not visible/accessible outside of the eclipse project explorer.
Any ideas?
You most likely haven't ticked "Copy projects into workspace" checkbox option.
File -> Import -> Existing projects into workspace:
It is possible that the projects were not put into the default, workspace folder.
To check this, right click on such a project, select Properties (it is usually available at the bottom of the list), go to the Resources tab, where you have the location of the project files displayed.
Obviously, there is a problem with Windows explorer and OneDrive in particular.
When I navigate to C:/Users/username/OneDrive/Documents/workspace or through command line I do see my eclipse projects.
But when I try to use 'Open file..' option from any application or navigate through Windows explorer, projects are not recognized nor displayed.

How do I make Javadoc files show in Eclipse Package Explorer?

I'm using the Android Developer Tools wrapper of Eclipse, and the EGit git plugin for Eclipse. I'm having a problem where I'm generating Javadoc, but I can't find it in the package explorer.
I go to Project->Generate Javadoc.
I'm using C:\Program Files\Java\jdk1.7.0_51\bin\javadoc.exe as my Javadoc command, and I select the package I want to generate Javadoc for.
I select the standard doclet with the following destination, where ReverseSentence is my package.
C:\Users\myname\workspace\ReverseSentence\doc
I check "open generated index file in browser", and generate the javadoc. It generates the Javadoc with no errors, and the index shows up in the main section of eclipse. However, the files don't show up in the package explorer.
I searched in the workspace through opening up the folder, and inside workspace\ReverseSentence there is a folder doc, which contains the proper Javadoc. However it isn't showing up in the package explorer.
How do I make it show up in the package explorer? When I used the regular version of Eclipse in the past (not the android developer tools wrapper), the Javadocs showed up there automatically.
What I've tried:
refreshing the project
closing and restarting eclipse
generating the Javadoc with an older version of the Javadoc command, which was what I was using in the other version of eclipse last time it worked (jdk1.6.0_43)
deleting the doc folder, recreating it, then trying to generate the javadoc in it (it generated in it but did not show up)
unchecking the filters which hide some things in the package explorer, (as shown how to do here: How can I get Eclipse to show .* files?)
I think that the problem is the destination folder/directory for your Javadoc files once they are generated. I encountered this same problem and discovered (finally) that the Javadocs were getting sent to a different folder than my package files were in. They went to the workspace folder I thought held all of my code also, but the code was going into a different repository. Maybe try looking for your code's location and then seeing if the generated Javadocs are landing somewhere else when they are generated. If this is the case, then the fix is to regenerate and send to the code's directory. This way, Package Explorer should be able to find and display them. Hope this helps!
Did you try by refreshing the workspace or re-opening the eclipse !?
Check the filters in the settings of the explorer. If something does not show up, usually the filter hides it. The filter can be accessed in the drop down menu of Package Explorer.

Open directory containing a source file via Eclipse

In Visual Studio, or MyEclipse, you have a button which is able to locate a source file on disk, and open the containing directory in Windows explorer.
This is useful, for example, to browse images, or to use an other tool when a conflict occurs in CVS or SVN.
What would be the way to do it in Eclipse with a free plugin, or without any plugin ?
I found it :
"In eclipse, it is common requirement to open the folder containing source file but there is no direct method to do that like in Visual studio of Microsoft."
http://shivasoft.in/blog/others/tips/locate-source-file-on-local-disc-in-eclipse-external-tool/
An actual plugin can be found at http://blog.samsonis.me/2009/02/open-explorer-plugin-for-eclipse/
And version 1.5 can be found here http://blog.samsonis.me/2011/08/openexplorer-eclipse-plugin-1-5-0/
One that I've since upgraded to & find more useful
http://basti1302.github.io/startexplorer/
I always do this:
right click on file/folder, show in..., system explorer. Done.
I guess we don't need a plugin to do that, or I am misunderstanding the question?? I am using Luna 4.4.2 on Windows 7.
On Mac you can follow this steps to add it without a plug-in:
Click the disclosure icon to the right of the External Tools icon:
Select External Tools Configuration:
The External Tools Configuration window will appear. Select Programs and then click New Launch Configuration:
This will create a new launch configuration. Enter a name of the configuration in the name field:
In the Location field enter the path to the Open Finder, "/usr/bin/open" without quotes:
In the Arguments field enter the following argument, "${container_loc}" with quotes:
Click Apply. It should look like the following:
Switch to the build tab and deselect Build before launch:
Switch to the Common tab and select the External Tools checkbox in Favorites. Click Apply again and close out of the window.
You are done. Now to use:
Select a file or folder in Eclipse Package Explorer.
Click the disclosure icon to the right of the External Tools icon:
Select the Open Containing Folder from the drop down menu:
You're file or folder should open in Finder.
PRO TIP: After you use the external tool once you can click the External Tools icon again and it will run the last used external tool. In other words, you won't need to select it from the pop up menu each time.
You can also look up the source directory by right clicking on the project, going to properties, and looking at "Location: ... "

Eclipse Package Explorer Oddity

Recently whenever I open my workspace in Eclipse the Package Explorer has always defaulted to focusing on a single folder of all my projects/resource files. I've put up with this for a few months since I can just "Up to" to get back to the project level.
However, I'd like to get this sorted. Does anyone have any idea how I can stop Eclipse opening this specific folder as its default?
You've probably already found the solution by now, but I recently ran into the same problem and found a solution that seemed to work for me and thought I'd share.
Close Eclipse and open your workspace's workbench.xml file for edit:
gedit <yourEclipseWorkspaceDir>/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
Search the doc for the name of the folder your Package Explorer keeps defaulting to. This should be the value of the path attribute in a line like this:
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="<theOffendingFolder>" type="2"/>
Change the value of the path attribute to point to the desired folder, or delete that input line entirely if you want the Package Explorer to show you the default project level. Save the file and open Eclipse.
Maybe this is related to the files automatically opened when you start your workspace (because it was closed in that state) and the package explorer "Link with editor button". This button at the top right of package explorer view allows to synchronize the current visible file in the editor with the package explorer (personally I often use this feature but I know some of my colleagues hate it ;-)).
Hope this can help
Manu