### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.ui Index: src/org/eclipse/pde/internal/ui/launcher/PluginBlock.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginBlock.java,v retrieving revision 1.14 diff -u -r1.14 PluginBlock.java --- src/org/eclipse/pde/internal/ui/launcher/PluginBlock.java 31 Oct 2008 15:29:32 -0000 1.14 +++ src/org/eclipse/pde/internal/ui/launcher/PluginBlock.java 12 Jan 2009 23:49:55 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * EclipseSource Corporation - ongoing enhancements * Ian Bull - bug 204404 *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; @@ -15,8 +16,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.core.util.IdUtil; import org.eclipse.pde.internal.ui.IPDEUIConstants; @@ -62,30 +61,34 @@ fNumWorkspaceChecked = automaticAdd ? fWorkspaceModels.length : 0; String attribute = automaticAdd ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS; - Set bundles = LaunchPluginValidator.parsePlugins(configuration, attribute); - Iterator it = bundles.iterator(); - while (it.hasNext()) { - IPluginModelBase base = (IPluginModelBase) it.next(); - fPluginTreeViewer.setChecked(base, !automaticAdd); - fNumWorkspaceChecked = automaticAdd ? fNumWorkspaceChecked - 1 : fNumWorkspaceChecked + 1; + Map map = BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, attribute); + Iterator iter = map.keySet().iterator(); + fPluginTreeViewer.setSubtreeChecked(fWorkspacePlugins, false); + while (iter.hasNext()) { + IPluginModelBase model = (IPluginModelBase) iter.next(); + if (fPluginTreeViewer.setChecked(model, !automaticAdd)) { + setText(model, map.get(model).toString()); + } } + fNumWorkspaceChecked = map.size(); + resetGroup(fWorkspacePlugins); fPluginTreeViewer.setChecked(fWorkspacePlugins, fNumWorkspaceChecked > 0); fPluginTreeViewer.setGrayed(fWorkspacePlugins, fNumWorkspaceChecked > 0 && fNumWorkspaceChecked < fWorkspaceModels.length); } - protected void initExternalPluginsState(ILaunchConfiguration config) throws CoreException { - fNumExternalChecked = 0; - + protected void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { + Map map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); + Iterator iter = map.keySet().iterator(); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); - Set selected = LaunchPluginValidator.parsePlugins(config, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); - Iterator it = selected.iterator(); - while (it.hasNext()) { - IPluginModelBase model = (IPluginModelBase) it.next(); - fPluginTreeViewer.setChecked(model, true); - fNumExternalChecked += 1; + while (iter.hasNext()) { + IPluginModelBase model = (IPluginModelBase) iter.next(); + if (fPluginTreeViewer.setChecked(model, true)) { + setText(model, map.get(model).toString()); + } } - + fNumExternalChecked = map.size(); + resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < fExternalModels.length); } @@ -99,7 +102,7 @@ // if "automatic add" option is selected, save "deselected" workspace plugins // Otherwise, save "selected" workspace plugins if (fPluginTreeViewer.getChecked(model) != fAddWorkspaceButton.getSelection()) { - appendBundle(wbuf, model); + appendToBuffer(wbuf, model); } } @@ -129,7 +132,7 @@ if (checked[i] instanceof IPluginModelBase) { IPluginModelBase model = (IPluginModelBase) checked[i]; if (model.getUnderlyingResource() == null) { - appendBundle(exbuf, model); + appendToBuffer(exbuf, model); } } } @@ -142,20 +145,6 @@ } } - private void appendBundle(StringBuffer buffer, IPluginModelBase model) { - if (buffer.length() > 0) - buffer.append(","); //$NON-NLS-1$ - - String id = model.getPluginBase().getId(); - buffer.append(id); - - ModelEntry entry = PluginRegistry.findEntry(id); - if (entry.getActiveModels().length > 1) { - buffer.append(BundleLauncherHelper.VERSION_SEPARATOR); - buffer.append(model.getPluginBase().getVersion()); - } - } - protected void computeSubset() { validateExtensions(); super.computeSubset(); @@ -227,7 +216,4 @@ return new EclipsePluginValidationOperation(fLaunchConfig); } - protected void refreshTreeView(CheckboxTreeViewer treeView) { - treeView.setSelection(StructuredSelection.EMPTY); - } } Index: src/org/eclipse/pde/internal/ui/launcher/OSGiBundleBlock.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiBundleBlock.java,v retrieving revision 1.20 diff -u -r1.20 OSGiBundleBlock.java --- src/org/eclipse/pde/internal/ui/launcher/OSGiBundleBlock.java 7 Dec 2008 00:00:21 -0000 1.20 +++ src/org/eclipse/pde/internal/ui/launcher/OSGiBundleBlock.java 12 Jan 2009 23:49:55 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,169 +15,18 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.util.Util; -import org.eclipse.jface.viewers.*; import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.core.PDECore; -import org.eclipse.pde.internal.ui.PDELabelProvider; -import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.pde.internal.ui.elements.NamedElement; import org.eclipse.pde.ui.launcher.BundlesTab; import org.eclipse.pde.ui.launcher.IPDELauncherConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.TreeEditor; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.*; public class OSGiBundleBlock extends AbstractPluginBlock { - private HashMap levelColumnCache = new HashMap(); - private HashMap autoColumnCache = new HashMap(); - private TreeEditor levelColumnEditor = null; - private TreeEditor autoColumnEditor = null; - - class OSGiLabelProvider extends PDELabelProvider { - public Image getColumnImage(Object obj, int index) { - return index == 0 ? super.getColumnImage(obj, index) : null; - } - - public String getColumnText(Object obj, int index) { - switch (index) { - case 0 : - return super.getColumnText(obj, index); - case 1 : - if (levelColumnCache != null && levelColumnCache.containsKey(obj)) - return (String) levelColumnCache.get(obj); - return ""; //$NON-NLS-1$ - case 2 : - if (autoColumnCache != null && autoColumnCache.containsKey(obj)) - return (String) autoColumnCache.get(obj); - return ""; //$NON-NLS-1$ - default : - return ""; //$NON-NLS-1$ - } - } - } - private ILaunchConfiguration fLaunchConfiguration; public OSGiBundleBlock(BundlesTab tab) { super(tab); } - protected void createPluginViewer(Composite composite, int span, int indent) { - super.createPluginViewer(composite, span, indent); - Tree tree = fPluginTreeViewer.getTree(); - - TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); - column1.setText(fTab.getName()); - column1.setWidth(300); - - TreeColumn column2 = new TreeColumn(tree, SWT.CENTER); - column2.setText(PDEUIMessages.EquinoxPluginBlock_levelColumn); - column2.setWidth(80); - - TreeColumn column3 = new TreeColumn(tree, SWT.CENTER); - column3.setText(PDEUIMessages.EquinoxPluginBlock_autoColumn); - column3.setWidth(80); - tree.setHeaderVisible(true); - - createEditors(); - } - - private void createEditors() { - final Tree tree = fPluginTreeViewer.getTree(); - - levelColumnEditor = new TreeEditor(tree); - levelColumnEditor.horizontalAlignment = SWT.CENTER; - levelColumnEditor.minimumWidth = 60; - if (Util.isMac()) - levelColumnEditor.minimumHeight = 27; - - autoColumnEditor = new TreeEditor(tree); - autoColumnEditor.horizontalAlignment = SWT.CENTER; - autoColumnEditor.grabHorizontal = true; - autoColumnEditor.minimumWidth = 60; - - tree.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - // Clean up any previous editor control - Control oldEditor = levelColumnEditor.getEditor(); - if (oldEditor != null && !oldEditor.isDisposed()) - oldEditor.dispose(); - - oldEditor = autoColumnEditor.getEditor(); - if (oldEditor != null && !oldEditor.isDisposed()) - oldEditor.dispose(); - - // Identify the selected row - final TreeItem item = (TreeItem) e.item; - if (!isEditable(item)) - return; - - if (!isFragment(item)) { // only display editing controls if we're not a fragment - final Spinner spinner = new Spinner(tree, SWT.BORDER); - spinner.setMinimum(0); - String level = item.getText(1); - int defaultLevel = level.length() == 0 || "default".equals(level) ? 0 : Integer.parseInt(level); //$NON-NLS-1$ - spinner.setSelection(defaultLevel); - spinner.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - if (item.getChecked()) { - int selection = spinner.getSelection(); - item.setText(1, selection == 0 ? "default" //$NON-NLS-1$ - : Integer.toString(selection)); - levelColumnCache.put(item.getData(), item.getText(1)); - fTab.updateLaunchConfigurationDialog(); - } - } - }); - levelColumnEditor.setEditor(spinner, item, 1); - - final CCombo combo = new CCombo(tree, SWT.BORDER | SWT.READ_ONLY); - combo.setItems(new String[] {"default", Boolean.toString(true), Boolean.toString(false)}); //$NON-NLS-1$ - combo.setText(item.getText(2)); - combo.pack(); - combo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (item.getChecked()) { - item.setText(2, combo.getText()); - autoColumnCache.put(item.getData(), item.getText(2)); - fTab.updateLaunchConfigurationDialog(); - } - } - }); - autoColumnEditor.setEditor(combo, item, 2); - } - } - }); - } - - private boolean isEditable(TreeItem item) { - Object obj = item.getData(); - if (obj instanceof IPluginModelBase) { - IPluginModelBase model = (IPluginModelBase) obj; - String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId(); - if (!(systemBundleId.equals(model.getPluginBase().getId()))) - return fPluginTreeViewer.getChecked(model); - } - return false; - } - - private boolean isFragment(TreeItem item) { - Object obj = item.getData(); - if (obj instanceof IPluginModelBase) { - return ((IPluginModelBase) obj).isFragmentModel(); - } - return false; - } - - protected ILabelProvider getLabelProvider() { - return new OSGiLabelProvider(); - } - protected void savePluginState(ILaunchConfigurationWorkingCopy config) { Object[] selected = fPluginTreeViewer.getCheckedElements(); StringBuffer wBuffer = new StringBuffer(); @@ -206,24 +55,8 @@ config.setAttribute(IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS, buffer.length() > 0 ? buffer.toString() : (String) null); } - private void appendToBuffer(StringBuffer buffer, IPluginModelBase model) { - if (buffer.length() > 0) - buffer.append(","); //$NON-NLS-1$ - - String startLevel = null; - String autoStart = null; - if (fPluginTreeViewer.getChecked(model)) { - startLevel = levelColumnCache.get(model) != null ? levelColumnCache.get(model).toString() : null; - autoStart = autoColumnCache.get(model) != null ? autoColumnCache.get(model).toString() : null; - } - String value = BundleLauncherHelper.writeBundleEntry(model, startLevel, autoStart); - buffer.append(value); - } - public void initializeFrom(ILaunchConfiguration configuration) throws CoreException { super.initializeFrom(configuration); - levelColumnCache = new HashMap(); - autoColumnCache = new HashMap(); initWorkspacePluginsState(configuration); initExternalPluginsState(configuration); updateCounter(); @@ -231,8 +64,10 @@ handleFilterButton(); // Once the page is initialized, apply any filtering. } + // TODO deal with the discrepency between save/init states of the two blocks + private void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { - Map map = BundleLauncherHelper.getTargetBundleMap(configuration); + Map map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.TARGET_BUNDLES); Iterator iter = map.keySet().iterator(); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); while (iter.hasNext()) { @@ -247,21 +82,6 @@ fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < fExternalModels.length); } - private void resetGroup(NamedElement group) { - Widget widget = fPluginTreeViewer.testFindItem(group); - if (widget instanceof TreeItem) { - TreeItem[] items = ((TreeItem) widget).getItems(); - for (int i = 0; i < items.length; i++) { - if (!items[i].getChecked()) { - Object model = items[i].getData(); - if (model instanceof IPluginModelBase) { - resetText((IPluginModelBase) model); - } - } - } - } - } - private void initWorkspacePluginsState(ILaunchConfiguration configuration) throws CoreException { Map map = BundleLauncherHelper.getWorkspaceBundleMap(configuration); Iterator iter = map.keySet().iterator(); @@ -279,153 +99,8 @@ fPluginTreeViewer.setGrayed(fWorkspacePlugins, fNumWorkspaceChecked > 0 && fNumWorkspaceChecked < fWorkspaceModels.length); } - protected void handleGroupStateChanged(Object group, boolean checked) { - super.handleGroupStateChanged(group, checked); - - if (group instanceof NamedElement) { - NamedElement namedElement = (NamedElement) group; - TreeItem item = (TreeItem) fPluginTreeViewer.testFindItem(namedElement); - if (item != null) { - TreeItem[] children = item.getItems(); - if (children == null) - return; - for (int i = 0; i < children.length; i++) { - TreeItem childItem = children[i]; - Object child = childItem.getData(); - if (child instanceof IPluginModelBase) { - resetText((IPluginModelBase) child); - } - } - } - } - } - - protected void handleCheckStateChanged(CheckStateChangedEvent event) { - super.handleCheckStateChanged(event); - resetText((IPluginModelBase) event.getElement()); - } - - protected void setChecked(IPluginModelBase model, boolean checked) { - super.setChecked(model, checked); - resetText(model); - } - - protected void setCheckedElements(Object[] checked) { - super.setCheckedElements(checked); - updateGroup(fWorkspacePlugins); - updateGroup(fExternalPlugins); - } - - private void updateGroup(Object group) { - Widget item = fPluginTreeViewer.testFindItem(group); - if (item instanceof TreeItem) { - TreeItem[] items = ((TreeItem) item).getItems(); - for (int i = 0; i < items.length; i++) { - TreeItem child = items[i]; - if (child.getChecked() == (child.getText(1).length() == 0)) { - Object model = items[i].getData(); - if (model instanceof IPluginModelBase) { - resetText((IPluginModelBase) model); - } - } - } - } - } - - private void setText(IPluginModelBase model, String value) { - Widget widget = fPluginTreeViewer.testFindItem(model); - if (widget instanceof TreeItem) { - TreeItem item = (TreeItem) widget; - int index = value == null ? -1 : value.indexOf(':'); - String levelValue = index == -1 ? "" : value.substring(0, index); //$NON-NLS-1$ - String autoValue = null; - item.setText(1, levelValue); - if (model.isFragmentModel()) { - autoValue = "false"; //$NON-NLS-1$ - item.setText(2, autoValue); - } else { - autoValue = index == -1 ? "" : value.substring(index + 1); //$NON-NLS-1$ - item.setText(2, autoValue); - } - levelColumnCache.put(model, levelValue); - autoColumnCache.put(model, autoValue); - } - } - - private void resetText(IPluginModelBase model) { - String levelText = null; - String autoText = null; - Widget widget = fPluginTreeViewer.testFindItem(model); - if (fPluginTreeViewer.getChecked(model)) { - String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId(); - boolean isSystemBundle = systemBundleId.equals(model.getPluginBase().getId()); - levelText = isSystemBundle ? "" : "default"; //$NON-NLS-1$ //$NON-NLS-2$ - autoText = isSystemBundle ? "" : "default"; //$NON-NLS-1$ //$NON-NLS-2$ - if (levelColumnCache.containsKey(model) && !isSystemBundle) { - levelText = (String) levelColumnCache.get(model); - levelText = levelText.length() > 0 ? levelText : "default"; //$NON-NLS-1$ - } - if (autoColumnCache.containsKey(model) && !isSystemBundle) { - autoText = (String) autoColumnCache.get(model); - autoText = autoText.length() > 0 ? autoText : "default"; //$NON-NLS-1$ - } - - if (model.isFragmentModel()) { - autoText = "false"; //$NON-NLS-1$ - } - } else { - levelText = ""; //$NON-NLS-1$ - autoText = ""; //$NON-NLS-1$ - } - if (levelText != null) { - levelColumnCache.put(model, levelText); - if (widget instanceof TreeItem) { - ((TreeItem) widget).setText(1, levelText); - } - } - if (autoText != null) { - autoColumnCache.put(model, autoText); - if (widget instanceof TreeItem) { - ((TreeItem) widget).setText(2, autoText); - } - } - } - - protected void handleRestoreDefaults() { - Object[] selected = fPluginTreeViewer.getCheckedElements(); - for (int i = 0; i < selected.length; i++) { - if (selected[i] instanceof IPluginModelBase) { - resetText((IPluginModelBase) selected[i]); - } - } - } - - protected int getTreeViewerStyle() { - return super.getTreeViewerStyle() | SWT.FULL_SELECTION; - } - protected LaunchValidationOperation createValidationOperation() { return new OSGiValidationOperation(fLaunchConfiguration); } - /** - * Refreshes the tree viewer. It clears any editors on the view. - */ - protected void refreshTreeView(CheckboxTreeViewer treeView) { - // Remove any selection - if (treeView.getTree().getItemCount() > 0) { - treeView.getTree().setSelection(treeView.getTree().getItem(0)); - } else { - treeView.setSelection(new StructuredSelection(StructuredSelection.EMPTY)); - } - - // Reset any editors on the tree viewer - if (levelColumnEditor != null && levelColumnEditor.getEditor() != null && !levelColumnEditor.getEditor().isDisposed()) { - levelColumnEditor.getEditor().dispose(); - } - - if (autoColumnEditor != null && autoColumnEditor.getEditor() != null && !autoColumnEditor.getEditor().isDisposed()) { - autoColumnEditor.getEditor().dispose(); - } - } } Index: src/org/eclipse/pde/internal/ui/launcher/LauncherUtils.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LauncherUtils.java,v retrieving revision 1.113 diff -u -r1.113 LauncherUtils.java --- src/org/eclipse/pde/internal/ui/launcher/LauncherUtils.java 7 Nov 2008 21:37:34 -0000 1.113 +++ src/org/eclipse/pde/internal/ui/launcher/LauncherUtils.java 12 Jan 2009 23:49:55 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * EclipseSource Corporation - ongoing enhancements *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; @@ -291,8 +292,8 @@ } private static void handleSelectedPlugins(ILaunchConfiguration config, String timeStamp, ArrayList projects) throws CoreException { - Set selectedPlugins = LaunchPluginValidator.parsePlugins(config, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS); - Iterator it = selectedPlugins.iterator(); + Map selectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS); + Iterator it = selectedPlugins.keySet().iterator(); while (it.hasNext()) { IPluginModelBase model = (IPluginModelBase) it.next(); IResource res = model.getUnderlyingResource(); @@ -306,13 +307,13 @@ } private static void handleDeselectedPlugins(ILaunchConfiguration config, String launcherTimeStamp, ArrayList projects) throws CoreException { - Set deSelectedPlugins = LaunchPluginValidator.parsePlugins(config, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS); + Map deSelectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS); IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (int i = 0; i < projs.length; i++) { if (!WorkspaceModelManager.isPluginProject(projs[i])) continue; IPluginModelBase base = PluginRegistry.findModel(projs[i]); - if (base == null || base != null && deSelectedPlugins.contains(base)) + if (base == null || base != null && deSelectedPlugins.containsKey(base)) continue; String timestamp = getTimeStamp(projs[i]); if (timestamp.compareTo(launcherTimeStamp) > 0 && shouldAdd(projs[i], launcherTimeStamp, timestamp)) Index: src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java,v retrieving revision 1.31 diff -u -r1.31 LaunchPluginValidator.java --- src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java 7 Dec 2008 00:00:21 -0000 1.31 +++ src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java 12 Jan 2009 23:49:55 -0000 @@ -165,16 +165,17 @@ Collection result = null; if (configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true)) { result = new ArrayList(); - Set deselected = parsePlugins(configuration, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS); + Map deselected = BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS); if (deselected.size() == 0) return models; for (int i = 0; i < models.length; i++) { String id = models[i].getPluginBase().getId(); - if (id != null && !deselected.contains(models[i])) + if (id != null && !deselected.containsKey(models[i])) result.add(models[i]); } } else { - result = parsePlugins(configuration, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS); + // FIXME is this the right behavior? + result = BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS).entrySet(); } return (IPluginModelBase[]) result.toArray(new IPluginModelBase[result.size()]); } @@ -193,9 +194,15 @@ String[] entries = ids.split(","); //$NON-NLS-1$ Map unmatchedEntries = new HashMap(); for (int i = 0; i < entries.length; i++) { - int index = entries[i].indexOf(BundleLauncherHelper.VERSION_SEPARATOR); - String id = (index == -1) ? entries[i] : entries[i].substring(0, index); - String version = (index == -1) ? null : entries[i].substring(index + 1); + int index = entries[i].indexOf('@'); + if (index < 0) { // if no start levels, assume default + entries[i] = entries[i].concat("@default:default"); //$NON-NLS-1$ + index = entries[i].indexOf('@'); + } + String idVersion = entries[i].substring(0, index); + int versionIndex = entries[i].indexOf(BundleLauncherHelper.VERSION_SEPARATOR); + String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion; + String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null; ModelEntry entry = PluginRegistry.findEntry(id); if (entry != null) { IPluginModelBase matchingModels[] = attribute.equals(IPDELauncherConstants.SELECTED_TARGET_PLUGINS) ? entry.getExternalModels() : entry.getWorkspaceModels(); @@ -244,8 +251,9 @@ addToMap(map, getSelectedWorkspacePlugins(config)); - Set exModels = parsePlugins(config, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); - Iterator it = exModels.iterator(); + Map exModels = BundleLauncherHelper.getTargetBundleMap(config, null, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); + + Iterator it = exModels.keySet().iterator(); while (it.hasNext()) { IPluginModelBase model = (IPluginModelBase) it.next(); String id = model.getPluginBase().getId(); Index: src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java,v retrieving revision 1.9 diff -u -r1.9 BundleLauncherHelper.java --- src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java 10 Dec 2008 18:07:08 -0000 1.9 +++ src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java 12 Jan 2009 23:49:55 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * EclipseSource Corporation - ongoing enhancements *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; @@ -21,17 +22,17 @@ public static final char VERSION_SEPARATOR = '*'; public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration) throws CoreException { - return getWorkspaceBundleMap(configuration, null); + return getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.WORKSPACE_BUNDLES); } public static Map getTargetBundleMap(ILaunchConfiguration configuration) throws CoreException { - return getTargetBundleMap(configuration, null); + return getTargetBundleMap(configuration, null, IPDELauncherConstants.TARGET_BUNDLES); } public static Map getMergedBundleMap(ILaunchConfiguration configuration) throws CoreException { Set set = new HashSet(); - Map map = getWorkspaceBundleMap(configuration, set); - map.putAll(getTargetBundleMap(configuration, set)); + Map map = getWorkspaceBundleMap(configuration, set, IPDELauncherConstants.WORKSPACE_BUNDLES); + map.putAll(getTargetBundleMap(configuration, set, IPDELauncherConstants.TARGET_BUNDLES)); return map; } @@ -40,13 +41,17 @@ return (IPluginModelBase[]) map.keySet().toArray(new IPluginModelBase[map.size()]); } - private static Map getWorkspaceBundleMap(ILaunchConfiguration configuration, Set set) throws CoreException { - String selected = configuration.getAttribute(IPDELauncherConstants.WORKSPACE_BUNDLES, ""); //$NON-NLS-1$ + public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException { + String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$ Map map = new HashMap(); StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$ while (tok.hasMoreTokens()) { String token = tok.nextToken(); int index = token.indexOf('@'); + if (index < 0) { // if no start levels, assume default + token = token.concat("@default:default"); //$NON-NLS-1$ + index = token.indexOf('@'); + } String idVersion = token.substring(0, index); int versionIndex = idVersion.indexOf(VERSION_SEPARATOR); String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion; @@ -88,13 +93,17 @@ return map; } - private static Map getTargetBundleMap(ILaunchConfiguration configuration, Set set) throws CoreException { - String selected = configuration.getAttribute(IPDELauncherConstants.TARGET_BUNDLES, ""); //$NON-NLS-1$ + public static Map getTargetBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException { + String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$ Map map = new HashMap(); StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$ while (tok.hasMoreTokens()) { String token = tok.nextToken(); int index = token.indexOf('@'); + if (index < 0) { // if no start levels, assume default + token = token.concat("@default:default"); //$NON-NLS-1$ + index = token.indexOf('@'); + } String idVersion = token.substring(0, index); int versionIndex = idVersion.indexOf(VERSION_SEPARATOR); String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion; Index: src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java,v retrieving revision 1.32 diff -u -r1.32 AbstractPluginBlock.java --- src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java 15 Dec 2008 23:15:04 -0000 1.32 +++ src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java 12 Jan 2009 23:49:55 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; @@ -36,8 +37,9 @@ import org.eclipse.pde.ui.launcher.IPDELauncherConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTException; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.custom.TreeEditor; +import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -81,6 +83,34 @@ private boolean viewerEnabled = true; + private HashMap levelColumnCache = new HashMap(); + private HashMap autoColumnCache = new HashMap(); + private TreeEditor levelColumnEditor = null; + private TreeEditor autoColumnEditor = null; + + class OSGiLabelProvider extends PDELabelProvider { + public Image getColumnImage(Object obj, int index) { + return index == 0 ? super.getColumnImage(obj, index) : null; + } + + public String getColumnText(Object obj, int index) { + switch (index) { + case 0 : + return super.getColumnText(obj, index); + case 1 : + if (levelColumnCache != null && levelColumnCache.containsKey(obj)) + return (String) levelColumnCache.get(obj); + return ""; //$NON-NLS-1$ + case 2 : + if (autoColumnCache != null && autoColumnCache.containsKey(obj)) + return (String) autoColumnCache.get(obj); + return ""; //$NON-NLS-1$ + default : + return ""; //$NON-NLS-1$ + } + } + } + class Listener extends SelectionAdapter { private void filterAffectingControl(SelectionEvent e) { @@ -251,7 +281,7 @@ } protected ILabelProvider getLabelProvider() { - return PDEPlugin.getDefault().getLabelProvider(); + return new OSGiLabelProvider(); } protected void createPluginViewer(Composite composite, int span, int indent) { @@ -338,6 +368,110 @@ fExternalPlugins = new NamedElement(PDEUIMessages.PluginsTab_target, siteImage); fPluginTreeViewer.addFilter(new Filter()); + + Tree tree = fPluginTreeViewer.getTree(); + + TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); + column1.setText(fTab.getName()); + column1.setWidth(400); + + TreeColumn column2 = new TreeColumn(tree, SWT.CENTER); + column2.setText(PDEUIMessages.EquinoxPluginBlock_levelColumn); + column2.setWidth(80); + + TreeColumn column3 = new TreeColumn(tree, SWT.CENTER); + column3.setText(PDEUIMessages.EquinoxPluginBlock_autoColumn); + column3.setWidth(80); + tree.setHeaderVisible(true); + + createEditors(); + } + + private void createEditors() { + final Tree tree = fPluginTreeViewer.getTree(); + + levelColumnEditor = new TreeEditor(tree); + levelColumnEditor.horizontalAlignment = SWT.CENTER; + levelColumnEditor.minimumWidth = 60; + if (Util.isMac()) + levelColumnEditor.minimumHeight = 27; + + autoColumnEditor = new TreeEditor(tree); + autoColumnEditor.horizontalAlignment = SWT.CENTER; + autoColumnEditor.grabHorizontal = true; + autoColumnEditor.minimumWidth = 60; + + tree.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + // Clean up any previous editor control + Control oldEditor = levelColumnEditor.getEditor(); + if (oldEditor != null && !oldEditor.isDisposed()) + oldEditor.dispose(); + + oldEditor = autoColumnEditor.getEditor(); + if (oldEditor != null && !oldEditor.isDisposed()) + oldEditor.dispose(); + + // Identify the selected row + final TreeItem item = (TreeItem) e.item; + if (!isEditable(item)) + return; + + if (!isFragment(item)) { // only display editing controls if we're not a fragment + final Spinner spinner = new Spinner(tree, SWT.BORDER); + spinner.setMinimum(0); + String level = item.getText(1); + int defaultLevel = level.length() == 0 || "default".equals(level) ? 0 : Integer.parseInt(level); //$NON-NLS-1$ + spinner.setSelection(defaultLevel); + spinner.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + if (item.getChecked()) { + int selection = spinner.getSelection(); + item.setText(1, selection == 0 ? "default" //$NON-NLS-1$ + : Integer.toString(selection)); + levelColumnCache.put(item.getData(), item.getText(1)); + fTab.updateLaunchConfigurationDialog(); + } + } + }); + levelColumnEditor.setEditor(spinner, item, 1); + + final CCombo combo = new CCombo(tree, SWT.BORDER | SWT.READ_ONLY); + combo.setItems(new String[] {"default", Boolean.toString(true), Boolean.toString(false)}); //$NON-NLS-1$ + combo.setText(item.getText(2)); + combo.pack(); + combo.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (item.getChecked()) { + item.setText(2, combo.getText()); + autoColumnCache.put(item.getData(), item.getText(2)); + fTab.updateLaunchConfigurationDialog(); + } + } + }); + autoColumnEditor.setEditor(combo, item, 2); + } + } + }); + } + + private boolean isEditable(TreeItem item) { + Object obj = item.getData(); + if (obj instanceof IPluginModelBase) { + IPluginModelBase model = (IPluginModelBase) obj; + String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId(); + if (!(systemBundleId.equals(model.getPluginBase().getId()))) + return fPluginTreeViewer.getChecked(model); + } + return false; + } + + private boolean isFragment(TreeItem item) { + Object obj = item.getData(); + if (obj instanceof IPluginModelBase) { + return ((IPluginModelBase) obj).isFragmentModel(); + } + return false; } /** @@ -379,7 +513,7 @@ } protected int getTreeViewerStyle() { - return SWT.BORDER; + return SWT.BORDER | SWT.FULL_SELECTION; } private Button createButton(Composite composite, String text, int style) { @@ -407,6 +541,66 @@ } } adjustGroupState(); + resetText((IPluginModelBase) event.getElement()); + } + + protected void setText(IPluginModelBase model, String value) { + Widget widget = fPluginTreeViewer.testFindItem(model); + if (widget instanceof TreeItem) { + TreeItem item = (TreeItem) widget; + int index = value == null ? -1 : value.indexOf(':'); + String levelValue = index == -1 ? "" : value.substring(0, index); //$NON-NLS-1$ + String autoValue = null; + item.setText(1, levelValue); + if (model.isFragmentModel()) { + autoValue = "false"; //$NON-NLS-1$ + item.setText(2, autoValue); + } else { + autoValue = index == -1 ? "" : value.substring(index + 1); //$NON-NLS-1$ + item.setText(2, autoValue); + } + levelColumnCache.put(model, levelValue); + autoColumnCache.put(model, autoValue); + } + } + + protected void resetText(IPluginModelBase model) { + String levelText = null; + String autoText = null; + Widget widget = fPluginTreeViewer.testFindItem(model); + if (fPluginTreeViewer.getChecked(model)) { + String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId(); + boolean isSystemBundle = systemBundleId.equals(model.getPluginBase().getId()); + levelText = isSystemBundle ? "" : "default"; //$NON-NLS-1$ //$NON-NLS-2$ + autoText = isSystemBundle ? "" : "default"; //$NON-NLS-1$ //$NON-NLS-2$ + if (levelColumnCache.containsKey(model) && !isSystemBundle) { + levelText = (String) levelColumnCache.get(model); + levelText = levelText.length() > 0 ? levelText : "default"; //$NON-NLS-1$ + } + if (autoColumnCache.containsKey(model) && !isSystemBundle) { + autoText = (String) autoColumnCache.get(model); + autoText = autoText.length() > 0 ? autoText : "default"; //$NON-NLS-1$ + } + + if (model.isFragmentModel()) { + autoText = "false"; //$NON-NLS-1$ + } + } else { + levelText = ""; //$NON-NLS-1$ + autoText = ""; //$NON-NLS-1$ + } + if (levelText != null) { + levelColumnCache.put(model, levelText); + if (widget instanceof TreeItem) { + ((TreeItem) widget).setText(1, levelText); + } + } + if (autoText != null) { + autoColumnCache.put(model, autoText); + if (widget instanceof TreeItem) { + ((TreeItem) widget).setText(2, autoText); + } + } } protected void handleGroupStateChanged(Object group, boolean checked) { @@ -423,6 +617,22 @@ else if (group == fExternalPlugins) fNumExternalChecked = numberOfChildren; + if (group instanceof NamedElement) { + NamedElement namedElement = (NamedElement) group; + TreeItem item = (TreeItem) fPluginTreeViewer.testFindItem(namedElement); + if (item != null) { + TreeItem[] children = item.getItems(); + if (children == null) + return; + for (int i = 0; i < children.length; i++) { + TreeItem childItem = children[i]; + Object child = childItem.getData(); + if (child instanceof IPluginModelBase) { + resetText((IPluginModelBase) child); + } + } + } + } } protected void toggleGroups(boolean select) { @@ -458,6 +668,7 @@ protected void setChecked(IPluginModelBase model, boolean checked) { fPluginTreeViewer.setChecked(model, checked); + resetText(model); } private String[] getPluginIDs(IWorkingSet[] workingSets) { @@ -483,6 +694,8 @@ } public void initializeFrom(ILaunchConfiguration config) throws CoreException { + levelColumnCache = new HashMap(); + autoColumnCache = new HashMap(); fPluginFilteredTree.resetFilter(); fIncludeOptionalButton.setSelection(config.getAttribute(IPDELauncherConstants.INCLUDE_OPTIONAL, true)); fAddWorkspaceButton.setSelection(config.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true)); @@ -532,6 +745,24 @@ protected void setCheckedElements(Object[] checked) { fPluginTreeViewer.setCheckedElements(checked); + updateGroup(fWorkspacePlugins); + updateGroup(fExternalPlugins); + } + + private void updateGroup(Object group) { + Widget item = fPluginTreeViewer.testFindItem(group); + if (item instanceof TreeItem) { + TreeItem[] items = ((TreeItem) item).getItems(); + for (int i = 0; i < items.length; i++) { + TreeItem child = items[i]; + if (child.getChecked() == (child.getText(1).length() == 0)) { + Object model = items[i].getData(); + if (model instanceof IPluginModelBase) { + resetText((IPluginModelBase) model); + } + } + } + } } protected IPluginModelBase findPlugin(String id) { @@ -628,6 +859,13 @@ } } adjustGroupState(); + + Object[] selected = fPluginTreeViewer.getCheckedElements(); + for (int i = 0; i < selected.length; i++) { + if (selected[i] instanceof IPluginModelBase) { + resetText((IPluginModelBase) selected[i]); + } + } } protected Shell getShell() { @@ -675,6 +913,51 @@ * * @param treeView The tree view that will be refreshed. */ - protected abstract void refreshTreeView(CheckboxTreeViewer treeView); + protected void refreshTreeView(CheckboxTreeViewer treeView) { + // Remove any selection + if (treeView.getTree().getItemCount() > 0) { + treeView.getTree().setSelection(treeView.getTree().getItem(0)); + } else { + treeView.setSelection(new StructuredSelection(StructuredSelection.EMPTY)); + } + + // Reset any editors on the tree viewer + if (levelColumnEditor != null && levelColumnEditor.getEditor() != null && !levelColumnEditor.getEditor().isDisposed()) { + levelColumnEditor.getEditor().dispose(); + } + + if (autoColumnEditor != null && autoColumnEditor.getEditor() != null && !autoColumnEditor.getEditor().isDisposed()) { + autoColumnEditor.getEditor().dispose(); + } + } + + protected void appendToBuffer(StringBuffer buffer, IPluginModelBase model) { + if (buffer.length() > 0) + buffer.append(","); //$NON-NLS-1$ + + String startLevel = null; + String autoStart = null; + if (fPluginTreeViewer.getChecked(model)) { + startLevel = levelColumnCache.get(model) != null ? levelColumnCache.get(model).toString() : null; + autoStart = autoColumnCache.get(model) != null ? autoColumnCache.get(model).toString() : null; + } + String value = BundleLauncherHelper.writeBundleEntry(model, startLevel, autoStart); + buffer.append(value); + } + + protected void resetGroup(NamedElement group) { + Widget widget = fPluginTreeViewer.testFindItem(group); + if (widget instanceof TreeItem) { + TreeItem[] items = ((TreeItem) widget).getItems(); + for (int i = 0; i < items.length; i++) { + if (!items[i].getChecked()) { + Object model = items[i].getData(); + if (model instanceof IPluginModelBase) { + resetText((IPluginModelBase) model); + } + } + } + } + } } Index: src/org/eclipse/pde/ui/launcher/PluginsTab.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java,v retrieving revision 1.17 diff -u -r1.17 PluginsTab.java --- src/org/eclipse/pde/ui/launcher/PluginsTab.java 30 Jul 2008 20:44:34 -0000 1.17 +++ src/org/eclipse/pde/ui/launcher/PluginsTab.java 12 Jan 2009 23:49:55 -0000 @@ -18,8 +18,7 @@ import org.eclipse.pde.internal.ui.*; import org.eclipse.pde.internal.ui.launcher.PluginBlock; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -43,17 +42,24 @@ private boolean fShowFeatures = true; private Combo fSelectionCombo; private PluginBlock fPluginBlock; + private Combo fDefaultAutoStart; + private Spinner fDefaultStartLevel; + private Listener fListener; private static final int DEFAULT_SELECTION = 0; private static final int CUSTOM_SELECTION = 1; private static final int FEATURE_SELECTION = 2; - class Listener extends SelectionAdapter { + class Listener extends SelectionAdapter implements ModifyListener { public void widgetSelected(SelectionEvent e) { int index = fSelectionCombo.getSelectionIndex(); fPluginBlock.enableViewer(index == CUSTOM_SELECTION); updateLaunchConfigurationDialog(); } + + public void modifyText(ModifyEvent e) { + updateLaunchConfigurationDialog(); + } } /** @@ -76,6 +82,7 @@ fShowFeatures = showFeatures; fImage = PDEPluginImages.DESC_PLUGINS_FRAGMENTS.createImage(); fPluginBlock = new PluginBlock(this); + fListener = new Listener(); } /* @@ -94,7 +101,7 @@ */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(3, false)); + composite.setLayout(new GridLayout(7, false)); Label label = new Label(composite, SWT.NONE); label.setText(PDEUIMessages.PluginsTab_launchWith); @@ -105,14 +112,35 @@ GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; fSelectionCombo.setLayoutData(gd); - fSelectionCombo.addSelectionListener(new Listener()); + fSelectionCombo.addSelectionListener(fListener); + + label = new Label(composite, SWT.NONE); + gd = new GridData(); + gd.horizontalIndent = 20; + label.setLayoutData(gd); + label.setText(PDEUIMessages.EquinoxPluginsTab_defaultStart); + + fDefaultStartLevel = new Spinner(composite, SWT.BORDER); + fDefaultStartLevel.setMinimum(1); + fDefaultStartLevel.addModifyListener(fListener); + + label = new Label(composite, SWT.NONE); + gd = new GridData(); + gd.horizontalIndent = 20; + label.setLayoutData(gd); + label.setText(PDEUIMessages.EquinoxPluginsTab_defaultAuto); + + fDefaultAutoStart = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + fDefaultAutoStart.setItems(new String[] {Boolean.toString(true), Boolean.toString(false)}); + fDefaultAutoStart.select(0); + fDefaultAutoStart.addSelectionListener(fListener); label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 3; + gd.horizontalSpan = 7; label.setLayoutData(gd); - fPluginBlock.createControl(composite, 3, 10); + fPluginBlock.createControl(composite, 7, 10); setControl(composite); Dialog.applyDialogFont(composite); @@ -134,6 +162,10 @@ fSelectionCombo.setText(fSelectionCombo.getItem(index)); boolean custom = fSelectionCombo.getSelectionIndex() == CUSTOM_SELECTION; fPluginBlock.initializeFrom(configuration, custom); + boolean auto = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false); + fDefaultAutoStart.setText(Boolean.toString(auto)); + int level = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4); + fDefaultStartLevel.setSelection(level); } catch (CoreException e) { PDEPlugin.log(e); } @@ -160,6 +192,8 @@ if (fShowFeatures) configuration.setAttribute(IPDELauncherConstants.USEFEATURES, index == FEATURE_SELECTION); fPluginBlock.performApply(configuration); + configuration.setAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, Boolean.toString(true).equals(fDefaultAutoStart.getText())); + configuration.setAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, fDefaultStartLevel.getSelection()); } /* Index: src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java,v retrieving revision 1.30 diff -u -r1.30 EclipseApplicationLaunchConfiguration.java --- src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java 19 Jun 2008 16:29:07 -0000 1.30 +++ src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java 12 Jan 2009 23:49:55 -0000 @@ -36,6 +36,11 @@ */ public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConfiguration { + // used to generate the dev classpath entries + // key is bundle ID, value is a model + // TODO + //protected Map fAllBundles; + /** * To avoid duplicating variable substitution (and duplicate prompts) * this variable will store the substituted workspace location. @@ -69,6 +74,7 @@ } boolean showSplash = true; + // TODO fix getPluginstoRun to return a map that is model/startlevel Map pluginMap = LaunchPluginValidator.getPluginsToRun(configuration); if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) { validateFeatures(); @@ -229,6 +235,13 @@ */ protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { fWorkspaceLocation = null; +// Map fModels = BundleLauncherHelper.getMergedBundleMap(configuration); +// fAllBundles = new HashMap(fModels.size()); +// Iterator iter = fModels.keySet().iterator(); +// while (iter.hasNext()) { +// IPluginModelBase model = (IPluginModelBase) iter.next(); +// fAllBundles.put(model.getPluginBase().getId(), model); +// } validateConfigIni(configuration); super.preLaunchCheck(configuration, launch, monitor); } #P org.eclipse.pde.core Index: src/org/eclipse/pde/internal/core/BundleValidationOperation.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/BundleValidationOperation.java,v retrieving revision 1.3 diff -u -r1.3 BundleValidationOperation.java --- src/org/eclipse/pde/internal/core/BundleValidationOperation.java 2 Jan 2008 15:56:17 -0000 1.3 +++ src/org/eclipse/pde/internal/core/BundleValidationOperation.java 12 Jan 2009 23:49:55 -0000 @@ -10,17 +10,10 @@ *******************************************************************************/ package org.eclipse.pde.internal.core; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.Map; - +import java.util.*; import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.osgi.service.resolver.State; -import org.eclipse.osgi.service.resolver.StateObjectFactory; +import org.eclipse.core.runtime.*; +import org.eclipse.osgi.service.resolver.*; import org.eclipse.pde.core.plugin.IPluginModelBase; public class BundleValidationOperation implements IWorkspaceRunnable {