use of org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkForm in project scout.rt by eclipse.
the class AbstractBookmarkMenu method createNewBookmark.
protected void createNewBookmark(int kind) {
Bookmark b = ClientSessionProvider.currentSession().getDesktop().createBookmark();
if (b != null) {
IBookmarkService service = BEANS.get(IBookmarkService.class);
b.setKind(kind);
IBookmarkForm form = null;
if (getConfiguredBookmarkForm() != null) {
try {
form = getConfiguredBookmarkForm().newInstance();
} catch (Exception e) {
BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + getConfiguredBookmarkForm().getName() + "'.", e));
}
}
if (form == null) {
form = new BookmarkForm();
}
if (kind == Bookmark.GLOBAL_BOOKMARK) {
form.setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
} else if (kind == Bookmark.USER_BOOKMARK) {
form.setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
}
form.setBookmark(b);
form.startNew();
form.waitFor();
if (form.isFormStored()) {
b.setTitle(form.getBookmark().getTitle());
b.setKeyStroke(form.getBookmark().getKeyStroke());
b.setOrder(form.getBookmark().getOrder());
BookmarkFolder folder = form.getFolder();
if (folder == null) {
folder = form.getBookmarkRootFolder();
}
folder.getBookmarks().add(b);
service.storeBookmarks();
}
}
}
Aggregations