Eclipse juno function bug in ubuntu - java

I am using Eclipse Juno in an Ubuntu environment, and about every hour my eclipse functions start to act weird. Pressing delete, Ctrl-d will stop working, or delete things in another class I have opened.
Same thing for the cut/paste and inspect functionality, it either doesn't do anything or it pastes/inspects something in a different class I have opened. I doesn't matter if I try it by using the mouse or the keyboard shortcuts.
I'm fairly sure it's an eclipse issue, as this only affects eclipse, and when I restart eclipse these issues are resolved. This is a pain in the ass though, as I have multiple servers running in eclipse, and restarting these take some time.
Refreshing my project as described here doesn't work for me.. Any ideas?

sounds like your key bindings might be being overridden by a plugin you have installed..\
Open eclipse, go to -
Window->Preferences->General->Keys
filter for Delete Line- if it is not bound to Ctrl+d then set the binding.
To check for duplicates, click the Delete Line key binding, then sort by "Binding" and see if you have one overriding it. If you do, then you have a couple options -
Disable the Ctrl+d binding that the plugin is using
Change your Delete Line binding to another. I like mine being Ctrl+L
The way keybindings work in eclipse is all dependent on the When column in the key bindings window. It should be set to Editing Text - if it's not, then you should probably set it to that. It might not be working for you in some other content type, say, if you are editing the .classpath

Related

The cursor randomly disappears in Eclipse 2019-09 and sometimes stops writing

I have a very annoying problem with Eclipse 2019-09 (4.13.0) version: while I'm editing code (often when I copy and paste things or after accepting a code completion suggestion) the cursor (I'm talking about the text cursor: |) disappears completely! I cannot see it anymore, so I'm not able to detect on which part of the line I am! This is very annoying. I found a partial fix by installing the extension 'Vrapper': enabling and disabling it makes the cursor appear again.
Another problem I experience every time I press Ctrl+Space to ask for code completion suggestions, the cursor stops writing. After doing random things like switching tabs or opening new files the cursor starts to write again, but then the keyboard shortcuts stop working and I have to restart the entire IDE.
This behavior is intolerable, so I was wondering whether somebody else has had the same problem and how they have dealt with it.
The configuration of my system is:
OS: Debian, using i3wm+compton as a window manager on Xserver.
Thanks in advance.
Dead place, but I'm currently dealing with the same. The weird thing is that it happens on a per-file basis. Eclipse also treats that file as if it was not open, i.e. I can only save it through the 'Save all' method, not Ctrl-S ('Save') as I usually do. It's hellishly annoying, but it usually is fixed by reopening the file in question, and editing other files between the closing and reopening of other files.
If you have a better answer than this that you've found since, please, please post it here. It's annoying as all hell.
Minimize eclipse and maximize again.
Happened to me on Eclipse 2022-09 (4.25.0).

Eclipse suddenly closes Java file, and now refuses to recognize it as such

I've come across quite an odd problem with eclipse.
I was working on a project and I right clicked on a method call declared in another class and used Eclipse's handy find declaration in project (saves me quite a bit of scrolling) to run a search for that specific method declaration. Right as it should my search pane pops up with a link to the method declaration. So I click the link, the other file the method is declared in is opened automatically, and poof the Java file I had searched from disappears from my editor tabs.
So I say to myself, "damn this old version of eclipse (Indigo) has some bugs...now I've got to go reopen my file and get back to my spot...GREAT!". But when I open the file, it is treated like a plain text file. All the text is the same color, and the outline won't work!!!
So I solved the problem whilst I was typing the above up and decided to post the answer since it isn't a nice clean solution..and I doubt one exists.
Okay so file wasn't being recognized by eclipse..
So I open the file and do a Save As, and save it under another name in the same package.
Then, I went to my test code and right clicked on a method call that was declared in the file that eclipse had buggered up, and went to search for declaration in project.
Sure enough two results popped up, one in the newly saved as file, and one in the old one.
I clicked on the old one, and still plain text...no difference.
But then I clicked on the new one, and my highlighting was back!
So then I just deleted the old file and refactored.
I think somehow eclipse made the file disappear without properly closing it...just my guess, glad I resolved this nice and quickly, hopefully anyone who has the same issue can be helped by this.
This happened to me a couple of minutes ago. Trying to close/open the projet, restarting eclipse did not work for me.
The steps I used were:
Pick another Java file (same package) right next to the bogus one (make sure syntax highlighting works on this one)
Choose 'Save As' and override the bogus one.
Verify that the bogus one now has proper syntax highlighting
Use git checkout -- to retrieve you original file
Et voilĂ  !

