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);
  }
 /**
  * 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 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);
   }
 }
Example #4
0
  private void initializeState() {
    fLaunchConfigCombo.setEnabled(false);
    if (fLaunchConfigCombo.getItemCount() > 0)
      fLaunchConfigCombo.setText(fLaunchConfigCombo.getItem(0));

    if (fModel != null && fModel.getPluginBase().getId() != null) {
      IPluginExtension[] extensions = fModel.getPluginBase().getExtensions();
      for (int i = 0; i < extensions.length; i++) {
        String point = extensions[i].getPoint();
        if ("org.eclipse.core.runtime.products".equals(point)) { // $NON-NLS-1$
          String id = extensions[i].getId();
          if (id != null) {
            String full = fModel.getPluginBase().getId() + "." + id; // $NON-NLS-1$
            if (fProductCombo.indexOf(full) != -1) {
              fProductCombo.setText(full);
              fProductButton.setSelection(true);
              return;
            }
          }
        }
      }
    }

    fBasicButton.setSelection(true);

    fProductCombo.setEnabled(false);
    if (fProductCombo.getItemCount() > 0) fProductCombo.setText(fProductCombo.getItem(0));
  }
Example #5
0
  /** Stores it current configuration in the dialog store. */
  private void writeConfiguration() {
    IDialogSettings s = getDialogSettings();
    s.put(STORE_CASE_SENSITIVE, fIsCaseSensitive);
    s.put(STORE_IS_REG_EX_SEARCH, fIsRegExSearch);
    s.put(STORE_SEARCH_DERIVED, fSearchDerived);

    int historySize = Math.min(fPreviousSearchPatterns.size(), HISTORY_SIZE);
    s.put(STORE_HISTORY_SIZE, historySize);
    for (int i = 0; i < historySize; i++) {
      IDialogSettings histSettings = s.addNewSection(STORE_HISTORY + i);
      SearchPatternData data = fPreviousSearchPatterns.get(i);
      data.store(histSettings);
    }

    IDialogSettings extensionsSettings = s.addNewSection(STORE_EXTENSIONS);
    extensionsSettings.put(Integer.toString(0), fExtensions.getText());
    Set<String> extensions = new HashSet<String>(HISTORY_SIZE);
    extensions.add(fExtensions.getText());
    int length = Math.min(fExtensions.getItemCount(), HISTORY_SIZE - 1);
    int j = 1;
    for (int i = 0; i < length; i++) {
      String extension = fExtensions.getItem(i);
      if (extensions.add(extension)) {
        extensionsSettings.put(Integer.toString(j++), extension);
      }
    }
  }
 private boolean validateLanguage(String language) {
   String errorMessage = null;
   boolean valid = true;
   if (comboLanguage.getItemCount() == 1) return true;
   if (!isValidFormat(language)) {
     errorMessage = MESSAGE_LANGUAGE_SUPPORT;
     valid = false;
   }
   if (comboLanguage.getItemCount() == 0) {
     errorMessage = MESSAGE_PROJECT_COMPOSER;
     valid = false;
     languageDirty = true;
   }
   if (languageDirty) setErrorMessage(errorMessage);
   return valid;
 }
  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();
  }
  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();
  }
 @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;
     }
   }
 }
  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"));
    }
  }
  /** 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();
  }
  @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 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$
    }
  }
  /**
   * create Label and Combo width a Array of String.
   *
   * @param parent
   * @param labelStr
   * @param tip
   * @param item
   * @param horizontalSpan
   * @param isFill
   * @param style
   */
  private void createLabelledCombo(
      final Composite parent,
      final String labelStr,
      final String tip,
      final String[] item,
      int horizontalSpan,
      boolean isFill,
      int style) {

    // label
    label = new Label(parent, SWT.LEFT);
    label.setText(labelStr);
    label.addListener(
        SWT.MouseEnter,
        new Listener() {

          public void handleEvent(final Event e) {
            checkbox.forceFocus();
          }
        });

    // checkbox
    checkbox = new Button(parent, SWT.CHECK);

    // combo
    GridData gridData;
    if (isFill) {
      gridData = new GridData(GridData.FILL_HORIZONTAL);
    } else {
      gridData = new GridData();
    }
    gridData.horizontalSpan = horizontalSpan;
    combo = new Combo(parent, style);
    combo.setLayoutData(gridData);
    combo.setSize(A_100, A_20);

    for (int i = 0; i < item.length; i++) {
      combo.add(item[i]);
    }
    int visibleItemCount = combo.getItemCount();
    if (visibleItemCount > MAX_VISIBLE_ITEM_COUNT) {
      visibleItemCount = MAX_VISIBLE_ITEM_COUNT;
    }
    combo.setVisibleItemCount(visibleItemCount);

    if (tip != null) {
      combo.setToolTipText(tip);
    }
    combo.setEnabled(false);

    addControls(parent);
  }
