コード例 #1
0
ファイル: AbstractPage.java プロジェクト: Traveller7/cdt
  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();
  }
コード例 #2
0
  public void createCombos(Composite parent) {
    parent.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(64, 10).create());

    GridData comboGridData = new GridData();
    comboGridData.widthHint = 100;

    Label label = new Label(parent, SWT.None);
    label.setText("Complex");
    complexCombo = new Combo(parent, SWT.READ_ONLY);
    complexCombo.add("true");
    complexCombo.add("false");
    complexCombo.setToolTipText(
        "Flag to indicate data is complex.  If true, data values assumed to be alternating real and complex float values.");
    complexCombo.setLayoutData(comboGridData);

    label = new Label(parent, SWT.None);
    label.setText("Loop");
    loopCombo = new Combo(parent, SWT.READ_ONLY);
    loopCombo.add("true");
    loopCombo.add("false");
    //		loopCombo.setEnabled(false);
    loopCombo.setToolTipText(
        "Do we continue to replay and loop over the input file when we are done or not");
    loopCombo.setLayoutData(comboGridData);
  }
コード例 #3
0
 @Override
 public void widgetDefaultSelected(SelectionEvent e) {
   if (e.getSource().equals(cmbDirectoryLocation)) {
     final String newDirectory = cmbDirectoryLocation.getText();
     if (newDirectory != null && newDirectory.length() > 0) {
       newDirectory.trim();
       addToHistory();
       resetHistory();
       String[] oldDirs = cmbDirectoryLocation.getItems();
       boolean foundEntry = false;
       for (int i = 0; i < oldDirs.length; i++) {
         if (newDirectory.equals(oldDirs[i])) {
           foundEntry = true;
           break;
         }
       }
       if (!foundEntry) {
         if (cmbDirectoryLocation.getItemCount() > 0) cmbDirectoryLocation.add(newDirectory, 0);
         else cmbDirectoryLocation.add(newDirectory);
       }
       resetPlaying(true);
       spawnLoadJob(newDirectory);
       currentDir = newDirectory;
     }
   }
 }
コード例 #4
0
  /** 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);
  }
コード例 #5
0
  public void createControl(Composite parent) {
    Font font = parent.getFont();
    Group group = new Group(parent, SWT.NONE);
    group.setText("Browser:");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayoutData(gd);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    group.setLayout(layout);
    group.setFont(font);

    vjoBrowserType = new Combo(group, SWT.READ_ONLY);

    vjoBrowserType.add("IE"); // IE_6P
    vjoBrowserType.add("FIREFOX"); // Firefox_1P
    vjoBrowserType.select(0);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    vjoBrowserType.setLayoutData(gd);
    vjoBrowserType.setFont(font);

    SelectionListener listener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateLaunchConfigurationDialog();
          }
        };
    vjoBrowserType.addSelectionListener(listener);
  }
  private void populateDoctypeValues() {
    fDocumentTypeIds = new ArrayList();
    // add none first
    fDocumentTypeCombo.add(SELECT_NONE);
    fDocumentTypeIds.add(null);

    HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
    Enumeration e = reg.getEntries();
    while (e.hasMoreElements()) {
      HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
      String publicId = entry.getPublicId();
      String displayName = entry.getDisplayName();
      displayName = displayName != null ? displayName : publicId;

      fDocumentTypeCombo.add(displayName);
      fDocumentTypeIds.add(publicId);

      if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) {
        maxLengthStringInHTMLDocumentTypeRegistry = displayName;
      }

      if (entry.getSystemId() == null) continue; // if HTML entry

      if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
        maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId();
    }
  }
コード例 #7
0
 /**
  * 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]);
 }
コード例 #8
0
  /**
   * Create contents of the wizard.
   *
   * @param parent
   */
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    setControl(container);
    container.setLayout(new GridLayout(2, false));

    Label lblChooseProject = new Label(container, SWT.NONE);
    lblChooseProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblChooseProject.setText("Choose project: ");

    project = new Combo(container, SWT.READ_ONLY);
    project.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            /*
             * set namespace combo to all namespaces in selected project
             */
            ThinklabProject proj = ThinkScape.getProject(project.getText(), false);
            namespace.removeAll();
            for (SemanticAnnotationContainer c : proj.getAnnotationNamespaces()) {
              namespace.add(c.getNamespace());
            }
          }
        });
    project.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblAnnotationNamespace = new Label(container, SWT.NONE);
    lblAnnotationNamespace.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblAnnotationNamespace.setText("Annotation namespace: ");

    namespace = new Combo(container, SWT.BORDER);
    namespace.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    boolean ex = false;
    for (ThinklabProject p : ThinkScape.getProjects()) {
      project.add(p.getName());
      ex = true;
    }

    if (ex) {
      project.select(0);
      /*
       * set namespaces in combo
       */
      ThinklabProject proj = ThinkScape.getProject(project.getText(), false);
      for (SemanticAnnotationContainer c : proj.getAnnotationNamespaces()) {
        namespace.add(c.getNamespace());
      }
    }

    if (!ex) {
      project.setEnabled(false);
      namespace.setEnabled(false);
      this.setErrorMessage("No projects have been created. Create a project first.");
    }
  }
