/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { AgentMappings mappings = cmrRepositoryDefinition.getConfigurationInterfaceService().getAgentMappings(); Collection<Environment> environments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments(); final AgentMappingInput input = new AgentMappingInput(cmrRepositoryDefinition, mappings, environments); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { activePage.openEditor(input, AgentMappingEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Agent mapping settings editor.", e, -1); } } }); return Status.OK_STATUS; } catch (Exception e) { return new Status(IStatus.ERROR, InspectIT.ID, "Exception occurred loading the data from the CMR.", e); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); environments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments(); profiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); // remove common profiles as they can not be exported for (Iterator<Profile> it = profiles.iterator(); it.hasNext();) { if (it.next().isCommonProfile()) { it.remove(); } } } for (Object selected : structuredSelection.toArray()) { if (selected instanceof IProfileProvider) { selectedProfilesIds.add(((IProfileProvider) selected).getProfile().getId()); } } for (Object selected : structuredSelection.toArray()) { if (selected instanceof IEnvironmentProvider) { selectedEnvironmentsIds.add(((IEnvironmentProvider) selected).getEnvironment().getId()); } } }
Collection<Environment> updatedEnvironments = repositoryDefinition.getConfigurationInterfaceService().getAllEnvironments();
Collection<Environment> existingEnvironments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments();