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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java (-19 / +56 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
2
 * Copyright (c) 2007, 2011 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 32-38 Link Here
32
	 * simple configurator and update configurator, we change the start level as they 
32
	 * simple configurator and update configurator, we change the start level as they 
33
	 * shouldn't be started together.
33
	 * shouldn't be started together.
34
	 */
34
	 */
35
	public static final String DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL = "3:true"; //$NON-NLS-1$
35
	public static final String DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL_TEXT = "3"; //$NON-NLS-1$
36
	public static final String DEFAULT_UPDATE_CONFIGURATOR_AUTO_START_TEXT = "true"; //$NON-NLS-1$
37
	public static final String DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL = DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL_TEXT + ":" + DEFAULT_UPDATE_CONFIGURATOR_AUTO_START_TEXT; //$NON-NLS-1$
36
38
37
	public static final char VERSION_SEPARATOR = '*';
39
	public static final char VERSION_SEPARATOR = '*';
38
40
Lines 358-363 Link Here
358
		return map;
360
		return map;
359
	}
361
	}
360
362
363
	public static String resolveSystemRunLevelText(IPluginModelBase model) {
364
		BundleDescription description = model.getBundleDescription();
365
		String modelName = description.getSymbolicName();
366
367
		if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) {
368
			return "1"; //$NON-NLS-1$ 
369
		} else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) {
370
			return "1"; //$NON-NLS-1$
371
		} else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) {
372
			return "2"; //$NON-NLS-1$
373
		} else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) {
374
			return "-1"; //$NON-NLS-1$
375
		} else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) {
376
			return DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL_TEXT;
377
		} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) {
378
			if (TargetPlatformHelper.getTargetVersion() > 3.1) {
379
				return "default"; //$NON-NLS-1$
380
			}
381
			return "2"; //$NON-NLS-1$
382
		} else {
383
			return null;
384
		}
385
	}
386
387
	public static String resolveSystemAutoText(IPluginModelBase model) {
388
		BundleDescription description = model.getBundleDescription();
389
		String modelName = description.getSymbolicName();
390
391
		if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) {
392
			return "true"; //$NON-NLS-1$ 
393
		} else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) {
394
			return "true"; //$NON-NLS-1$
395
		} else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) {
396
			return "true"; //$NON-NLS-1$
397
		} else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) {
398
			return "true"; //$NON-NLS-1$
399
		} else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) {
400
			return DEFAULT_UPDATE_CONFIGURATOR_AUTO_START_TEXT;
401
		} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) {
402
			if (TargetPlatformHelper.getTargetVersion() > 3.1) {
403
				return "true"; //$NON-NLS-1$
404
			}
405
			return "true"; //$NON-NLS-1$
406
		} else {
407
			return null;
408
		}
409
	}