Example #15
0
 public static boolean setComboSelection(Combo combo, String value) {
   if (value == null) {
     return false;
   }
   int count = combo.getItemCount();
   for (int i = 0; i < count; i++) {
     if (value.equals(combo.getItem(i))) {
       combo.select(i);
       return true;
     }
   }
   return false;
 }
Example #16
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public void setVisible(boolean visible) {
   super.setVisible(visible);
   if (visible) {
     if (initialObjectField.getItemCount() == 1) {
       initialObjectField.clearSelection();
       encodingField.setFocus();
     } else {
       encodingField.clearSelection();
       initialObjectField.setFocus();
     }
   }
 }
Example #17
0
  /*
   * Event Handlers
   */
  private void handleConfigSelection() {
    // If there is nothing in config selection widget just bail
    if (configSelector.getItemCount() == 0) return;
    int selectionIndex = configSelector.getSelectionIndex();
    if (selectionIndex == -1) return;
    if (cfgDescs == null || cfgDescs.length == 0) return;

    // Check if the user has selected the "all / multiple" configuration
    if (selectionIndex >= cfgDescs.length) {
      if (selectionIndex == cfgDescs.length) { // all
        multiCfgs = cfgDescs;
      } else { // multiple
        // Check previous state of variables figuring out if need to pop up selection dialog
        // areCfgsStillThere() covers deletions by a user in Manage Configurations dialog
        boolean enterMultiCfgsDialog =
            (multiCfgs == null) || (multiCfgs == cfgDescs) || !areCfgsStillThere(multiCfgs);
        if (enterMultiCfgsDialog) {
          ICConfigurationDescription[] mcfgs =
              ConfigMultiSelectionDialog.select(cfgDescs, parentComposite.getShell());
          if (mcfgs == null || mcfgs.length == 0) {
            // return back to previous selection
            int cfgIndex = -1;
            if (multiCfgs == cfgDescs) { // return to choice "All"
              cfgIndex = cfgDescs.length;
            } else {
              cfgIndex = getCfgIndex(lastSelectedCfg);
            }
            configSelector.select(cfgIndex);
            return;
          }
          multiCfgs = mcfgs;
        }
      }
      lastSelectedCfg = null;

      cfgChanged(MultiItemsHolder.createCDescription(multiCfgs));
      return;
    }
    multiCfgs = null;

    String id1 = getResDesc() == null ? null : getResDesc().getId();
    lastSelectedCfg = cfgDescs[selectionIndex];
    String id2 = lastSelectedCfg.getId();
    if (id2 != null && !id2.equals(id1)) {
      cfgChanged(lastSelectedCfg);
    }
  }
