View | Details | Raw Unified | Return to bug 272068 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java (+9 lines)
Lines 512-517 Link Here
512
	}
512
	}
513
513
514
	/**
514
	/**
515
	 * @return the location of the category definition file, or null if none is specified
516
	 */
517
	protected String getCategoryDefinition() {
518
		return fInfo.categoryDefinition;
519
	}
520
521
	/**
515
	* Adds the necessary properties to invoke the p2 metadata generator.  This method will
522
	* Adds the necessary properties to invoke the p2 metadata generator.  This method will
516
	* be called when creating the ant build properties map.
523
	* be called when creating the ant build properties map.
517
	* 
524
	* 
Lines 525-530 Link Here
525
			map.put(IBuildPropertiesConstants.PROPERTY_P2_FINAL_MODE_OVERRIDE, IBuildPropertiesConstants.TRUE);
532
			map.put(IBuildPropertiesConstants.PROPERTY_P2_FINAL_MODE_OVERRIDE, IBuildPropertiesConstants.TRUE);
526
			map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE);
533
			map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE);
527
			map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata()));
534
			map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata()));
535
			if (getCategoryDefinition() != null)
536
				map.put(IBuildPropertiesConstants.PROPERTY_P2_CATEGORY_DEFINITION, getCategoryDefinition());
528
			try {
537
			try {
529
				String destination = ""; //$NON-NLS-1$
538
				String destination = ""; //$NON-NLS-1$
530
				if (publishingP2Metadata()) {
539
				if (publishingP2Metadata()) {
(-)src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java (+1 lines)
Lines 26-30 Link Here
26
	public String[] signingInfo;
26
	public String[] signingInfo;
27
	public String[] jnlpInfo;
27
	public String[] jnlpInfo;
28
	public String[][] targets;
28
	public String[][] targets;
29
	public String categoryDefinition;
29
30
30
}
31
}
(-)src/org/eclipse/pde/internal/ui/wizards/exports/FeatureOptionsTab.java (-4 / +105 lines)
Lines 10-36 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.exports;
11
package org.eclipse.pde.internal.ui.wizards.exports;
12
12
13
import java.io.File;
14
import java.net.URI;
13
import org.eclipse.jface.dialogs.IDialogSettings;
15
import org.eclipse.jface.dialogs.IDialogSettings;
14
import org.eclipse.pde.internal.core.FeatureModelManager;
16
import org.eclipse.pde.internal.core.FeatureModelManager;
15
import org.eclipse.pde.internal.core.PDECore;
17
import org.eclipse.pde.internal.core.PDECore;
16
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
18
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
17
import org.eclipse.pde.internal.ui.PDEUIMessages;
19
import org.eclipse.pde.internal.ui.*;
18
import org.eclipse.pde.internal.ui.SWTFactory;
20
import org.eclipse.pde.internal.ui.util.SWTUtil;
19
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.events.SelectionAdapter;
22
import org.eclipse.swt.events.SelectionAdapter;
21
import org.eclipse.swt.events.SelectionEvent;
23
import org.eclipse.swt.events.SelectionEvent;
22
import org.eclipse.swt.layout.GridData;
24
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.widgets.Composite;
26
import org.eclipse.swt.widgets.*;
25
27
26
public class FeatureOptionsTab extends ExportOptionsTab {
28
public class FeatureOptionsTab extends ExportOptionsTab {
27
29
28
	private static final String S_MULTI_PLATFORM = "multiplatform"; //$NON-NLS-1$
30
	private static final String S_MULTI_PLATFORM = "multiplatform"; //$NON-NLS-1$
29
	private static final String S_EXPORT_METADATA = "p2metadata"; //$NON-NLS-1$
31
	private static final String S_EXPORT_METADATA = "p2metadata"; //$NON-NLS-1$
32
	private static final String S_CATEGORY_FILE = "category_file"; //$NON-NLS-1$
33
	private static final String S_CREATE_CATEGORIES = "create_categories"; //$NON-NLS-1$
30
34
31
	private Button fMultiPlatform;
35
	private Button fMultiPlatform;
32
	private Button fExportMetadata;
36
	private Button fExportMetadata;
33
37
38
	private Button fCategoryButton;
39
	private Combo fCategoryCombo;
40
	private Button fCategoryBrowse;
41
34
	public FeatureOptionsTab(FeatureExportWizardPage page) {
42
	public FeatureOptionsTab(FeatureExportWizardPage page) {
35
		super(page);
43
		super(page);
36
	}
44
	}
Lines 39-44 Link Here
39
		fJarButton.addSelectionListener(new SelectionAdapter() {
47
		fJarButton.addSelectionListener(new SelectionAdapter() {
40
			public void widgetSelected(SelectionEvent e) {
48
			public void widgetSelected(SelectionEvent e) {
41
				fExportMetadata.setEnabled(fJarButton.getSelection());
49
				fExportMetadata.setEnabled(fJarButton.getSelection());
50
				fCategoryButton.setEnabled(fExportMetadata.getSelection() && fJarButton.getSelection());
51
				updateCategoryGeneration();
42
			}
52
			}
43
		});
53
		});
44
		fExportMetadata = SWTFactory.createCheckButton(comp, PDEUIMessages.ExportWizard_includesMetadata, null, false, 1);
54
		fExportMetadata = SWTFactory.createCheckButton(comp, PDEUIMessages.ExportWizard_includesMetadata, null, false, 1);
Lines 51-56 Link Here
51
			fMultiPlatform = new Button(comp, SWT.CHECK);
61
			fMultiPlatform = new Button(comp, SWT.CHECK);
52
			fMultiPlatform.setText(PDEUIMessages.ExportWizard_multi_platform);
62
			fMultiPlatform.setText(PDEUIMessages.ExportWizard_multi_platform);
53
		}
63
		}
64
		Composite categoryComposite = new Composite(comp, SWT.NONE);
65
66
		data = new GridData(SWT.FILL, SWT.FILL, true, false);
67
		data.horizontalIndent = 20;
68
		categoryComposite.setLayoutData(data);
69
		GridLayout layout = new GridLayout(3, false);
70
		layout.marginRight = 0;
71
		layout.marginLeft = 0;
72
		layout.marginWidth = 0;
73
		layout.marginHeight = 0;
74
		layout.marginBottom = 0;
75
		layout.marginTop = 0;
76
		categoryComposite.setLayout(layout);
77
78
		fCategoryButton = new Button(categoryComposite, SWT.CHECK);
79
		fCategoryButton.setText(PDEUIMessages.ExportWizard_generateCategories + ":"); //$NON-NLS-1$
80
		fCategoryButton.setSelection(true);
81
82
		fCategoryCombo = new Combo(categoryComposite, SWT.NONE);
83
		fCategoryCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
84
85
		fCategoryBrowse = new Button(categoryComposite, SWT.PUSH);
86
		fCategoryBrowse.setText(PDEUIMessages.ExportWizard_browse);
87
		fCategoryBrowse.setLayoutData(new GridData());
88
		SWTUtil.setButtonDimensionHint(fCategoryBrowse);
54
89
55
	}
90
	}
56
91
Lines 65-70 Link Here
65
		return fExportMetadata.isEnabled() && fExportMetadata.getSelection();
100
		return fExportMetadata.isEnabled() && fExportMetadata.getSelection();
66
	}
101
	}
67
102
103
	protected URI getCategoryDefinition() {
104
		if (doExportCategories()) {
105
			File f = new File(fCategoryCombo.getText().trim());
106
			if (f.exists())
107
				return f.toURI();
108
		}
109
		return null;
110
	}
111
112
	/**
113
	 * @return whether to publish categories when exporting
114
	 */
