/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { Environment environment = cmrRepositoryDefinition.getConfigurationInterfaceService().getEnvironment(environmentId); Collection<Profile> profiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); final EnvironmentEditorInput environmentEditorInput = new EnvironmentEditorInput(environment, profiles, cmrRepositoryDefinition); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { page.openEditor(environmentEditorInput, EnvironmentEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Environment editor.", e, -1); } } }); return Status.OK_STATUS; } catch (BusinessException e) { return new Status(IStatus.ERROR, InspectIT.ID, "Exception occurred loading the environment 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()); } } }
try { Environment updatedEnvironment = repositoryDefinition.getConfigurationInterfaceService().getEnvironment(input.getEnvironment().getId()); List<Profile> updatedProfiles = repositoryDefinition.getConfigurationInterfaceService().getAllProfiles();
List<Profile> existingProfiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); Collection<Environment> existingEnvironments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments();