use of name.abuchen.portfolio.model.Watchlist in project portfolio by buchen.
the class ClientEditorSidebar method addMoveUpAndDownActions.
private void addMoveUpAndDownActions(Watchlist watchlist, Entry entry, IMenuManager manager) {
List<Watchlist> list = editor.getClient().getWatchlists();
int size = list.size();
int index = list.indexOf(watchlist);
if (index > 0) {
manager.add(new Action(Messages.MenuMoveUp) {
@Override
public void run() {
Client client = editor.getClient();
List<Watchlist> watchlists = client.getWatchlists();
watchlists.remove(watchlist);
watchlists.add(index - 1, watchlist);
client.markDirty();
entry.moveUp();
sidebar.layout();
}
});
}
if (index < size - 1 && size > 1) {
manager.add(new Action(Messages.MenuMoveDown) {
@Override
public void run() {
Client client = editor.getClient();
List<Watchlist> watchlists = client.getWatchlists();
watchlists.remove(watchlist);
watchlists.add(index + 1, watchlist);
client.markDirty();
entry.findNeighbor(SWT.ARROW_DOWN).moveUp();
sidebar.layout();
}
});
}
}
use of name.abuchen.portfolio.model.Watchlist in project portfolio by buchen.
the class ClientEditorSidebar method createGeneralDataSection.
private void createGeneralDataSection(final Sidebar sidebar) {
final Entry section = new Entry(sidebar, Messages.LabelSecurities);
section.setAction(new Action(Messages.LabelSecurities, Images.PLUS.descriptor()) {
@Override
public void run() {
String name = askWatchlistName(Messages.WatchlistNewLabel);
if (name == null)
return;
Watchlist watchlist = new Watchlist();
watchlist.setName(name);
editor.getClient().getWatchlists().add(watchlist);
editor.markDirty();
createWatchlistEntry(section, watchlist);
sidebar.layout();
scrolledComposite.setMinSize(sidebar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
allSecurities = new Entry(section, new // $NON-NLS-1$
ActivateViewAction(// $NON-NLS-1$
Messages.LabelAllSecurities, // $NON-NLS-1$
"SecurityList", Images.SECURITY.descriptor()));
allSecurities.setContextMenu(setAsStartPage);
for (Watchlist watchlist : editor.getClient().getWatchlists()) createWatchlistEntry(section, watchlist);
}