Eclipse – Formatter e Save Action
Depois de ter falado sobre Code Templates para comentários no código, vou neste post falar sobre a formatação e como otimizar isso para lhe ajudar e não atrapalhar.
Muitos desenvolvedores tem problemas com o famoso Ctrl+Shift+F, que promete formatar seu código e muitas vezes acaba é deixando ele mais confuso.
Bem, o nosso padrão de código(se é que posso chamar assim) é muito diferente(ou um pouco depende) dos códigos dos gringos, ou seja, o Eclipse formata no padrão deles pode dizer assim ;).
Para resolver esse “problema” o desenvolvedor tem que fazer uma configuração simples, mas um pouco chata(considerada por alguns) mas no pior caso será feita apenas uma única vez ;).
Vá em Windows –> Preferences –> Java –> Code Style –> Formatter.
Vamos agora criar um novo profiler, clique em New e digite um nome para o seu novo profile.

Pronto, agora vamos personalizar, clique em editar.

Vou tentar falar um pouco sobre cada aba de opção.
Indentation
Nesta aba você vai selecionar a indentação em si e o tamanho dela, normalmente o tamanho da tab é 4.
Braces
Nesta aba você vai personalizar a posição das chaves(“{” , “}”).
White Space
Está é interessante, pois você poderá personalizar até os espaços em branco entre cada variável, método e assinaturas de todo tipo de objeto, desde strings até arrays e várias outras.
Blank Lines
Nesta aba você irá definir as quebras de linhas(linhas em branco) entres métodos, variáveis, pacotes e etc. Aqui você irá definir por exemplo que o espaço de linha entre a declaração de um package para um import seja de 2 linhas por exemplo.
New Lines
Nesta aba você define como um método vazio deverá ficar, se você deseja inserir uma nova linha neste método, definir também como um array declarado deverá ser exibido e identado, assim como uma annotation.
Control Statements
Esse é bem interessante mesmo, pois aqui você irá definir como seus else, IF, catch, while etc devem ser identados.
Line Wrapping
Neste você define o tamanho Maximo da coluna que uma linha pode comportar, como deve ser a identação de uma assinatura de um método, métodos declarados, enum, variáveis declaradas e etc.
Comments
Isso é referente a identação do Java Doc, blocos de comentários normais(//, /**/), qual o formato das tags HTML, espaço entre os textos do comentário e se desejar remover qualquer linha em branco que esteja no comentário.
Todas essa opções podem já serem visualizadas no código de exemplo ao lado de cada uma, facilitando assim a personalização.
Então supondo que você já criou e personalizou seu profile vamos agora tentar otimizar isso.
Para se utilizar do profile basta você executar o atalho dentro do código, que é o Ctrl + Shitf + F, pronto ele aplica a sua configuração personalizada.
Mas supondo que você criou um profile e quer sempre executar ele, fica meio chato você ficar sempre digitando o Ctrl+Shit+F correto ? Que tal otimizar isso ?
Save Actions
Vá em Windows –> Preferences –> Java –> Editor –> Save Actions.
Para ativar(caso não esteja) basta selecionar a opção “Perform the selected actions on save”.
Agora podemos adicionar uma formatação automática, selecione o Format source code e clique em Formatter.

Verifique se o seu profile está selecionado como profile ativo(Active Profile), clique em Ok e pronto, na próxima vez que você salvar(Ctrl + S) qualquer arquivo .java(classe) ele irá aplicar a(s) sua(s) configuração(ões) automaticamente.
Para definir como padrão para todos os integrantes da equipe, basta seguir os passos abaixo.
Vá em Windows –> Preferences –> Java –> Code Style –> Formatter –> Edit –> Export –> Salve seu profile.
Agora cada desenvolvedor irá poder importar toda a configuração de formatação de código, ou você mesmo poderá levar para onde quiser a sua formatação.
Simples não ?
Ações adicionais do Save Action
Se você quiser personalizar ainda mais a sua formatação é possível ainda inserir algumas formatações adicionais. Na tela de Save Actions temos o Configure onde você poderá definir mais configurações que serão executadas ao salvar qualquer classe Java.

Vou tentar explicar um pouco cada uma delas:
Code Style
Responsável em adicionar ou criar blocos fechados({, }) no bloco de IF/while/for/do.Definir se você quer parênteses em condições por exemplo:
(((i > 0) && (i < 10)) || (i == 50)) ou sem (i > 0 && i < 10 || i == 50).
Se quer adicionar o modificador final em todas os parâmetros onde seja necessário, e quais tipos de parâmetros(private, parameter, local variables).
Member Accesses
Usar o “this” em todos as variáveis e métodos locais ou somente onde for necessário. Como devem ser declarados os métodos e variáveis etc.
Unnecessary Code
Como o nome mesmo já diz, remove trechos de códigos desnecessários, como imports de classes que não existem dentre outras configurações.
Missing Code
Adiciona automaticamente as tags “@Override” e “@Deprecated” nos métodos.
Code Organizing
Organiza a ordem do métodos.
Bem essa são as formas simples de como otimizar o código, seja pela formatação dele ou até por simples comentários, mas essa é a intenção, não perder tempo com coisas simples e repetitivas ;).
Abraços e espero ter contribuído com este artigo para agilizar o processo de desenvolvimento.


