/** {@inheritDoc} */
 @Override
 public void dispose() {
   cmrRepositoryManager.removeCmrRepositoryChangeListener(this);
   InspectIT.getDefault()
       .getInspectITConfigurationInterfaceManager()
       .removeProfileChangeListener(this);
   InspectIT.getDefault()
       .getInspectITConfigurationInterfaceManager()
       .removeEnvironmentChangeListener(this);
   super.dispose();
 }
  /** Default constructor. */
  public ConfigurationInterfaceManagerView() {
    cmrRepositoryManager = InspectIT.getDefault().getCmrRepositoryManager();
    cmrRepositoryManager.addCmrRepositoryChangeListener(this);
    selectDisplayedCmrRepositoryDefinition();

    InspectIT.getDefault()
        .getInspectITConfigurationInterfaceManager()
        .addProfileChangeListener(this);
    InspectIT.getDefault()
        .getInspectITConfigurationInterfaceManager()
        .addEnvironmentChangeListener(this);
  }
  /** Updates the form menu. Sub-classes can extend if needed. */
  protected void updateFormMenuManager() {
    IMenuManager menuManager = mainForm.getMenuManager();
    menuManager.removeAll();

    for (CmrRepositoryDefinition cmrRepositoryDefinition :
        cmrRepositoryManager.getCmrRepositoryDefinitions()) {
      if (!Objects.equals(cmrRepositoryDefinition, displayedCmrRepositoryDefinition)) {
        menuManager.add(new SelectCmrAction(cmrRepositoryDefinition));
      }
    }
    menuManager.update(true);
    mainForm.getHead().layout();
  }
 /** Selects the displayed repository definition. */
 private void selectDisplayedCmrRepositoryDefinition() {
   List<CmrRepositoryDefinition> repositories = cmrRepositoryManager.getCmrRepositoryDefinitions();
   if (CollectionUtils.isNotEmpty(repositories)) {
     // find first online
     for (CmrRepositoryDefinition repositoryDefinition : repositories) {
       if (repositoryDefinition.getOnlineStatus() == OnlineStatus.ONLINE) {
         displayedCmrRepositoryDefinition = repositoryDefinition;
         performUpdate(true);
         selectionProviderAdapter.setSelection(
             new StructuredSelection(displayedCmrRepositoryDefinition));
         return;
       }
     }
     // if no online display first
     displayedCmrRepositoryDefinition = repositories.get(0);
     performUpdate(true);
     selectionProviderAdapter.setSelection(
         new StructuredSelection(displayedCmrRepositoryDefinition));
   }
 }