示例#1
0
 /**
  * Adds a new row in the view for the given symbol (if one does not already exist).
  *
  * @param symbol symbol to add to view
  */
 public void addSymbol(final Equity symbol) {
   if (mItemMap.containsKey(symbol)) {
     PhotonPlugin.getMainConsoleLogger().warn(DUPLICATE_SYMBOL.getText(symbol));
   } else {
     busyRun(
         new Runnable() {
           @Override
           public void run() {
             MarketDataViewItem item =
                 new MarketDataViewItem(mMarketDataManager.getMarketData(), symbol);
             mItemMap.put(symbol, item);
             mItems.add(item);
           }
         });
   }
 }
示例#2
0
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
   ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
   if (part instanceof MarketDataView && selection instanceof IStructuredSelection) {
     final MarketDataView view = (MarketDataView) part;
     final IStructuredSelection sselection = (IStructuredSelection) selection;
     // this can take some time
     view.busyRun(
         new Runnable() {
           public void run() {
             for (Object obj : sselection.toArray()) {
               if (obj instanceof MarketDataViewItem) {
                 view.remove((MarketDataViewItem) obj);
               }
             }
           }
         });
   }
   return null;
 }