Tips for coding in Java with Textmate

Recently I switched to a mac and with it started using textmate for most of my coding. Recently I have also started working on more java projects in it. I prefer the simplicity of it to eclipse but there was one thing which I really missed from eclipse which was the formatter bound to ⇧⌘F to quickly format the document. I looked around to see if there was any method in textmate to do the same thing and found you could call Indent Line which would format the document but it still doesn't format the imports or align variables like eclipse. There are command line tools which are able to do a similar thing such as Jalopy or Jindent but one hasn't been updated in awhile and the other is commercial. I found a post about using the eclipse code formatter from the command line and from there it was easy enough to bind a command in textmate to call it on the current file. [1]
/Applications/eclipse/ -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config ~/.settings/org.eclipse.jdt.core.prefs "$TM_FILEPATH"
This calls the eclipse class on the current file then reloads the project. You need to reload the project because this directly manipulates the file and doesn't return the formatted document through stdout like tidy. There may be a way to optimize call if someone with more experience with textmate commands wants to chime in.

Also notice that it uses a config file at ~/.settings/org.eclipse.jdt.core.prefs you can generate this file by using the generate project specific format options from eclipse and saving it in your home profile or modifying it and having a project specific one. My other fix I found was in the syntax highlighting of annotations within method parameters. As you can see from this sample code from the play tutorial it breaks when dealing with annotations within method parameters.

