コード例 #1
0
  /** 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();
  }
コード例 #2
0
 /** 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));
   }
 }