/** Load list of scopes for user selection of top level element for report. */
  private void setupComboScopes() {
    // check if audit was selected by context menu:
    if (this.auditId != null && isContextMenuCall()) {
      scopeCombo.removeAll();
      scopeCombo.add(this.auditName);
      rootElement = auditId;
      scopeCombo.setEnabled(true);
      scopeCombo.select(0);
      scopeCombo.redraw();
      return;
    } else if (this.preSelectedElments != null
        && this.preSelectedElments.size() > 0
        && isContextMenuCall()) {
      scopeCombo.removeAll();
      ArrayList<Integer> auditIDList = new ArrayList<Integer>();
      StringBuilder sb = new StringBuilder();
      for (CnATreeElement elmt : preSelectedElments) {
        sb.append(elmt.getTitle());
        if (preSelectedElments.indexOf(elmt) != preSelectedElments.size() - 1) sb.append(" & ");
        auditIDList.add(elmt.getDbId());
      }
      scopeCombo.add(sb.toString());
      rootElements = auditIDList.toArray(new Integer[auditIDList.size()]);
      scopeCombo.setEnabled(false);
      scopeCombo.select(0);
      scopeCombo.redraw();
      return;
    }

    scopes = new ArrayList<CnATreeElement>();
    scopeTitles = new ArrayList<String>();

    scopes.addAll(loadScopes());
    scopes.addAll(loadITVerbuende());

    Collections.sort(
        scopes,
        new Comparator<CnATreeElement>() {
          @Override
          public int compare(CnATreeElement o1, CnATreeElement o2) {
            return o1.getTitle().compareToIgnoreCase(o2.getTitle());
          }
        });

    for (CnATreeElement elmt : scopes) {
      scopeTitles.add(elmt.getTitle());
      if (LOG.isDebugEnabled()) {
        LOG.debug(
            Messages.GenerateReportDialog_16
                + elmt.getDbId()
                + ": "
                + elmt
                    .getTitle()); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
                                  // //$NON-NLS-1$
      }
    }

    String[] titles = scopeTitles.toArray(new String[scopeTitles.size()]);
    scopeCombo.setItems(titles);
  }
  private void doSelectConnection(boolean clearCurrentData) {
    try {
      if (clearCurrentData) {
        tableViewFields.table.removeAll();
        comboCube.removeAll();
      }

      if (addConnectionLine.getText() != null) {
        DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
        if (dbMeta != null) {
          PaloCellOutputData data = new PaloCellOutputData(dbMeta);
          data.helper.connect();
          List<String> cubes = data.helper.getCubesNames();
          Collections.sort(cubes, new PaloNameComparator());
          for (String cubeName : cubes) {
            if (comboCube.indexOf(cubeName) == -1) {
              comboCube.add(cubeName);
            }
          }
          data.helper.disconnect();
        }
      }
    } catch (Exception ex) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesErrorTitle"),
          BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesError"),
          ex);
    }
  }
 /**
  * Initializes the container collecting the supported languages.<br>
  * If a file was selected, the language of the file will be selected.
  */
 private void initComboLanguage() {
   composer = featureProject.getComposer();
   formats = composer.getTemplates();
   comboLanguage.removeAll();
   if (!formats.isEmpty()) {
     for (String[] format : formats) comboLanguage.add(format[0]);
     if (comboLanguage.getItemCount() <= 1) {
       comboLanguage.setEnabled(false);
     } else {
       comboLanguage.setEnabled(true);
     }
     Object element = selection.getFirstElement();
     if (element instanceof IFile) {
       String extension = ((IFile) element).getFileExtension();
       int i = 0;
       for (String[] template : composer.getTemplates()) {
         if (template[1].equals(extension)) {
           comboLanguage.select(i);
           return;
         }
         i++;
       }
     }
     if (composer.getId().equals(lastComposerID) && lastSelection < comboLanguage.getItemCount()) {
       comboLanguage.select(lastSelection);
     } else {
       comboLanguage.select(composer.getDefaultTemplateIndex());
     }
   }
 }
  private void populateOperationCombo() {
    if (_operationSelectionCombo != null && !_operationSelectionCombo.isDisposed()) {
      _operationSelectionCombo.removeAll();
      _operationSelectionCombo.clearSelection();

      if (getTargetObject() == null) {
        PictogramElement[] pes =
            SwitchyardSCAEditor.getActiveEditor().getSelectedPictogramElements();
        if (pes.length > 0) {
          Object bo =
              SwitchyardSCAEditor.getActiveEditor()
                  .getDiagramTypeProvider()
                  .getFeatureProvider()
                  .getBusinessObjectForPictogramElement(pes[0]);
          if (bo instanceof Contract) {
            setTargetObject(bo);
          }
        }
      }
      if (getTargetObject() != null && getTargetObject() instanceof Contract) {
        String[] operations = InterfaceOpsUtil.gatherOperations((Contract) getTargetObject());
        for (int i = 0; i < operations.length; i++) {
          _operationSelectionCombo.add(operations[i]);
        }
      }
    }
  }
 private void initComboFeature() {
   container = sourceFolder != null ? sourceFolder.getFolder(comboFeature.getText()) : null;
   if (featureProject == null) {
     return;
   }
   comboFeature.removeAll();
   for (String s : featureProject.getFeatureModel().getConcreteFeatureNames()) comboFeature.add(s);
   if (feature != null) {
     comboFeature.setText(feature);
   } else {
     if (comboFeature.getItemCount() > 0) comboFeature.select(0);
   }
   Object obj = selection.getFirstElement();
   if (obj instanceof IResource) {
     IResource resource = (IResource) obj;
     boolean found = false;
     while (found == false && resource.getParent() != null) {
       if (resource.getParent().equals(sourceFolder)) {
         for (int i = 0; i < comboFeature.getItemCount(); i++)
           if (comboFeature.getItem(i).equals(resource.getName())) {
             comboFeature.select(i);
             found = true;
             break;
           }
       }
       resource = resource.getParent();
     }
   }
   if (comboFeature.getItemCount() == 1
       || !featureProject.getComposer().createFolderForFeatures()) {
     comboFeature.setEnabled(false);
   } else {
     comboFeature.setEnabled(true);
   }
 }
  private void revalidate(RepositorySelection repoSelection, List<Ref> branches, Ref head) {
    if (repoSelection.equals(validatedRepoSelection)
        && branches.equals(validatedSelectedBranches)
        && head.equals(validatedHEAD)) {
      checkPage();
      return;
    }

    if (!repoSelection.equals(validatedRepoSelection)) {
      validatedRepoSelection = repoSelection;
      // update repo-related selection only if it changed
      final String n = validatedRepoSelection.getURI().getHumanishName();
      setDescription(NLS.bind(UIText.CloneDestinationPage_description, n));
      directoryText.setText(
          new File(ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toFile(), n)
              .getAbsolutePath());
    }

    validatedSelectedBranches = branches;
    validatedHEAD = head;

    initialBranch.removeAll();
    final Ref actHead = head;
    int newix = 0;
    for (final Ref r : branches) {
      String name = r.getName();
      if (name.startsWith(Constants.R_HEADS)) name = name.substring((Constants.R_HEADS).length());
      if (actHead != null && actHead.getName().equals(r.getName()))
        newix = initialBranch.getItemCount();
      initialBranch.add(name);
    }
    initialBranch.select(newix);
    checkPage();
  }
  protected void projectChanged() {

    projectText = projectCombo.getText();
    IJavaProject selectedProject = null;
    for (int i = 0; i < gwtProjects.length; i++) {
      IJavaProject gwtProject = gwtProjects[i];
      if (projectText.equals(gwtProject.getProject().getName())) {
        selectedProject = gwtProject;
        break;
      }
    }

    if (selectedProject != null) {
      try {
        moduleCombo.removeAll();
        List modulesList = Util.findModules(selectedProject);
        for (Iterator i = modulesList.iterator(); i.hasNext(); ) {
          IFile file = (IFile) i.next();
          IPath projectRelativePath = file.getProjectRelativePath();
          String fileName = file.getName();
          String moduleName =
              fileName.substring(0, fileName.length() - Constants.GWT_XML_EXT.length() - 1);
          moduleCombo.add(projectRelativePath.toString());
          moduleCombo.setData(moduleName, file);
        }
        int i = modulesList.indexOf(selectedModule);
        if (i == -1) i = 0;
        moduleCombo.select(i);
        moduleText = moduleCombo.getText();
      } catch (CoreException e) {
        Activator.logException(e);
      }
    }
    doStatusUpdate();
  }
  private void initializeContextCombo() {
    IContextManager contextManager = getContextManager();
    if (contextsCombo.getItems().length > 0) {
      contextsCombo.removeAll();
    }
    if (contextManager != null) {
      List<IContext> contexts = contextManager.getListContext();
      for (IContext context : contexts) {
        if (!Arrays.asList(contextsCombo.getItems()).contains(context.getName())) {
          contextsCombo.add(context.getName());
        }
      }

      for (int i = 0; i < contextsCombo.getItemCount(); i++) {
        IContext defaultContext = contextManager.getDefaultContext();
        if (defaultContext.getName().equals(contextsCombo.getItem(i))) {
          contextsCombo.select(i);
          break;
        }
      }
    }

    int visibleItemCount = contextsCombo.getItemCount();
    if (visibleItemCount > 20) {
      visibleItemCount = 20;
    }
    contextsCombo.setVisibleItemCount(visibleItemCount);
  }
