Eclipse key for "go to typed in class" - eclipse

Is there a key in Eclipse Neon.3 (Java) that allows me to type in a class name and which then takes me to that class, whichever project in my workspace contains it? Specifically, I am not sitting in a source file with a reference to it, but I have a case like someone emails me and says "I have a question about class StoreImportantData" and I want to be able to type that class name in and go to it without thinking about where it might be located. Various "Search" functions will work, but are very clumsy or require temporarily changing my default search settings.

Normally Ctrl+Shift+T is bound to Open Type - should be the default, I'm pretty sure that I've not changed it.
Note: Ctrl+Shift+L list all key bindings, and the preferences
Window -> Preferences -> General -> Keys
lists all commands and bindings. It not only allows changing the binding, but also has a filter field that helps searching a specific functionality..

Related

eclipse preferences: setting proxy bypass defaults via plugin

i'm trying to set some values into the Eclipse preferences, especially in the network connections -> Proxy bypass. I want to make some own entries.
So how can I put there some values?
By the
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
or better by
InstanceScope.INSTANCE.getNode(... ?
How do i access it, to put some values into?
Any hints would be welcome.
Thanks a lot guys!
You can find details about ConfigurationScope, InstanceScope and DefaultScope right here, from Vogella.
What you want to do is create FieldEditors.
Create preference pages like this:
public class ProxyPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
You will also need a "static" class (preferably interface) to hold the preference keys
IProxyPreferenceKeys -> put all your preference variables here.
When you create the field editors, pass the preference constant to it.
new ColorFieldEditor(IProxyPreferenceKeys.PROXY, "Proxy color:", parent);
Finally, in your code, when you need the preference setting, just get it like this:
Activator.getDefault().getPreferenceStore().getString(IProxyPreferenceKeys.PROXY)
The Network Connections preference page is org.eclipse.ui.internal.net.ProxyPreferencePage. This does not get the values directly from preferences but via classes such as ProxySelector and ProxyManager (all internal classes).
Looks like the values actually come from ConfigurationScope.INSTANCE.getNode("org.eclipse.core.net") with the keys defined in org.eclipse.core.internal.net.ProxyManager

Eclipse Open Type Pick Absolute Match First

I have two classes, UserServiceDBImpl and UsergroupServiceDBImpl. When I use the "Open Type" dialog and type in 'UserServiceDBImpl' it often puts UsergroupServiceDBImpl first even though the other class is an exact match.
Is there any way to convince Eclipse to put the absolute match ahead of whatever it decides is the "best" solution according to its internal rules?
There has been a bug report open for this since 2005:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=109670
If you include the package when typing the classname into the dialog eg: "*.user.UserServiceDBImpl" it will help narrow it down, at least if the wrong options are in different packages anyway. Tedious though.

Stop eclipse propose variable type after variable name

Like I type:
public String name
Eclipse is suggesting nameString for the variable name.
I am using Eclipse 4.2
I saw the same question here, but by following the instruction in the answer, I am still not sure what to do.
How to stop Eclipse from putting the variable type after the variable name
In the
window -> preferences -> java -> editor -> content assist -> advanced
page you need to turn off Java Proposals or Java Proposals (Task-Focused)
Unfortunately this also turns off alot of useful content assists

In-place ("Quick-Assist" or something easier) source code modifier?

Eclipse already has very impressive and useful what I call "source code modifiers" (please suggest a better name).
For example, it has "Quick Fix", "Word Completion", "Externalize Strings" and other functions that modify source code via menu (or key-combination).
Now, I am looking to add my own "source code modifier" function: I would like to:
Highlight (select) an arbitrary string.
Right-click on it
Invoke a menu item that would "translate" that string to a different string, using a function that I wrote (preferably in Java). Similar to "Quick Fix" or "Replace With" currently on the default context menu.
Is this possible in Eclipse?
If so, what do I need to do to accomplish this?
The short answer:
The quick assist will have to modify the AST of the Java code. Essentially you will have to replace a org.eclipse.jdt.core.dom.SimpleName node with one that you want.
The long answer:
The org.eclipse.jdt.ui.quickAssistProcessors extension point enables you to contribute your own Java code quick assists.
To create a new extension for the extension point you need to first provide the required extension in the plugin.xml. For example, JDT defines the following processor
<extension
point="org.eclipse.jdt.ui.quickAssistProcessors">
<quickAssistProcessor
name="%defaultQuickAssistProcessor"
class="org.eclipse.jdt.internal.ui.text.correction.QuickAssistProcessor"
id="org.eclipse.jdt.ui.text.correction.QuickAssistProcessor">
</quickAssistProcessor>
</extension>
(For a description of the individual attributes, please refer to the extension point documentation)
Then you need to create the class that implements the org.eclipse.jdt.ui.text.java.IQuickAssistProcessor interface, and modify the AST in this class. (This class is the same as the one you specified while declaring the extension)
Supplying the right IJavaCompletionProposal
JDT provides the following default implementations for correction proposals that can be used to contribute quick fixes and quick assists.
ChangeCorrectionProposal
CUCorrectionProposal
ASTRewriteCorrectionProposal
If you use an ASTRewrite, you should create an ASTRewriteCorrectionProposal.
ASTView Plugin
This is something that will help you visualize the AST of a Java source file http://www.eclipse.org/jdt/ui/astview/index.php
The right name is 'Quick Assist'. You have to write some code to create your Quick Assists.

Eclipse caret jumps to constructor while typing

While typing in Eclipse (Java) I often have the problem that when I begin to type accessors, the caret jumps down to the beginning of the constructor definition. So in a document like this:
private int mSomeInt;
public
in|public MyClass(){
}
I would like to manually type out the accessor (getter/setter) for mSomeInt, but when I press space after 'public' above, the caret jumps to the beginning of 'public MyClass'.
I often type complete lines to look up and find my methods jumbled with the constructor (like above).
Any help would be appreciated.
Note - this isn't only with accessors but rather any access modifiers that I define before the constructor or another method.
Edit
After unsuccessfully trying Deco's solution below, I've managed to narrow it down a little further.
The problem only happens if I have all the blocks in the file in a collapsed state (ctrl+shift+numPadDivide). I can see the problem is now that the new access modifier I type is then (quickly) collapsed into the below method. i.e. Eclipse is actually taking the first accessor modifier and collapsing everything from there, even though my intention is actually to write a new method.
The only solution I've been able to find is to only edit the source with all the 'fold' elements unfolded.
Under Window -> Preferences -> <Language> (e.g. Java) -> Editor there is a Content Assist menu item where you can configure auto completion and caret placement as well as auto-activation of it and the delay it uses.
Edit:
After your update to the original question I was able to successfully replicate this in Eclipse Indigo. When you have all of the code blocks collapsed it looks like Eclipse assumes that the code you are writing needs to be in that block (rather than as a variable declaration). I'm not sure if this is expected behaviour or not - but the only way around it I've found is to edit the code with the main block open, and then close it after the fact - or turn folding off altogether.
From what I can tell there are various folding plugins/addons that you can get for Eclipse which override the default behaviour and might function better? A quick Google search will be able to get you a list of them quickly.
I'd probably also suggest posting this as an issue on the Eclipse support site for their official answer.
Unfortunately this issue still exists for me in the latest Elcipse version (Kepler).
As the issue only occurs when the document is 'folded', the work around this is to either disable folding in the editor - or disable folding on 'Members' from the :
Preferences -> Java -> Editor -> Folding