Example #1
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));
  }
 protected void initializeServerControl(ILaunchConfiguration configuration) {
   try {
     String serverName = configuration.getAttribute(Server.NAME, ""); // $NON-NLS-1$
     if (serverName != null && !serverName.equals("")) { // $NON-NLS-1$
       server = ServersManager.getServer(serverName);
       if (server == null) { // server no longer exists
         setErrorMessage(
             PHPServerUIMessages.getString("ServerTab.invalidServerError")); // $NON-NLS-1$
         selectDefaultServer(configuration);
       } else {
         serverCombo.setText(server.getName());
       }
     } else {
       selectDefaultServer(configuration);
     }
     // flag should only be set if launch has been attempted on the
     // config
     if (configuration.getAttribute(READ_ONLY, false)) {
       serverCombo.setEnabled(false);
     }
     boolean enabled = configuration.getAttribute(SERVER_ENABLED, true);
     serverCombo.setEnabled(enabled);
     createNewServer.setEnabled(enabled);
   } catch (Exception e) {
   }
 }
Example #3
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;
 }
Example #4
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new RowLayout());
   Combo combo = new Combo(shell, SWT.NONE);
   combo.setItems(new String[] {"A-1", "B-1", "C-1"});
   Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
   text.setText("some text");
   combo.addListener(
       SWT.DefaultSelection,
       new Listener() {
         public void handleEvent(Event e) {
           System.out.println(e.widget + " - Default Selection");
         }
       });
   text.addListener(
       SWT.DefaultSelection,
       new Listener() {
         public void handleEvent(Event e) {
           System.out.println(e.widget + " - Default Selection");
         }
       });
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Example #5
0
 @Nullable
 public static String getComboSelection(Combo combo) {
   int selectionIndex = combo.getSelectionIndex();
   if (selectionIndex < 0) {
     return null;
   }
   return combo.getItem(selectionIndex);
 }
 private void createUICategoryCombo(Composite parent) {
   int style = SWT.READ_ONLY | SWT.BORDER;
   fCategoryCombo = new Combo(parent, style);
   GridData data = new GridData(GridData.FILL_HORIZONTAL);
   fCategoryCombo.setLayoutData(data);
   fCategoryCombo.add(CSWizardMessages.RegisterCSWizardPage_none);
   fCategoryCombo.setText(CSWizardMessages.RegisterCSWizardPage_none);
 }
Example #7
0
 /**
  * @param combo
  * @param itemList
  * @return Array of combo items
  */
 public static String[] setComboItems(Combo combo, List<String> itemList, String defaultItemText) {
   String[] itemArray = itemList.toArray(new String[itemList.size()]);
   Arrays.sort(itemArray);
   combo.setItems(itemArray);
   if (defaultItemText != null && defaultItemText.length() > 0) {
     combo.setText(defaultItemText);
   }
   return itemArray;
 }
Example #8
0
  public static Combo createLabelCombo(Composite parent, String label, int style) {
    Label labelControl = createControlLabel(parent, label);
    // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Combo combo = new Combo(parent, style);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return combo;
  }
