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)); }
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); }
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; }
private void createUIListenersCategoryCombo() { fCategoryCombo.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { fDataCategoryName = fCategoryCombo.getText(); } }); }
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); } } }
/** * 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); } } }
/* (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(); }
/** * Process category elements * * @param parentElement */ private void updateUICategoryComboElement(IPluginElement parentElement) { // Get the id attribute IPluginAttribute idAttribute = parentElement.getAttribute(ICompCSConstants.ATTRIBUTE_ID); // Get the name attribute IPluginAttribute nameAttribute = parentElement.getAttribute(ICompCSConstants.ATTRIBUTE_NAME); // Add the category to the combo box only if // (1) the category name is defined // (2) the category has not already been added to the combo box if ((nameAttribute != null) && PDETextHelper.isDefined(nameAttribute.getValue()) && (idAttribute != null) && PDETextHelper.isDefined(idAttribute.getValue()) && (fCategoryTrackerUtil.containsCategoryName(nameAttribute.getValue()) == false)) { // TODO: MP: LOW: CompCS: Reference translated value fCategoryCombo.add(nameAttribute.getValue()); // Assocate the category ID with the category name fCategoryTrackerUtil.associate( idAttribute.getValue(), nameAttribute.getValue(), CSCategoryTrackerUtil.F_TYPE_OLD_CATEGORY); } }
public String getSelectedProduct() { return fProductButton.getSelection() ? fProductCombo.getText() : null; }