410
361
	/**
411
	/**
362
	 * Adds the given bundle and start information to the map.  This will override anything set
412
	 * Adds the given bundle and start information to the map.  This will override anything set
363
	 * for system bundles, and set their start level to the appropriate level
413
	 * for system bundles, and set their start level to the appropriate level
Lines 369-391 Link Here
369
		BundleDescription desc = bundle.getBundleDescription();
419
		BundleDescription desc = bundle.getBundleDescription();
370
		boolean defaultsl = (sl == null || sl.equals("default:default")); //$NON-NLS-1$
420
		boolean defaultsl = (sl == null || sl.equals("default:default")); //$NON-NLS-1$
371
		if (desc != null && defaultsl) {
421
		if (desc != null && defaultsl) {
372
			String modelName = desc.getSymbolicName();
422
			String runLevelText = resolveSystemRunLevelText(bundle);
373
			if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) {
423
			String autoText = resolveSystemAutoText(bundle);
374
				map.put(bundle, "1:true"); //$NON-NLS-1$ 
424
			if (runLevelText != null && autoText != null) {
375
			} else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) {
425
				map.put(bundle, runLevelText + ":" + autoText); //$NON-NLS-1$
376
				map.put(bundle, "1:true"); //$NON-NLS-1$
377
			} else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) {
378
				map.put(bundle, "2:true"); //$NON-NLS-1$
379
			} else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) {
380
				map.put(bundle, "-1:true"); //$NON-NLS-1$
381
			} else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) {
382
				map.put(bundle, DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL);
383
			} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) {
384
				if (TargetPlatformHelper.getTargetVersion() > 3.1) {
385
					map.put(bundle, "default:true"); //$NON-NLS-1$
386
				} else {
387
					map.put(bundle, "2:true"); //$NON-NLS-1$
388
				}
389
			} else {
426
			} else {
390
				map.put(bundle, sl);
427
				map.put(bundle, sl);
391
			}
428
			}
(-)src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java (-24 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 103-117 Link Here
103
		}
103
		}
104
104
105
		public String getColumnText(Object obj, int index) {
105
		public String getColumnText(Object obj, int index) {
106
			boolean isChecked = fPluginTreeViewer.getChecked(obj);
106
			switch (index) {
107
			switch (index) {
107
				case 0 :
108
				case 0 :
108
					return super.getColumnText(obj, index);
109
					return super.getColumnText(obj, index);
109
				case 1 :
110
				case 1 :
110
					if (levelColumnCache != null && levelColumnCache.containsKey(obj))
111
					if (isChecked && levelColumnCache != null && levelColumnCache.containsKey(obj))
111
						return (String) levelColumnCache.get(obj);
112
						return (String) levelColumnCache.get(obj);
112
					return ""; //$NON-NLS-1$
113
					return ""; //$NON-NLS-1$
113
				case 2 :
114
				case 2 :
114
					if (autoColumnCache != null && autoColumnCache.containsKey(obj))
115
					if (isChecked && autoColumnCache != null && autoColumnCache.containsKey(obj))
115
						return (String) autoColumnCache.get(obj);
116
						return (String) autoColumnCache.get(obj);
116
					return ""; //$NON-NLS-1$
117
					return ""; //$NON-NLS-1$
117
				default :
118
				default :
Lines 596-630 Link Here
596
	protected void resetText(IPluginModelBase model) {
597
	protected void resetText(IPluginModelBase model) {
597
		String levelText = ""; //$NON-NLS-1$
598
		String levelText = ""; //$NON-NLS-1$
598
		String autoText = ""; //$NON-NLS-1$
599
		String autoText = ""; //$NON-NLS-1$
599
		String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId();
600
600
		boolean isSystemBundle = systemBundleId.equals(model.getPluginBase().getId());
601
		if (model.isFragmentModel()) {
602
			autoText = "false"; //$NON-NLS-1$
603
		} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(model.getPluginBase().getId()) || "org.eclipse.equinox.ds".equals(model.getPluginBase().getId())) { //$NON-NLS-1$
604
			autoText = "true"; //$NON-NLS-1$
605
		}
606
		Widget widget = fPluginTreeViewer.testFindItem(model);
601
		Widget widget = fPluginTreeViewer.testFindItem(model);
607
		if (fPluginTreeViewer.getChecked(model)) {
602
		if (fPluginTreeViewer.getChecked(model)) {
608
			if (levelColumnCache.containsKey(model) && !isSystemBundle) {
603
			if (levelColumnCache.containsKey(model)) {
609
				levelText = (String) levelColumnCache.get(model);
604
				levelText = (String) levelColumnCache.get(model);
610
				levelText = levelText.length() > 0 ? levelText : "default"; //$NON-NLS-1$
605
				levelText = levelText == null || levelText.length() == 0 ? "default" : levelText; //$NON-NLS-1$
611
			}
606
			}
612
			if (autoColumnCache.containsKey(model) && !isSystemBundle) {
607
			if (autoColumnCache.containsKey(model)) {
613
				autoText = (String) autoColumnCache.get(model);
608
				autoText = (String) autoColumnCache.get(model);
614
				autoText = autoText.length() > 0 ? autoText : "default"; //$NON-NLS-1$
609
				autoText = autoText == null || autoText.length() == 0 ? "default" : autoText; //$NON-NLS-1$
615
			}
610
			}
611
612
			// Replace run levels and autostart values for certain important system bundles
613
			String systemLevelText = BundleLauncherHelper.resolveSystemRunLevelText(model);
614
			levelText = systemLevelText != null ? systemLevelText : levelText;
615
616
			String systemAutoText = BundleLauncherHelper.resolveSystemAutoText(model);
617
			autoText = systemAutoText != null ? systemAutoText : autoText;
616
		}
618
		}
617
		if (levelText != null) {
619
618
			levelColumnCache.put(model, levelText);
620
		// Set values in UI (although I'm not sure why we don't use the label provider here)
619
			if (widget instanceof TreeItem) {
621
		if (widget instanceof TreeItem) {
620
				((TreeItem) widget).setText(1, levelText);
622
			((TreeItem) widget).setText(1, levelText);
621
			}
622
		}
623
		}
623
		if (autoText != null) {
624
624
			autoColumnCache.put(model, autoText);
625
		if (widget instanceof TreeItem) {
625
			if (widget instanceof TreeItem) {
626
			((TreeItem) widget).setText(2, autoText);
626
				((TreeItem) widget).setText(2, autoText);
627
			}
628
		}
627
		}
629
	}
628
	}
630
629
(-)src/org/eclipse/pde/internal/ui/launcher/ConfigurationAreaBlock.java (-3 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 99-105 Link Here
99
99
100
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
100
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
101
		configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, fUseDefaultLocationButton.getSelection());
101
		configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, fUseDefaultLocationButton.getSelection());
102
		fLastEnteredConfigArea = getLocation();
102
		// This is a hack.  A more proper way is likely to have the Configuration name text
103
		// change callback update the location text directly ... but I could not unravel
104
		// a reasonable way to pass messages in the correct direction.
105
		
106
		// Given the brittle nature of the implementation this seemed like a reasonable compromise.
107
		if (fUseDefaultLocationButton.getSelection()) {
108
			fLastEnteredConfigArea = DEFAULT_DIR + configuration.getName();
109
		} else {
110
			fLastEnteredConfigArea = getLocation();
111
		}
103
		configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, fLastEnteredConfigArea);
112
		configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, fLastEnteredConfigArea);
104
		configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, fClearConfig.getSelection());
113
		configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, fClearConfig.getSelection());
105
	}
114
	}
Lines 132-136 Link Here
132
			return null;
141
			return null;
133
		return super.validate();
142
		return super.validate();
134
	}
143
	}
135
136
}
144
}
(-)src/org/eclipse/pde/ui/launcher/OSGiSettingsTab.java (-3 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2011 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.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.IPDELauncherConstants;
14
15
import org.eclipse.core.runtime.CoreException;
13
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.ILaunchConfiguration;
14
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
Lines 19-24 Link Here
19
import org.eclipse.pde.internal.ui.*;
17
import org.eclipse.pde.internal.ui.*;
20
import org.eclipse.pde.internal.ui.launcher.ConfigurationAreaBlock;
18
import org.eclipse.pde.internal.ui.launcher.ConfigurationAreaBlock;
21
import org.eclipse.pde.internal.ui.launcher.JREBlock;
19
import org.eclipse.pde.internal.ui.launcher.JREBlock;
20
import org.eclipse.pde.launching.IPDELauncherConstants;
22
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.graphics.Image;
22
import org.eclipse.swt.graphics.Image;
24
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.layout.GridData;
Lines 146-149 Link Here
146
	public String getId() {
145
	public String getId() {
147
		return IPDELauncherConstants.TAB_OSGI_SETTINGS_ID;
146
		return IPDELauncherConstants.TAB_OSGI_SETTINGS_ID;
148
	}
147
	}
148
149
	// Since editing the config name is not updating the location field in real time
150
	// This code at least makes sure the location field is set with the current config name
151
	// if the tab is selected.
152
	public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
153
		super.activated(workingCopy);
154
		try {
155
			fConfigurationBlock.initializeFrom(workingCopy);
156
		} catch (CoreException e) {
157
			// A horrible cop out but exactly what the other callers of .initializeFrom() in org.eclipse.pde.ui.launcher do.
158
		}
159
	}
149
}
160
}

Return to bug 309701