コード例 #9
0
 private Combo createAttributeCombo() {
   final Combo c = new Combo(this, SWT.NONE);
   c.add("sourceTimestamp"); // $NON-NLS-1$
   c.add("entryTimestamp"); // $NON-NLS-1$
   for (final Event.Fields field : Event.Fields.values()) {
     c.add(field.getName());
   }
   c.add(Messages.custom_field);
   c.select(0);
   return c;
 }
コード例 #10
0
 private void initProjectsAndMetamodels() {
   for (IProject project : ((INewRefactoringWizard) getWizard()).getProjects()) {
     projectCombo.add(project.getName());
   }
   Object[] metamodelObjects =
       EPackage.Registry.INSTANCE.keySet().toArray(new Object[EPackage.Registry.INSTANCE.size()]);
   Arrays.sort(metamodelObjects);
   for (Object object : metamodelObjects) {
     metamodelCombo.add(object.toString());
   }
 }
コード例 #11
0
  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);
        }
      }
    }
  }
コード例 #12
0
  /* (non-Javadoc)
   * Method declared on Dialog.
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Font font = parent.getFont();
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    // create message
    if (message != null) {
      Label label = new Label(composite, SWT.WRAP);
      label.setText(message);
      GridData data =
          new GridData(
              GridData.GRAB_HORIZONTAL
                  | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
      data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
      label.setLayoutData(data);
      label.setFont(font);
    }

    combo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
    combo.add(Boolean.TRUE.toString());
    combo.add(Boolean.FALSE.toString());

    GridData gridData =
        new GridData(
            GridData.GRAB_HORIZONTAL
                | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.GRAB_VERTICAL
                | GridData.VERTICAL_ALIGN_FILL);
    gridData.heightHint = 12;
    gridData.widthHint = 30;
    combo.setLayoutData(gridData);
    combo.setFont(font);
    combo.addSelectionListener(
        new SelectionAdapter() {

          /*
           * (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            if (okButton.isEnabled()) {
              return;
            }
            okButton.setEnabled(true);
          }
        });

    return composite;
  }
コード例 #13
0
  private void fillStoredData() {

    if (stepname != null) textStepName.setText(stepname);

    int index =
        addConnectionLine.indexOf(
            meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) addConnectionLine.select(index);

    if (meta.getDimension() != null) {
      comboDimension.add(meta.getDimension());
      comboDimension.select(0);
    }

    buttonBaseElementsOnly.setSelection(meta.getBaseElementsOnly());

    tableViewFields.table.removeAll();
    if (meta.getLevels().size() > 0) {
      for (PaloDimensionLevel level : meta.getLevels()) {
        tableViewFields.add(
            level.getLevelName(),
            String.valueOf(level.getLevelNumber()),
            level.getFieldName(),
            level.getFieldType());
      }
      tableViewFields.setRowNums();
      tableViewFields.optWidth(true);
    }
  }
コード例 #14
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 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;
 }
コード例 #15
0
  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();
  }
コード例 #16
0
  /**
   * The set of available types are different when the constant is a conversion type and when it is
   * not. This method makes sure the types are correct.
   */
  private void normalizeTypes() {
    // processTypeChange = false;
    String selection = cbxType.getText(); // save current selection
    String[] invalidTypes = BuilderUtils.INVALID_CONVERSION_ARG_TYPES;
    boolean conversionType = isConversionType();

    for (int i = 0; i < invalidTypes.length; i++) {
      if (conversionType) {
        if (cbxType.indexOf(invalidTypes[i]) != -1) {
          cbxType.remove(invalidTypes[i]);
        } else {
          // assume if one type is not there then all of them are not there
          break;
        }
      } else {
        if (cbxType.indexOf(invalidTypes[i]) == -1) {
          cbxType.add(invalidTypes[i]);
        } else {
          // assume if one type is there then all of them are there
          break;
        }
      }
    }

    cbxType.setText(selection); // set back to saved selection
    // processTypeChange = true;
  }
