private ArtifactVersion getRuntimeVersion() { ISelection runtimeVersionListSelection = _settingsGroup.getRuntimeVersionsList().getSelection(); if (runtimeVersionListSelection.isEmpty()) { return null; } return (ArtifactVersion) ((IStructuredSelection) runtimeVersionListSelection).getFirstElement(); }
private void initRuntimeVersion() { ArtifactVersion version = null; String versionString = _switchYardProject.getVersion(); if (versionString != null && versionString.length() > 0) { version = new DefaultArtifactVersion(versionString); } if (version != null) { _settingsGroup.getRuntimeVersionsList().setSelection(new StructuredSelection(version), true); } _settingsGroup .getRuntimeVersionsList() .getControl() .setEnabled(!_switchYardProject.isUsingDependencyManagement()); boolean integCheckSelected = pomDefinesIntegrationVersion() && pomDefinesKieVersion() && pomUsesSwitchYardBOM(); _settingsGroup.getConfigureIntegrationCheckbox().setSelection(integCheckSelected); _settingsGroup .getRuntimeVersionsList() .addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) { return; } _switchYardProject.setRuntimeVersion( ((IStructuredSelection) selection).getFirstElement().toString()); } }); _settingsGroup .getIntegrationVersionsList() .addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) { return; } _switchYardProject.setIntegrationVersion( ((IStructuredSelection) selection).getFirstElement().toString()); } }); _settingsGroup .getKieVersionsList() .addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) { return; } _switchYardProject.setKieVersion( ((IStructuredSelection) selection).getFirstElement().toString()); } }); }