View | Details | Raw Unified | Return to bug 246926
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/pderesources.properties (-1 / +5 lines)
Lines 2344-2347 Link Here
2344
LicenseSection_title=License
2344
LicenseSection_title=License
2345
LicenseSection_description=Specify the license text and URL for your product.
2345
LicenseSection_description=Specify the license text and URL for your product.
2346
LicenseSection_url=URL:
2346
LicenseSection_url=URL:
2347
LicenseSection_text=Text:
2347
LicenseSection_text=Text:
2348
2349
VersionDialog_text=Specify a version:
2350
2351
Product_FeatureSection_properties=Properties...
(-)src/org/eclipse/pde/internal/ui/PDELabelProvider.java (-9 / +9 lines)
Lines 184-198 Link Here
184
	}
184
	}
185
185
186
	public String getObjectText(IProductPlugin obj) {
186
	public String getObjectText(IProductPlugin obj) {
187
		if (isFullNameModeEnabled()) {
187
		// TODO, should we just get the model and call the proper method?
188
			String id = obj.getId();
188
		String name = obj.getId();
189
			IPluginModelBase model = PluginRegistry.findModel(obj.getId());
189
		String version = obj.getVersion();
190
			if (model != null) {
190
		String text;
191
				return model.getPluginBase().getTranslatedName();
191
		if (version != null && version.length() > 0)
192
			}
192
			text = name + ' ' + formatVersion(obj.getVersion());
193
			return id != null ? id : "?"; //$NON-NLS-1$
193
		else
194
		}
194
			text = name;
195
		return preventNull(obj.getId());
195
		return preventNull(text);
196
	}
196
	}
197
197
198
	public String getObjectText(BundleDescription bundle) {
198
	public String getObjectText(BundleDescription bundle) {
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+3 lines)
Lines 1806-1811 Link Here
1806
	public static String ProductExportWizardPage_browse;
1806
	public static String ProductExportWizardPage_browse;
1807
	public static String Product_PluginSection_removeAll;
1807
	public static String Product_PluginSection_removeAll;
1808
	public static String Product_PluginSection_newPlugin;
1808
	public static String Product_PluginSection_newPlugin;
1809
	public static String Product_FeatureSection_properties;
1809
	public static String Product_DependenciesPage_title;
1810
	public static String Product_DependenciesPage_title;
1810
	public static String ProductFileWizadPage_groupTitle;
1811
	public static String ProductFileWizadPage_groupTitle;
1811
	public static String Product_PluginSection_newFragment;
1812
	public static String Product_PluginSection_newFragment;
Lines 2910-2913 Link Here
2910
	public static String PDECompilersConfigurationBlock_warning;
2911
	public static String PDECompilersConfigurationBlock_warning;
2911
	public static String PDECompilersConfigurationBlock_ignore;
2912
	public static String PDECompilersConfigurationBlock_ignore;
2912
2913
2914
	public static String VersionDialog_text;
2915
2913
}
2916
}
(-)src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java (-6 / +27 lines)
Lines 66-81 Link Here
66
	}
66
	}
67
67
68
	private static String[] getButtonLabels() {
68
	private static String[] getButtonLabels() {
69
		String[] labels = new String[9];
69
		String[] labels = new String[10];
70
		labels[0] = PDEUIMessages.Product_PluginSection_add;
70
		labels[0] = PDEUIMessages.Product_PluginSection_add;
71
		labels[1] = PDEUIMessages.Product_PluginSection_working;
71
		labels[1] = PDEUIMessages.Product_PluginSection_working;
72
		labels[2] = PDEUIMessages.Product_PluginSection_required;
72
		labels[2] = PDEUIMessages.Product_PluginSection_required;
73
		labels[3] = PDEUIMessages.PluginSection_remove;
73
		labels[3] = PDEUIMessages.PluginSection_remove;
74
		labels[4] = PDEUIMessages.Product_PluginSection_removeAll;
74
		labels[4] = PDEUIMessages.Product_PluginSection_removeAll;
75
		labels[5] = null;
75
		labels[5] = PDEUIMessages.Product_FeatureSection_properties;
76
		labels[6] = null;
76
		labels[6] = null;
77
		labels[7] = PDEUIMessages.Product_PluginSection_newPlugin;
77
		labels[7] = null;
78
		labels[8] = PDEUIMessages.Product_PluginSection_newFragment;
78
		labels[8] = PDEUIMessages.Product_PluginSection_newPlugin;
79
		labels[9] = PDEUIMessages.Product_PluginSection_newFragment;
79
		return labels;
80
		return labels;
80
	}
81
	}
