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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/wizards/product/ProductFromConfigOperation.java (-4 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
2
 * Copyright (c) 2005, 2009 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 7-15 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.product;
12
package org.eclipse.pde.internal.ui.wizards.product;
12
13
14
import java.util.*;
13
import org.eclipse.core.resources.IContainer;
15
import org.eclipse.core.resources.IContainer;
14
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
Lines 19-25 Link Here
19
import org.eclipse.pde.internal.core.iproduct.*;
21
import org.eclipse.pde.internal.core.iproduct.*;
20
import org.eclipse.pde.internal.core.iproduct.IProduct;
22
import org.eclipse.pde.internal.core.iproduct.IProduct;
21
import org.eclipse.pde.internal.ui.PDEPlugin;
23
import org.eclipse.pde.internal.ui.PDEPlugin;
22
import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator;
24
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
23
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
25
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
24
26
25
/**
27
/**
Lines 67-73 Link Here
67
				product.setJREInfo(jreInfo);
69
				product.setJREInfo(jreInfo);
68
			}
70
			}
69
71
70
			addPlugins(factory, product, LaunchPluginValidator.getPluginList(fLaunchConfiguration));
72
			// fetch the plug-ins models
73
			String workspaceId = IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS;
74
			String targetId = IPDELauncherConstants.SELECTED_TARGET_PLUGINS;
75
			if (fLaunchConfiguration.getType().getIdentifier().equals(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE)) {
76
				workspaceId = IPDELauncherConstants.WORKSPACE_BUNDLES;
77
				targetId = IPDELauncherConstants.TARGET_BUNDLES;
78
			}
79
			Set set = new HashSet();
80
			Map map = BundleLauncherHelper.getWorkspaceBundleMap(fLaunchConfiguration, set, workspaceId);
81
			map.putAll(BundleLauncherHelper.getTargetBundleMap(fLaunchConfiguration, set, targetId));
82
83
			addPlugins(factory, product, map);
84
71
			if (fLaunchConfiguration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
85
			if (fLaunchConfiguration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
72
				super.initializeProduct(product);
86
				super.initializeProduct(product);
73
			} else {
87
			} else {
Lines 83-89 Link Here
83
				}
97
				}
84
			}
98
			}
85
		} catch (CoreException e) {
99
		} catch (CoreException e) {
100
			PDEPlugin.logException(e);
86
		}
101
		}
87
	}
102
	}
88
89
}
103
}
(-)src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java (-6 / +25 lines)
Lines 12-19 Link Here
12
package org.eclipse.pde.internal.ui.wizards.product;
12
package org.eclipse.pde.internal.ui.wizards.product;
13
13
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
import java.util.Properties;
15
import java.util.*;
16
import java.util.StringTokenizer;
17
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
Lines 157-170 Link Here
157
		}
156
		}
158
	}
157
	}
159
158
160
	protected void addPlugins(IProductModelFactory factory, IProduct product, IPluginModelBase[] plugins) {
159
	protected void addPlugins(IProductModelFactory factory, IProduct product, Map plugins) {
161
		IProductPlugin[] pplugins = new IProductPlugin[plugins.length];
160
		IProductPlugin[] pplugins = new IProductPlugin[plugins.size()];
162
		for (int i = 0; i < plugins.length; i++) {
161
		List configurations = new ArrayList(3);
162
		IPluginModelBase[] models = (IPluginModelBase[]) plugins.keySet().toArray(new IPluginModelBase[plugins.size()]);
163
		for (int i = 0; i < models.length; i++) {
164
			IPluginModelBase model = models[i];
165
166
			// create plug-in model
163
			IProductPlugin pplugin = factory.createPlugin();
167
			IProductPlugin pplugin = factory.createPlugin();
164
			pplugin.setId(plugins[i].getPluginBase().getId());
168
			pplugin.setId(model.getPluginBase().getId());
165
			pplugins[i] = pplugin;
169
			pplugins[i] = pplugin;
170
171
			// create plug-in configuration model
172
			String sl = (String) plugins.get(model);
173
			if (!model.isFragmentModel() && !sl.equals("default:default")) { //$NON-NLS-1$
174
				IPluginConfiguration configuration = factory.createPluginConfiguration();
175
				configuration.setId(model.getPluginBase().getId());
176
				// TODO do we want to set the version here?
177
				String[] slinfo = sl.split(":"); //$NON-NLS-1$
178
				configuration.setStartLevel(Integer.valueOf(slinfo[0]).intValue());
179
				configuration.setAutoStart(slinfo[0].equals("true")); //$NON-NLS-1$
180
				configurations.add(configuration);
181
			}
166
		}
182
		}
167
		product.addPlugins(pplugins);
183
		product.addPlugins(pplugins);
184
		int size = configurations.size();
185
		if (size > 0)
186
			product.addPluginConfigurations((IPluginConfiguration[]) configurations.toArray(new IPluginConfiguration[size]));
168
	}
187
	}
169
188
170
	protected void addPlugins(IProductModelFactory factory, IProduct product, String[] plugins) {
189
	protected void addPlugins(IProductModelFactory factory, IProduct product, String[] plugins) {
(-)src/org/eclipse/pde/internal/ui/wizards/product/ProductFileWizardPage.java (-8 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2009 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 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.product;
12
package org.eclipse.pde.internal.ui.wizards.product;
12
13
Lines 20-28 Link Here
20
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.viewers.IStructuredSelection;
22
import org.eclipse.jface.viewers.IStructuredSelection;
22
import org.eclipse.pde.core.plugin.*;
23
import org.eclipse.pde.core.plugin.*;
23
import org.eclipse.pde.internal.ui.IHelpContextIds;
24
import org.eclipse.pde.internal.ui.*;
24
import org.eclipse.pde.internal.ui.PDEUIMessages;
25
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
25
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
26
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
27
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
26
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionAdapter;
28
import org.eclipse.swt.events.SelectionEvent;
30
import org.eclipse.swt.events.SelectionEvent;
Lines 146-158 Link Here
146
		ArrayList list = new ArrayList();
148
		ArrayList list = new ArrayList();
147
		try {
149
		try {
148
			ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
150
			ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
149
			ILaunchConfigurationType type = manager.getLaunchConfigurationType("org.eclipse.pde.ui.RuntimeWorkbench"); //$NON-NLS-1$
151
			ILaunchConfigurationType type = manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
150
			ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
152
			ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
151
			for (int i = 0; i < configs.length; i++) {
153
			for (int i = 0; i < configs.length; i++) {
152
				if (!DebugUITools.isPrivate(configs[i]))
154
				if (!DebugUITools.isPrivate(configs[i]))
153
					list.add(configs[i].getName());
155
					list.add(configs[i].getName());
154
			}
156
			}
157
			// add osgi launch configs to the list
158
			type = manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
159
			configs = manager.getLaunchConfigurations(type);
160
			for (int i = 0; i < configs.length; i++) {
161
				if (!DebugUITools.isPrivate(configs[i]))
162
					list.add(configs[i].getName());
163
			}
155
		} catch (CoreException e) {
164
		} catch (CoreException e) {
165
			PDEPlugin.logException(e);
156
		}
166
		}
157
		return (String[]) list.toArray(new String[list.size()]);
167
		return (String[]) list.toArray(new String[list.size()]);
158
	}
168
	}
Lines 164-176 Link Here
164
		String configName = fLaunchConfigCombo.getText();
174
		String configName = fLaunchConfigCombo.getText();
165
		try {
175
		try {
166
			ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
176
			ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
167
			ILaunchConfigurationType type = manager.getLaunchConfigurationType("org.eclipse.pde.ui.RuntimeWorkbench"); //$NON-NLS-1$
177
			ILaunchConfigurationType type = manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
178
			ILaunchConfigurationType type2 = manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
168
			ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
179
			ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
169
			for (int i = 0; i < configs.length; i++) {
180
			ILaunchConfiguration[] configs2 = manager.getLaunchConfigurations(type2);
170
				if (configs[i].getName().equals(configName) && !DebugUITools.isPrivate(configs[i]))
181
			ILaunchConfiguration[] configurations = new ILaunchConfiguration[configs.length + configs2.length];
171
					return configs[i];
182
			System.arraycopy(configs, 0, configurations, 0, configs.length);
183
			System.arraycopy(configs2, 0, configurations, configs.length, configs2.length);
184
			for (int i = 0; i < configurations.length; i++) {
185
				if (configurations[i].getName().equals(configName) && !DebugUITools.isPrivate(configurations[i]))
186
					return configurations[i];
172
			}
187
			}
173
		} catch (CoreException e) {
188
		} catch (CoreException e) {
189
			PDEPlugin.logException(e);
174
		}
190
		}
175
		return null;
191
		return null;
176
	}
192
	}
(-)src/org/eclipse/pde/internal/ui/launcher/LaunchAction.java (-4 / +4 lines)
Lines 111-123 Link Here
111
111
112
	private void appendBundle(StringBuffer buffer, IPluginModelBase model) {
112
	private void appendBundle(StringBuffer buffer, IPluginModelBase model) {
113
		IPluginConfiguration configuration = (IPluginConfiguration) fPluginConfigurations.get(model.getPluginBase().getId());
113
		IPluginConfiguration configuration = (IPluginConfiguration) fPluginConfigurations.get(model.getPluginBase().getId());
114
		int sl = 4;
114
		String sl = "default"; //$NON-NLS-1$
115
		String autostart = "false"; //$NON-NLS-1$
115
		String autostart = "default"; //$NON-NLS-1$
116
		if (configuration != null) {
116
		if (configuration != null) {
117
			sl = configuration.getStartLevel();
117
			sl = Integer.toString(configuration.getStartLevel());
118
			autostart = Boolean.toString(configuration.isAutoStart());
118
			autostart = Boolean.toString(configuration.isAutoStart());
119
		}
119
		}
120
		String entry = BundleLauncherHelper.writeBundleEntry(model, Integer.toString(sl), autostart);
120
		String entry = BundleLauncherHelper.writeBundleEntry(model, sl, autostart);
121
		buffer.append(entry);
121
		buffer.append(entry);
122
		buffer.append(',');
122
		buffer.append(',');
123
	}
123
	}

Return to bug 245782