@Override
  protected void createFields() {
    pAuthors = addTextField(Messages.getString("wizard.newproject.pages.project.authors"));
    pVersion = addTextField(Messages.getString("wizard.newproject.pages.project.version"));
    pRelease = addTextField(Messages.getString("wizard.newproject.pages.project.release"));

    // TODO use preferences to select the default one
    pLanguage =
        addComboBox(
            Messages.getString("wizard.newproject.pages.project.language"),
            IConfigConstants.LANGUAGES);
    pLanguage.select(1);

    // TODO use preferences to select the default one
    pTheme =
        addComboBox(
            Messages.getString("wizard.newproject.pages.project.theme"),
            IConfigConstants.HTML_THEMES);
    pTheme.select(1);

    pSeparateSourceBuild =
        addCheckBox(Messages.getString("wizard.newproject.pages.project.separatedsources"));
    pSeparateSourceBuild.setSelection(true);

    pExtensionTodo = addCheckBox(Messages.getString("wizard.newproject.pages.project.ext.todo"));
    pExtensionTodo.setSelection(true);
  }
  /** 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();
  }
 /**
  * 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());
     }
   }
 }
  public void createProjectControls(Composite parent, int nColumns) {

    Label locationLabel = new Label(parent, SWT.NONE);
    locationLabel.setText("Project:");
    locationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

    projectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    projectCombo.setLayoutData(data);
    projectCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            projectText = projectCombo.getText();
            projectChanged();
          }
        });
    gwtProjects = Util.getGwtProjects();
    for (int i = 0; i < gwtProjects.length; i++) {
      IJavaProject gwtProject = gwtProjects[i];
      String name = gwtProject.getProject().getName();
      projectCombo.add(name);
      if (name.equals(selectedProject)) projectCombo.select(i);
    }
    if (projectCombo.getSelectionIndex() == -1) projectCombo.select(0);

    new Label(parent, SWT.NONE);
  }
  /** 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 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);
   }
 }
  @Override
  public void init() {

    if (oldUserDB != null) {

      selGroupName = oldUserDB.getGroup_name();
      preDBInfo.setTextDisplayName(oldUserDB.getDisplay_name());
      preDBInfo
          .getComboOperationType()
          .setText(
              PublicTadpoleDefine.DBOperationType.valueOf(oldUserDB.getOperation_type())
                  .getTypeName());

      textHost.setText(oldUserDB.getHost());
      textPort.setText(oldUserDB.getPort());
      textDatabase.setText(oldUserDB.getDb());
      textUser.setText(oldUserDB.getUsers());
      textPassword.setText(oldUserDB.getPasswd());

      textJDBCOptions.setText(oldUserDB.getUrl_user_parameter());

    } else if (ApplicationArgumentUtils.isTestMode() || ApplicationArgumentUtils.isTestDBMode()) {

      preDBInfo.setTextDisplayName(getDisplayName());

      textHost.setText("127.0.0.1");
      textPort.setText("10002");
      textDatabase.setText("default");
      textUser.setText("");
      textPassword.setText("");

    } else {
      textPort.setText("10002");
    }

    Combo comboGroup = preDBInfo.getComboGroup();
    if (comboGroup.getItems().length == 0) {
      comboGroup.add(strOtherGroupName);
      comboGroup.select(0);
    } else {
      if ("".equals(selGroupName)) {
        comboGroup.setText(strOtherGroupName);
      } else {
        // 콤보 선택
        for (int i = 0; i < comboGroup.getItemCount(); i++) {
          if (selGroupName.equals(comboGroup.getItem(i))) comboGroup.select(i);
        }
      }
    }

    // Initialize otherConnectionComposite
    othersConnectionInfo.callBackUIInit(textHost.getText());

    textHost.setFocus();
  }
 private void selectLastUsedUri() {
   String lastUri = settings.get(lastUriKey);
   if (lastUri != null) {
     int i = uriCombo.indexOf(lastUri);
     if (i != -1) {
       uriCombo.select(i);
       return;
     }
   }
   uriCombo.select(0);
 }
Beispiel #9
0
  /**
   * Evaluates the page
   *
   * <p>This checks whether the current settings on the page make any sense. If everything is fine,
   * the settings are being put into the appropriate data container {@link ImportWizardModel} and
   * the current page is marked as complete by invoking {@link #setPageComplete(boolean)}. Otherwise
   * an error message is set, which will make sure the user is informed about the reason for the
   * error.
   */
  private void evaluatePage() {

    setPageComplete(false);
    setErrorMessage(null);
    tablePreview.setVisible(false);

    if (comboLocation.getText().equals("")) { // $NON-NLS-1$
      return;
    }

    try {
      if (!customLinebreak) {
        detectLinebreak();
        comboLinebreak.select(selectedLinebreak);
      }
      if (!customDelimiter) {
        detectDelimiter();
        comboDelimiter.select(selectedDelimiter);
      }
      readPreview();

    } catch (IOException | IllegalArgumentException e) {
      setErrorMessage(e.getMessage());
      return;
    } catch (TextParsingException e) {
      setErrorMessage(Resources.getMessage("ImportWizardPageCSV.16")); // $NON-NLS-1$
      return;
    } catch (RuntimeException e) {
      if (e.getCause() != null) {
        setErrorMessage(e.getCause().getMessage());
      } else {
        setErrorMessage(e.getMessage());
      }
      return;
    }

    /* Put data into container */
    ImportWizardModel data = wizardImport.getData();

    data.setWizardColumns(wizardColumns);
    data.setPreviewData(previewData);
    data.setFirstRowContainsHeader(btnContainsHeader.getSelection());
    data.setFileLocation(comboLocation.getText());
    data.setCsvDelimiter(delimiters[selectedDelimiter]);
    data.setCsvQuote(quotes[selectedQuote]);
    data.setCsvEscape(escapes[selectedEscape]);
    data.setCharset(
        Charsets.getCharsetForName(Charsets.getNamesOfAvailableCharsets()[selectedCharset]));
    data.setCsvLinebreak(
        CSVSyntax.getLinebreakForLabel(CSVSyntax.getAvailableLinebreaks()[selectedLinebreak]));

    /* Mark page as completed */
    setPageComplete(true);
  }
 private void loadDefaultPreferences() {
   cmbColourMap.select(cmbColourMap.indexOf(getDefaultColourMapChoicePreference()));
   spnAutoLoThreshold.setSelection(getDefaultAutoContrastLoPreference());
   spnAutoHiThreshold.setSelection(getDefaultAutoContrastHiPreference());
   spnWaitTime.setSelection(getDefaultTimeDelayPreference());
   spnSkipImages.setSelection(getDefaultPlaybackRatePreference());
   spnImageSize.setSelection(getDefaultImageSizePreference());
   String viewName = getDefaultPlaybackViewPreference();
   for (int i = 0; i < cmbDisplayViews.getItems().length; i++) {
     if (cmbDisplayViews.getItems()[i].equals(viewName)) cmbDisplayViews.select(i);
   }
 }
  private void populateLists() {
    // Populate font names list
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String[] saFontNames = ge.getAvailableFontFamilyNames();
    String currentFont = ChartUIUtil.getFontName(fdCurrent);
    cmbFontNames.add(ChartUIUtil.FONT_AUTO);
    if (ChartUIUtil.FONT_AUTO.equals(currentFont)) {
      cmbFontNames.select(0);
    }
    for (int iC = 0; iC < saFontNames.length; iC++) {
      cmbFontNames.add(saFontNames[iC]);
      if (saFontNames[iC].equalsIgnoreCase(currentFont)) {
        cmbFontNames.select(iC + 1);
      }
    }
    if (cmbFontNames.getSelectionIndex() == -1) {
      cmbFontNames.select(0);
    }

    // Select alignment button
    if (isAlignmentEnabled
        && fdCurrent.getAlignment() != null
        && fdCurrent.getAlignment().isSetHorizontalAlignment()
        && fdCurrent.getAlignment().isSetVerticalAlignment()) {
      HorizontalAlignment ha = fdCurrent.getAlignment().getHorizontalAlignment();
      VerticalAlignment va = fdCurrent.getAlignment().getVerticalAlignment();
      if (HorizontalAlignment.LEFT_LITERAL.equals(ha)) {
        if (VerticalAlignment.TOP_LITERAL.equals(va)) {
          btnATopLeft.setSelection(true);
        } else if (VerticalAlignment.BOTTOM_LITERAL.equals(va)) {
          btnABottomLeft.setSelection(true);
        } else {
          btnACenterLeft.setSelection(true);
        }
      } else if (HorizontalAlignment.RIGHT_LITERAL.equals(ha)) {
        if (VerticalAlignment.TOP_LITERAL.equals(va)) {
          btnATopRight.setSelection(true);
        } else if (VerticalAlignment.BOTTOM_LITERAL.equals(va)) {
          btnABottomRight.setSelection(true);
        } else {
          btnACenterRight.setSelection(true);
        }
      } else {
        if (VerticalAlignment.TOP_LITERAL.equals(va)) {
          btnATopCenter.setSelection(true);
        } else if (VerticalAlignment.BOTTOM_LITERAL.equals(va)) {
          btnABottomCenter.setSelection(true);
        } else {
          btnACenter.setSelection(true);
        }
      }
    }
  }
  /** 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);
    }
  }
 private void setCombo(Combo combo, int value) {
   switch (value) {
     case IMarker.SEVERITY_ERROR:
       combo.select(0);
       break;
     case IMarker.SEVERITY_WARNING:
       combo.select(1);
       break;
     case IMarker.SEVERITY_INFO:
       combo.select(2);
       break;
     default:
       combo.select(3);
   }
 }
 private void loadEditorsAndFillEditorChooser() {
   IEditorReference activeReference = EditorsManager.getInstance().getActiveEditorReference();
   for (int i = 0; i < editorRefs.size(); i++) {
     comboEditorInputSelector.add(editorRefs.get(i).getTitle());
     if (activeReference != null && activeReference.equals(editorRefs.get(i))) {
       comboEditorInputSelector.setText(editorRefs.get(i).getTitle());
       comboEditorInputSelector.select(i);
     }
   }
   if (activeReference == null) {
     if (editorRefs.size() > 0) {
       comboEditorInputSelector.select(0);
     }
   }
 }
  @Override
  protected Control createDialogArea(Composite shell) {
    setTitle(TITLE);
    setMessage(DEFAULT_MESSAGE);

    Composite parent = (Composite) super.createDialogArea(shell);
    Composite c = new Composite(parent, SWT.BORDER);
    c.setLayout(new GridLayout(2, false));
    c.setLayoutData(new GridData(GridData.FILL_BOTH));

    createLabel(c, "Filter Name:");
    mFilterNameText = new Text(c, SWT.BORDER);
    mFilterNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mFilterNameText.setText(mFilterName);

    createSeparator(c);

    createLabel(c, "by Log Tag:");
    mTagFilterText = new Text(c, SWT.BORDER);
    mTagFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mTagFilterText.setText(mTag);

    createLabel(c, "by Log Message:");
    mTextFilterText = new Text(c, SWT.BORDER);
    mTextFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mTextFilterText.setText(mText);

    createLabel(c, "by PID:");
    mPidFilterText = new Text(c, SWT.BORDER);
    mPidFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mPidFilterText.setText(mPid);

    createLabel(c, "by Application Name:");
    mAppNameFilterText = new Text(c, SWT.BORDER);
    mAppNameFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mAppNameFilterText.setText(mAppName);

    createLabel(c, "by Log Level:");
    mLogLevelCombo = new Combo(c, SWT.READ_ONLY | SWT.DROP_DOWN);
    mLogLevelCombo.setItems(getLogLevels().toArray(new String[0]));
    mLogLevelCombo.select(getLogLevels().indexOf(mLogLevel));

    /* call validateDialog() whenever user modifies any text field */
    ModifyListener m =
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent arg0) {
            DialogStatus status = validateDialog();
            mOkButton.setEnabled(status.valid);
            setErrorMessage(status.message);
          }
        };
    mFilterNameText.addModifyListener(m);
    mTagFilterText.addModifyListener(m);
    mTextFilterText.addModifyListener(m);
    mPidFilterText.addModifyListener(m);
    mAppNameFilterText.addModifyListener(m);

    return c;
  }
  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();
  }
 public void refresh() {
   IRooInstall defaultInstall =
       RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall();
   if (defaultInstall != null) {
     useDefault.setText(
         NewRooWizardMessages.bind(
             NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallation,
             defaultInstall.getName()));
   } else {
     setErrorMessage(
         NewRooWizardMessages.NewRooProjectWizardPageOne_noRooInstallationConfigured);
     setPageComplete(false);
     useDefault.setText(
         NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallationNoCurrent);
   }
   rooInstallCombo.setItems(
       RooCoreActivator.getDefault().getInstallManager().getAllInstallNames());
   String[] names = rooInstallCombo.getItems();
   for (int i = 0; i < names.length; i++) {
     if (RooCoreActivator.getDefault().getInstallManager().getRooInstall(names[i]).isDefault()) {
       rooInstallCombo.select(i);
       break;
     }
   }
   fireEvent();
 }
  /*
   * @see PreferencePage#performDefaults()
   */
  @Override
  protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
      Button button = fCheckBoxes.get(i);
      String key = (String) button.getData();
      button.setSelection(store.getDefaultBoolean(key));
    }
    for (int i = 0; i < fRadioButtons.size(); i++) {
      Button button = fRadioButtons.get(i);
      String[] info = (String[]) button.getData();
      button.setSelection(info[1].equals(store.getDefaultString(info[0])));
    }
    for (int i = 0; i < fTextControls.size(); i++) {
      Text text = fTextControls.get(i);
      String key = (String) text.getData();
      text.setText(store.getDefaultString(key));
    }
    if (fJRECombo != null) {
      fJRECombo.select(store.getDefaultInt(CLASSPATH_JRELIBRARY_INDEX));
    }

    validateFolders();
    super.performDefaults();
  }
  /**
   * Pick the previous encoding preference else default to NSSTRINGENCODING.NSUTF8StringEncoding
   *
   * @param c
   */
  public void selectNSStringEncodingPreference(Combo c) {
    String previousEncoding = this.getDialogSettings().get(NSSTRING_ENCODING_KEY);

    if (previousEncoding != null && previousEncoding.length() > 0) {
      int i = 0;
      for (NSSTRINGENCODING entry : NSSTRINGENCODING.values()) {
        if (previousEncoding.equals(entry.getDisplayString())) {
          c.select(i);
          return;
        }
        i++;
      }
    }
    // default
    c.select(0);
  }
