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.
darknet search engine dark market list
dark websites deep web search
tor market url darknet drugs
Hello, just wanted to mention, I enjoyed this blog post.
It was inspiring. Keep on posting!
darknet sites darkmarkets
dark web market darknet markets 2023
darknet sites darknet drugs
dark market link darknet seiten
Thank you for the good writeup. It in reality
was once a amusement account it. Glance complicated to more delivered
agreeable from you! By the way, how can we keep up a correspondence?
my web page – เว็บบทความ
Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.
I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience.
Any help would be enormously appreciated!
My homepage สล็อตออนไลน์
Piece of writing writing is also a fun, if you be acquainted with then you can write if not it is
difficult to write.
Hi there just wanted to give you a quick heads up.
The words in your content seem to be running off
the screen in Ie. I’m not sure if this is a format issue or
something to do with internet browser compatibility but
I thought I’d post to let you know. The design look great
though! Hope you get the problem solved soon. Many thanks
dark web search engine darknet marketplace
darknet search engine dark website
darknet market links how to get on dark web
dark websites dark web access
It’s an amazing post for all the web visitors; they
will get benefit from it I am sure.
tor market url dark web search engine
dark web links best darknet markets
deep web drug markets tor markets 2023
паркетная доска из массива лиственницы https://lespk.ru/
dark market darknet marketplace
dark market dark web links
dark web site the dark internet
dark websites dark web drug marketplace
darknet marketplace dark markets
Hello would you mind stating which blog platform you’re working with?
I’m planning to start my own blog soon but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design seems
different then most blogs and I’m looking for something completely unique.
P.S Apologies for being off-topic but I had to ask!
Experience the fresh, cool sensation of Killa Cold Mint! It’s a minty kick you’ll love.
dark market onion darknet seiten
dark web sites links dark net
My brother suggested I might like this blog. He was entirely right.
This post actually made my day. You cann’t imagine simply how much time I had spent for this information! Thanks!
dark websites onion market
dark web site darkmarket 2023
Дешевые теплицы с доставкой купить.
dark web market dark net
dark web sites links dark web market list
Thank you for sharing your info. I really appreciate your efforts and I will
be waiting for your next post thank you once again.
dark web search engines deep web sites
dark market list darknet drugs
Online casinos have become increasingly popular in recent years,
and for good reason. They offer a convenient and exciting solution to enjoy
all your favorite casino games from the comfort of your own home.
Probably the most popular online casino platforms is Evolution Gaming,
which offers an array of games and features that are sure to help keep you
entertained for hours on end.
In this essay, we shall explore the many benefits of playing at Evolution Gaming, including the
variety of games available, the caliber of the software, and
the entire user experience. We shall also discuss some guidelines for maximizing your
winnings and enjoying your time at the casino.
First and foremost, Evolution Gaming offers an impressive selection of games to choose
from. Whether you prefer classic table games like blackjack and roulette or even more modern options like video slots and live dealer games, you are sure to find a thing that
suits your tastes. The platform is continually
updating its offerings with new games and features, so there’s always something new to try.
Among the standout top features of Evolution Gaming
is its high-quality software. The platform uses state-of-the-art technology to ensure all games run smoothly and without any glitches or lag.
Because of this you can enjoy a seamless gaming experience
without any interruptions or delays.
Another key benefit of playing at Evolution Gaming is the
overall user experience. The platform was created with user-friendliness at heart, making
it easy for even novice players to navigate and enjoy all the available features.
The website can be optimized for cellular devices, in order to play your preferred games on-the-go from your own smartphone
or tablet.
Of course, one of the main reasons people play at online casinos is to win money.
At Evolution Gaming, there are many opportunities to
do that. The platform supplies a selection of bonuses and promotions which can help increase your winnings and increase your likelihood of
hitting it big. Additionally, a lot of the games offer high payout percentages, giving you
a better potential for winning big.
To maximize your winnings at Evolution Gaming,
it is critical to have a solid strategy in place. This means setting a cover yourself before you start playing
and sticking to it whatever. It also means benefiting from any bonuses or promotions that
are available to you, as these can help boost your bankroll without risking any extra funds.
Overall, playing at Evolution Gaming is a good way to enjoy your entire
favorite casino games from the comfortable surroundings of your own home.
With its impressive selection of games, high-quality software, and user-friendly interface,
it’s no wonder why so many people choose this platform over
others. Why not give it a try today? Who knows ? you just
might hit the jackpot!
Take a look at my site – Evolution Gaming Casino Singapore
tor darknet bitcoin dark web
deep web search dark web markets
dark web drug marketplace the dark internet
My spouse and I stumbled over here by a different web
page and thought I should check things out.
I like what I see so i am just following you.
Look forward to going over your web page repeatedly.
brand naproxen how to get cefdinir without a prescription lansoprazole 30mg uk
deep web links deep web drug markets
dark market 2023 dark web search engine
tacrolimus tablet
deep web links tor marketplace
dark web market list dark web drug marketplace