We are a bunch of volunteers and starting a new scheme in our community.
Your site provided us with useful information to
work on. You have done a formidable job and our entire neighborhood will probably be grateful to you.
darkmarkets darknet drug store
Pills information sheet. Effects of Drug Abuse.
buy viagra
Best information about medicine. Get information here.
tor markets links darkmarket link
http://cytotecpills.pro/# buy cytotec over the counter
montelukast canada amantadine generic buy dapsone 100mg generic
Having read this I believed it was very enlightening.
I appreciate you finding the time and energy to put this
information together. I once again find myself personally spending a significant amount of time both reading and posting comments.
But so what, it was still worth it!
tor dark web dark market link
http://onlaintelevizia.listbb.ru/viewtopic.php?f=2&t=104
tor marketplace blackweb official website
I do agree with all the ideas you have presented to your post.
They’re really convincing and will definitely work.
Nonetheless, the posts are very quick for novices.
May you please prolong them a little from next time?
Thank you for the post.
black internet drug markets dark web
dark web drug marketplace darknet websites
dark web sites darkmarket link
Hi there, just became alert to your blog through Google, and
found that it is truly informative. I am gonna watch out for brussels.
I’ll appreciate if you continue this in future.
Many people will be benefited from your writing. Cheers!
tor markets darknet market list
deep web drug markets dark web market links
Keep on writing, great job!
It’s impressive that you are getting thoughts from this article as well as from our discussion made here.
Fantastic site you have here but I was curious if you knew of any user
discussion forums that cover the same topics talked about here?
I’d really like to be a part of group where I can get feed-back from other experienced individuals that share the same
interest. If you have any recommendations, please let me know.
Thank you!
darknet markets 2023 dark web markets
obviously like your web-site however you have to take a look at the spelling
on several of your posts. Many of them are rife with spelling problems and I to find it very bothersome
to tell the truth nevertheless I will surely come again again.
I wіll right aԝay snatch your rss as I can’t find your e-mail sbscription hyperlink oг newsⅼetter service.
Do you’ve any? Please let mme understand so that I may
just subscribe. Thanks.
my Ƅlog – topjitu
Hey there! I know this is kinda off topic however , I’d figured I’d
ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa?
My website discusses a lot of the same subjects as yours
and I feel we could greatly benefit from each other.
If you might be interested feel free to send me
an e-mail. I look forward to hearing from you! Great blog by the way!
I beliеve everything published was actually very reаsonable.
However, consider this, suppose yyou added a littlе information? І am not sugggesting your information isn’t solid.,
but suppоse you аdded a tіtle that grabbed a person’s attention? I mеan Eclipse – Formatter e Save Acrion –
Handerson Frota is kinda vanilla. Yoou mіght glance
at Yahoo’s home page and wаtcһ how they write post heaqdlines to grab people
to click. You might add a гelatеd video oг a pic oor two to grab people excited about whаt уou’ve got to say.
In my ߋpiniߋn, it could make your blog a little bit more interesting.
Revіew my web-site – kartutoto
dark market url dark web access
dark market link dark markets 2023
dark market tor market
deep dark web tor market url
Hi would you mind sharing which blog platform you’re using?
I’m looking to start my own blog soon but I’m having a difficult time
choosing between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely
unique. P.S Apologies for getting off-topic but I had to ask!
I love it when folks come together and share ideas. Great site, keep it up!
Medicines information sheet. What side effects?
finpecia
Everything what you want to know about medication. Get information now.
onion market darkweb marketplace
darkmarket darknet seiten
tor markets links darknet search engine
darknet drug links onion market
http://odinzovo.moibb.ru/viewtopic.php?f=26&t=289
There is definately a lot to find out about this subject.
I like all the points you’ve made.
amoxicillin without prescription
Oh my goodness! Amazing article dude! Thanks, However I am having difficulties with
your RSS. I don’t know why I am unable to subscribe to it.
Is there anybody else having identical RSS issues?
Anyone who knows the answer will you kindly respond?
Thanks!!
blackweb official website the dark internet
buy cytotec in usa buy cytotec in usa cytotec online
deep web drug url dark market url
deep web drug links tor darknet
I jսst could not go awaү ʏour web site prior
to suggesting that I extremely loved tһe standard info a person supply tߋ your visitors?
Is gоing to be again steadily to check up on new posts
Mʏ page; Canadian News Today
tor market dark web search engines
dark market url darknet sites
Thank you for your whole labor on this web site. Betty really loves going through research and it’s really easy
to see why. A lot of people notice all of the compelling method you create very helpful techniques on this web site
and even inspire contribution from other individuals on the point then our own princess has
always been discovering a lot. Take pleasure in the remaining portion of the new year.
You are performing a stunning job.
Feel free to surf to my site … CoolX Air Conditioner
Hello, constantly i used to check weblog posts here in the early hours in the break of day,
for the reason that i like to find out more and more.
Very great post. I just stumbled upon your blog and wanted to say that I have truly enjoyed browsing your blog posts.
After all I’ll be subscribing to your feed and
I am hoping you write once more soon!