Exemple #9
0
  private void populateConfigurations() {
    IProject prj = getProject();
    // Do nothing in case of Preferences page.
    if (prj == null) return;

    // Do not re-read if list already created by another page
    if (cfgDescs == null) {
      ICProjectDescription pDesc = CDTPropertyManager.getProjectDescription(this, prj);
      cfgDescs = (pDesc == null) ? null : pDesc.getConfigurations();
      if (cfgDescs == null || cfgDescs.length == 0) return;
      Arrays.sort(cfgDescs, CDTListComparator.getInstance());

    } else {
      if (cfgDescs.length == 0) return;
      // just register in CDTPropertyManager;
      CDTPropertyManager.getProjectDescription(this, prj);
    }

    // Do nothing if widget not created yet.
    if (configSelector == null) {
      lastSelectedCfg = cfgDescs[getActiveCfgIndex()];
      cfgChanged(lastSelectedCfg);
      return;
    }

    // Clear and replace the contents of the selector widget
    configSelector.removeAll();
    for (int i = 0; i < cfgDescs.length; ++i) {
      String name = cfgDescs[i].getName();
      if (cfgDescs[i].isActive()) {
        name = name + "  " + Messages.AbstractPage_16; // $NON-NLS-1$
      }
      configSelector.add(name);
    }

    // Ensure that the last selected config is selected by default
    int cfgIndex = getCfgIndex(lastSelectedCfg);

    // "All cfgs" - shown if at least 2 cfgs available
    if (cfgDescs.length > 1) {
      configSelector.add(Messages.AbstractPage_4);
      if (multiCfgs == cfgDescs) {
        cfgIndex = cfgDescs.length;
      }
    }
    // "Multi cfgs" - shown if at least 3 cfgs available
    if (cfgDescs.length > 2) {
      configSelector.add(Messages.AbstractPage_5);
      if (multiCfgs != null && multiCfgs != cfgDescs) {
        cfgIndex = cfgDescs.length + 1;
      }
    }

    if (cfgIndex < 0) {
      cfgIndex = getActiveCfgIndex();
    }

    configSelector.select(cfgIndex);
    handleConfigSelection();
  }
  /** Carga los controles (combos y cajas de texto) */
  public void inicializar() {
    // Clean
    lbIconConcepto.setVisible(false);
    lbIconRubro.setVisible(false);

    txConcepto.setText("");
    rubros = contable.getAllRubros();

    cbRubro.removeAll();
    for (Rubro r : rubros) {
      cbRubro.add(r.getRubro());
    }
    if (cbRubro.getItemCount() > 0) cbRubro.select(0);

    // Load. Si está editando, carga los campos del concepto

    if (concepto != null) {
      if (concepto.getConcepto() != null) txConcepto.setText(concepto.getConcepto());
      if (concepto.getCosto() != null) {
        for (int i = 0; i < rubros.size(); i++) {
          if (rubros.get(i).getRubro().equals(concepto.getCosto().getRubro())) {
            cbRubro.select(i);
            break;
          }
        }
      }
    }

    txConcepto.setFocus();
  }
  protected Control createDialogArea(final Composite parent) {
    Composite container = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    container.setLayout(layout);
    Group group = new Group(container, SWT.None);
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    layout = new GridLayout();
    layout.numColumns = 2;
    group.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    container.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    new Label(group, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(gd);

    Label urlLabel = new Label(group, SWT.NONE);
    GridData gd_urlLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_urlLabel.widthHint = 100;
    urlLabel.setLayoutData(gd_urlLabel);
    urlLabel.setText("URL ");

    Text urlText = new Text(group, SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    urlText.setLayoutData(gd);

    urlText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent event) {
            Text url = (Text) event.widget;
            serverUrl = url.getText();
            setServerUrl(serverUrl);
          }
        });

    Label pathLabel = new Label(group, SWT.NONE);
    pathLabel.setText("Path ");

    urlText.setText("https://localhost:9443");

    pathText = new Combo(group, SWT.NONE);
    pathText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent arg0) {
            updateSelectedPath();
          }
        });
    pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    pathText.removeAll();
    List<String> defaultPaths = getDefaultPaths();
    for (String path : defaultPaths) {
      pathText.add(path);
    }
    pathText.select(getDefaultPathId());
    updateSelectedPath();
    return super.createDialogArea(parent);
  }
 /**
  * Sets the color choiceSet from DE model.
  *
  * @param choiceSet The color ChoiceSet.
  */
 public void setChoiceSet(IChoiceSet choiceSet) {
   this.choiceSet = choiceSet;
   String[] colors = ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
   Arrays.sort(colors);
   combo.removeAll();
   combo.add(NONE_CHOICE);
   if (colors != null) for (int i = 0; i < colors.length; i++) combo.add(colors[i]);
 }
