How can i make code formatting in netbeans and eclipse equal - eclipse

How can i make code formatting standards equal in netbeans and eclipse equal. Also is ther is any way that i use eclipse code formatter in netbeans as for netbeans does not format javadocs comments
Abdul Khaliq

Maybe. You have these options:
Configure the formatters to the lowest common denominator (i.e. something that both of them can do). Not sure if that's possible because you can't "switch off" some options.
Eclipse has a feature called "Clean up". Select the project and it becomes available in the "Source" menu. This allows you to clean up certain aspects of a project: Unused imports, formatting, etc. So you save the work in Netbeans and then clean up the project once in a while in Eclipse.
Use an external formatter like Jindent (Commercial but they have a non-commercial license). Create an Ant task to format the code.

If your project uses Maven, you can use this Maven plugin: http://code.google.com/p/maven-java-formatter-plugin/
It uses Eclipse formatting classes to do the format, and can be configured with your Eclipse formatting preferences, see the configFile property here: http://maven-java-formatter-plugin.googlecode.com/svn/site/0.3.1/format-mojo.html

Related

Share Eclipse Settings With Team

We have a very common use case: we want to standardize all our Eclipse settings like formatter, warnings, save actions etc.
This question got the answer to just use project settings for that, but here's why that won't work for us:
We have way too many projects. We have about 500 Maven / Tycho reactors (many with branches) which in turn contain of usually 3-5 Java projects. Copying project settings for all of these is tedious, error prone and not update-friendly.
So we decided to import workspace setting for each workspace, but that's not optimal either. E.g. I already have about 100 workspaces, so it's almost as tedious and error prone as the project settings.
Let's not even talk about the fact that most of us have more then one Eclipse installation.
Right now I'm thinking about creating a custom plug-in / fragment for Eclipse, which programmatically adds our company's formatter and other settings to the workspace. It would only need to be installed once, and could be updated via the built-in update mechanism.
But I really can't believe nobody has a similiar problem. So I wondering, if there is a build-in way to share Eclipse settings with a big team with many projects?
Eclipse Oomph is licensed under EPL 1.0 - I can't see why that shouldn't be allowed for companies.
Wrt https://stackoverflow.com/a/37799711/10235188 also Yatta Profiles for Eclipse is mentioned to share Eclipse preferences like Code Formatter and other settings.

Add ttcn3 syntax highlighting to eclipse

I don't work with ttcn3 full-time, what I need is just basic syntax highlighting and commenting on Ctrl+/ added to eclipse.
After some googling I discovered Eclipse Titan, but it seems to be a full-blown IDE for ttcn3 with compiler and stuff, and I need just a plugin to eclipse.
I would like to find something like "Set syntax: ttcn3" from SublimeText, is it possible in eclipse?
if you go to this link:
https://projects.eclipse.org/projects/tools.titan/downloads
you will find that you can download the Titan plugins for Eclipse (today they look like this):
Eclipse plug-ins 6.2.0
You may want to install them in your current Eclipse and find out if that is what you are after.
Gustavo.
After installing the plugin
1.change the nature of your ttcn project for "TITAN Nature" this way:
Project popup>Properties>Project Natures>Add...>TITAN Nature.
(if this is not enough:)
2.Select Window>Preferences>TITAN Preferences>On-the-fly checker>Enable parsing of TTCN-3, ASN.1 and runtime configuration files
(You can also set perspective TITAN Editing/Titan Executing/TITAN Log Viewer)

"Bare" Eclipse Installation for Generic Projects

Members of my team will be working on a number of plain-text files. Rather than using a normal text editor, I would like them to utilize eclipse, so we can take advantage of the plug-ins that will make life easier... such as the svn plugin.
Therefore, I would like to provide them with an installation of Eclipse where they will set up generic projects, rather than Java projects.
However, the basic Eclipse download from the website includes all the java functionality. This means that their GUI is littered with java-related functions that are not required, and I don't really want them using.
I have attempted to remove the JDT plugins / features from the installation, but at this point the generic project functions disappear too!
How can one go about removing java functionality whilst retaining generic project functionality?
The 'Eclipse Platform' contains the minimal Eclipse without the JDT or PDE Tools.
Go to http://download.eclipse.org/eclipse/downloads/ and choose either Eclipse Kepler 4.3.2 or the release candidate of Eclipse Luna 4.4.RC3 (RC4 later today). Choose the appropriate download from the 'Platform Runtime Binary' section.
Update:
You need to open the Resource perspective to create projects and edit files - use Window > Open Perspective > Other... > Resource. The resource perspective should already be open if you start with a new workspace.

Eclipse Indigo "Save Actions" are not being applied

I'm new to Eclipse and downloaded the following version:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Release
Build id: 20110615-0604
[edit] Eclipse Platform Version 3.7
I have edited Java > Editor > Save Actions to do the following: Remove trailing white spaces on all lines, Correct indentation
When I save the .java file, those actions are not applied... is this a bug?
Found this that might be related: https://bugs.eclipse.org/bugs/show_bug.cgi?id=350475
Assuming that this relates to JavaScript files, then the related Eclipse bug could be helpful.
The problem (as I've just experienced) is that you can edit the JavaScript -> Save Actions preferences via the context menu when editing a JavaScript file, but the actions will not be run.
The solution is to right click on the project containing the .js file, and select Configure -> Convert to JavaScript project.
The bad news is that this will then will also enable Eclipse's not-so-great JavaScript validation, therefore telling you that libraries such as moment.min.js are broken.
Well for those of you who have found this topic... I did find 2 solutions, no thanks to Eclipse, other than the fact that it is open source and people can write plugins.
Eclipse Platform Version 3.7
AnyEdit - plugin that does it for you when you Save file (I believe this is what eclipse SHOULD be doing)
Go to: Window > Preferences. Then under General > Keys. Make sure drop down for Scheme: is Default and enter 'remove trailing' in the filter. You should then see "Remove Trailing Whitespace" under the command column. Bind it to your own key command.
The only drawback to #2 is that you have to actually press the key binding while editing the file, kindof like a cleanup action.
Too bad Eclipse hasn't taken the approach that ALL file types should be configurable in this way... sometimes I miss TextPad.
Old question, but at least for newer Eclipse versions there's a better solution: Go to the project properties, then to Project Facets. If it tells you that your project isn't in faceted form yet, then convert it. Afterwards (or if it already was faceted), just enable the JavaScript checkbox.
I had the same issue with Eclipse 4.4 (Luna) and this fixed it for me, the save actions are now executed on save.
Adding to jlh's answer, I also had to configure the JavaScript include path of the project to enable save actions. Before that even a manual "Clean Up ..." from the source menu wouldn't work.

Can NetBeans auto-build java free-form (Ant) projects?

After every save I need to right-click on the project in the project browser and click on build.
Is there a way to configure NetBeans to auto-build the project when I save a file?
See Compile on Save FAQ: http://wiki.netbeans.org/FaqCompileOnSave
I don't use CoS myself, I highly recommend Jenkins for your auto-build needs (and so much more): http://jenkins-ci.org/
The compile on save option is not available for free-form projects as of NetBeans version 8.0. And I don't think it will be made available in future too. The very idea of free-form is that that IDE does not know anything about your project and completely relies on the ant-scripts and the mappings you provide.
If you don't want to build an entire project every time you make changes to a file, create a target in ant to compile a single file and map it to the IDE command compile.single. You could add a context menu for that if required, although the existing keyboard shortcut F9 should suffice.
You can read more on the advance free-form configuration here - Advanced Free-Form Project Configuration