Example #9
0
  /**
   * Must be called after createProjectDropDownMenu, since we need to figure out the selected
   * project.
   *
   * @author stolz
   */
  protected void createProductDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Product", 1, 1, GridData.FILL_HORIZONTAL);

    productDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    productDropDown.setLayoutData(gridData);

    productDropDown.addListener(SWT.Selection, myListener);
  }
  /** This method initializes main controls of the main window */
  private void initControlsArea(
      final Composite controlsArea,
      final Combo feederSelectionCombo,
      final Button startStopButton,
      final StartStopScanningAction startStopScanningAction,
      final ToolsActions.Preferences preferencesListener,
      final ToolsActions.ChooseFetchers chooseFetchersListsner) {
    controlsArea.setLayoutData(
        LayoutHelper.formData(
            new FormAttachment(feederArea),
            new FormAttachment(100),
            new FormAttachment(0),
            new FormAttachment(feederArea, 0, SWT.BOTTOM)));
    controlsArea.setLayout(LayoutHelper.formLayout(7, 3, 3));

    // steal the height from the second child of the FeederGUI - this must be the first edit box.
    // this results in better visual alignment with FeederGUIs
    Control secondControl = feederRegistry.current().getChildren()[1];
    // initialize global standard button height
    buttonHeight = secondControl.getSize().y + 2;

    // feeder selection combobox
    this.feederSelectionCombo = feederSelectionCombo;
    feederSelectionCombo.pack();
    IPFeederSelectionListener feederSelectionListener = new IPFeederSelectionListener();
    feederSelectionCombo.addSelectionListener(feederSelectionListener);
    // initialize the selected feeder GUI
    feederSelectionCombo.select(guiConfig.activeFeeder);
    feederSelectionCombo.setToolTipText(Labels.getLabel("combobox.feeder.tooltip"));

    // start/stop button
    this.startStopButton = startStopButton;
    shell.setDefaultButton(startStopButton);
    startStopButton.addSelectionListener(startStopScanningAction);

    // traverse the button before the combo (and don't traverse other buttons at all)
    controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo});

    prefsButton = new ToolBar(controlsArea, SWT.FLAT);
    prefsButton.setCursor(prefsButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    ToolItem item = new ToolItem(prefsButton, SWT.PUSH);
    item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.preferences.img")));
    item.setToolTipText(Labels.getLabel("title.preferences"));
    item.addListener(SWT.Selection, preferencesListener);

    fetchersButton = new ToolBar(controlsArea, SWT.FLAT);
    fetchersButton.setCursor(fetchersButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    item = new ToolItem(fetchersButton, SWT.PUSH);
    item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.fetchers.img")));
    item.setToolTipText(Labels.getLabel("title.fetchers.select"));
    item.addListener(SWT.Selection, chooseFetchersListsner);

    feederSelectionListener.widgetSelected(null);
  }
Example #11
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 #12
0
 protected void fillProjectDropDownMenue(String name) {
   List<String> projectNames = getProjectNames();
   int selectedProjectName = 0;
   projectDropDown.removeAll();
   for (int i = 0; i < projectNames.size(); i++) {
     String projectName = projectNames.get(i);
     if (projectName.equals(name)) {
       selectedProjectName = i;
     }
     projectDropDown.add(projectName);
   }
   projectDropDown.select(selectedProjectName);
 }
  private void relayoutControls() {
    boolean twoRowToolbar = Math.abs(feederRegistry.current().getSize().y - buttonHeight * 2) <= 10;

    feederSelectionCombo.setLayoutData(
        LayoutHelper.formData(
            SWT.DEFAULT, buttonHeight, new FormAttachment(0), null, new FormAttachment(0), null));
    if (twoRowToolbar) {
      startStopButton.setLayoutData(
          LayoutHelper.formData(
              feederSelectionCombo.getSize().x,
              Platform.MAC_OS ? SWT.DEFAULT : buttonHeight,
              new FormAttachment(0),
              null,
              new FormAttachment(feederSelectionCombo, 0),
              null));
      prefsButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(feederSelectionCombo),
              null,
              new FormAttachment(feederSelectionCombo, 0, SWT.CENTER),
              null));
      fetchersButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(startStopButton),
              null,
              new FormAttachment(startStopButton, 0, SWT.CENTER),
              null));
    } else {
      startStopButton.setLayoutData(
          LayoutHelper.formData(
              feederSelectionCombo.getSize().x,
              Platform.MAC_OS ? SWT.DEFAULT : buttonHeight,
              new FormAttachment(feederSelectionCombo),
              null,
              new FormAttachment(-1),
              null));
      prefsButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(startStopButton),
              null,
              new FormAttachment(feederSelectionCombo, 0, SWT.CENTER),
              null));
      fetchersButton.setLayoutData(
          LayoutHelper.formData(
              new FormAttachment(prefsButton),
              null,
              new FormAttachment(startStopButton, 0, SWT.CENTER),
              null));
    }
  }
Example #14
0
  public ILaunchConfiguration getSelectedLaunchConfiguration() {
    if (!fLaunchConfigButton.getSelection()) return null;

    String configName = fLaunchConfigCombo.getText();
    try {
      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType type =
          manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
      ILaunchConfigurationType type2 =
          manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
      ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
      ILaunchConfiguration[] configs2 = manager.getLaunchConfigurations(type2);
      ILaunchConfiguration[] configurations =
          new ILaunchConfiguration[configs.length + configs2.length];
      System.arraycopy(configs, 0, configurations, 0, configs.length);
      System.arraycopy(configs2, 0, configurations, configs.length, configs2.length);
      for (int i = 0; i < configurations.length; i++) {
        if (configurations[i].getName().equals(configName)
            && !DebugUITools.isPrivate(configurations[i])) return configurations[i];
      }
    } catch (CoreException e) {
      PDEPlugin.logException(e);
    }
    return null;
  }
