/** * The fields are populated based on the plug-in attributes. Some fields are set to their default * values. */ private FragmentFieldData populateFieldData(IPluginModelBase plugin, Locale locale) { FragmentFieldData fragmentData = new FragmentFieldData(); fragmentData.setId(pluginName(plugin, locale)); fragmentData.setVersion(DEFAULT_VERSION); fragmentData.setMatch(0); fragmentData.setPluginId(plugin.getPluginBase().getId()); fragmentData.setPluginVersion(incrementRelease(plugin.getPluginBase().getVersion())); fragmentData.setName(pluginName(plugin, locale) + " Fragment"); // $NON-NLS-1$ fragmentData.setProvider(EMPTY_STRING); fragmentData.setSimple(true); if (!(plugin instanceof ExternalPluginModelBase)) { fragmentData.setSourceFolderName("src"); // $NON-NLS-1$ fragmentData.setOutputFolderName("bin"); // $NON-NLS-1$ } fragmentData.setLegacy(false); fragmentData.setTargetVersion( Double.toString(ensureTargetVersionCompatibility(TargetPlatformHelper.getTargetVersion()))); fragmentData.setHasBundleStructure(true); fragmentData.setOSGiFramework(null); fragmentData.setWorkingSets(null); return fragmentData; }
public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_HORIZONTAL); section.setLayoutData(data); section.setText(PDEUIMessages.IntroSection_sectionText); section.setDescription(PDEUIMessages.IntroSection_sectionDescription); boolean canCreateNew = TargetPlatformHelper.getTargetVersion() >= NEW_INTRO_SUPPORT_VERSION; Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, canCreateNew ? 3 : 2)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = toolkit.createLabel(client, PDEUIMessages.IntroSection_introLabel, SWT.WRAP); GridData td = new GridData(); td.horizontalSpan = canCreateNew ? 3 : 2; label.setLayoutData(td); Label introLabel = toolkit.createLabel(client, PDEUIMessages.IntroSection_introInput); introLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fIntroCombo = new ComboPart(); fIntroCombo.createControl(client, toolkit, SWT.READ_ONLY); td = new GridData(GridData.FILL_HORIZONTAL); fIntroCombo.getControl().setLayoutData(td); loadManifestAndIntroIds(false); if (fAvailableIntroIds != null) fIntroCombo.setItems(fAvailableIntroIds); fIntroCombo.add(""); // $NON-NLS-1$ fIntroCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleSelection(); } }); if (canCreateNew) { Button button = toolkit.createButton(client, PDEUIMessages.IntroSection_new, SWT.PUSH); button.setEnabled(isEditable()); button.setLayoutData(new GridData(GridData.FILL)); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleNewIntro(); } }); } fIntroCombo.getControl().setEnabled(isEditable()); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }