private MenuItem getReferMenuItem(final boolean isCommon) {
final MenuItem referMenuItem = new MenuItem("复制引用语句", new SelectionHandler<MenuItem>() {
@Override
public void onSelection(SelectionEvent<MenuItem> event) {
FileModel m =isCommon?getCommonTreeGrid().getSelectionModel().getSelectedItem():getMyTreeGrid().getSelectionModel().getSelectedItem();
Window w = new Window();
final TextField f = new TextField(){
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
selectAll();
}
};
w.setModal(true);
w.setHeadingText("脚本引用语句");
w.setHeight(60);
StringBuffer sb = new StringBuffer();
sb.append("download[").append("doc://")
.append(m.getId()).append(' ').append(m.getName().replace(' ', '_'))
.append("]");
f.setValue(sb.toString());
f.setReadOnly(true);
f.setWidth(350);
w.setWidget(f);
w.show();
f.focus();
}
});
referMenuItem.setIcon(Images.getImageResources().script());
return referMenuItem;