Esempio n. 1
0
  @Override
  public void refresh() {
    super.refresh();
    updateLanguageCombo();
    AllLanguages allLanguages = test.getAllLanguages();

    if (allLanguages.isEmpty()) {
      removeButton.setVisible(false);
      refreshButton.setVisible(false);
      openI18nFileButton.setVisible(false);
      selectLabel.setVisible(false);
      languageCombo.setVisible(false);

    } else {
      removeButton.setVisible(true);
      refreshButton.setVisible(true);
      openI18nFileButton.setVisible(true);
      selectLabel.setVisible(true);
      languageCombo.setVisible(true);
    }

    Language currentLanguage = allLanguages.getCurrentLanguage();
    if (currentLanguage != null) {
      if (currentLanguage.isEmpty()) {
        noI18nValuesLabel.setVisible(true);
        noObserversLabel.setVisible(false);
      } else if (!allLanguages.hasObservers()) {
        noI18nValuesLabel.setVisible(false);
        noObserversLabel.setVisible(true);
      } else {
        noI18nValuesLabel.setVisible(false);
        noObserversLabel.setVisible(false);
      }
    }
  }
Esempio n. 2
0
 @Override
 public void setInput(IWorkbenchPart part, ISelection selection) {
   super.setInput(part, selection);
   if (test != null) {
     test.getAllLanguages().removePropertyChangeListener(this);
   }
   Assert.isTrue(selection instanceof IStructuredSelection);
   Object input = ((IStructuredSelection) selection).getFirstElement();
   Assert.isTrue(input instanceof TestEditPart);
   test = (Test) ((TestEditPart) input).getModel();
   AllLanguages langs = test.getAllLanguages();
   langs.addPropertyChangeListener(this);
 }
Esempio n. 3
0
 private void updateLanguageCombo() {
   if (test != null && test.getAllLanguages() != null) {
     AllLanguages allLanguages = test.getAllLanguages();
     languageCombo.removeAll();
     for (Language lang : allLanguages.getLanguages()) {
       languageCombo.add(lang.getName() + " - " + lang.getFileName());
     }
     int i = 0;
     for (Language language : allLanguages.getLanguages()) {
       if (language.relaxedEqual(allLanguages.getCurrentLanguage())) {
         languageCombo.select(i);
         return;
       }
       i++;
     }
   }
 }