115
	private boolean doExportCategories() {
116
		return doExportMetadata() && fCategoryButton.getSelection() && fCategoryCombo.getText().trim().length() > 0;
117
	}
118
68
	protected void initialize(IDialogSettings settings) {
119
	protected void initialize(IDialogSettings settings) {
69
		super.initialize(settings);
120
		super.initialize(settings);
70
		if (fMultiPlatform != null) {
121
		if (fMultiPlatform != null) {
Lines 74-79 Link Here
74
		String selected = settings.get(S_EXPORT_METADATA);
125
		String selected = settings.get(S_EXPORT_METADATA);
75
		fExportMetadata.setSelection(selected == null ? true : Boolean.TRUE.toString().equals(selected));
126
		fExportMetadata.setSelection(selected == null ? true : Boolean.TRUE.toString().equals(selected));
76
		fExportMetadata.setEnabled(fJarButton.getSelection());
127
		fExportMetadata.setEnabled(fJarButton.getSelection());
128
		selected = settings.get(S_CREATE_CATEGORIES);
129
130
		fCategoryButton.setEnabled(fExportMetadata.getSelection() && fJarButton.getSelection());
131
		fCategoryButton.setSelection(selected == null ? true : Boolean.TRUE.toString().equals(selected));
132
		if (settings.get(S_CATEGORY_FILE) != null)
133
			fCategoryCombo.setText(settings.get(S_CATEGORY_FILE));
134
		updateCategoryGeneration();
77
	}
135
	}
78
136
79
	protected void saveSettings(IDialogSettings settings) {
137
	protected void saveSettings(IDialogSettings settings) {
Lines 82-87 Link Here
82
			settings.put(S_MULTI_PLATFORM, fMultiPlatform.getSelection());
140
			settings.put(S_MULTI_PLATFORM, fMultiPlatform.getSelection());
83
		}
141
		}
84
		settings.put(S_EXPORT_METADATA, doExportMetadata());
142
		settings.put(S_EXPORT_METADATA, doExportMetadata());
143
		settings.put(S_CREATE_CATEGORIES, fCategoryButton.getSelection());
144
		settings.put(S_CATEGORY_FILE, fCategoryCombo.getText());
85
	}
145
	}