Beispiel #20
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();
  }
Beispiel #21
0
 private void loadPreferences() {
   pingerRegistry.checkSelectedPinger();
   maxThreadsText.setText(Integer.toString(scannerConfig.maxThreads));
   threadDelayText.setText(Integer.toString(scannerConfig.threadDelay));
   String[] pingerNames = pingerRegistry.getRegisteredNames();
   for (int i = 0; i < pingerNames.length; i++) {
     if (scannerConfig.selectedPinger.equals(pingerNames[i])) {
       pingersCombo.select(i);
     }
   }
   pingingCountText.setText(Integer.toString(scannerConfig.pingCount));
   pingingTimeoutText.setText(Integer.toString(scannerConfig.pingTimeout));
   deadHostsCheckbox.setSelection(scannerConfig.scanDeadHosts);
   skipBroadcastsCheckbox.setSelection(scannerConfig.skipBroadcastAddresses);
   portTimeoutText.setText(Integer.toString(scannerConfig.portTimeout));
   adaptTimeoutCheckbox.setSelection(scannerConfig.adaptPortTimeout);
   minPortTimeoutText.setText(Integer.toString(scannerConfig.minPortTimeout));
   minPortTimeoutText.setEnabled(scannerConfig.adaptPortTimeout);
   portsText.setText(scannerConfig.portString);
   addRequestedPortsCheckbox.setSelection(scannerConfig.useRequestedPorts);
   notAvailableText.setText(scannerConfig.notAvailableText);
   notScannedText.setText(scannerConfig.notScannedText);
   displayMethod[guiConfig.displayMethod.ordinal()].setSelection(true);
   showInfoCheckbox.setSelection(guiConfig.showScanStats);
   askConfirmationCheckbox.setSelection(guiConfig.askScanConfirmation);
 }