Example #18
0
 public static void handleHistoryItems(Combo combo, int maxItem) {
   String text = combo.getText();
   String[] items = combo.getItems();
   boolean found = false;
   for (String string : items) {
     if (string.equalsIgnoreCase(text)) {
       found = true;
       break;
     }
   }
   if (!found) {
     combo.add(text, 0);
     while (combo.getItemCount() > maxItem) {
       combo.remove(maxItem);
     }
   }
 }
  public void updateChannelsCombo() {
    for (int i = 0; i < 255; i++) {
      String key = getKey(String.valueOf(i));
      if (raptorPreferenceStore.contains(key)) {
        boolean contains = false;
        for (int j = 0; j < channels.getItemCount(); j++) {
          if (channels.getItem(j).equals(String.valueOf(i))) {
            contains = true;
            break;
          }
        }

        if (!contains) {
          channels.add(String.valueOf(i));
        }
      }
    }
  }
 /*
  * Select the default server.
  */
 private void selectDefaultServer(ILaunchConfiguration configuration) throws CoreException {
   if (serverCombo != null && serverCombo.getItemCount() > 0) {
     // Select the default server
     String projectName =
         configuration.getAttribute(IPHPDebugConstants.PHP_Project, (String) null);
     IProject project = null;
     if (projectName != null) {
       project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
     }
     Server defaultServer = ServersManager.getDefaultServer(project);
     int nameIndex = serverCombo.indexOf(defaultServer.getName());
     if (nameIndex > -1) {
       serverCombo.select(nameIndex);
     } else {
       serverCombo.select(0);
     }
     server = ServersManager.getServer(serverCombo.getText());
   }
 }
  @Override
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout();
    int ncol = 3;
    gl.numColumns = ncol;
    GridData gridData = new GridData();
    new Label(composite, SWT.NONE).setText("Diagram Name:");
    diagramName = new Text(composite, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = ncol - 1;
    diagramName.setLayoutData(gridData);
    gridData.horizontalAlignment = GridData.BEGINNING;
    IWizardPage prePage = this.getPreviousPage();
    if (prePage instanceof WizardNewFileCreationPage) {
      WizardNewFileCreationPage p = (WizardNewFileCreationPage) prePage;
      String filename = p.getFileName();
      String subString = filename.substring(0, filename.length() - 18);
      diagramName.setText(subString);
    }
    gridData.widthHint = GridData.HORIZONTAL_ALIGN_FILL;
    gridData.minimumWidth = GridData.HORIZONTAL_ALIGN_FILL;
    new Label(composite, SWT.NONE).setText("NamespaceURI:");
    namespaceURI = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    for (String s : RegistryUtil.getNamepsaceURIS()) {
      namespaceURI.add(s);
    }
    namespaceURI.setLayoutData(gridData);
    namespaceURI.addListener(SWT.Selection, new MyListener());

    new Label(composite, SWT.NONE).setText("Connection Visualization:");
    connectionVisualization = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    for (MappingVisualization m : MappingVisualization.values()) {
      connectionVisualization.add(m.getLiteral());
    }
    if (connectionVisualization.getItemCount() > 0) {
      connectionVisualization.select(0);
    }
    connectionVisualization.setLayoutData(gridData);
    composite.setLayout(gl);
    setControl(composite);
  }
  /** Called when a server is selected. This method should not be called directly. */
  protected void handleServerSelection() {
    int numEntries = serverCombo.getItemCount();
    int index = serverCombo.getSelectionIndex();

    if (!servers.isEmpty()) {
      Object obj = servers.get(serverCombo.getSelectionIndex());
      if (obj != null && obj instanceof Server) {
        server = servers.get(serverCombo.getSelectionIndex());
        initializeURLControl();
      }
    }

    if (server == null && (index + 1) != numEntries)
      setErrorMessage(
          PHPServerUIMessages.getString("ServerTab.noSelectedServerError")); // $NON-NLS-1$
    else {
      setErrorMessage(null);
    }
    updateLaunchConfigurationDialog();
  }
Example #23
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);
  }
  public void populateCustomUIPanel(Shell dialog) {
    ArrayList<String> customNames = new ArrayList<String>();
    for (int i = 0; i < customUIPanels.size(); i++) {
      CustomVfsUiPanel panel = customUIPanels.get(i);
      if (panel.getVfsScheme().equalsIgnoreCase("file")
          || schemeRestrictions == null
          || isRestrictedTo(panel.getVfsScheme())) {
        if (panel.getVfsScheme().equalsIgnoreCase("file") && !showFileScheme) {
          continue;
        }
        customNames.add(panel.getVfsSchemeDisplayText());
      }
    }

    customUIPicker.setItems(customNames.toArray(new String[] {}));
    hideCustomPanelChildren();

    // hide entire panel if no customizations
    if (customNames.size() == 0) {
      customUIPanel.setParent(fakeShell);
    } else {
      if (customNames.size() == 1 && "file".equals(customNames.get(0))) {
        customUIPanel.setParent(fakeShell);
      } else {
        String initialSchemeDisplayText = initialScheme;
        for (int i = 0; i < customUIPanels.size(); i++) {
          if (customUIPanels.get(i).getVfsScheme().equalsIgnoreCase(initialScheme)) {
            initialSchemeDisplayText = customUIPanels.get(i).getVfsSchemeDisplayText();
            break;
          }
        }
        for (int i = 0; i < customUIPicker.getItemCount(); i++) {
          if (customUIPicker.getItem(i).equalsIgnoreCase(initialSchemeDisplayText)) {
            customUIPicker.select(i);
            customUIPicker.notifyListeners(SWT.Selection, null);
          }
        }
      }
    }
  }
  @Override
  public void init() {

    if (oldUserDB != null) {

      selGroupName = oldUserDB.getGroup_name();
      textDisplayName.setText(oldUserDB.getDisplay_name());
      comboOperationType.setText(
          DBOperationType.valueOf(oldUserDB.getOperation_type()).getTypeName());

      textHost.setText(oldUserDB.getHost());
      textUser.setText(oldUserDB.getUsers());
      textPassword.setText(oldUserDB.getPasswd());
      textDatabase.setText(oldUserDB.getDb());
      textPort.setText(oldUserDB.getPort());
    } else if (ApplicationArgumentUtils.isTestMode()) {

      textDisplayName.setText("Sample Oracle 10g");

      textHost.setText(Messages.OracleLoginComposite_0);
      textUser.setText(Messages.OracleLoginComposite_1);
      textPassword.setText(Messages.OracleLoginComposite_2);
      textDatabase.setText(Messages.OracleLoginComposite_3);
      textPort.setText(Messages.OracleLoginComposite_4);
    }

    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);
        }
      }
    }
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  protected Control createDialogArea(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(4, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gridLayout.horizontalSpacing =
        convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    content.setLayout(gridLayout);
    content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    Label label = new Label(content, SWT.NONE);
    label.setText(Messages.CustomPeriodDialog_BeginDate);
    begin = new Combo(content, SWT.READ_ONLY);
    begin.setVisibleItemCount(25);

    label = new Label(content, SWT.NONE);
    label.setText(Messages.CustomPeriodDialog_EndDate);
    end = new Combo(content, SWT.READ_ONLY);
    end.setVisibleItemCount(25);

    int first = -1, last = -1;
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); // $NON-NLS-1$
    for (int i = 0; i < history.size(); i++) {
      Bar bar = (Bar) history.get(i);
      begin.add(dateFormat.format(bar.getDate()));
      end.add(dateFormat.format(bar.getDate()));
      if (first == -1
          && beginDate != null
          && (bar.getDate().equals(beginDate) || bar.getDate().after(beginDate))) first = i;
      if (last == -1
          && endDate != null
          && (bar.getDate().equals(endDate) || bar.getDate().after(endDate))) last = i;
    }
    begin.select(first != -1 ? first : 0);
    end.select(last != -1 ? last : end.getItemCount() - 1);

    return content;
  }