86
146
87
	protected void hookListeners() {
147
	protected void hookListeners() {
Lines 93-98 Link Here
93
				}
153
				}
94
			});
154
			});
95
		}
155
		}
156
157
		fExportMetadata.addSelectionListener(new SelectionAdapter() {
158
			public void widgetSelected(SelectionEvent e) {
159
				fCategoryButton.setEnabled(fExportMetadata.getSelection() && fJarButton.getSelection());
160
				updateCategoryGeneration();
161
			}
162
		});
163
		fCategoryButton.addSelectionListener(new SelectionAdapter() {
164
			public void widgetSelected(SelectionEvent e) {
165
				updateCategoryGeneration();
166
			}
167
		});
168
169
		fCategoryBrowse.addSelectionListener(new SelectionAdapter() {
170
			public void widgetSelected(SelectionEvent e) {
171
				openFile(fCategoryCombo, new String[] {"*.xml", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$
172
			}
173
		});
174
	}
175
176
	protected void updateCategoryGeneration() {
177
		fCategoryBrowse.setEnabled(fExportMetadata.getSelection() && fCategoryButton.getSelection() && fJarButton.getSelection());
178
		fCategoryCombo.setEnabled(fExportMetadata.getSelection() && fCategoryButton.getSelection() && fJarButton.getSelection());
96
	}
179
	}
97
180
98
	protected boolean doMultiplePlatform() {
181
	protected boolean doMultiplePlatform() {
Lines 102-107 Link Here
102
	protected void setEnabledForInstall(boolean enabled) {
185
	protected void setEnabledForInstall(boolean enabled) {
103
		super.setEnabledForInstall(enabled);
186
		super.setEnabledForInstall(enabled);
104
		fExportMetadata.setEnabled(enabled);
187
		fExportMetadata.setEnabled(enabled);
188
		fCategoryButton.setEnabled(enabled);
189
		fCategoryCombo.setEnabled(enabled);
190
		fCategoryBrowse.setEnabled(enabled);
191
	}
192
193
	protected void openFile(Combo combo, String[] filter) {
194
		FileDialog dialog = new FileDialog(fPage.getShell(), SWT.OPEN);
195
		String path = combo.getText();
196
		if (path.trim().length() == 0)
197
			path = PDEPlugin.getWorkspace().getRoot().getLocation().toString();
198
		dialog.setFilterExtensions(filter);
199
		dialog.setFileName(path);
200
		String res = dialog.open();
201
		if (res != null) {
202
			if (combo.indexOf(res) == -1)
203
				combo.add(res, 0);
204
			combo.setText(res);
205
		}
105
	}
206
	}
106
207
107
}
208
}
(-)src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java (+3 lines)
Lines 13-18 Link Here
13
import java.io.File;
13
import java.io.File;
14
import javax.xml.parsers.*;
14
import javax.xml.parsers.*;
15
import org.eclipse.core.resources.ResourcesPlugin;
15
import org.eclipse.core.resources.ResourcesPlugin;
16
import org.eclipse.core.runtime.URIUtil;
16
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
17
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
17
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
18
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
18
import org.eclipse.pde.internal.build.site.QualifierReplacer;
19
import org.eclipse.pde.internal.build.site.QualifierReplacer;
Lines 74-79 Link Here
74
		info.signingInfo = fPage.getSigningInfo();
