/** * {@inheritDoc} * * @see org.teiid.designer.vdb.connections.SourceHandler#getTranslatorTypes() */ @Override public String[] getTranslatorTypes() { Server defaultServer = getDefaultServer(); if ((defaultServer != null) && defaultServer.isConnected()) { Collection<TeiidTranslator> translators = null; try { translators = defaultServer.getAdmin().getTranslators(); } catch (Exception e) { UTIL.log( IStatus.ERROR, e, UTIL.getString( "VdbSourceConnectionHandler.errorObtainingTranslators", defaultServer.getHost())); // $NON-NLS-1$ } if (translators != null) { Collection<String> translatorTypes = new ArrayList<String>(); for (TeiidTranslator translator : translators) { translatorTypes.add(translator.getName()); } return translatorTypes.toArray(new String[translatorTypes.size()]); } } return null; }
@Override public void selectionChanged(SelectionChangedEvent event) { TreeSelection selection = (TreeSelection) event.getSelection(); if (selection.isEmpty()) { this.selectedTranslator = null; this.translatorNameText.setText(UNDEFINED); updateOnSelection(null); return; } Object firstElement = selection.getFirstElement(); if (!(firstElement instanceof TeiidTranslator)) { this.selectedTranslator = null; this.translatorNameText.setText(UNDEFINED); } else { this.selectedTranslator = (TeiidTranslator) selection.getFirstElement(); this.translatorNameText.setText(selectedTranslator.getName()); } updateOnSelection(firstElement); }