Example #27
0
  private boolean validateFeature(String feature) {
    String errorMessage = null;
    boolean valid = true;
    if (comboFeature.getItemCount() == 1) {
      return true;
    }
    if (container == null) {
      return false;
    }

    if (feature.length() == 0) {
      errorMessage = MESSAGE_FEATURE_SELECTED;
      valid = false;
    }
    if (!sourceFolder.isAccessible()) {
      errorMessage = MESSAGE_FEATURE_FOLDER;
      valid = false;
    }

    if (featureDirty) setErrorMessage(errorMessage);
    return valid;
  }
  public void preselectCamelVersionForRuntime(String runtimeCamelVersion) {
    if (Widgets.isDisposed(camelVersionCombo)) {
      return;
    }

    if (UNKNOWN_CAMEL_VERSION.equals(runtimeCamelVersion)) {
      camelVersionCombo.setEnabled(true);
    } else {
      List<String> compatibleVersions =
          Arrays.stream(camelVersionCombo.getItems())
              .filter(camelVersion -> isCompatible(runtimeCamelVersion, camelVersion))
              .collect(Collectors.toList());
      if (!compatibleVersions.isEmpty()) {
        if (compatibleVersions.contains(runtimeCamelVersion)) {
          camelVersionCombo.setText(runtimeCamelVersion);
        } else {
          Collections.sort(compatibleVersions);
          camelVersionCombo.setText(compatibleVersions.get(compatibleVersions.size() - 1));
        }
      } else {
        camelVersionCombo.select(Math.max(0, camelVersionCombo.getItemCount() - 1));
      }
    }
  }
Example #29
0
/*
Example #30
0
    /**
     *
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated
     */
    public void createControl(Composite parent) {
      Composite composite = new Composite(parent, SWT.NONE);
      {
        GridLayout layout = new GridLayout();
        layout.numColumns = 1;
        layout.verticalSpacing = 12;
        composite.setLayout(layout);

        GridData data = new GridData();
        data.verticalAlignment = GridData.FILL;
        data.grabExcessVerticalSpace = true;
        data.horizontalAlignment = GridData.FILL;
        composite.setLayoutData(data);
      }

      Label containerLabel = new Label(composite, SWT.LEFT);
      {
        containerLabel.setText(WebPageEditorPlugin.INSTANCE.getString("_UI_ModelObject"));

        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        containerLabel.setLayoutData(data);
      }

      initialObjectField = new Combo(composite, SWT.BORDER);
      {
        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        initialObjectField.setLayoutData(data);
      }

      for (String objectName : getInitialObjectNames()) {
        initialObjectField.add(getLabel(objectName));
      }

      if (initialObjectField.getItemCount() == 1) {
        initialObjectField.select(0);
      }
      initialObjectField.addModifyListener(validator);

      Label encodingLabel = new Label(composite, SWT.LEFT);
      {
        encodingLabel.setText(WebPageEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));

        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        encodingLabel.setLayoutData(data);
      }
      encodingField = new Combo(composite, SWT.BORDER);
      {
        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        encodingField.setLayoutData(data);
      }

      for (String encoding : getEncodings()) {
        encodingField.add(encoding);
      }

      encodingField.select(0);
      encodingField.addModifyListener(validator);

      setPageComplete(validatePage());
      setControl(composite);
    }