use of name.abuchen.portfolio.model.ClientSettings in project portfolio by buchen.
the class BookmarksListTab method fillContextMenu.
private void fillContextMenu(IMenuManager manager) {
Bookmark bookmark = (Bookmark) ((IStructuredSelection) bookmarks.getSelection()).getFirstElement();
if (bookmark == null)
return;
if (!bookmark.isSeparator())
addTestMenu(manager, bookmark);
addMoveUpAndDownActions(manager, bookmark);
manager.add(new Separator());
manager.add(new Action(Messages.BookmarksListView_insertBefore) {
@Override
public void run() {
Bookmark index = (Bookmark) ((IStructuredSelection) bookmarks.getSelection()).getFirstElement();
Bookmark wl = new Bookmark(Messages.BookmarksListView_NewBookmark, DEFAULT_URL);
client.getSettings().insertBookmark(index, wl);
client.markDirty();
bookmarks.setInput(client.getSettings().getBookmarks());
bookmarks.editElement(wl, 0);
}
});
manager.add(new Action(Messages.BookmarksListView_insertAfter) {
@Override
public void run() {
Bookmark index = (Bookmark) ((IStructuredSelection) bookmarks.getSelection()).getFirstElement();
Bookmark wl = new Bookmark(Messages.BookmarksListView_NewBookmark, DEFAULT_URL);
client.getSettings().insertBookmarkAfter(index, wl);
client.markDirty();
bookmarks.setInput(client.getSettings().getBookmarks());
bookmarks.editElement(wl, 0);
}
});
manager.add(new Action(Messages.BookmarksListView_addSeparator) {
@Override
public void run() {
Bookmark index = (Bookmark) ((IStructuredSelection) bookmarks.getSelection()).getFirstElement();
// $NON-NLS-1$ //$NON-NLS-2$
Bookmark wl = new Bookmark("-", "");
client.getSettings().insertBookmarkAfter(index, wl);
client.markDirty();
bookmarks.setInput(client.getSettings().getBookmarks());
}
});
manager.add(new Separator());
addSubmenuWithPlaceholders(manager);
manager.add(new Separator());
manager.add(new Action(Messages.BookmarksListView_delete) {
@Override
public void run() {
ClientSettings settings = client.getSettings();
for (Object element : ((IStructuredSelection) bookmarks.getSelection()).toArray()) settings.removeBookmark((Bookmark) element);
client.markDirty();
bookmarks.setInput(settings.getBookmarks());
}
});
}
use of name.abuchen.portfolio.model.ClientSettings in project portfolio by buchen.
the class AttributeListTab method addDeleteActions.
private void addDeleteActions(IMenuManager manager, IStructuredSelection selection) {
manager.add(new Separator());
manager.add(new Action(Messages.BookmarksListView_delete) {
@Override
public void run() {
ClientSettings settings = client.getSettings();
for (Object element : selection.toArray()) {
AttributeType attribute = (AttributeType) element;
// remove any existing attribute values from securities
for (Security security : client.getSecurities()) security.getAttributes().remove(attribute);
settings.removeAttributeType(attribute);
}
client.markDirty();
tableViewer.setInput(settings.getAttributeTypes().toArray());
}
});
}
Aggregations