Exemple #13
0
 public static void readHistoryItems(String comboName, Combo combo) {
   String itemsStr =
       Activator.getDefault().getPreferenceStore().getString("history.items.list." + comboName);
   combo.removeAll();
   if (itemsStr != null) {
     for (StringTokenizer st = new StringTokenizer(itemsStr, ","); st.hasMoreElements(); ) {
       combo.add(st.nextToken());
     }
   }
 }
 private void setElementCombos(int index) {
   if (index == -1) {
     comboInput.removeAll();
     comboOutput.removeAll();
     comboInput.setEnabled(false);
     comboOutput.setEnabled(false);
   } else {
     String mm = comboMM.getItem(index);
     // new
     Object value = EPackage.Registry.INSTANCE.get(mm);
     System.out.println(value);
     metaModel = (EPackage) value;
     setModelElementNames();
     comboInput.setItems(modelElementNames);
     comboInput.setEnabled(true);
     comboOutput.setItems(modelElementNames);
     comboOutput.add("String");
     comboOutput.setEnabled(!isFilter);
   }
 }
 /** 设置Combo下拉列表中的数据 */
 private void setComboData(Combo combo, String[] data) {
   if (combo == null || data == null || data.length == 0) {
     return;
   }
   combo.clearSelection();
   combo.removeAll();
   int i = 0;
   for (String temp : data) {
     combo.add(temp, i++);
   }
 }
 private void setupComboOutputFormatContent() {
   comboOutputFormat.removeAll();
   for (IOutputFormat of : reportTypes[comboReportType.getSelectionIndex()].getOutputFormats()) {
     comboOutputFormat.add(of.getLabel());
   }
   ;
   comboOutputFormat.select(0);
   if (chosenReportType != null) {
     chosenOutputFormat =
         chosenReportType.getOutputFormats()[comboOutputFormat.getSelectionIndex()];
   }
 }
  private void updateForm() {
    try {
      if (loggedIn) {
        if (templateStore == null) {
          templateStore = new TemplateStore();
        }
        setEnable(true);

        // remove and reload template combo
        templateCombo.removeAll();
        for (String templateName : templateStore.getTemplateNames()) {
          templateCombo.add(templateName);
        }

        if (templateCombo.getItemCount() > 0) templateCombo.select(0);

        for (int i = 0; i < templateCombo.getItemCount(); i++) {
          if (templateCombo
              .getItem(i)
              .equals(perferenceStore.getString(PreferenceConstants.TEMPLATE_NAME))) {
            templateCombo.select(i);
            break;
          }
        }
        templateCombo.redraw();

        loadSelectedTemplate();

      } else {
        setEnable(false);
        templateCombo.removeAll();
        templateCombo.redraw();
      }
    } catch (ApplicationException e) {
      BgcPlugin.openAsyncError(
          "Database Error", //$NON-NLS-1$
          "Error while updating form",
          e); //$NON-NLS-1$
    }
  }
