マクロいろいろ

(1) 2chに張ったマクロ。
新しいタブを開く時にフォルダーにカーソルがあったら、そのフォルダーを開く。
DFのShift+Enterの動作に近い。

import com.nullfish.app.jfd2.ui.container2.NumberedJFD2
import com.nullfish.app.jfd2.ui.container2.JFD2TitleUpdater
import com.nullfish.app.jfd2.ui.container2.ContainerPosition
owner = jfd.getJFDOwner()
if(owner==null) return
model = jfd.getModel()
selectedFile = model.getSelectedFile()
newDir = selectedFile.isDirectory() ? selectedFile:model.getCurrentDirectory()
newJFD = new NumberedJFD2()
newJFD.init(owner.getConfigDirectory())
owner.addComponent(newJFD, ContainerPosition.MAIN_PANEL, new JFD2TitleUpdater(newJFD))
newJFD.getModel().setDirectoryAsynchIfNecessary(newDir, newDir.getParent(), newJFD)

(2) 長いから2chに張ってないマクロ。
1画面モードから2画面に縦分割。アクティブでないタブをサブウィンドウに移送。
コピー先を決めるのに便利。

import com.nullfish.app.jfd2.ui.container2.JFD2TitleUpdater
import com.nullfish.app.jfd2.ui.container2.NumberedJFD2
import com.nullfish.app.jfd2.ui.container2.ContainerPosition

owner=jfd.getJFDOwner()
if(owner==null) return
mainPanel=owner.getContentPane().getComponent(0)
subPanel=owner.getContentPane().getComponent(1)
tc0=mainPanel.getTabCount()
tc1=subPanel.getTabCount()
if(tc0+tc1<2) return
owner.getContentPane().getLayout().setHorizontal(true)
if(tc1==0){  // 1画面
  colCount=(int)(jfd.getColumnCount()/2)
  if(colCount==0) colCount=1
  for (ee in mainPanel.getComponents()) {
    e=ee.getComponent()
    e.setColumnCount(colCount)
  }
}
if(tc0==1){  // 次画面無し
  colCount=(int)(jfd.getColumnCount()*2)
  jfd.setColumnCount(colCount)
  for (ee in subPanel.getComponents()) {
    e=ee.getComponent()
    owner.removeComponent(e)
    e.setColumnCount(colCount)
    owner.addComponent(e, ContainerPosition.MAIN_PANEL,new JFD2TitleUpdater((NumberedJFD2)e))
  }
}else{
  for (ee in mainPanel.getComponents()) {
    e=ee.getComponent()
    if(e.getComponent()==jfd) continue
    owner.removeComponent(e)
    owner.addComponent(e, ContainerPosition.SUB_PANEL,new JFD2TitleUpdater((NumberedJFD2)e))
    break
  }
}
owner.removeComponent(jfd)
owner.addComponent(jfd, ContainerPosition.MAIN_PANEL,new JFD2TitleUpdater((NumberedJFD2)jfd))

コードをpreタグで囲んでいたのに、確認したら括弧が重なった部分が、はてな記法の脚注と判断されてしまった・・。
preタグの中はそのまま出してくれ。
仕方が無くはてなのヘルプを参照。"スーパーpre記法"ってのを発見。コードの言語タイプを指定するとキーワードの色分けとかもしてくれる。言語にはgroovyも指定できるのは偉い"とかも見てくれる">*1

*1:javaと同じかと思ったら、ちゃんと"->"とかも見てくれる