Is it possible to trigger a sequence of actions in RCP-Plugin without plugins activation?

If I activate an Eclipse plugin (e.g. by clicking on a command from the plug-in in a menu) a number of actions is automatically triggering - like setting preferences, etc.
I would like to ask if is it possible to activate a plug-in automatically at the Eclipse startup without clicking on any actions?
Possible duplicate: Launch an action in Eclipse RCP at startup
I'm not sure if is is the same case like mine. If it is, then sorry for duplicate.
[It is not totally clear to me what you mean, but it does seem to be an exact duplicate as far as I can see...]
If you want to start an Eclipse plug-in as Eclipse is started, you can either use either start-levels of OGSi or use the org.eclipse.ui.startup extension point... The frmer is the most general, whereas later is probably the easiest if you can change the plugin.xml of the plug-in...

How to programmatically load a desired plugin on eclipse start up

Is there any method in SWT to programmatically set my plugin as default whenever the eclipse IDE starts i.e. when the eclipse starts a desired plugin is set as perspective.
If I remember correctly, it should be possible with setDefaultPerspective(String id).
You can access this via:
PlatformUI.getWorkbench().getPerspectiveRegistry().setDefaultPerspective(id);
However, be careful when doing this. I can imagine that a lot of people might uninstall your plugin, just because they are annoyed by this small change.

AutoIndent in Eclipse possible?

I have been wracking my brain trying to figure this out. For the first time I used jEdit the other day and I was pleasantly surprised that it auto indented my code (meaning that I'd put in the following code:
int method () {
_ //<-- and it put me here automatically
I've tried to get the same thing working with eclipse but with no success. I got into the code formatter but I don't see how to make that happen.
Is it possible to do this? Also while I'm here, is there a such thing as a eclipse plugin that will allow you to search the methods and classes of the standard java library?
Thanks
Personally all I use for this is the format options Window->preferences under Java->Code Style ->Formatter.
I once took the time to tweek how I like my code to look like when I work and exported the whole thing. After that I just code without too much bother on what it looks like. When I find the code looks messy by pressing the combination ctrl+shift+f and the whole class becomes pretty again, comments and all.
After a while it pretty much became a reflex...
code code code
ctrl-s, ctrl-b (cause I disable auto build sometimes), ctrl-shift-f
code some more etc...
Once I got used to this I never really cared how it presented the code as i was typing because I knew it would look all pretty as soon as the loop/if/switch/method etc is finished
My clean eclipse install does this by default.
Have you changed any options? Make sure the file you are editing has the .java file extension. The preference options that control the typing automations are under Java -> Editor -> Typing in the Window -> Preferences menu.
Also, I find that the auto-indenting, and most of the other auto-complete functions of eclipse do not function well if the file I am editing has errors in it which prevent compilation. Make sure that your curly-braces are matched correctly, this is the main one that I've noticed blocks auto-indent.
Regarding searching through the standard Java libraries, use the Search -> Java.. menu option, and check the JRE libraries checkbox, then search away. You can also use the Hierarchy view to see how the classes relate. Also, in the Package and Project views you can expand the JRE System Library, and then expand rt.jar which holds pretty much all the standard Java pacakges.
Eclipse has always done this for me by default.
One really cool thing about eclipse is that you can search preference pages. Just right click and go to prefrences. Go to the "Window" menu, and click "Prefrences". Then at the top of the tree view there's a text box that says "type filter text". Replace that with "indent" and it should bring up the page where the indent option is.
Make sure that eclipse recognizes your file as a java file, that you're using the Java distribution, the latest version, etc.
Iv been trying to work around the eclipse indenting and other supposed features for years, and it seems that the bottom line is this ...
It only works for the programming style of the authors, so to use it you need to modify your style to comply.
This would be OK except that the authors of eclipse have some very strange ideas about common shortcut keys.
One horrid example is the search features, eg when did Ctrl+K become "Find Next occurrence" and why doesnt F3 or n work?
That all being said I use eclipse because if you have the time to wait around while it starts up - or never close it - and you can modify everything youve learned about using an editor - why why why - then it will certainly increase your efficiency.
Please note that there is a preference setting for indenting, it can be set for a project, a workspace, or globally, but no matter how you set it eclipse will still chuck tab characters in where you dont want them.
In fact its indent crazy, like it wants to indent everything, even if its already indented.
Like I said Iv been using it for years and it STILL drives me nuts with its random behavior.
Follow these steps for Eclipse:
Select all text: ctrl+A
Correct indentation: ctrl+I
You should check:
Hidden features/tricks for Eclipse?
What is your favorite hot-key in Eclipse?

Categories