### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.ui Index: src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java,v retrieving revision 1.78 diff -u -r1.78 BaseExportWizardPage.java --- src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java 6 Dec 2008 23:58:19 -0000 1.78 +++ src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java 23 Jan 2009 12:00:41 -0000 @@ -279,6 +279,10 @@ return fOptionsTab.doExportSource(); } + protected boolean doExportSourceBundles() { + return fOptionsTab.doExportSourceBundles(); + } + protected boolean useJARFormat() { return fOptionsTab.useJARFormat(); } Index: src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java,v retrieving revision 1.28 diff -u -r1.28 ProductExportWizard.java --- src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java 27 Nov 2008 18:35:19 -0000 1.28 +++ src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java 23 Jan 2009 12:00:42 -0000 @@ -71,6 +71,7 @@ FeatureExportInfo info = new FeatureExportInfo(); info.toDirectory = fPage.doExportToDirectory(); info.exportSource = fPage.doExportSource(); + info.exportSourceBundle = fPage.doExportSourceBundles(); info.allowBinaryCycles = fPage.doBinaryCycles(); info.exportMetadata = fPage.doExportMetadata(); info.destinationDirectory = fPage.getDestination(); Index: src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java,v retrieving revision 1.56 diff -u -r1.56 PluginExportWizard.java --- src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java 6 Dec 2008 23:58:19 -0000 1.56 +++ src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java 23 Jan 2009 12:00:42 -0000 @@ -45,6 +45,7 @@ info.toDirectory = fPage.doExportToDirectory(); info.useJarFormat = fPage.useJARFormat(); info.exportSource = fPage.doExportSource(); + info.exportSourceBundle = fPage.doExportSourceBundles(); info.allowBinaryCycles = fPage.allowBinaryCycles(); info.useWorkspaceCompiledClasses = fPage.useWorkspaceCompiledClasses(); info.destinationDirectory = fPage.getDestination(); Index: src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizardPage.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizardPage.java,v retrieving revision 1.25 diff -u -r1.25 ProductExportWizardPage.java --- src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizardPage.java 26 Oct 2008 18:24:02 -0000 1.25 +++ src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizardPage.java 23 Jan 2009 12:00:43 -0000 @@ -29,6 +29,7 @@ private static final String S_SYNC_PRODUCT = "syncProduct"; //$NON-NLS-1$ private static final String S_EXPORT_SOURCE = "exportSource"; //$NON-NLS-1$ + private static final String S_EXPORT_SOURCE_FORMAT = "exportSourceFormat"; //$NON-NLS-1$ private static final String S_ALLOW_BINARY_CYCLES = "allowBinaryCycles"; //$NON-NLS-1$ private static final String S_MULTI_PLATFORM = "multiplatform"; //$NON-NLS-1$ private static final String S_EXPORT_METADATA = "p2metadata"; //$NON-NLS-1$ @@ -37,7 +38,8 @@ private IStructuredSelection fSelection; private ProductDestinationGroup fExportGroup; private ProductConfigurationSection fConfigurationGroup; - private Button fExportSource; + private Button fExportSourceButton; + private Combo fExportSourceCombo; private Button fMultiPlatform; private Button fExportMetadata; private Button fAllowBinaryCycles; @@ -110,8 +112,17 @@ group.setLayout(new GridLayout()); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fExportSource = new Button(group, SWT.CHECK); - fExportSource.setText(PDEUIMessages.ExportWizard_includeSource); + Composite composite = new Composite(group, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = layout.marginWidth = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + fExportSourceButton = new Button(composite, SWT.CHECK); + fExportSourceButton.setText(PDEUIMessages.ExportWizard_includeSource); + + fExportSourceCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER); + fExportSourceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fExportMetadata = new Button(group, SWT.CHECK); fExportMetadata.setText(PDEUIMessages.ExportWizard_includesMetadata); @@ -139,7 +150,12 @@ fExportGroup.initialize(settings, fConfigurationGroup.getProductFile()); - fExportSource.setSelection(settings.getBoolean(S_EXPORT_SOURCE)); + fExportSourceButton.setSelection(settings.getBoolean(S_EXPORT_SOURCE)); + fExportSourceCombo.setItems(new String[] {PDEUIMessages.ExportWizard_includeSourceInBinaryBundles, PDEUIMessages.ExportWizard_generateAssociatedSourceBundles}); + String sourceComboValue = settings.get(S_EXPORT_SOURCE_FORMAT) != null ? settings.get(S_EXPORT_SOURCE_FORMAT) : PDEUIMessages.ExportWizard_generateAssociatedSourceBundles; + fExportSourceCombo.setText(sourceComboValue); + fExportSourceCombo.setEnabled(fExportSourceButton.getSelection()); + fExportMetadata.setSelection(settings.getBoolean(S_EXPORT_METADATA)); String selected = settings.get(S_ALLOW_BINARY_CYCLES); @@ -147,6 +163,16 @@ if (fMultiPlatform != null) fMultiPlatform.setSelection(settings.getBoolean(S_MULTI_PLATFORM)); + + hookListeners(); + } + + protected void hookListeners() { + fExportSourceButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + fExportSourceCombo.setEnabled(fExportSourceButton.getSelection()); + } + }); } protected void updateProductFields() { @@ -174,6 +200,7 @@ settings.put(S_SYNC_PRODUCT, fSyncButton.getSelection()); fExportGroup.saveSettings(settings); settings.put(S_EXPORT_SOURCE, doExportSource()); + settings.put(S_EXPORT_SOURCE_FORMAT, fExportSourceCombo.getItem(fExportSourceCombo.getSelectionIndex())); settings.put(S_EXPORT_METADATA, doExportMetadata()); settings.put(S_ALLOW_BINARY_CYCLES, doBinaryCycles()); @@ -190,7 +217,11 @@ } protected boolean doExportSource() { - return fExportSource.getSelection(); + return fExportSourceButton.getSelection(); + } + + protected boolean doExportSourceBundles() { + return PDEUIMessages.ExportWizard_generateAssociatedSourceBundles.equalsIgnoreCase(fExportSourceCombo.getText()); } protected boolean doBinaryCycles() { Index: src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java,v retrieving revision 1.13 diff -u -r1.13 ExportOptionsTab.java --- src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java 6 Dec 2008 23:58:19 -0000 1.13 +++ src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java 23 Jan 2009 12:00:42 -0000 @@ -26,6 +26,7 @@ protected static final String S_JAR_FORMAT = "exportUpdate"; //$NON-NLS-1$ private static final String S_EXPORT_SOURCE = "exportSource"; //$NON-NLS-1$ + private static final String S_EXPORT_SOURCE_FORMAT = "exportSourceFormat"; //$NON-NLS-1$ private static final String S_SAVE_AS_ANT = "saveAsAnt"; //$NON-NLS-1$ private static final String S_ANT_FILENAME = "antFileName"; //$NON-NLS-1$ private static final String S_QUALIFIER = "qualifier"; //$NON-NLS-1$ @@ -33,7 +34,8 @@ private static final String S_ALLOW_BINARY_CYCLES = "allowBinaryCycles"; //$NON-NLS-1$ private static final String S_USE_WORKSPACE_COMPILED_CLASSES = "useWorkspaceCompiledClasses"; //$NON-NLS-1$ - private Button fIncludeSource; + private Button fIncludeSourceButton; + private Combo fIncludeSourceCombo; protected Button fJarButton; private Button fSaveAsAntButton; private Combo fAntCombo; @@ -63,9 +65,21 @@ return container; } - protected void addSourceOption(Composite comp) { - fIncludeSource = new Button(comp, SWT.CHECK); - fIncludeSource.setText(PDEUIMessages.ExportWizard_includeSource); + protected void addSourceOption(Composite container) { + Composite composite = new Composite(container, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = layout.marginWidth = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + fIncludeSourceButton = new Button(composite, SWT.CHECK); + fIncludeSourceButton.setText(PDEUIMessages.ExportWizard_includeSource); + GridData gd = new GridData(); + gd.horizontalSpan = 1; + fIncludeSourceButton.setLayoutData(gd); + + fIncludeSourceCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER); + fIncludeSourceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } protected void addJAROption(Composite comp) { @@ -84,7 +98,7 @@ protected void addUseWorkspaceCompiledClassesSection(Composite comp) { fUseWSCompiledClasses = new Button(comp, SWT.CHECK); - fUseWSCompiledClasses.setText("Use class files compiled in the workspace"); + fUseWSCompiledClasses.setText("Use class files compiled in the workspace"); //$NON-NLS-1$ } protected String getJarButtonText() { @@ -141,7 +155,11 @@ } protected void initialize(IDialogSettings settings) { - fIncludeSource.setSelection(settings.getBoolean(S_EXPORT_SOURCE)); + fIncludeSourceButton.setSelection(settings.getBoolean(S_EXPORT_SOURCE)); + fIncludeSourceCombo.setItems(new String[] {PDEUIMessages.ExportWizard_includeSourceInBinaryBundles, PDEUIMessages.ExportWizard_generateAssociatedSourceBundles}); + String sourceComboValue = settings.get(S_EXPORT_SOURCE_FORMAT) != null ? settings.get(S_EXPORT_SOURCE_FORMAT) : PDEUIMessages.ExportWizard_generateAssociatedSourceBundles; + fIncludeSourceCombo.setText(sourceComboValue); + fIncludeSourceCombo.setEnabled(fIncludeSourceButton.getSelection()); fJarButton.setSelection(getInitialJarButtonSelection(settings)); fSaveAsAntButton.setSelection(settings.getBoolean(S_SAVE_AS_ANT)); initializeCombo(settings, S_ANT_FILENAME, fAntCombo); @@ -157,7 +175,8 @@ protected void saveSettings(IDialogSettings settings) { settings.put(S_JAR_FORMAT, fJarButton.getSelection()); - settings.put(S_EXPORT_SOURCE, fIncludeSource.getSelection()); + settings.put(S_EXPORT_SOURCE, fIncludeSourceButton.getSelection()); + settings.put(S_EXPORT_SOURCE_FORMAT, fIncludeSourceCombo.getItem(fIncludeSourceCombo.getSelectionIndex())); settings.put(S_SAVE_AS_ANT, fSaveAsAntButton.getSelection()); settings.put(S_QUALIFIER, fQualifierButton.getSelection()); settings.put(S_QUALIFIER_NAME, fQualifierText.getText()); @@ -189,6 +208,12 @@ } protected void hookListeners() { + fIncludeSourceButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + fIncludeSourceCombo.setEnabled(fIncludeSourceButton.getSelection()); + } + }); + fJarButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ((BaseExportWizardPage) fPage).adjustAdvancedTabsVisibility(); @@ -241,7 +266,11 @@ } protected boolean doExportSource() { - return fIncludeSource.getSelection(); + return fIncludeSourceButton.getSelection(); + } + + protected boolean doExportSourceBundles() { + return PDEUIMessages.ExportWizard_generateAssociatedSourceBundles.equalsIgnoreCase(fIncludeSourceCombo.getText()); } protected boolean doBinaryCycles() { Index: src/org/eclipse/pde/internal/ui/pderesources.properties =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v retrieving revision 1.1027 diff -u -r1.1027 pderesources.properties --- src/org/eclipse/pde/internal/ui/pderesources.properties 21 Jan 2009 22:37:14 -0000 1.1027 +++ src/org/eclipse/pde/internal/ui/pderesources.properties 23 Jan 2009 12:00:41 -0000 @@ -1499,6 +1499,8 @@ ExportWizard_Plugin_description = Export the selected projects into a form suitable for deploying in an Eclipse product ExportWizard_archive = Ar&chive file: ExportWizard_includeSource = &Include source code +ExportWizard_includeSourceInBinaryBundles = Include source in binary bundle(s) +ExportWizard_generateAssociatedSourceBundles = Generate associated source bundle(s) ExportWizard_includesMetadata = Generate metadata &repository ExportWizard_multi_platform = Export for &multiple platforms ExportWizard_destination = &Destination Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v retrieving revision 1.401 diff -u -r1.401 PDEUIMessages.java --- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 21 Jan 2009 22:37:14 -0000 1.401 +++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 23 Jan 2009 12:00:37 -0000 @@ -1652,6 +1652,8 @@ public static String ExportWizard_Plugin_description; public static String ExportWizard_archive; public static String ExportWizard_includeSource; + public static String ExportWizard_includeSourceInBinaryBundles; + public static String ExportWizard_generateAssociatedSourceBundles; public static String ExportWizard_includesMetadata; public static String ExportWizard_multi_platform; public static String ExportWizard_destination; #P org.eclipse.pde.core Index: src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java,v retrieving revision 1.8 diff -u -r1.8 FeatureBasedExportOperation.java --- src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java 6 Dec 2008 23:58:20 -0000 1.8 +++ src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java 23 Jan 2009 12:00:48 -0000 @@ -12,12 +12,16 @@ import java.io.*; import java.lang.reflect.InvocationTargetException; -import java.util.Properties; +import java.util.*; import org.eclipse.core.runtime.*; +import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.pde.core.IModel; +import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.plugin.TargetPlatform; import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.PDECoreMessages; +import org.eclipse.pde.internal.core.ifeature.IFeature; +import org.eclipse.pde.internal.core.ifeature.IFeatureModel; public abstract class FeatureBasedExportOperation extends FeatureExportOperation { @@ -84,6 +88,36 @@ file.mkdirs(); Properties prop = new Properties(); prop.put("pde", "marker"); //$NON-NLS-1$ //$NON-NLS-2$ + + if (fInfo.exportSource && fInfo.exportSourceBundle) { + prop.put("individualSourceBundles", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + Dictionary environment = new Hashtable(4); + environment.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$ + environment.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$ + environment.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$ + environment.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$ + + for (int i = 0; i < fInfo.items.length; i++) { + if (fInfo.items[i] instanceof IFeatureModel) { + IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature(); + prop.put("generate.feature@" + feature.getId() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + BundleDescription bundle = null; + if (fInfo.items[i] instanceof IPluginModelBase) { + bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription(); + } + if (bundle == null) { + if (fInfo.items[i] instanceof BundleDescription) + bundle = (BundleDescription) fInfo.items[i]; + } + if (bundle == null) + continue; + if (shouldAddPlugin(bundle, environment)) { + prop.put("generate.plugin@" + bundle.getSymbolicName() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } save(new File(file, "build.properties"), prop, "Marker File"); //$NON-NLS-1$ //$NON-NLS-2$ } Index: src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java,v retrieving revision 1.7 diff -u -r1.7 FeatureExportInfo.java --- src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java 6 Dec 2008 23:58:20 -0000 1.7 +++ src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java 23 Jan 2009 12:00:48 -0000 @@ -15,6 +15,7 @@ public boolean toDirectory; public boolean useJarFormat; public boolean exportSource; + public boolean exportSourceBundle; public boolean exportMetadata; public boolean allowBinaryCycles; public boolean useWorkspaceCompiledClasses; Index: src/org/eclipse/pde/internal/core/exports/ProductExportOperation.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/ProductExportOperation.java,v retrieving revision 1.39 diff -u -r1.39 ProductExportOperation.java --- src/org/eclipse/pde/internal/core/exports/ProductExportOperation.java 27 Nov 2008 18:35:21 -0000 1.39 +++ src/org/eclipse/pde/internal/core/exports/ProductExportOperation.java 23 Jan 2009 12:00:50 -0000 @@ -22,10 +22,12 @@ import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.HostSpecification; import org.eclipse.osgi.util.NLS; -import org.eclipse.pde.core.plugin.TargetPlatform; +import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.build.*; import org.eclipse.pde.internal.build.packager.PackageScriptGenerator; import org.eclipse.pde.internal.core.*; +import org.eclipse.pde.internal.core.ifeature.IFeature; +import org.eclipse.pde.internal.core.ifeature.IFeatureModel; import org.eclipse.pde.internal.core.iproduct.*; import org.eclipse.pde.internal.core.iproduct.IProduct; import org.eclipse.pde.internal.core.util.CoreUtility; @@ -178,6 +180,36 @@ } } + if (fInfo.exportSource && fInfo.exportSourceBundle) { + properties.put("individualSourceBundles", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + Dictionary environment = new Hashtable(4); + environment.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$ + environment.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$ + environment.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$ + environment.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$ + List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels()); + for (int i = 0; i < fInfo.items.length; i++) { + if (fInfo.items[i] instanceof IFeatureModel) { + IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature(); + properties.put("generate.feature@" + feature.getId() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + BundleDescription bundle = null; + if (fInfo.items[i] instanceof IPluginModelBase) { + bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription(); + } + if (bundle == null) { + if (fInfo.items[i] instanceof BundleDescription) + bundle = (BundleDescription) fInfo.items[i]; + } + if (bundle == null) + continue; + + if (shouldAddPlugin(bundle, environment) && workspacePlugins.contains(PluginRegistry.findModel(bundle))) { + properties.put("generate.plugin@" + bundle.getSymbolicName() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } save(new File(file, "build.properties"), properties, "Build Configuration"); //$NON-NLS-1$ //$NON-NLS-2$ } Index: src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java,v retrieving revision 1.21 diff -u -r1.21 FeatureExportOperation.java --- src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 13 Dec 2008 20:12:29 -0000 1.21 +++ src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 23 Jan 2009 12:00:50 -0000 @@ -298,7 +298,7 @@ } private String[] getBuildExecutionTargets() { - if (fInfo.exportSource) + if (fInfo.exportSource && !fInfo.exportSourceBundle) return new String[] {"build.jars", "build.sources"}; //$NON-NLS-1$ //$NON-NLS-2$ return new String[] {"build.jars"}; //$NON-NLS-1$ } @@ -524,7 +524,7 @@ } AbstractScriptGenerator.setForceUpdateJar(false); - AbstractScriptGenerator.setEmbeddedSource(fInfo.exportSource); + AbstractScriptGenerator.setEmbeddedSource(fInfo.exportSource && !fInfo.exportSourceBundle); // allow for binary cycles Properties properties = new Properties(); @@ -695,6 +695,7 @@ environment.put("osgi.ws", config[1]); //$NON-NLS-1$ environment.put("osgi.arch", config[2]); //$NON-NLS-1$ environment.put("osgi.nl", config[3]); //$NON-NLS-1$ + List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels()); for (int i = 0; i < fInfo.items.length; i++) { if (fInfo.items[i] instanceof IFeatureModel) { @@ -703,6 +704,13 @@ includes.setAttribute("id", feature.getId()); //$NON-NLS-1$ includes.setAttribute("version", feature.getVersion()); //$NON-NLS-1$ root.appendChild(includes); + + if (fInfo.exportSource && fInfo.exportSourceBundle) { + includes = doc.createElement("includes"); //$NON-NLS-1$ + includes.setAttribute("id", feature.getId() + " .source"); //$NON-NLS-1$ //$NON-NLS-2$ + includes.setAttribute("version", feature.getVersion()); //$NON-NLS-1$ + root.appendChild(includes); + } } else { BundleDescription bundle = null; if (fInfo.items[i] instanceof IPluginModelBase) { @@ -720,6 +728,27 @@ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ setAdditionalAttributes(plugin, bundle); root.appendChild(plugin); + + if (fInfo.exportSource && fInfo.exportSourceBundle) { + if (workspacePlugins.contains(PluginRegistry.findModel(bundle))) { // Is it a workspace plugin? + plugin = doc.createElement("plugin"); //$NON-NLS-1$ + plugin.setAttribute("id", bundle.getSymbolicName() + ".source"); //$NON-NLS-1$ //$NON-NLS-2$ + plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ + setAdditionalAttributes(plugin, bundle); + root.appendChild(plugin); + } else // include the .source plugin, if available + { + IPluginModelBase model = PluginRegistry.findModel(bundle.getSymbolicName() + ".source"); //$NON-NLS-1$ + if (model != null) { + bundle = model.getBundleDescription(); + plugin = doc.createElement("plugin"); //$NON-NLS-1$ + plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ + plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ + setAdditionalAttributes(plugin, bundle); + root.appendChild(plugin); + } + } + } } } }