{
Security security = (Security) prices.getData(Security.class.toString());
if (security == null)
return;
SecurityPrice price = new SecurityPrice();
price.setTime(Dates.today());
security.addPrice(price);
markDirty();
prices.setInput(security.getPrices());
latest.setInput(security);
transactions.setInput(security.getTransactions(getClient()));
events.setInput(security.getEvents());
updateChart(security);
prices.setSelection(new StructuredSelection(price), true);
prices.editElement(price, 0);
}
});
manager.add(new Separator());
}
if (((IStructuredSelection) prices.getSelection()).getFirstElement() != null)
{
manager.add(new Action(Messages.SecurityMenuDeletePrice)
{
@Override
public void run()
{
Security security = (Security) prices.getData(Security.class.toString());
if (security == null)
return;
Iterator<?> iter = ((IStructuredSelection) prices.getSelection()).iterator();
while (iter.hasNext())
{
SecurityPrice price = (SecurityPrice) iter.next();
if (price == null)
continue;
security.removePrice(price);
}