@Override public void runWithEvent(IAction arg0, Event arg1) { try { ExecutionReport report = (ExecutionReport) ((ReportHolder) mSelection.getFirstElement()).getReport(); processReport(report); } catch (Exception e) { PhotonPlugin.getMainConsoleLogger().error(Messages.CANNOT_CANCEL.getText(), e); } }
/** * 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); } }); } }
@Override protected void setValue(Object element, Object value) { if (StringUtils.isBlank(value.toString())) return; final MarketDataViewItem item = (MarketDataViewItem) element; final Equity equity = item.getEquity(); if (equity.getSymbol().equals(value)) return; final Equity newEquity = new Equity(value.toString()); if (mItemMap.containsKey(newEquity)) { PhotonPlugin.getMainConsoleLogger().warn(DUPLICATE_SYMBOL.getText(newEquity.getSymbol())); return; } busyRun( new Runnable() { @Override public void run() { mItemMap.remove(equity); item.setEquity(newEquity); mItemMap.put(newEquity, item); } }); }
/** * Processes a change in the contents of the filter widget. * * @param inValue a <code>String</code> value containing the text of the filter widget */ protected final void handleFilter(String inValue) { // inValue contains the full text of what the user entered in the filter widget, e.g. Side=B if (inValue.length() > 0) { // some filter value has been entered, process that value Matcher regexMatcher = mFilterPattern.matcher(inValue); // if the value is meaningful, continue, otherwise, exit and do nothing (no filtering changes) if (regexMatcher.matches()) { // the first match of the regex must be the field against which to match String fieldSpecifier = regexMatcher.group(1); try { // the second is the operator (either '=' or '~=' as dictated by the regex pattern) String operator = regexMatcher.group(2); // the third is the value to match String value = regexMatcher.group(3); // the field name may be one that we've translated to a shorter or more readable version // try to translate it back first String fieldNameToUse = FIXFieldLocalizer.readFIXFieldNameFromCache(fieldSpecifier); // dig out the field object indicated by the fieldSpecified (a failure will throw a // CoreException) Field<?> fixField = FIXMessageUtil.getQuickFixFieldFromName(fieldNameToUse); // this is the int value of the FIX field which we now know is valid int fixFieldInt = fixField.getField(); // create a matcher depending on the operator entered by the user if ("=".equals(operator)) { // $NON-NLS-1$ // use a straight string matcher getFilterMatcherEditor().setMatcher(createStringMatcher(fixFieldInt, value)); } else { // use a regex matcher assert "~=".equals(operator); // $NON-NLS-1$ getFilterMatcherEditor().setMatcher(createRegexMatcher(fixFieldInt, value)); } } catch (Throwable t) { PhotonPlugin.getMainConsoleLogger().error(UNRECOGNIZED_FIELD.getText(fieldSpecifier)); } } } else { // the value entered by the user is of zero length, use the default matcher getFilterMatcherEditor().setMatcher(getDefaultMatcher()); } }