Example #1
0
  /** Selects the appropriate alphabet for the analysed text and sets the combo box selection. */
  private void selectAppropriateAlphabet() {
    AbstractAlphabet[] alphas = AlphabetsManager.getInstance().getAlphabets();
    String prevAlpha = myOverlayAlphabet;

    double bestrating = -99999;
    int bestindex = 0;
    double actualrating = 0;
    for (int i = 0; i < alphas.length; i++) {
      actualrating = rateAlphabetTextDifference(String.valueOf(alphas[i].getCharacterSet()), text);
      if (actualrating > bestrating) {
        bestrating = actualrating;
        bestindex = i;
      }
    }

    String bestAlphaString = String.valueOf(alphas[bestindex].getCharacterSet());
    if (bestAlphaString != null && !bestAlphaString.equals(prevAlpha)) {
      if (combo2.isVisible() && combo2.isEnabled()) {
        tipLauncher.showNewTooltip(
            combo2.toDisplay(
                new Point((int) Math.round((combo2.getSize().x) * 0.612), combo2.getSize().y)),
            9000,
            "",
            Messages.FullAnalysisUI_5); // $NON-NLS-1$
      }
    }

    combo2.select(bestindex);
    combo2WidgetSelected(null);
  }
 public void updatePageComplete() {
   if (comboMM.getSelectionIndex() == -1) {
     this.setMessage("The meta model is not specified.", ERROR);
     this.setPageComplete(false);
     return;
   }
   if (comboInput.isEnabled() && (comboInput.getSelectionIndex() == -1)) {
     this.setMessage("The type of the input port is not specified.", ERROR);
     this.setPageComplete(false);
     return;
   }
   if (comboOutput.isEnabled() && (comboOutput.getSelectionIndex() == -1)) {
     this.setMessage("The type of the output port is not specified.", ERROR);
     this.setPageComplete(false);
     return;
   }
   this.setMessage("Please select a meta model and corresponding port type(s).");
   this.setPageComplete(true);
 }
    public Control createControl(Composite composite) {
      Group group = new Group(composite, SWT.NONE);
      group.setFont(composite.getFont());
      group.setText("Maven Support");
      group.setLayout(initGridLayout(new GridLayout(1, false), true));

      final Composite installComposite = new Composite(group, SWT.NULL);
      installComposite.setFont(composite.getFont());
      installComposite.setLayout(new GridLayout(2, false));
      installComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Label options = new Label(installComposite, SWT.WRAP);
      options.setText("Provider: ");
      options.setLayoutData(new GridData(GridData.BEGINNING));

      dependencyManagementCombo = new Combo(installComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
      dependencyManagementCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // get available dependency management providers
      List<String> provider = new ArrayList<String>();
      dependencyManagementCombo.setEnabled(false);

      if (DependencyManagementUtils.IS_M2ECLIPSE_PRESENT) {
        provider.add("Full Maven build");
        dependencyManagementCombo.setEnabled(true);
      }
      if (DependencyManagementUtils.IS_STS_MAVEN_PRESENT) {
        provider.add("Dependency management only");
        dependencyManagementCombo.setEnabled(true);
      }
      dependencyManagementCombo.setItems(provider.toArray(new String[provider.size()]));
      if (dependencyManagementCombo.isEnabled()) {
        dependencyManagementCombo.select(0);
      }

      group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      return group;
    }