Does anyone know of a plugin for Eclipse to use 'favorite folders' in a project ?
There are maybe 2 or 3 folders inside my project (of 1000+ folders) that I regularly switch between. It's really a drag to use 开发者_运维技巧the scrollbar in the Project Explorer each time to get to the right folder, since some of them are 5 levels deep in the directory tree.
It would be VERY nice to have a separate small panel below the Project Explorer to access these frequently used folders...
Eclipse now allows to bookmark folders -- the corresponding bug is fixed.
When you select a folder in the tree, the add option might not appear in the context menu, but it does appear in the application menu at Edit -› Add Bookmark.
However, while the folder then is listed in the bookmarks view, nothing happens when it gets clicked. One has to right-click the bookmark and then select Show in... to get the actual folder focused in the navigator/explorer. IMHO it is better (i.e. more robust) than the workaround using file-bases bookmarks, but it still could be improved (e.g. without the context menu extra clicks to switch to a bookmarked folder).
At this point, looks like https://stackoverflow.com/a/12365878/470838 is more relevant than this answer.
Note quite what you want, but Eclipse allows you to bookmark files. You could use this to bookmark a file in each directory and then use the Bookmarks view to move around from there.
This topic may be old, but I think this solution is good enough
Use "Working set" feature to group files/folders you need into a working set
Create a working set
- Open a view like Project Expoler, Navigator or PHPExplore (if you have PDT) or Package Explorer (if you are a java coder)
- Click "View Menu" (small triangle icon) at top-right of the view opened
- Select "Select Working Set..."
- Choose "Selected Working Sets" option
- Click button "New"
- Pick a type you need, click next, give it a name (eg: MyBookmark) and choose any project(s)/folder(s)/file(s) shown under "Working set content" to include in MyBookmark and finish
Open/edit/close a working set
- To open a working set (MyBookmark), follow steps 1 -> 4 above and check the checkbox named MyBookmark, click OK. Now the view display only contents of MyBookmark
- To edit MyBookmark contents click "View Menu" and select "Edit Active Working Set..."
- To close current working set and back to original display click "View Menu" and select "Deselect Working Set"
I would really recommend Mylyn (a task-focused interface) for this kind of workflow.
By defining the appropriate task context, you could switch to such tasks and see only the folders you need (no dragging involved) as opposed to see everything.
To add to VonC's answer:
Adding files into Mylyn's current task context using Bash
Currently there are two main ways I have found to manually add certain files into the activated Mylyn task context when you activate a new task. This works well for me because I always have a prompt open or accessible at a keypress.
- In a bash prompt, run:
eclipse <file_to_add>
- With Focus on Active Task selected in Eclipse's Project Explorer...
- Run
touch <file_to_add>
(either create a new file, or update timestamp of existing file) - In Eclipse, click on your project and press F5 to Refresh. The file should show up.
- Run
The first one will open the file you want to work on in Eclipse, and it will show the file in the task context. The second one forces Eclipse to see that the file was accessed, and it will add it to your task context.
Setting up commonly used directories in Bash
To solve the problem of having to cd
into your most commonly used folders all the time, use bash's built in directory stack feature.
Create a script (preferably in your personal home bin) called sh.init
Add something like this to the file:
pushd ~/src/some/seldomly/used/path
pushd ~/src/some/less-seldomly/used/path
pushd ~/src/some/commonly/used/path
pushd ~/src/some/most-commonly/used/path
Make sure to chmod +x sh.init
. (I added this into a function in my .bashrc myself that does a couple other things, but a separate script is probably easiest.) Now run this script whenever you want to add these dirs into your directory stack, and end up in the last one. There is a good tutorial on how to use these functions here or in the bash man page ( Look for dirs under Shell Builtin Commands section). You will always be in the directory on the top of the stack. Here are some quick tips:
- Use
dirs
to display the stack ( will display on one line. Top = left, Bottom = right ) - Use
dirs -v
to display the stack in multiple lines with numbering ( makes top / bottom order make more sense graphically ) - To switch the top 2 directories, run
pushd
- To cd into the third or fourth dir from the left, (effectively rotate the stack) use
pushd +2
orpushd +3
respectively. - These general rules apply when rotating the stack:
- Numbering always starts from 0
- If counting n dirs from the top (left), use +n
- If counting n dirs from the bottom (right), use -n
- Use
popd
to pop a directory off the stack, and cd into the new top dir on stack- Use
dirs +n
ordirs -n
to display the n'th dir from the top (left) or right (bottom) of stack.
- Use
- Use
pushd <new_dir>
to push a new directory onto the stack (and cd into it)
精彩评论