/* (non-Javadoc)
   * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
   */
  public void selectionChanged(IAction action, ISelection selection) {
    if (defaultText == null) defaultText = action.getText();

    security = null;
    if (selection instanceof SecuritySelection) {
      security = ((SecuritySelection) selection).getSecurity();
      action.setText(defaultText + " " + security.getDescription()); // $NON-NLS-1$
    } else action.setText(defaultText);
    action.setEnabled(this.security != null);
  }
 private void updateDisplay() {
   Security security = watchlistItem.getSecurity();
   setName(security.getDescription());
   Quote quote = security.getQuote();
   if (quote != null) {
     double last =
         CurrencyConverter.getInstance()
             .convert(
                 quote.getLast(),
                 security.getCurrency(),
                 watchlistItem.getParent().getCurrency());
     double close =
         CurrencyConverter.getInstance()
             .convert(
                 security.getClose(),
                 security.getCurrency(),
                 watchlistItem.getParent().getCurrency());
     setValue(numberFormatter.format(last));
     if (security.getClose() != null) {
       double change = last - close;
       double percentage = change / close * 100;
       String prefix = "";
       if (change > 0) prefix = "+";
       setChange(
           prefix
               + numberFormatter.format(change)
               + " ("
               + prefix
               + percentageFormatter.format(percentage)
               + "%)");
     }
     if (quote.getDate() != null) setTime(formatter.format(quote.getDate()));
     if (lastValue != null) {
       if (quote.getLast() > lastValue.doubleValue()) setImage(up);
       else if (quote.getLast() < lastValue.doubleValue()) setImage(down);
       else setImage(equal);
     }
     lastValue = new Double(quote.getLast());
   }
   getParent().layout(true, true);
 }