Exemple #18
0
  public void setPreviousPage(IWizardPage page) {
    super.setPreviousPage(page);
    final IWizardNewProjectNameAndLocationPage projectPage = projectPageCallback.call();
    final String projectType = projectPage.getProjectType();

    if (djVersionCombo.getItemCount() == 0) {
      // fill it only if it's still not properly filled
      djVersionCombo.removeAll();
      for (String version : DJANGO_VERSIONS) {
        djVersionCombo.add(version);
      }
    }

    final String projectInterpreter = projectPage.getProjectInterpreter();
    if (!projectType.equals(previousProjectType)
        || !projectInterpreter.equals(previousProjectInterpreter)) {
      discoverDefaultVersion(projectType, projectInterpreter);
    }
    djVersionCombo.setText(defaultVersion);

    if (!projectType.equals(previousProjectType)) {
      List<String> engines =
          DB_ENGINES.get(
              projectType.startsWith("jython")
                  ? DjangoSettingsPage.JYTHON
                  : DjangoSettingsPage.CPYTHON);
      engineCombo.removeAll();
      for (String engine : engines) {
        engineCombo.add(engine);
      }

      engineCombo.setText(engines.get(0));
    }

    this.previousProjectType = projectType;
    this.previousProjectInterpreter = projectInterpreter;

    // Always update the sqlite path if needed.
    updateSqlitePathIfNeeded(projectPage);
  }
  /** update zoom levels for the selected mp */
  private void updateZoomLevels() {

    // get selected zoom level
    final int selectedIndex = _comboTargetZoom.getSelectionIndex();
    int selectedZoomLevel = -1;
    if (selectedIndex != -1 && _targetZoomLevels != null) {
      selectedZoomLevel = _targetZoomLevels[selectedIndex];
    }

    /*
     * get valid zoom levels
     */
    _validMapZoomLevel = _mapZoomLevel;
    final int mapMaxZoom = _selectedMp.getMaxZoomLevel();

    // check if the map zoom level is higher than the available mp zoom levels
    if (_mapZoomLevel > mapMaxZoom) {
      _validMapZoomLevel = mapMaxZoom;
    } else {
      _validMapZoomLevel = _mapZoomLevel;
    }

    _targetZoomLevels = new int[mapMaxZoom - _validMapZoomLevel + 1];

    int zoomIndex = 0;
    for (int zoomLevel = _validMapZoomLevel; zoomLevel <= mapMaxZoom; zoomLevel++) {
      _targetZoomLevels[zoomIndex++] = zoomLevel;
    }

    // fill zoom combo
    _comboTargetZoom.removeAll();
    int reselectedZoomLevelIndex = -1;
    zoomIndex = 0;
    for (final int zoomLevel : _targetZoomLevels) {

      _comboTargetZoom.add(Integer.toString(zoomLevel + 1));

      if (selectedZoomLevel != -1 && zoomLevel == selectedZoomLevel) {
        reselectedZoomLevelIndex = zoomIndex;
      }

      zoomIndex++;
    }

    // reselect zoom level
    if (reselectedZoomLevelIndex == -1) {
      // old zoom level is not available, select first zoom level
      _comboTargetZoom.select(0);
    } else {
      _comboTargetZoom.select(reselectedZoomLevelIndex);
    }
  }
 /** Fills the class combo with class names of the same package at other features. */
 private void initComboClassName() {
   String c = comboClass.getText();
   Object obj = selection.getFirstElement();
   if (obj instanceof IFile) {
     String fileExtension = ((IFile) obj).getFileExtension();
     if (composer.extensions().contains(fileExtension)) {
       String fileName = ((IFile) obj).getName();
       c = fileName.substring(0, fileName.lastIndexOf('.'));
     }
   }
   comboClass.removeAll();
   LinkedList<String> inclusions = new LinkedList<String>();
   LinkedList<String> exclusions = new LinkedList<String>();
   if (featureProject.getComposer().hasFeatureFolder()) {
     try {
       for (IResource res : featureProject.getSourceFolder().members()) {
         if (res instanceof IFolder) {
           IFolder folder = (IFolder) res;
           if (folder.getName().equals(comboFeature.getText())) {
             exclusions = getClasses(folder);
           } else {
             for (String className : getClasses(folder)) {
               boolean added = false;
               if (!inclusions.contains(className)) {
                 int i = 0;
                 for (String name : inclusions) {
                   if (className.compareToIgnoreCase(name) < 0) {
                     inclusions.add(i, className);
                     added = true;
                     break;
                   }
                   i++;
                 }
                 if (!added) {
                   inclusions.add(className);
                 }
               }
             }
           }
         }
       }
     } catch (CoreException e) {
       UIPlugin.getDefault().logError(e);
     }
   }
   for (String className : inclusions) {
     if (!exclusions.contains(className)) {
       comboClass.add(className);
     }
   }
   comboClass.setText(c);
 }