81
82
Lines 116-123 Link Here
116
117
117
		// remove buttons will be updated on refresh
118
		// remove buttons will be updated on refresh
118
119
119
		tablePart.setButtonEnabled(7, isEditable());
120
		tablePart.setButtonEnabled(5, isEditable());
120
		tablePart.setButtonEnabled(8, isEditable());
121
		tablePart.setButtonEnabled(8, isEditable());
122
		tablePart.setButtonEnabled(9, isEditable());
121
123
122
		toolkit.paintBordersFor(container);
124
		toolkit.paintBordersFor(container);
123
		section.setClient(container);
125
		section.setClient(container);
Lines 176-181 Link Here
176
			case 4 :
178
			case 4 :
177
				handleRemoveAll();
179
				handleRemoveAll();
178
				break;
180
				break;
181
			case 5 :
182
				handleProperties();
183
				break;
179
			case 7 :
184
			case 7 :
180
				handleNewPlugin();
185
				handleNewPlugin();
181
				break;
186
				break;
Lines 206-211 Link Here
206
		}
211
		}
207
	}
212
	}
208
213
214
	private void handleProperties() {
215
		IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
216
		if (ssel.size() == 1) {
217
			IProductPlugin plugin = (IProductPlugin) ssel.toArray()[0];
218
			VersionDialog dialog = new VersionDialog(PDEPlugin.getActiveWorkbenchShell(), isEditable(), plugin.getVersion());
219
			dialog.create();
220
			SWTUtil.setDialogSize(dialog, 400, 200);
221
			if (dialog.open() == Window.OK) {
222
				plugin.setVersion(dialog.getVersion());
223
			}
224
		}
225
	}
226
209
	/* (non-Javadoc)
227
	/* (non-Javadoc)
210
	 * @see org.eclipse.pde.internal.ui.editor.TableSection#handleDoubleClick(org.eclipse.jface.viewers.IStructuredSelection)
228
	 * @see org.eclipse.pde.internal.ui.editor.TableSection#handleDoubleClick(org.eclipse.jface.viewers.IStructuredSelection)
211
	 */
229
	 */
Lines 381-387 Link Here
381
			Object[] bundles = dialog.getResult();
399
			Object[] bundles = dialog.getResult();
382
			for (int i = 0; i < bundles.length; i++) {
400
			for (int i = 0; i < bundles.length; i++) {
383
				BundleDescription desc = (BundleDescription) bundles[i];
401
				BundleDescription desc = (BundleDescription) bundles[i];
384
				addPlugin(desc.getSymbolicName(), desc.getVersion().toString());
402
				addPlugin(desc.getSymbolicName(), "0.0.0"); //$NON-NLS-1$
403
				//addPlugin(desc.getSymbolicName(), desc.getVersion().toString());
385
			}
404
			}
386
		}
405
		}
387
	}
406
	}
Lines 454-459 Link Here
454
				table.setSelection(count - 1);
473
				table.setSelection(count - 1);
455
			}
474
			}
456
475
476
		} else if (e.getChangeType() == IModelChangedEvent.CHANGE) {
477
			fPluginTable.refresh();
457
		}
478
		}
458
		updateRemoveButtons(false, true);
479
		updateRemoveButtons(false, true);
459
	}
480
	}
(-)src/org/eclipse/pde/internal/ui/editor/product/FeatureSection.java (-11 / +28 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor.product;
11
package org.eclipse.pde.internal.ui.editor.product;
12
12
13
import org.eclipse.pde.internal.ui.dialogs.FeatureSelectionDialog;
14
15
import java.util.ArrayList;
13
import java.util.ArrayList;
16
import org.eclipse.jface.action.*;
14
import org.eclipse.jface.action.*;
17
import org.eclipse.jface.util.IPropertyChangeListener;
15
import org.eclipse.jface.util.IPropertyChangeListener;
Lines 27-32 Link Here
27
import org.eclipse.pde.internal.core.iproduct.*;
25
import org.eclipse.pde.internal.core.iproduct.*;
28
import org.eclipse.pde.internal.ui.PDEPlugin;
26
import org.eclipse.pde.internal.ui.PDEPlugin;
29
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
28
import org.eclipse.pde.internal.ui.dialogs.FeatureSelectionDialog;
30
import org.eclipse.pde.internal.ui.editor.*;
29
import org.eclipse.pde.internal.ui.editor.*;
31
import org.eclipse.pde.internal.ui.editor.actions.SortAction;
30
import org.eclipse.pde.internal.ui.editor.actions.SortAction;
32
import org.eclipse.pde.internal.ui.editor.feature.FeatureEditor;
31
import org.eclipse.pde.internal.ui.editor.feature.FeatureEditor;
Lines 61-75 Link Here
61
	}
