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.
Jadi ketika Anda memasuki situs tersebut, Anda akan dibanjiri dengan berbagai tombol yang
memungkinkan Anda untuk memilih permainan yang ingin Anda nikmati.
Caranya adalah dengan menekan tombol demo slot ketika anda sudah masuk ke dalam situs kami.
Siapa saja bisa mendapatkan akun pribadi mereka ketika ingin mendaftarkan diri.
Livechat akan online sepanjang 24 jam penuh, kalian bisa
mengontak kami lewat whatsapp yang tercantum di halaman homepage web kami ini.
Yang harus kalian kerjakan ialah mentransfer deposit lalu kalian bisa mainkan mesin slot favourite kalian. Namun kamu harus bisa
berupaya menyelesaikan misi yang diberikannya.
Karena Lucky Eggs sudah terbukti membayar langsung memaulai
dompet digital, jadi kamu jangan ragu untuk mengunduhnya.
Tidak perlu memverifikasi akun lagi karena dapat digunakan langsung
untuk bermain sport slot on-line. Anda akan memiliki beberapa perbedaan dari segi transaksi menggunakan rekening bank tersebut sehingga dalam hal ini perlu dipelajari dan dicari tahu di mana
letak perbedaannya. Perlu Anda ketahui juga bahwa permainan yang dinikmati
secara gratis tidak bisa menghasilkan uang asli.
darknet site darknet market
darknet links dark web sites
deep web search darknet search engine
My relatives every time say that I am killing my time
here at web, but I know I am getting familiarity all the time by reading thes
fastidious posts.
dark web market list darkmarket link
Hello! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my
blog to rank for some targeted keywords but I’m not seeing very good gains.
If you know of any please share. Thanks!
darkmarket list dark web sites links
darknet market bitcoin dark web
https://www.metooo.io/u/63265be6ba88547441a795c8
free dark web tor market
dark market 2023 tor dark web
На сайте https://yudin7.com/ вы сможете воспользоваться услугами квалифицированного и опытного дизайнера Семена Юдина. У него соответствующее образование, а также большой опыт работы, который позволяет браться даже за самые сложные проекты. Ознакомьтесь с примерами работ, которые представлены на портале. Семен оказывает такие услуги, как: дизайн интерьера, комплектация, бюджетирование, авторский надзор, работы «под ключ». Сейчас на определенные работы действует скидка. Весь процесс сотрудничества описан на сайте. Ознакомьтесь с ним сейчас.
dark net dark internet
https://ba.rolka.me/viewtopic.php?id=10299
Aw, this was an exceptionally good post. Finding the time and actual effort to produce a top
notch article… but what can I say… I hesitate a lot and
never seem to get anything done.
tor markets dark market link
dark websites dark web access
darkmarket link dark web drug marketplace
tor markets 2023 darknet websites
Every weekend i used to ρay a quick visit this web paɡe, because i want еnjoyment,
since this thijs web site ⅽonations genuinely fastiidi᧐us funny data too.
Here is my blog :: coloured
dark market onion darknet drugs
I was suggested this web site by my cousin. I’m not sure whether this
post is written by him as no one else know such detailed
about my problem. You’re wonderful! Thanks!
http://nagatinos.getbb.ru/viewtopic.php?f=6&t=143
I am really inspired along with your writing skills and also with the
format for your blog. Is this a paid theme or did you customize it your self?
Anyway stay up the nice high quality writing, it’s uncommon to
see a great weblog like this one these days..
Koe taydellinen nikotiinipussi elamys!
This design іs ѕpectacᥙⅼar! Yߋu obvioussly know hoԝ too keep a reader amused.
Between your ѡit and your videos, I wass almost mokved to start my own blog (well, almost…ΗaHa!) Fantastіc јob.
I reɑlly loved wһat yоuu hаd to say, and more than that, how you preѕented іt.
Too coߋl!
my wеbpagе :: crackwhore
Hi there, You have done an excellent job.
I’ll definitely digg it and personally suggest to my
friends. I’m sure they will be benefited from this site.
antabuse online pharmacy
onion market dark market
Greetings from Carolina! I’m bored at work so I decided to check out your blog on my iphone during
lunch break. I enjoy the knowledge you provide here and can’t wait to take
a look when I get home. I’m surprised at how quick your
blog loaded on my phone .. I’m not even using WIFI,
just 3G .. Anyways, amazing site!
На сайте https://lenstroykomplekt.ru/ вы сможете воспользоваться такими услугами, как монтаж, кровельные работы, реконструкция кровли, монтажные и строительные работы на различных объектах Москвы и области. В бригаде работают квалифицированные, компетентные сотрудники, которые применяют не только свой полученный опыт, инновационное оборудование, но и качественный инвентарь. Вот почему результат оправдает все ожидания, сохранится на длительное время. Работы выполняются по доступным расценкам.
https://plinkoxy.casino/kak-igrat-v-plinko/
Does your blog have a contact page? I’m having trouble locating it
but, I’d like to shoot you an email. I’ve got some ideas for
your blog you might be interested in hearing. Either way, great site and I look forward to seeing it expand over time.
Hello! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading through
your blog posts. Can you recommend any other blogs/websites/forums that deal with the same topics?
Thanks for your time!
You made some decent points there. I checked on the net for more information about the issue and found most individuals will
go along with your views on this website.
darknet market dark web websites
dark web link tor market
Thank you, I’ve recently been searching for information approximately this
subject for a while and yours is the greatest I have found out till
now. But, what concerning the bottom line? Are you certain in regards to the source?
Ridiculous quest there. What happened after? Good luck!
dark web search engines darknet markets
http://detimgn.iboards.ru/viewtopic.php?f=50&t=30052
you are truly a excellent webmaster. The site loading speed
is amazing. It kind of feels that you’re doing any unique trick.
Moreover, The contents are masterwork. you have done a magnificent job
in this subject!
This piece of wrіting will assіst thе internet
eople for setting up new weblog or even a weblog from start tⲟ
end.
Allso vksit my blog post bi
tor darknet dark web sites links
http://tt46.ru/club/forum/topic/add/forum3/
Как сдать работу на отлично, не тратя время? Автор 24 официальный – получите работу точно в срок или раньше!
darknet drug market dark web search engines
http://ustgrsosh.ru/forum/messages/forum1/topic12/message12/?result=new
tor dark web tor marketplace