In my Eclipse Preferences -> Java -> Editor -> Content Assist -> Advanced
settings, I see the following:
- Java Non-Type Proposals
- Java Proposals
- Java Proposals (Task-focused)
- Java Type Proposals
- JPA Proposals (is always empty for me)
- PDE API Tools Proposals (gets skipped when checked in the Content-Assist Cycling settings)
- SWT Template Proposals (always empty)
- Template Proposals (always empty)
- Word Proposals (gets skipped when checked in the Content-Assist Cycling settings)
I tried googling (separately) for "Java Non-Type Proposals" and "Java Proposals (Task-Focused)", but didn't find anything describing them.
The entries matching /Java ((Non-)?Type)? Proposals/
make sense to me, but the others don't.
So, what do the others do?
- I've never seen a result for the PDE, SWT, Template or Word proposals. When are they useful?
- I've also never really started using Mylyn, which I imagine is what provides "Java Proposals (Task-focused)". What would that buy me, if I'm not using a bug-tracker that Mylyn understands?
I've also never really started using Mylyn, which I imagine is what provides "Java Proposals (Task-focused)". What would that buy me, if I'm not using a bug-tracker that Mylyn understands?
What you can do with Mylyn, even without an integrated bug tracker (in the Mylyn parlance, a "task repository"), is create tasks in your "local" repository, and use them to maintain the context of your different development tasks.
The context support in Mylyn is quite unique, although disconcerting when you first activate it for a new task, because what Mylyn does is filter the contents of windows like the Package Explorer so that only those artifacts are visible which you've visited while the task was activated, and now, since you have just activated a task for the first time, nothing has been visited, and the Package Explorer is blank!
What you'd probably want to do, assuming your task description was something like "Find the cause of the NPE in your.code.AbstractMappingParameter", is use Ctrl-shift-T (Open Type...) and navigate to that class. (Save yourself some typing and use the camel case support in the Open Task dialog: just type "AMP".) Your Package Explorer now shows that class, and the hierarchy above it (the file it's in, the package, and the project). The editor, if you've configured it to fold code automatically, will display each comment and method folded, so you can see more of the class that you usually might.
Visit a couple more files like that, and you start to build up your context, which Mylyn automatically saves along with the task. Your subsequent "Open Type..." searches now present in-context classes first, and the content-assist proposals you mentioned work also. NOTE: don't close files unless you think they're not relevant to the task. When you close an editor, the class/file/etc. is deleted from the context, and no longer appears in your Package Explorer. The average development task doesn't take more than a dozen or so files, a small-enough number of files and editor windows to keep open while you're working on it.
If you now created another task (locally, or in a repository), and then activated it, you would again start with a cleared Package Explorer, and would build up context as you worked.
Then, if you reactivated the first task, you'd see an interesting thing: the windows you have open will close, and the package explorer will clear, and then the contents of the explorer from the last time you worked on that task will appear, and all the windows you had opened at that time will now be opened again! You're back to work on it. It's very handy.
There's a brief summary of what you can do with Mylyn without an integrated repository. If you're curious to hear more, you might go to http://www.eclipse.org/mylyn/ and read what's there.
For the Template Proposals and SWT Template Proposals that you see as always empty, you need to be typing something before invoking the content assist.
Try this to see:
- Window --> Show View --> Templates (to show a list of possible templates)
- In a Java class, set the cursor outside a method but within the class
- Type
main
then press Ctrl-Space - The content assist should show
- Press Ctrl-Space again to switch to the 'Template Proposals'
- The 'main method' template should show here
You can try the same for the SWT Templates too, with an extra Ctrl-Space to switch to the SWT Templates. A good example is typing table
as this will show templates for Table
, TableColumn
and TableItem
.
Note you need to have SWT in the project for this to work.
from experimentation, Template proposals are the ones that allow you to type shortcuts like sysout, and ctrl space expands out to System.out.printnl(); I'm not sure what other shortcuts are available - no doubt they are listed somewhere in documentation
I've never seen a result for the PDE, SWT, Template or Word proposals. When are they useful?
Probably if you are working on a PDE or SWT project.
I've also never really started using Mylyn, which I imagine is what provides "Java Proposals (Task-focused)". What would that buy me, if I'm not using a bug-tracker that Mynlyn understands?
Again this is probably for uses cases (people using Mylyn) that aren't yours.
来源:https://stackoverflow.com/questions/1543588/how-is-eclipse-mylin-useful