コード例 #17
0
 /**
  * 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());
     }
   }
 }
コード例 #18
0
  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();
  }
コード例 #19
0
  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);
  }
コード例 #20
0
  /** 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 void onDeleteClicked() {
    if (selectedConfigsList.getSelectionCount() == 0) {
      return;
    }
    String[] selection = selectedConfigsList.getSelection();
    StringBuilder b = new StringBuilder();
    for (String item : selection) {
      if (b.length() > 0) {
        b.append(", ");
      }
      b.append(item);
    }
    int response =
        ask(
            "Are you shure you want to remove [" + b.toString() + "]?",
            "Removing launch configuration");
    if (response != SWT.YES) {
      return;
    }

    selectedConfigsList.remove(selectedConfigsList.getSelectionIndices());
    for (String item : selection) {
      if (allConfigNames.contains((String) item)) {
        availableConfigsCombo.add(item);
      }
    }
    updateButtonsState();
    updateLaunchConfigurationDialog();
  }
コード例 #22
0
  protected void createServerSelectionControl(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$
    GridLayout ly = new GridLayout(1, false);
    ly.marginHeight = 0;
    ly.marginWidth = 0;
    group.setLayout(ly);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite phpServerComp = new Composite(group, SWT.NONE);
    phpServerComp.setLayout(new GridLayout(4, false));
    phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    phpServerComp.setFont(parent.getFont());

    Label label = new Label(phpServerComp, SWT.WRAP);
    GridData data = new GridData(GridData.BEGINNING);
    data.widthHint = 100;
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$

    serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    serverCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleServerSelection();
          }
        });

    createNewServer =
        createPushButton(
            phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$
    createNewServer.addSelectionListener(fListener);

    configureServers =
        createPushButton(
            phpServerComp,
            PHPServerUIMessages.getString("ServerTab.configure"),
            null); //$NON-NLS-1$
    configureServers.addSelectionListener(fListener);

    servers = new ArrayList<Server>();
    populateServerList(servers);

    // initialize the servers list
    if (!servers.isEmpty()) {
      for (int i = 0; i < servers.size(); i++) {
        Server svr = servers.get(i);
        serverCombo.add(svr.getName());
      }
    }

    // select first item in list
    if (serverCombo.getItemCount() > 0) {
      serverCombo.select(0);
    }

    serverCombo.forceFocus();
  }
コード例 #23
0
 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);
   }
 }
  protected void onSave() {
    try {
      int channelInt = Integer.parseInt(channelName.getText());
      if (channelInt < 0 || channelInt > 256) {
        throw new Exception();
      }
      String key = getKey(String.valueOf(channelInt));
      raptorPreferenceStore.setValue(key, colorSelector.getColorValue());

      boolean channelsHasSelection = false;
      for (int i = 0; i < channels.getItemCount(); i++) {
        if (channels.getItem(i).equals(String.valueOf(channelInt))) {
          channelsHasSelection = true;
          break;
        }
      }

      if (!channelsHasSelection) {
        channels.add(String.valueOf(channelInt));
      }
    } catch (Throwable t) {
      MessageDialog.openInformation(
          Raptor.getInstance().getWindow().getShell(),
          local.getString("alert"),
          local.getString("chatConColP3"));
    }
  }
コード例 #25
0
  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);
  }
コード例 #26
0
  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);
    }
  }
コード例 #27
0
ファイル: CamelSQLComposite.java プロジェクト: punkhorn/tools
  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 populateCSSProfileValues() {
    fProfileIds = new ArrayList();
    // add none first
    fProfileCombo.add(SELECT_NONE);
    fProfileIds.add(null);

    CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
    Iterator i = reg.getProfiles();
    while (i.hasNext()) {
      CSSProfile profile = (CSSProfile) i.next();
      String id = profile.getProfileID();
      String name = profile.getProfileName();
      fProfileCombo.add(name);
      fProfileIds.add(id);
    }
  }
コード例 #29
0
  private void createPoolGroup(Composite comp, ValidationHandler validationHandler) {
    Group poolGroup;
    GridData gd;
    Label label;

    poolGroup = new Group(comp, SWT.SHADOW_NONE);
    poolGroup.setText("Pool");
    poolGroup.setLayout(new GridLayout(2, false));
    gd = new GridData(GridData.FILL_HORIZONTAL);
    poolGroup.setLayoutData(gd);

    label = new Label(poolGroup, SWT.NONE);
    label.setText("Target:");

    targetCombo = new Combo(poolGroup, SWT.READ_ONLY);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.widthHint = convertHorizontalDLUsToPixels(180);
    targetCombo.setLayoutData(gd);
    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target target = (Target) i.next();
      targetCombo.add(target.toString());
    }
    targetCombo.addModifyListener(validationHandler);

    label = new Label(poolGroup, SWT.NONE);
    label.setText("Pool ID:");

    poolIdText = new Text(poolGroup, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    poolIdText.setLayoutData(gd);
    poolIdText.addModifyListener(validationHandler);
  }
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setLocation(location);
    shell.setSize(132, 85);
    shell.setText(getText());

    final Combo combo = new Combo(shell, SWT.NONE);
    combo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println(combo.getItem(combo.getSelectionIndex()));
            MSA structure = worksheet_.getStructure();
            int no = Integer.parseInt(combo.getItem(combo.getSelectionIndex()));
            try {
              element_.setMaterial(structure.getMaterialByNo(no));
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }

            shell.dispose();
          }
        });
    combo.setBounds(0, 0, 100, 40);

    for (Material material : this.worksheet_.getStructure().getMaterials()) {
      combo.add(String.valueOf(material.getNo()));
    }
    //		combo.add("1223");
    //		combo.add("343");

    //		combo.setBounds(20, 10, 88, 23);

  }