75
		info.signingInfo = fPage.getSigningInfo();
75
		info.jnlpInfo = ((FeatureExportWizardPage) fPage).getJNLPInfo();
76
		info.jnlpInfo = ((FeatureExportWizardPage) fPage).getJNLPInfo();
76
		info.qualifier = fPage.getQualifier();
77
		info.qualifier = fPage.getQualifier();
78
		if (((FeatureExportWizardPage) fPage).getCategoryDefinition() != null)
79
			info.categoryDefinition = URIUtil.toUnencodedString(((FeatureExportWizardPage) fPage).getCategoryDefinition());
77
80
78
		final boolean installAfterExport = fPage.doInstall();
81
		final boolean installAfterExport = fPage.doInstall();
79
		if (installAfterExport) {
82
		if (installAfterExport) {
(-)src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizardPage.java (+11 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.exports;
11
package org.eclipse.pde.internal.ui.wizards.exports;
12
12
13
import java.net.URI;
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.IAdaptable;
15
import org.eclipse.core.runtime.IAdaptable;
15
import org.eclipse.jface.dialogs.IDialogSettings;
16
import org.eclipse.jface.dialogs.IDialogSettings;
Lines 143-148 Link Here
143
		return false;
144
		return false;
144
	}
145
	}
145
146
147
	/**
148
	 * @return the location of the category definition file.  Null if none specified.
149
	 */
150
	protected URI getCategoryDefinition() {
151
		if (fOptionsTab instanceof FeatureOptionsTab) {
152
			return ((FeatureOptionsTab) fOptionsTab).getCategoryDefinition();
153
		}
154
		return null;
155
	}
156
146
	public IWizardPage getNextPage() {
157
	public IWizardPage getNextPage() {
147
		return doMultiPlatform() ? getWizard().getNextPage(this) : null;
158
		return doMultiPlatform() ? getWizard().getNextPage(this) : null;
148
	}
159
	}
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+1 lines)
Lines 1654-1659 Link Here
1654
	public static String ExportWizard_includeSourceInBinaryBundles;
1654
	public static String ExportWizard_includeSourceInBinaryBundles;
1655
	public static String ExportWizard_generateAssociatedSourceBundles;
1655
	public static String ExportWizard_generateAssociatedSourceBundles;
1656
	public static String ExportWizard_includesMetadata;
1656
	public static String ExportWizard_includesMetadata;
1657
	public static String ExportWizard_generateCategories;
1657
	public static String ExportWizard_multi_platform;
1658
	public static String ExportWizard_multi_platform;
1658
	public static String ExportWizard_destination;
1659
	public static String ExportWizard_destination;
1659
	public static String ExportWizard_options;
1660
	public static String ExportWizard_options;
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+1 lines)
Lines 1501-1506 Link Here
1501
ExportWizard_includeSourceInBinaryBundles = Include source in exported plug-ins
1501
ExportWizard_includeSourceInBinaryBundles = Include source in exported plug-ins
1502
ExportWizard_generateAssociatedSourceBundles = Generate source bundles
1502
ExportWizard_generateAssociatedSourceBundles = Generate source bundles
1503
ExportWizard_includesMetadata = Generate metadata &repository
1503
ExportWizard_includesMetadata = Generate metadata &repository
1504
ExportWizard_generateCategories = &Categorize repository
1504
ExportWizard_multi_platform = Export for &multiple platforms
1505
ExportWizard_multi_platform = Export for &multiple platforms
1505
ExportWizard_destination = &Destination
1506
ExportWizard_destination = &Destination
1506
ExportWizard_options = &Options
1507
ExportWizard_options = &Options

Return to bug 272068