How can do code alignment in Eclipse base Force.com IDE - eclipse

How can do code alignment with Eclipse base Force.com IDE.
Alignment shortcut key 'CTRL+SHIFT+F' is not working for Apex code.

None of the suggestions so far work for me. Note that the Force IDE opens the Apex class in an Apex Editor. This editor does not appear in the list of contexts that you can associate with a key event. For example, this list contains such contexts as "editing in structured text", "editing in Java Source", etc.
The Apex Editor does not contribute a "Source" menu option to the right click menu. So there is no way to get to the formatting features.
I tried to open the apex class in the Java. Now the "Source" menu option appears the format option doesn't do anything. (Hence no key event will be able to do anything.)
The only thing I can get to work is this ...
Select file.... Open With... Other ... locate Java Editor.
Once file is open ... select all text .. right click and select Source ... Correct Indentation .
This does not reformat but it does fix the indentation problem.
Someday I hope SFDC will make the code for the Force IDE open source. Then we, as a community, could build more developer-friendly tools.

Apex classes and triggers use a different editor than Java. The auto formatter (or code alignment) does not work with Apex Code (or the Apex Code Editor). I couldn't get CTRL-SHIFT+F to work in the most recent version of Eclipse with the Force.com IDE, either. I believe this is because the auto formatter is designed to work with Java only.
However, if you switch to the Java perspective and open your Apex class with the Java Editor, CTRL+I does correct indentation properly.

Go to Preferences -> General -> Keys and type "format" into the search box, you will see what keys (if any) are bound to the format commands. Then you can bind what you like or use what's available.

Related

Enable context-sensitive help in Eclipse

Using Eclipse Mars (4.5) to write a Java application. Say I'm trying to see the documentation for the keyword final. I put the cursor in the middle of "final" in the line final static int RIGHT_PADDING = 12; and hit F1.
In Delphi and Visual Studio a related keyword might be const and the context help displays correctly. In Eclipse, I would expect the relevant Java documentation to be displayed in Eclipse or possibly in a web browser (either is fine). The relevant page might be this Oracle Java documentation page.
Instead I get this Help panel which appears on the right as in the image below. No help on final is displayed. I've tried setting some of the Windows > Preferences > General > Keys binding for help-related commands to F1 but so far without success.
Is this functionality available in Eclipse Mars?
Do I need to use a different key binding other than F1?
The Eclipse Java editor supports context-sensitive help only for names (of classes,
methods, fields, variables), but not for keywords (like final, class, int).
AFAIK the same holds for other language editors (C/C++, JavaScript, Python) in Eclipse.
By the way, distinguish between the following two key-bindings:
Click F1: Context-sensitive help for the active GUI-part (in your example: the Java editor itself)
Click F2: Context-sensitive tooltip for the selected token (for example String,
toString, myVariable)
You probably want F2.

Eclipse : Run an external software in editor view

I am using Eclipse to edit almost any file that I code. But for some, I prefer to use gEdit (for instance CoffeeScript files).
I wondered if there was a way to somehow embed the UI of gEdit (or any other software) in the Editor view of Eclipse. I could use my favorite editor in an unified environment and this could also bring the richness of the Eclipse environment to those files (even if I'm well aware that most of it won't work).
But is it ever possible ? Better, is there already a plugin for that ?
Thanks for your help !
I wondered if there was a way to somehow embed the UI of gEdit (or any other software) in the Editor view of Eclipse.
No, there isn't.
However, you can execute an external editor from Eclipse.
From the main Eclipse menu, left click on Window -> Preferences.
On the Preferences dialog, left click General -> Editors -> File Associations.
For any file type, you can associate one or more editors. These editors can be external to Eclipse.
Once you've done this, you can bring up your external editor by double clicking on the module name in the Package Explorer.
After you're finished editing with an external editor, refresh the module so Eclipse knows you've made changes.
SWT allows to integrate apps using OLE. Unluckily this is obviously available only when running on Windows.
For more info, see this article by Lars Vogel.

how to format code in eclipse "git repository browsing prespective"?

