/* (non-Javadoc) * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento) */ @Override public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); BundleContext bundleContext = UIActivator.getDefault().getBundle().getBundleContext(); ServiceReference<ITradingSystemService> serviceReference = bundleContext.getServiceReference(ITradingSystemService.class); tradingSystemService = bundleContext.getService(serviceReference); activator = CoreActivator.getDefault(); IDialogSettings rootDialogSettings = UIActivator.getDefault().getDialogSettings(); dialogSettings = rootDialogSettings.getSection(VIEW_ID); if (dialogSettings == null) { dialogSettings = rootDialogSettings.addNewSection(VIEW_ID); dialogSettings.put( COLUMNS, new String[] { "org.eclipsetrader.ui.providers.LastTrade", //$NON-NLS-1$ "org.eclipsetrader.ui.providers.BidPrice", //$NON-NLS-1$ "org.eclipsetrader.ui.providers.AskPrice", //$NON-NLS-1$ "org.eclipsetrader.ui.providers.Position", //$NON-NLS-1$ "org.eclipsetrader.ui.providers.LastTradeDateTime", //$NON-NLS-1$ "org.eclipsetrader.ui.providers.gain", //$NON-NLS-1$ }); IDialogSettings section = dialogSettings.addNewSection(COLUMN_NAMES); section.put("org.eclipsetrader.ui.providers.LastTrade", "Last"); // $NON-NLS-1$ section.put("org.eclipsetrader.ui.providers.BidPrice", "Bid"); // $NON-NLS-1$ section.put("org.eclipsetrader.ui.providers.AskPrice", "Ask"); // $NON-NLS-1$ section.put("org.eclipsetrader.ui.providers.Position", "Position"); // $NON-NLS-1$ section.put("org.eclipsetrader.ui.providers.LastTradeDateTime", "Date / Time"); // $NON-NLS-1$ section.put("org.eclipsetrader.ui.providers.gain", "Gain"); // $NON-NLS-1$ dialogSettings.addNewSection(COLUMN_WIDTHS); } settingsAction = new SettingsAction(site.getShell(), this); IActionBars actionBars = site.getActionBars(); actionBars.setGlobalActionHandler(settingsAction.getId(), settingsAction); actionBars.updateActionBars(); }
/* (non-Javadoc) * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object) */ @Override public ISecurity unmarshal(String v) throws Exception { if (v == null) { return null; } URI uri = new URI(v); if (repositoryService == null) { try { BundleContext context = CoreActivator.getDefault().getBundle().getBundleContext(); ServiceReference serviceReference = context.getServiceReference(IRepositoryService.class.getName()); repositoryService = (IRepositoryService) context.getService(serviceReference); context.ungetService(serviceReference); } catch (Exception e) { Status status = new Status( IStatus.ERROR, CoreActivator.PLUGIN_ID, 0, "Error reading repository service", e); CoreActivator.log(status); } } ISecurity security = repositoryService != null ? repositoryService.getSecurityFromURI(uri) : null; if (security == null) { Status status = new Status( IStatus.WARNING, CoreActivator.PLUGIN_ID, 0, "Failed to load security " + uri.toString(), null); CoreActivator.log(status); return new FailsafeSecurity(uri); } return security; }