Example #15
0
  /**
   * Handle a dialog type combo selection event.
   *
   * @param event the selection event
   */
  void dialogSelected(SelectionEvent event) {

    /* Enable/Disable the buttons */
    String name = dialogCombo.getText();
    boolean isMessageBox = name.equals(ControlExample.getResourceString("MessageBox"));
    boolean isFileDialog = name.equals(ControlExample.getResourceString("FileDialog"));
    okButton.setEnabled(isMessageBox);
    cancelButton.setEnabled(isMessageBox);
    yesButton.setEnabled(isMessageBox);
    noButton.setEnabled(isMessageBox);
    retryButton.setEnabled(isMessageBox);
    abortButton.setEnabled(isMessageBox);
    ignoreButton.setEnabled(isMessageBox);
    iconErrorButton.setEnabled(isMessageBox);
    iconInformationButton.setEnabled(isMessageBox);
    iconQuestionButton.setEnabled(isMessageBox);
    iconWarningButton.setEnabled(isMessageBox);
    iconWorkingButton.setEnabled(isMessageBox);
    noIconButton.setEnabled(isMessageBox);
    saveButton.setEnabled(isFileDialog);
    openButton.setEnabled(isFileDialog);
    multiButton.setEnabled(isFileDialog);

    /* Unselect the buttons */
    if (!isMessageBox) {
      okButton.setSelection(false);
      cancelButton.setSelection(false);
      yesButton.setSelection(false);
      noButton.setSelection(false);
      retryButton.setSelection(false);
      abortButton.setSelection(false);
      ignoreButton.setSelection(false);
    }
  }
 /* (non-Javadoc)
  * @see org.eclipse.swt.widgets.Control#setEnabled(boolean)
  */
 public void setEnabled(boolean enabled) {
   fTree.getControl().setEnabled(enabled);
   if (enabled) {
     updateButtons();
   } else {
     fSelectButton.setEnabled(false);
     fSelectAllButton.setEnabled(false);
     fDeselectButton.setEnabled(false);
     fDeselectAllButton.setEnabled(false);
     fSelectRequiredButton.setEnabled(false);
     fCountLabel.setText(""); // $NON-NLS-1$
   }
   fModeLabel.setEnabled(enabled);
   fPluginModeButton.setEnabled(enabled);
   fFeaureModeButton.setEnabled(enabled);
   fShowLabel.setEnabled(enabled);
   fShowPluginsButton.setEnabled(enabled);
   fShowSourceButton.setEnabled(enabled);
   boolean isPluginMode = !fFeaureModeButton.getSelection();
   fGroupLabel.setEnabled(enabled && isPluginMode);
   if (fGroupCombo != null) {
     fGroupCombo.setEnabled(enabled && isPluginMode);
   } else {
     fGroupComboPart.setEnabled(enabled && isPluginMode);
   }
 }
Example #17
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);
 }
Example #18
0
 protected IProject getSelectedProject() {
   final int idx = projectDropDown.getSelectionIndex();
   if (idx == -1) return null;
   String projN = getProjectNames().get(idx);
   IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projN);
   return proj;
 }