60
	}
62
61
63
	private static String[] getButtonLabels() {
62
	private static String[] getButtonLabels() {
64
		String[] labels = new String[8];
63
		String[] labels = new String[9];
65
		labels[0] = PDEUIMessages.Product_FeatureSection_add;
64
		labels[0] = PDEUIMessages.Product_FeatureSection_add;
66
		labels[1] = PDEUIMessages.Product_FeatureSection_remove;
65
		labels[1] = PDEUIMessages.Product_FeatureSection_remove;
67
		labels[2] = PDEUIMessages.Product_PluginSection_removeAll;
66
		labels[2] = PDEUIMessages.Product_PluginSection_removeAll;
68
		labels[3] = PDEUIMessages.Product_FeatureSection_up;
67
		labels[3] = PDEUIMessages.Product_FeatureSection_properties;
69
		labels[4] = PDEUIMessages.Product_FeatureSection_down;
68
		labels[4] = PDEUIMessages.Product_FeatureSection_up;
70
		labels[5] = null;
69
		labels[5] = PDEUIMessages.Product_FeatureSection_down;
71
		labels[6] = null;
70
		labels[6] = null;
72
		labels[7] = PDEUIMessages.Product_FeatureSection_newFeature;
71
		labels[7] = null;
72
		labels[8] = PDEUIMessages.Product_FeatureSection_newFeature;
73
		return labels;
73
		return labels;
74
	}
74
	}
75
75
Lines 102-108 Link Here
102
102
103
		tablePart.setButtonEnabled(3, isEditable());
103
		tablePart.setButtonEnabled(3, isEditable());
104
		tablePart.setButtonEnabled(4, isEditable());
104
		tablePart.setButtonEnabled(4, isEditable());
105
		tablePart.setButtonEnabled(7, isEditable());
105
		tablePart.setButtonEnabled(5, isEditable());
106
		tablePart.setButtonEnabled(8, isEditable());
106
107
107
		toolkit.paintBordersFor(container);
108
		toolkit.paintBordersFor(container);
108
		section.setClient(container);
109
		section.setClient(container);
Lines 154-169 Link Here
154
				handleRemoveAll();
155
				handleRemoveAll();
155
				break;
156
				break;
156
			case 3 :
157
			case 3 :
157
				handleUp();
158
				handleProperties();
158
				break;
159
				break;
159
			case 4 :
160
			case 4 :
161
				handleUp();
162
				break;
163
			case 5 :
160
				handleDown();
164
				handleDown();
161
				break;
165
				break;
162
			case 7 :
166
			case 8 :
163
				handleNewFeature();
167
				handleNewFeature();
164
		}
168
		}
165
	}
169
	}
166
170
171
	private void handleProperties() {
172
		IStructuredSelection ssel = (IStructuredSelection) fFeatureTable.getSelection();
173
		if (ssel.size() == 1) {
174
			IProductFeature feature = (IProductFeature) ssel.toArray()[0];
175
			VersionDialog dialog = new VersionDialog(PDEPlugin.getActiveWorkbenchShell(), isEditable(), feature.getVersion());
176
			dialog.create();
177
			SWTUtil.setDialogSize(dialog, 400, 200);
178
			if (dialog.open() == Window.OK) {
179
				feature.setVersion(dialog.getVersion());
180
			}
181
		}
182
	}
