public void open(FileModel fm) {
if (contain(fm.getId())) {
tabPanel.setActiveWidget(wordMap.get(fm.getId()));
} else {
Widget widget = null;
TabItemConfig config = new TabItemConfig(getDocViewName(fm), true);
if (fm.isFolder()) {
throw new RuntimeException("不能打开文件夹");
} else if (fm.getName().endsWith(".hive")) {
HiveWord word = new HiveWord(context, presenter, fm);
config.setIcon(Images.getImageResources().script());
wordMap.put(fm.getId(), word);
widget = word.asWidget();
} else if (fm.getName().endsWith(".sh")) {
ShellWord word = new ShellWord(context, presenter, fm);
config.setIcon(Images.getImageResources().script());
wordMap.put(fm.getId(), word);
widget = word.asWidget();
} else {
TextWord word = new TextWord(context, presenter, fm);
config.setIcon(Images.getImageResources().page_white());
wordMap.put(fm.getId(), word);
widget = word.asWidget();
}
if (widget != null) {
tabPanel.add(widget, config);