public boolean isVirtualSelected() {
   boolean isVirtual = false;
   if (metamodelCombo.getSelectionIndex() > 0) {
     ModelType selectedModelType = getSelectedModelType();
     isVirtual =
         ((selectedModelType != null) && selectedModelType.equals(ModelType.VIRTUAL_LITERAL));
   }
   return isVirtual;
 }
  private void updateContributorTable() {
    // clear out the current selection
    if (!builderAutoSelected) {
      contributorTable.setSelection(new StructuredSelection());

      // clear out the table
      Object[] elements = NewModelWizard.getContributorList().toArray();
      contributorTable.remove(elements);
      if (modelTypesCombo.getSelectionIndex() > 0) {
        ModelType selectedModelType = getSelectedModelType();
        boolean isVirtual =
            ((selectedModelType != null) && selectedModelType.equals(ModelType.VIRTUAL_LITERAL));
        List contributorList = NewModelWizard.getModelBuilders(getMetamodelDescriptor(), isVirtual);
        contributorTable.add(contributorList.toArray());
      }
    }
  }
 private void populateModelTypesCombo(List /*<ModelType>*/ types) {
   modelTypesCombo.removeAll();
   modelTypesCombo.add(CHOOSE_A_MODEL_TYPE);
   Iterator it = types.iterator();
   while (it.hasNext()) {
     ModelType modelType = (ModelType) it.next();
     String modelTypeName = modelType.getDisplayName();
     modelTypeMap.put(modelTypeName, modelType);
     modelTypesCombo.add(modelTypeName);
   }
   if (types.size() == 1) {
     modelTypesCombo.select(1);
   } else {
     modelTypesCombo.select(0);
   }
   modelTypesCombo.setEnabled(true);
   modelTypeSelected();
 }
  void setInitialComboStates() {

    /*
     * jh Defect 21885: if metamodel class not set, default to 'Relational'
     *                  This default will be used in Enterprise, while the
     *                  class and type will normally be set in Dimension.
     */

    String sMetamodelClass = DEFAULT_CLASS;

    // if we have been supplied with a particular initial class, use that one
    if (initialMetamodelClass != null) {
      sMetamodelClass = initialMetamodelClass;
    }

    // walk through the metamodel classes and select the matching type
    String[] classItems = metamodelCombo.getItems();
    for (int i = 0; i < classItems.length; i++) {
      if (classItems[i].equalsIgnoreCase(sMetamodelClass)) {
        metamodelCombo.select(i);
        metamodelComboSelected();
        metamodelWasFoundAndSelected = true;
        break;
      }
    }

    // jh Defect 21885: if metamodel type not set, default to 'View Source'
    String sMetamodelType = DEFAULT_TYPE;

    // if we have been supplied with a particular initial type, use that one
    if (initialModelType != null && initialModelType.getDisplayName() != null) {
      sMetamodelType = initialModelType.getDisplayName();
    }

    boolean foundType = false;
    if (metamodelWasFoundAndSelected && sMetamodelType != null) {

      // walk through the types and select the matching type
      String[] typeItems = modelTypesCombo.getItems();
      for (int i = 0; i < typeItems.length; i++) {
        if (typeItems[i].equalsIgnoreCase(sMetamodelType)) {
          modelTypesCombo.select(i);
          modelTypeSelected();
          foundType = true;
          break;
        }
      }
    }

    if (initialBuilderType != null && metamodelWasFoundAndSelected && foundType) {

      TableItem[] items = contributorTable.getTable().getItems();
      String label = null;
      for (int i = 0; i < items.length; i++) {
        label = items[i].getText();
        if (label != null && label.equalsIgnoreCase(initialBuilderType)) {
          builderAutoSelected = true;
          contributorTable.setSelection(new StructuredSelection(items[i].getData()));
          handleTableSelection();
          break;
        }
      }
    }

    if (initialMetamodelClass != null) {
      boolean hiddenProject =
          ProductCustomizerMgr.getInstance().getProductCharacteristics().isHiddenProjectCentric();
      String msgId =
          (hiddenProject
              ? "NewModelWizard.hiddenProjectSpecifyMsg" //$NON-NLS-1$
              : "NewModelWizard.specifyOnlylModelNameDesc"); //$NON-NLS-1$
      setDescription(Util.getStringOrKey(msgId));
      setTitle(
          Util.getString(
              "NewModelWizard.singleModelTypeTitle", initialMetamodelClass)); // $NON-NLS-1$
    }
  }