How to format code to specific coding style in Git Repository perspective in Eclipse ? like Ctrl+shift+f works in Java perspective. Can anybody help me to solve this ?
Here My problem is to format a android repo.
The "format" actions are tied to specific editors. Use ctrl+shift+L twice in a row to open the list of all available hotkeys. Filter that list on "format" and you should see a number of potential candidates... and their context. The Java ctrl+shift+F (Format) action is available in any Java editor ... even when in the Git perspective (at least, that's true with Eclipse 4.2 as I just tried it). That is, as long as you have a Java editor open and it has focus. The Ant "format" action should work the same way : as long as you have an "ant build file" editor opened and focused.
Whether the "ctrl+shift+F" you want is active or not depends on which action exactly you are trying to trigger : java format, ant format, xtext format... and how that specific action is contributed (and bound) by its contributing plugin. To check that, you can open an editor where you know the action is active, hit alt+shift+F2 then right-click your editor and locate the "format" action. When you click that action just after alt+shift+F2 has been pressed, it will not be triggered : rather, a dialog will pop-up to tell you which action that is, who contributes it, through which plugin.xml...
I found the answer, it was very easy,
Right Click on project in Git perspective -> import project -> check import as a general project ->select the working directory which you want to import -> finish
Now go to the java perspective and find the project :) thats all

eclipse's plugin or vim's plugin similar like ctrl+p and type # to find function/method list in sublime

eclipse is good at autocompletion when static typing , when is dynamic typing ,eclipse failed to autocompletion ; in sublime ctrl+p ,type # and type 'method name'to find function/method list , It is a wonderful way to find the right method while coding dynamic typing language ;
the key point is :
the operation in sublime text 2 is very convenient ,all key type is in one input box ; never need to chage active file tab; we can focus on the active code file tab ;
is there any plugin in eclipse or vim which can search method of any file conveniently ?
In ST2, this feature is used to quickly jump to a method anywhere in your project.
In Eclipse, Control+Shift+R can be used to jump quickly to a "resource" (file) and Control+Shift+T is for jumping to a type (not method). Control+o opens a very useful and quick outline of the current file. It doesn't work project-wide.
I'm not aware of something that works exactly like ST2's feature. Did you search the marketplace?
In Vim, FuzzyFinder, Command-T and CtrlP all allow you to navigate through your project using fuzzy matching. They can be setup to use your tags file. AFAIK, there's no plugin that provides exactly what ST2 provides.
From your question I'm not sure you use it as intended: it sounds like you use it to show a list of methods in some file in your project in order to use the right method in your code. This sounds a lot like you'd benefit from autocompletion to me.
Being an IDE, Eclipse shines on that front: its "code assist" window will show you where the suggestion is defined as well as its type.
Vim's "omnicompletion" is quite limited compared to an IDE but, depending on your language and using some third party scripts, it can be made quite powerful.

add method/functions list like visualstudios on netbeans 7 editor toolbars?

is there any way, to enable a dropdown list of methods or functions, on the Editor Toolbars of NetBeans 7, like VS does? , i mean the toolbar that is inside on the tab of each file when you are editing a code, that has some options like, "last edit, next breakpoint, next bookmark, ..."
In VS is really helpful this feature, to jump of functions o methods more quickly, i know that netbeans has the navigator, but sometimes this help more
Greatings
is there any way, to enable a dropdown list of methods or functions,
on the Editor Toolbars of NetBeans 7, like VS does?
There is no way provided by standard NetBeans IDE offering or certified plugins available in NetBeans Update center, but a NetBeans plugin can be written for doing what is expected in your question. Has it been done? In my opinion no, as no one asked till now. Now that you have asked someone may think of developing such a plugin.
Best way to expedite such request and feature to be added to NetBeans is to add a Request for Enhancement in the NetBeans issue tracker.
In VS is really helpful this feature, to jump of functions o methods
more quickly, i know that netbeans has the navigator, but sometimes
this help more
There are many ways to reach specific methods in NetBeans IDE. You have already listed one and that is Navigator. Others include GoTo Type [CTRL+O] and GoTo Symbol [CTRL+ALT+SHIFT+O]