use of name.abuchen.portfolio.model.Exchange in project portfolio by buchen.
the class AbstractQuoteProviderPage method onFeedProviderChanged.
private void onFeedProviderChanged(SelectionChangedEvent event) {
String previousExchangeId = null;
if (comboExchange != null) {
Exchange exchange = (Exchange) ((IStructuredSelection) comboExchange.getSelection()).getFirstElement();
if (exchange != null)
previousExchangeId = exchange.getId();
}
if (previousExchangeId == null && model.getTickerSymbol() != null) {
previousExchangeId = model.getTickerSymbol();
}
QuoteFeed feed = (QuoteFeed) ((IStructuredSelection) event.getSelection()).getFirstElement();
createDetailDataWidgets(feed);
if (comboExchange != null) {
List<Exchange> exchanges = cacheExchanges.get(feed);
comboExchange.setInput(exchanges);
// select exchange if other provider supports same exchange id
// (yahoo close vs. yahoo adjusted close)
boolean exchangeSelected = false;
if (exchanges != null && previousExchangeId != null) {
for (Exchange e : exchanges) {
if (e.getId().equals(previousExchangeId)) {
comboExchange.setSelection(new StructuredSelection(e));
exchangeSelected = true;
break;
}
}
}
if (!exchangeSelected)
comboExchange.setSelection(null);
setStatus(exchangeSelected ? null : MessageFormat.format(Messages.MsgErrorExchangeMissing, getTitle()));
} else if (textFeedURL != null) {
boolean hasURL = getFeedURL() != null && getFeedURL().length() > 0;
if (hasURL)
textFeedURL.setText(getFeedURL());
setStatus(hasURL ? null : MessageFormat.format(Messages.EditWizardQuoteFeedMsgErrorMissingURL, getTitle()));
} else {
// get sample quotes?
if (feed != null) {
showSampleQuotes(feed, null);
} else {
clearSampleQuotes();
}
setStatus(null);
}
}
Aggregations