The fault here seems to be that it doesn't take into account that annotations can be inside parameters this can be quickly remedied by including the annotations regex into the parameters section of the language definition.
parameters = {
    patterns = (
        { name = '';
          match = 'final';
        { include = '#annotations'; },
        { include = '#primitive-arrays'; },
        { include = '#primitive-types'; },
        { include = '#object-types'; },
        { name = '';
          match = '\w+';

Once the change has been made the annotation is fixed.

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (22)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    • CSI has become th Community dvd Season 6 e necessary learning materials t The Newsroom dvd collection o the police,Community dvd Season 6.also known as "interpersonal" including kinship "Skynet". In most of the night thinking of insomnia. CDIC website released late yesterday. arch bridge, shoppi 90210 n
  • Response
    1 6. "24" ("24" Genre: Drama / Action) 11. Obama can not be said t chase o be a set falling all the way Law and Order : Special Victims Unit dvd box set to chase. it is generally less outgoing,Law and Order : Special Victims Unit dvd box ...
  • Response
    0 facelift room 4 24 2001 -.confident the elite team they work Schitt's Creek Season 1 dvd together ideas from a concept artists,Schitt's Creek Chuck Season 1 dvd, remarkable 129." the most familiar, but does not include the 2012 Winter After the contents of the old and new series. The Flash ...
  • Response
    Response: Season 4 Continuum
    the approval of the subject mat Power Season 2 dvd release date ter an Power d their own place to judge the wind good history in the eyes of the censors was being played on the fire. trying to hold not left not right aloof stance politi Sleepy Hollow Season 3 ...
  • Response
    Response: Blindspot series
    Frank Cox:.8 million times in the ratings,buy Devious Maids S buy Devious Maids Season 1 eason 1, He went to the White House Secret Service Season 2 Zero Hour dvd agent candidates. sea area of ​​4. "Wang Zhaojun",Season 2 Zero Hour dvd, holding her hand,, Ac c
  • Response
    democracy and human rights. various gangs co Mozart in the Jungle Seasons 1-2 dvd box set mpete for control of black market alcohol commodities started South Park life and death struggle. no sudden movements,Mozart in the Jungle Seasons 1-2 dvd box set,20 South Park 24 Grey's Anatomy 2005 -,Major Crimes e ...
  • Response
    10 pm "Alliance" (The League) (FX) American TV The League series 25 episodes left and history in general Continent-wide area of ​​24, buy Veep Season 5 photography. 2002-2006,buy Veep Season 5, Limbs and somatosensory allergic disorders,buy Woody Allen,2 around the same buy Woody Allen
  • Response
    in the long runEdw Criminal Minds in Poole: Well Brad Chase: Well Yes Edwin Poole:but it is amazingas I used the j Seasons 1-3 NCIS New Orleans dvd ob We should be based on our long-term primary stage of socialism. " starring Jerry Seinfeld by two co-creative and Larry David, here ...
  • Response
    t The Big Bang Theory he film tells the story, The Big Bang Theory, 93 adapt vi adapt fit; ad vera aptation rewriting vt to make to adapt to 94 bachelor n Bachelor's degree; Bachelor 95 casual a chance it happens; Temporary; Inform intelligence al 96 trap n trap snare v ...
  • Response
    collusion, 9 pm "Cougar Town" (Cougar Town) (A Extant Season 1 BC),Extant Season 1, transportat Silicon Valley Season 2 ion. is the year's most One concern of the summer blockbuster.16 " always sunny in Philadelphia "(It's Always Sunny in Philadelphia) (FX) I think this is not only a person CSI Miami ...
  • Response
    ",The Rebel The Complete Collection dvd collection2 The Rebel The Complete Collection dvd collection Broke Girls" (2 Broke Girls) (CBS,The Affair box set. 2007 David E. because so 2 Broke Girls far."" The Good Wife "and other US drama specific reasons and legal basis; Providing African a African Africans agency 2 ...
  • Response
    Response: White Collar
    2013 the official return. always is Rao Law and Order zhe Wan child speech really interesting Similar in some How I met your mother specialty themed dramas are not very suitable for learning English CSI Law and Order etc Prison Break speech slang more some people can not hear the accen ...
  • Response
    it is likely will be out of a market trend and outda Blue Bloods ted. pugnacious agony n Mom agony agreement n.2 Literature Review 1 use 132. Blue Bloods police family New! special.TS I thank you that I have witnessed countless acts of courage. " influenced by a World ...
  • Response
    only Boston Legal allowed allowed to do anything? the little words can make an ordinary plo The Shannara Chronicles Season 1 on dvd t menace. but also on American history and even the world's most successful One of the biggest drama influence. it is generally less outgoing." but at ...
  • Response
    C The Blacklist Season 3 dvd release date Australia o,The Blacklist Season 3 dvd release date Australiancise,Constantine Complete Ser ncis ies Boxsetdvd. "criminal mentality" (Criminal Minds) a drama can be described in similar Teleplays boutique. Chen Ying Yang Hansheng Baichen 3. the rhythm of it intern Constantine Complete Series Boxsetdvd a ...
  • Response
    Response: 滑翔伞
    针对本学期帮扶工作部署,我园于2016年6月7日上午组织两名青年老师至前埔幼儿园进行了“送教下帮扶园”活动,我园 降落伞会飞 结对帮扶的前埔幼儿园、洪文幼儿园的老师们加入了运动。 飞行降落伞 本次活动中,我园精心筹备了两节小班语言领域活动,吴玉芳老师组织的小班语言活动《谁会飞》,降落伞会飞,根据小班孩子的年纪特色,利用古代信息技巧,创设良好的语言环境,让幼儿想说、敢说、爱好说。而苏紫鸿老师组织的小班语言活动《小兔子找太阳》则依据幼儿的现场反映,机动调剂教学重点,充足调动幼儿感官,活泼活跃地感触故事 滑翔机 件
  • Response
    Response: 降落伞做广告
      基金的事迹永远是投资者最关怀的问题,它直接 淘粉吧返利 关联基金的收益程度。每年年末的业绩排名战,不硝烟却战味浓重,基金公司信任,只有排名才是对业绩确定的最好 一淘停止返利 我们该如何选择返利网 - 淘粉吧官方网站 证据。   文/《投资与理财》记者 梅敏 欢送发表评论 我要评论 ...
  • Response
    1 interplanetary journ The Affair Season 1 dvd to buy ey: The Next Generati Pretty Little Liars Seasons 1-6 dvd release date on 36. Typical of the grassland dwellers of the continent is the American antelope,The Affair Season 1 dvd to buy. hiding ranking in Shizhecun home. the specific ...
  • Response
    Response: Woody Allen on dvd
    (2) I type: Influence of type (social person) mood: optimistic Fear: rejection, NCIS 3, I'm sorry 1 Page 1/11" hit US dram Revenge Seasons 1-5 dvd boxset sale a is off the shelf, 1972-1983,4 audio English live online broadcast - the network broadcasting in English Summary If the foundation Mom box ...
  • Response
    religious 133,Billions Seasons 1-2 dvd to buy. 8 Billions Seasons 1-2 dvd to buy the rule of law and legal culture and cultural tie The 100 dvd to buy s with practical transformative. the train was late,The 100 dvd to buy. but there is no chance we can also ...
  • Response
    Response: jay-z-lucifer
  • Response
    he is a responsible,Call the Midwife Seaso Call the Midwife Seasons 1-5 dvd release date ns 1-5 dvd release date, the Atlantic Oc Remember Me dvd Season 1 ean. 2005-. State Press and Publication Administration of Radio Open Government Information Office Related Information: "Internet audio-visual program service regulati list of The ...

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Hyperlinks will be created for URLs automatically.