Example #19
0
  private void setCategories(Combo categoryCombo) {
    // set default category for combo box
    categoryCombo.add("Any Category");
    categoryCombo.setText("Any Category");
    categoryKey = "any";

    categories = getCategories();

    if (categories != null) {
      Iterator categoriesIterator = categories.iterator();
      while (categoriesIterator.hasNext()) {
        ConceptType category = (ConceptType) categoriesIterator.next();
        String name = category.getName();
        categoryCombo.add(name);
      }
    }
    return;
  }
 private void createUIListenersCategoryCombo() {
   fCategoryCombo.addModifyListener(
       new ModifyListener() {
         @Override
         public void modifyText(ModifyEvent e) {
           fDataCategoryName = fCategoryCombo.getText();
         }
       });
 }
 public void createFileFilterPanel(Shell dialog) {
   Composite filterPanel = new Composite(dialog, SWT.NONE);
   GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   filterPanel.setLayoutData(gridData);
   filterPanel.setLayout(new GridLayout(3, false));
   // create filter label
   Label filterLabel = new Label(filterPanel, SWT.NONE);
   filterLabel.setText(Messages.getString("VfsFileChooserDialog.filter")); // $NON-NLS-1$
   gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
   filterLabel.setLayoutData(gridData);
   // create file filter combo
   fileFilterCombo = new Combo(filterPanel, SWT.READ_ONLY);
   gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   fileFilterCombo.setLayoutData(gridData);
   fileFilterCombo.setItems(fileFilterNames);
   fileFilterCombo.addSelectionListener(this);
   fileFilterCombo.select(0);
 }
 /*
  * 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());
   }
 }
Example #23
0
  protected void createProjectDropDownMenu(TabListener myListener, Composite comp) {
    Group group = createGroup(comp, "ABS Project", 1, 1, GridData.FILL_HORIZONTAL);

    projectDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    projectDropDown.setLayoutData(gridData);

    projectDropDown.addListener(SWT.Selection, myListener);
    /* Refresh products everytime the project is changed */
    projectDropDown.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            fillProductDropDownMenue(null);
            updateErrors();
          }
        });
  }
  /** 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();
  }
  private void handleWidgetSelectedCategoryButton() {
    // Create a dialog allowing the user to input the category name
    NewCategoryNameDialog dialog =
        new NewCategoryNameDialog(PDEUserAssistanceUIPlugin.getActiveWorkbenchShell());
    dialog.create();
    dialog.getShell().setText(CSWizardMessages.RegisterCSWizardPage_descTooltip);

    if (dialog.open() == Window.OK) {
      String newCategoryName = dialog.getNameText();

      if (PDETextHelper.isDefinedAfterTrim(newCategoryName)) {
        String trimmedText = newCategoryName.trim();
        fCategoryCombo.add(trimmedText);
        fCategoryCombo.setText(trimmedText);
        fCategoryCombo.setFocus();
        String id = generateCategoryID(trimmedText);
        fCategoryTrackerUtil.associate(id, trimmedText, CSCategoryTrackerUtil.F_TYPE_NEW_CATEGORY);
      }
    }
  }
 protected void handleConfigureButtonSelected() {
   int selectionIndex = serverCombo.getSelectionIndex();
   Server server = servers.get(selectionIndex);
   String serverName = server.getName();
   Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
   NullProgressMonitor monitor = new NullProgressMonitor();
   ServerEditDialog dialog = new ServerEditDialog(shell, server);
   if (dialog.open() == Window.CANCEL) {
     monitor.setCanceled(true);
     return;
   }
   ServersManager.save();
   String newName = server.getName();
   if (!newName.equals(serverName)) {
     serverCombo.remove(selectionIndex);
     serverCombo.add(newName, selectionIndex);
     serverCombo.select(selectionIndex);
   }
   saveWorkingCopy = true;
   handleServerSelection();
 }
Example #27
0
  /**
   * Creates a combo that controls whether a cursor is set on the registered controls.
   *
   * @return the created combo
   */
  protected Combo createCursorCombo() {
    Composite group = new Composite(styleComp, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    new Label(group, SWT.NONE).setText("Cursor");
    final Combo combo = new Combo(group, SWT.READ_ONLY);
    combo.setItems(SWT_CURSORS);
    combo.select(0);
    combo.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(final SelectionEvent e) {
            String selection = null;
            int index = combo.getSelectionIndex();
            if (index > 0) {
              selection = combo.getItem(index);
            }
            updateCursor(selection);
          }
        });
    return combo;
  }
 /**
  * Process cheatsheet elements with a category attribute
  *
  * @param parentElement
  */
 private void updateUICategoryComboAttribute(IPluginElement element) {
   // Get the category attribute
   IPluginAttribute categoryAttribute = element.getAttribute(F_CS_ELEMENT_CATEGORY);
   // Process the category attribute
   if ((categoryAttribute != null) && PDETextHelper.isDefined(categoryAttribute.getValue())) {
     String id = categoryAttribute.getValue();
     // Check to see if the category ID has been defined
     if (fCategoryTrackerUtil.containsCategoryID(id)) {
       // Update the category combo selection
       String name = fCategoryTrackerUtil.getCategoryName(id);
       fCategoryCombo.setText(name);
     } else {
       // Add the category ID to the combo box (no assoicated name)
       // This can only happen if the category is defined outside of
       // the plug-in the cheat sheet is stored in
       fCategoryCombo.add(id);
       fCategoryCombo.setText(id);
       fCategoryTrackerUtil.associate(id, id, CSCategoryTrackerUtil.F_TYPE_OLD_CATEGORY);
     }
   }
 }
Example #29
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createAdvancedControls(org.eclipse.swt.widgets.Composite)
   */
  protected void createAdvancedControls(Composite parent) {
    fGroup = new Group(parent, SWT.NONE);
    fGroup.setText(PDEUIMessages.ProductFileWizadPage_groupTitle);
    fGroup.setLayout(new GridLayout(2, false));
    fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fBasicButton = new Button(fGroup, SWT.RADIO);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    fBasicButton.setLayoutData(gd);
    fBasicButton.setText(PDEUIMessages.ProductFileWizadPage_basic);

    fProductButton = new Button(fGroup, SWT.RADIO);
    fProductButton.setText(PDEUIMessages.ProductFileWizadPage_existingProduct);
    fProductButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fProductCombo.setEnabled(fProductButton.getSelection());
          }
        });

    fProductCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fProductCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fProductCombo.setItems(TargetPlatform.getProducts());

    fLaunchConfigButton = new Button(fGroup, SWT.RADIO);
    fLaunchConfigButton.setText(PDEUIMessages.ProductFileWizadPage_existingLaunchConfig);
    fLaunchConfigButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fLaunchConfigCombo.setEnabled(fLaunchConfigButton.getSelection());
          }
        });

    fLaunchConfigCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fLaunchConfigCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fLaunchConfigCombo.setItems(getLaunchConfigurations());

    initializeState();
  }
  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);
          }
        }
      }
    }
  }