183
167
	private void handleNewFeature() {
184
	private void handleNewFeature() {
168
		NewFeatureProjectWizard wizard = new NewFeatureProjectWizard();
185
		NewFeatureProjectWizard wizard = new NewFeatureProjectWizard();
169
		WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
186
		WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
(-)src/org/eclipse/pde/internal/ui/editor/product/VersionDialog.java (+60 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Code 9 Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Code 9 Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor.product;
12
13
import org.eclipse.jface.dialogs.StatusDialog;
14
import org.eclipse.pde.internal.ui.PDEUIMessages;
15
import org.eclipse.pde.internal.ui.parts.PluginVersionPart;
16
import org.eclipse.swt.events.ModifyEvent;
17
import org.eclipse.swt.events.ModifyListener;
18
import org.eclipse.swt.widgets.*;
19
20
public class VersionDialog extends StatusDialog {
21
22
	private String fVersion;
23
	private boolean fEditable;
24
	private PluginVersionPart fVersionPart;
25
26
	public VersionDialog(Shell parent, boolean editable, String version) {
27
		super(parent);
28
		fEditable = editable;
29
		fVersionPart = new PluginVersionPart(false) {
30
			protected String getGroupText() {
31
				return PDEUIMessages.VersionDialog_text;
32
			}
33
		};
34
		fVersionPart.setVersion(version);
35
	}
36
37
	protected Control createDialogArea(Composite parent) {
38
		Composite comp = (Composite) super.createDialogArea(parent);
39
40
		fVersionPart.createVersionFields(comp, true, fEditable);
41
		ModifyListener ml = new ModifyListener() {
42
			public void modifyText(ModifyEvent e) {
43
				updateStatus(fVersionPart.validateFullVersionRangeText(true));
44
			}
45
		};
46
		fVersionPart.addListeners(ml, ml);
47
48
		return comp;
49
	}
50
51
	public String getVersion() {
52
		return fVersion;
53
	}
54
55
	protected void okPressed() {
56
		fVersion = fVersionPart.getVersion();
57
		super.okPressed();
58
	}
59
60
}
(-)src/org/eclipse/pde/internal/core/product/ProductPlugin.java (-1 / +4 lines)
Lines 45-51 Link Here
45
	 */
45
	 */
46
	public void write(String indent, PrintWriter writer) {
46
	public void write(String indent, PrintWriter writer) {
47
		writer.print(indent + "<plugin id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$
47
		writer.print(indent + "<plugin id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$
48
		if (fVersion != null && !fVersion.equals("0.0.0")) { //$NON-NLS-1$
48
		if (fVersion != null && fVersion.length() > 0 && !fVersion.equals("0.0.0")) { //$NON-NLS-1$
49
			writer.print(" version=\"" + fVersion + "\""); //$NON-NLS-1$ //$NON-NLS-2$
49
			writer.print(" version=\"" + fVersion + "\""); //$NON-NLS-1$ //$NON-NLS-2$
50
		}
50
		}
51
		if (PluginRegistry.findModel(fId) instanceof IFragmentModel)
51
		if (PluginRegistry.findModel(fId) instanceof IFragmentModel)
Lines 72-78 Link Here
72
	}
72
	}
73
73
74
	public void setVersion(String version) {
74
	public void setVersion(String version) {
75
		String old = fVersion;
75
		fVersion = version;
76
		fVersion = version;
77
		if (isEditable())
78
			firePropertyChanged("version", old, fVersion); //$NON-NLS-1$
76
	}
79
	}
77
80
78
}
81
}
(-)src/org/eclipse/pde/internal/core/product/ProductFeature.java (-3 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-17 Link Here
11
package org.eclipse.pde.internal.core.product;
11
package org.eclipse.pde.internal.core.product;
12
12
13
import java.io.PrintWriter;
13
import java.io.PrintWriter;
14
15
import org.eclipse.pde.internal.core.iproduct.IProductFeature;
14
import org.eclipse.pde.internal.core.iproduct.IProductFeature;
16
import org.eclipse.pde.internal.core.iproduct.IProductModel;
15
import org.eclipse.pde.internal.core.iproduct.IProductModel;
17
import org.w3c.dom.Element;
16
import org.w3c.dom.Element;
Lines 36-42 Link Here
36
	}
35
	}
37
36
38
	public void write(String indent, PrintWriter writer) {
37
	public void write(String indent, PrintWriter writer) {
39
		writer.println(indent + "<feature id=\"" + fId + "\" version=\"" + fVersion + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
38
		writer.print(indent + "<feature id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$
39
		if (fVersion != null && fVersion.length() > 0 && !fVersion.equals("0.0.0")) { //$NON-NLS-1$
40
			writer.print(" version=\"" + fVersion + "\""); //$NON-NLS-1$ //$NON-NLS-2$
41
		}
42
		writer.println("/>"); //$NON-NLS-1$
40
	}
43
	}
41
44
42
	public String getId() {
45
	public String getId() {
Lines 52-58 Link Here
52
	}
55
	}
53
56
54
	public void setVersion(String version) {
57
	public void setVersion(String version) {
58
		String old = fVersion;
55
		fVersion = version;
59
		fVersion = version;
60
		if (isEditable())
61
			firePropertyChanged("version", old, fVersion); //$NON-NLS-1$
56
	}
62
	}
57
63
58
}
64
}

Return to bug 246926