Beispiel #22
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);
  }
  private Composite addOrderEntryChoices(Composite buttonComposite) {
    Label enterLabel = new Label(buttonComposite, SWT.NONE);
    enterLabel.setText(CodeInsertionDialog.insertionPoint);
    if (!enableInsertPosition) enterLabel.setEnabled(false);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    enterLabel.setLayoutData(gd);

    final Combo enterCombo = new Combo(buttonComposite, SWT.READ_ONLY);
    enterCombo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT);
    if (!enableInsertPosition) enterCombo.setEnabled(false);
    enterCombo.setItems(fLabels.toArray(new String[fLabels.size()]));
    enterCombo.select(currentPositionIndex);

    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertWidthInCharsToPixels(60);
    enterCombo.setLayoutData(gd);
    enterCombo.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            int index = enterCombo.getSelectionIndex();
            setInsertPosition(index);
            System.out.println(getElementPosition().toString());
          }
        });

    return buttonComposite;
  }
  private void refresh(boolean fromText) {
    String loc = comboDataBase.getText();
    int index = -1;
    for (int i = 0; i < recent.size(); ++i)
      if (recent.get(i).getValue1().equals(loc)) {
        index = i;
        break;
      }
    int lang;
    if (index >= 0 && fromText) {
      lang = recent.get(index).getValue2();
      comboLanguage.select(lang);
    } else {
      lang = comboLanguage.getSelectionIndex();
      if (lang < 0) return;
    }

    text.setText(_text[lang]);
    labelDataBase.setText(_database[lang]);
    buttonBrowse.setText(_browse[lang]);
    labelLanguage.setText(_language[lang]);
    buttonOk.setText(_ok[lang]);
    buttonCancel.setText(_cancel[lang]);
    getDialogPanel().layout(true, true);
    resize();
  }
  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();
  }
  /**
   * Pick the previous encoding preference else default to HTML.TRANSITIONAL_XHTML10
   *
   * @param c
   */
  public void selectHTMLDocTypePreference(Combo c) {
    String previousDocType = this.getDialogSettings().get(HTML_DOCTYPE_KEY);

    if (previousDocType != null && previousDocType.length() > 0) {
      int i = 0;
      for (HTML entry : HTML.values()) {
        if (previousDocType.equals(entry.getDisplayString())) {
          c.select(i);
          return;
        }
        i++;
      }
    }
    // default
    c.select(3);
  }
  protected void updateStubs() {
    ILiferayRuntimeStub[] stubs = LiferayServerCore.getRuntimeStubs();

    if (CoreUtil.isNullOrEmpty(stubs)) {
      return;
    }

    String[] names = new String[stubs.length];

    LiferayRuntimeStubDelegate delegate = getStubDelegate();

    String stubId = delegate.getRuntimeStubTypeId();

    int stubIndex = -1;

    for (int i = 0; i < stubs.length; i++) {
      names[i] = stubs[i].getName();
      if (stubs[i].getRuntimeStubTypeId().equals(stubId)) {
        stubIndex = i;
      }
    }

    comboRuntimeStubType.setItems(names);

    if (stubIndex >= 0) {
      comboRuntimeStubType.select(stubIndex);
    }
  }
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent());
    shell.setSize(334, 100);
    shell.setText(getText());
    shell.setLayout(new GridLayout(2, false));

    combo = new Combo(shell, SWT.READ_ONLY);
    combo.setItems(options);
    combo.select(0);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Button btnNewButton = new Button(shell, SWT.NONE);
    btnNewButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = combo.getText();
            shell.close();
          }
        });
    btnNewButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    btnNewButton.setText("Select");

    Button btnNewButton_1 = new Button(shell, SWT.NONE);
    btnNewButton_1.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = null;
            shell.close();
          }
        });
    btnNewButton_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    btnNewButton_1.setText("Cancel");
  }
  @Override
  public void createControl(Composite parent) {
    // Create filtered list component
    fLocaleFilter = new FilteredListComponent(fModelLocalesTable, new LocaleLabelProvider(), this);
    Composite container = fLocaleFilter.createFilteredListComponent(parent);

    createAllLocalesCheckbox(container);

    createLocaleGroupArea(container);

    setControl(container);
    Dialog.applyDialogFont(container);

    allLocalesCheckboxSelectionChanged();
    groupCheckboxSelectionChanged();

    try {
      int selectedIndex = getDialogSettings().getInt(SELECTED_GROUP);
      fLocaleGroupCombo.select(selectedIndex);
    } catch (NumberFormatException e) {
    }

    String pattern = not_null(getDialogSettings().get(FILTER_PATTERN), "");
    fLocaleFilter.fFilterText.setText(pattern);
  }
Beispiel #30
0
 public static Combo createEncodingCombo(Composite parent, String curCharset) {
   if (curCharset == null) {
     curCharset = GeneralUtils.getDefaultFileEncoding();
   }
   Combo encodingCombo = new Combo(parent, SWT.DROP_DOWN);
   encodingCombo.setVisibleItemCount(30);
   SortedMap<String, Charset> charsetMap = Charset.availableCharsets();
   int index = 0;
   int defIndex = -1;
   for (String csName : charsetMap.keySet()) {
     Charset charset = charsetMap.get(csName);
     encodingCombo.add(charset.displayName());
     if (charset.displayName().equalsIgnoreCase(curCharset)) {
       defIndex = index;
     }
     if (defIndex < 0) {
       for (String alias : charset.aliases()) {
         if (alias.equalsIgnoreCase(curCharset)) {
           defIndex = index;
         }
       }
     }
     index++;
   }
   if (defIndex >= 0) {
     encodingCombo.select(defIndex);
   } else {
     log.warn("Charset '" + curCharset + "' is not recognized"); // $NON-NLS-1$ //$NON-NLS-2$
   }
   return encodingCombo;
 }