Exemple #21
0
 protected void fillProjectDropDownMenue(String name) {
   List<String> projectNames = getProjectNames();
   int selectedProjectName = 0;
   projectDropDown.removeAll();
   for (int i = 0; i < projectNames.size(); i++) {
     String projectName = projectNames.get(i);
     if (projectName.equals(name)) {
       selectedProjectName = i;
     }
     projectDropDown.add(projectName);
   }
   projectDropDown.select(selectedProjectName);
 }
  private void updateStringValueCombo() {
    String resFile = mResFileCombo.getText();
    Map<String, String> ids = mXmlHelper.getResIdsForFile(mProject, resFile);

    // get the current text from the combo, to make sure we don't change it
    String currText = mStringIdCombo.getText();

    // erase the choices and fill with the given ids
    mStringIdCombo.removeAll();
    mStringIdCombo.setItems(ids.keySet().toArray(new String[ids.size()]));

    // set the current text to preserve it in case it changed
    if (!currText.equals(mStringIdCombo.getText())) {
      mStringIdCombo.setText(currText);
    }
  }
  private void reloadChannelCombo(Combo combo, List channels, int selected, String prefix) {
    if (!(combo.getData() instanceof List) || isDifferentList(channels, (List) combo.getData())) {
      combo.removeAll();
      combo.setData(channels);
      for (int i = 0; i < channels.size(); i++) {
        Integer channel = (Integer) channels.get(i);

        combo.add(prefix + " #" + channel.toString());
      }
    }
    for (int i = 0; i < channels.size(); i++) {
      Integer channel = (Integer) channels.get(i);
      if (channel.intValue() == selected) {
        combo.select(i);
      }
    }
  }
 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();
 }
 private void setupComboOutputFormatContent() {
   comboOutputFormat.removeAll();
   if (reportTemplates.length > 0) {
     for (IOutputFormat of :
         getDepositService()
             .getOutputFormats(
                 reportTemplates[comboReportType.getSelectionIndex()].getOutputFormats())) {
       comboOutputFormat.add(of.getLabel());
     }
     comboOutputFormat.select(0);
     if (chosenReportMetaData != null) {
       chosenOutputFormat =
           getDepositService()
               .getOutputFormat(
                   chosenReportMetaData.getOutputFormats()[comboOutputFormat.getSelectionIndex()]);
     }
   } else {
     showNoReportsExistant();
     return;
   }
 }
 /**
  * Fills the package combo with all current packages.
  *
  * @param folder
  * @param packageName
  */
 private void initComboPackages(IFolder folder, String packageName) {
   String p = comboPackage.getText();
   String p2 = null;
   Object obj = selection.getFirstElement();
   if (obj instanceof IFile) {
     IResource res = ((IFile) obj).getParent();
     if (res instanceof IFolder) {
       p2 = setPackage((IFolder) res);
     }
   } else if (obj instanceof IFolder) {
     p2 = setPackage((IFolder) obj);
   }
   try {
     if (composer.hasFeatureFolder() && folder.equals(sourceFolder)) {
       comboPackage.removeAll();
       for (IResource res : folder.members()) {
         if (res instanceof IFolder) {
           initComboPackages((IFolder) res, packageName);
         }
       }
     } else {
       for (IResource res : folder.members()) {
         if (res instanceof IFolder) {
           String subPackage = ("".equals(packageName) ? "" : packageName + ".") + res.getName();
           if (!containsPackage(subPackage)) {
             comboPackage.add(subPackage);
           }
           initComboPackages((IFolder) res, subPackage);
         }
       }
     }
   } catch (CoreException e) {
     UIPlugin.getDefault().logError(e);
   }
   if (p2 != null) {
     comboPackage.setText(p2);
   } else {
     comboPackage.setText(p);
   }
 }
 private void openLink() {
   PreferencesUtil.createPreferenceDialogOn(
           getShell(),
           DroolsProjectPreferencePage.PREF_ID,
           new String[] {DroolsProjectPreferencePage.PROP_ID},
           new HashMap())
       .open();
   droolsRuntimeCombo.removeAll();
   DroolsRuntime[] runtimes = DroolsRuntimeManager.getDroolsRuntimes();
   if (runtimes.length == 0) {
     setPageComplete(false);
     setErrorMessage("No Drools Runtimes have been defined, please do this first");
   } else {
     setPageComplete(true);
     setErrorMessage(null);
     for (int i = 0; i < runtimes.length; i++) {
       droolsRuntimeCombo.add(runtimes[i].getName());
     }
     droolsRuntimeCombo.select(0);
     selectedRuntime = droolsRuntimeCombo.getText();
   }
 }
 private void setFixedMetamodel(String metaModel) {
   for (String mm : metamodelCombo.getItems()) {
     if (mm.equals(metaModel)) {
       metamodelCombo.removeAll();
       metamodelCombo.setItems(new String[] {metaModel});
       metamodelCombo.select(0);
       metamodelCombo.setEnabled(false);
       EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(metaModel);
       importPackage = ePackage.getClass().getPackage().getName();
       if (importPackage.endsWith(".impl")) {
         int length = importPackage.length();
         importPackage = importPackage.substring(0, length - 5);
       }
       if (importPackage.endsWith(".internal")) {
         int length = importPackage.length();
         importPackage = importPackage.substring(0, length - 9);
       }
       System.out.println("importPackage: " + importPackage);
       File jarFile;
       try {
         jarFile =
             new File(
                 ePackage.getClass().getProtectionDomain().getCodeSource().getLocation().toURI());
         String jarName = jarFile.getName();
         int index = jarName.indexOf("_");
         if (index == -1) {
           jar = jarName;
         } else {
           jar = jarName.substring(0, index);
         }
         System.out.println("Jar5: " + jar);
       } catch (URISyntaxException e) {
         e.printStackTrace();
       }
       break;
     }
   }
 }
 @Override
 public void initializeFrom(ILaunchConfiguration configuration) {
   ILaunchManager launchManager = getLaunchManager();
   ILaunchConfiguration[] launchConfigurations;
   try {
     launchConfigurations = launchManager.getLaunchConfigurations();
   } catch (CoreException e) {
     // todo: may be this is the case to throw exception?
     setErrorMessage(e.getMessage());
     return;
   }
   List selectedList = Collections.emptyList();
   try {
     selectedList =
         configuration.getAttribute(SELECTED_CONFIGURATION_LIST, Collections.emptyList());
   } catch (CoreException e) {
     setErrorMessage(e.getMessage());
   }
   availableConfigsCombo.removeAll();
   allConfigNames = new HashSet<String>();
   for (ILaunchConfiguration conf : launchConfigurations) {
     String configurationName = conf.getName();
     if (!configurationName.equals(configuration.getName())
         && !selectedList.contains(configurationName)) {
       availableConfigsCombo.add(configurationName);
     }
     allConfigNames.add(configurationName);
   }
   selectedConfigsList.removeAll();
   for (Object item : selectedList) {
     selectedConfigsList.add((String) item);
     if (!allConfigNames.contains((String) item)) {
       setErrorMessage("Configuration [" + item + "] is undefined");
     }
   }
   updateButtonsState();
 }
Exemple #30
0
 /**
  * Lists all products in the current project's module, incl. a "<base>" product if no particular
  * product is selected.
  *
  * @param preSelected The product that should be preselected, or null for <base>.
  */
 protected void fillProductDropDownMenue(String preSelected) {
   productDropDown.removeAll();
   productDropDown.add("<base>");
   IProject proj = getSelectedProject();
   if (proj == null) {
     return;
   }
   AbsNature n = UtilityFunctions.getAbsNature(proj);
   Model m = n.getCompleteModel();
   if (m == null) return;
   Collection<Product> prods = m.getProducts();
   if (prods == null) return;
   int i = 1; /* base comes first */
   int selected = 0;
   for (Product p : prods) {
     final String name = p.qualifiedName();
     productDropDown.add(name);
     if (name.equals(preSelected)) {
       selected = i;
     }
     i++;
   }
   productDropDown.select(selected);
 }