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)); }
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; }
/* (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 String getSelectedProduct() { return fProductButton.getSelection() ? fProductCombo.getText() : null; }