Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 117335 Details for
Bug 240737
[product] be able to set start levels on a product
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
org.eclipse.pde.patch
clipboard.txt (text/plain), 60.99 KB, created by
Chris Aniszczyk
on 2008-11-07 11:43:39 EST
(
hide
)
Description:
org.eclipse.pde.patch
Filename:
MIME Type:
Creator:
Chris Aniszczyk
Created:
2008-11-07 11:43:39 EST
Size:
60.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/wizards/plugin/NewFragmentProjectWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewFragmentProjectWizard.java,v >retrieving revision 1.19 >diff -u -r1.19 NewFragmentProjectWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/plugin/NewFragmentProjectWizard.java 16 Jan 2008 17:08:32 -0000 1.19 >+++ src/org/eclipse/pde/internal/ui/wizards/plugin/NewFragmentProjectWizard.java 7 Nov 2008 16:41:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -111,4 +111,8 @@ > public String getFragmentId() { > return fFragmentData.getId(); > } >+ >+ public String getFragmentVersion() { >+ return fFragmentData.getVersion(); >+ } > } >Index: src/org/eclipse/pde/internal/ui/wizards/plugin/NewPluginProjectWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewPluginProjectWizard.java,v >retrieving revision 1.35 >diff -u -r1.35 NewPluginProjectWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/plugin/NewPluginProjectWizard.java 28 May 2008 21:13:03 -0000 1.35 >+++ src/org/eclipse/pde/internal/ui/wizards/plugin/NewPluginProjectWizard.java 7 Nov 2008 16:41:52 -0000 >@@ -182,4 +182,8 @@ > return fPluginData.getId(); > } > >+ public String getPluginVersion() { >+ return fPluginData.getVersion(); >+ } >+ > } >Index: src/org/eclipse/pde/internal/ui/editor/product/IntroSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/IntroSection.java,v >retrieving revision 1.29 >diff -u -r1.29 IntroSection.java >--- src/org/eclipse/pde/internal/ui/editor/product/IntroSection.java 16 Jan 2008 17:08:19 -0000 1.29 >+++ src/org/eclipse/pde/internal/ui/editor/product/IntroSection.java 7 Nov 2008 16:41:51 -0000 >@@ -212,9 +212,9 @@ > plugin.setId(INTRO_PLUGIN_ID); > product.addPlugins(new IProductPlugin[] {plugin}); > boolean includeOptional = false; >- IFormPage page = getPage().getEditor().findPage(ConfigurationPage.PLUGIN_ID); >+ IFormPage page = getPage().getEditor().findPage(DependenciesPage.PLUGIN_ID); > if (page != null) >- includeOptional = ((ConfigurationPage) page).includeOptionalDependencies(); >+ includeOptional = ((DependenciesPage) page).includeOptionalDependencies(); > PluginSection.handleAddRequired(new IProductPlugin[] {plugin}, includeOptional); > } > if (fManifest == null) >Index: src/org/eclipse/pde/internal/ui/editor/product/OverviewPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/OverviewPage.java,v >retrieving revision 1.35 >diff -u -r1.35 OverviewPage.java >--- src/org/eclipse/pde/internal/ui/editor/product/OverviewPage.java 16 Jan 2008 17:08:19 -0000 1.35 >+++ src/org/eclipse/pde/internal/ui/editor/product/OverviewPage.java 7 Nov 2008 16:41:51 -0000 >@@ -84,7 +84,7 @@ > getPDEEditor().doSave(null); > new ProductExportAction(getPDEEditor()).run(); > } else if (href.equals("configuration")) { //$NON-NLS-1$ >- String pageId = ((ProductLauncherFormPageHelper) getLauncherHelper()).getProduct().useFeatures() ? ConfigurationPage.FEATURE_ID : ConfigurationPage.PLUGIN_ID; >+ String pageId = ((ProductLauncherFormPageHelper) getLauncherHelper()).getProduct().useFeatures() ? DependenciesPage.FEATURE_ID : DependenciesPage.PLUGIN_ID; > getEditor().setActivePage(pageId); > } else > super.linkActivated(e); >Index: src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java,v >retrieving revision 1.45 >diff -u -r1.45 PluginSection.java >--- src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java 16 Jan 2008 17:08:18 -0000 1.45 >+++ src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java 7 Nov 2008 16:41:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >+ * Code 9 Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.ui.editor.product; > >@@ -190,7 +191,7 @@ > dialog.create(); > SWTUtil.setDialogSize(dialog, 400, 500); > if (dialog.open() == Window.OK) { >- addPlugin(wizard.getFragmentId()); >+ addPlugin(wizard.getFragmentId(), wizard.getFragmentVersion()); > } > } > >@@ -201,7 +202,7 @@ > dialog.create(); > SWTUtil.setDialogSize(dialog, 400, 500); > if (dialog.open() == Window.OK) { >- addPlugin(wizard.getPluginId()); >+ addPlugin(wizard.getPluginId(), wizard.getPluginVersion()); > } > } > >@@ -310,7 +311,7 @@ > for (int i = 0; i < bundles.length; i++) { > HostSpecification host = bundles[i].getHost(); > if (host != null && !("org.eclipse.ui.workbench.compatibility".equals(bundles[i].getSymbolicName())) //$NON-NLS-1$ >- && calculator.containsPluginId(host.getName())) { //$NON-NLS-1$ >+ && calculator.containsPluginId(host.getName())) { > calculator.findDependency(bundles[i]); > } > } >@@ -379,7 +380,8 @@ > if (dialog.open() == Window.OK) { > Object[] bundles = dialog.getResult(); > for (int i = 0; i < bundles.length; i++) { >- addPlugin(((BundleDescription) bundles[i]).getSymbolicName()); >+ BundleDescription desc = (BundleDescription) bundles[i]; >+ addPlugin(desc.getSymbolicName(), desc.getVersion().toString()); > } > } > } >@@ -397,11 +399,12 @@ > return (BundleDescription[]) map.values().toArray(new BundleDescription[map.size()]); > } > >- private void addPlugin(String id) { >+ private void addPlugin(String id, String version) { > IProduct product = getProduct(); > IProductModelFactory factory = product.getModel().getFactory(); > IProductPlugin plugin = factory.createPlugin(); > plugin.setId(id); >+ plugin.setVersion(version); > product.addPlugins(new IProductPlugin[] {plugin}); > fPluginTable.setSelection(new StructuredSelection(plugin)); > } >Index: src/org/eclipse/pde/internal/ui/editor/product/ProductOutlinePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/ProductOutlinePage.java,v >retrieving revision 1.5 >diff -u -r1.5 ProductOutlinePage.java >--- src/org/eclipse/pde/internal/ui/editor/product/ProductOutlinePage.java 16 Jan 2008 17:08:19 -0000 1.5 >+++ src/org/eclipse/pde/internal/ui/editor/product/ProductOutlinePage.java 7 Nov 2008 16:41:52 -0000 >@@ -24,8 +24,8 @@ > } > > protected Object[] getChildren(Object parent) { >- if (parent instanceof ConfigurationPage) { >- ConfigurationPage page = (ConfigurationPage) parent; >+ if (parent instanceof DependenciesPage) { >+ DependenciesPage page = (DependenciesPage) parent; > IProduct product = ((IProductModel) page.getModel()).getProduct(); > if (product.useFeatures()) > return product.getFeatures(); >@@ -36,9 +36,9 @@ > > protected String getParentPageId(Object item) { > if (item instanceof IProductPlugin) >- return ConfigurationPage.PLUGIN_ID; >+ return DependenciesPage.PLUGIN_ID; > if (item instanceof IProductFeature) >- return ConfigurationPage.FEATURE_ID; >+ return DependenciesPage.FEATURE_ID; > return super.getParentPageId(item); > } > >Index: src/org/eclipse/pde/internal/ui/editor/product/ProductInfoSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/ProductInfoSection.java,v >retrieving revision 1.44 >diff -u -r1.44 ProductInfoSection.java >--- src/org/eclipse/pde/internal/ui/editor/product/ProductInfoSection.java 26 Apr 2008 23:28:08 -0000 1.44 >+++ src/org/eclipse/pde/internal/ui/editor/product/ProductInfoSection.java 7 Nov 2008 16:41:52 -0000 >@@ -307,7 +307,7 @@ > } > > public void linkActivated(HyperlinkEvent e) { >- String pageId = fPluginButton.getSelection() ? ConfigurationPage.PLUGIN_ID : ConfigurationPage.FEATURE_ID; >+ String pageId = fPluginButton.getSelection() ? DependenciesPage.PLUGIN_ID : DependenciesPage.FEATURE_ID; > getPage().getEditor().setActivePage(pageId); > } > }); >@@ -447,7 +447,7 @@ > // If the current page is the configuration page, switch to the > // overview page before doing the update; otherwise, widget disposed > // errors may result >- if (currentPage instanceof ConfigurationPage) { >+ if (currentPage instanceof DependenciesPage) { > getPage().getEditor().setActivePage(OverviewPage.PAGE_ID); > } > ((ProductEditor) getPage().getEditor()).updateConfigurationPage(); >Index: src/org/eclipse/pde/internal/ui/editor/product/ProductEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/ProductEditor.java,v >retrieving revision 1.26 >diff -u -r1.26 ProductEditor.java >--- src/org/eclipse/pde/internal/ui/editor/product/ProductEditor.java 16 Jan 2008 17:08:19 -0000 1.26 >+++ src/org/eclipse/pde/internal/ui/editor/product/ProductEditor.java 7 Nov 2008 16:41:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -112,7 +112,8 @@ > protected void addEditorPages() { > try { > addPage(new OverviewPage(this)); >- addPage(new ConfigurationPage(this, useFeatures())); >+ addPage(new DependenciesPage(this, useFeatures())); >+ addPage(new ConfigurationPage(this, false)); > addPage(new LaunchingPage(this)); > addPage(new SplashPage(this)); > addPage(new BrandingPage(this)); >@@ -124,7 +125,7 @@ > public void updateConfigurationPage() { > try { > removePage(1); >- addPage(1, new ConfigurationPage(this, useFeatures())); >+ addPage(1, new DependenciesPage(this, useFeatures())); > } catch (PartInitException e) { > } > } >Index: src/org/eclipse/pde/internal/ui/editor/product/ConfigurationPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/ConfigurationPage.java,v >retrieving revision 1.22 >diff -u -r1.22 ConfigurationPage.java >--- src/org/eclipse/pde/internal/ui/editor/product/ConfigurationPage.java 16 Jan 2008 17:08:19 -0000 1.22 >+++ src/org/eclipse/pde/internal/ui/editor/product/ConfigurationPage.java 7 Nov 2008 16:41:51 -0000 >@@ -1,12 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2008 Code 9 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 > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * IBM Corporation - initial API and implementation >+ * Code 9 Corporation - initial API and implementation >+ * Bartosz Michalik (bartosz.michalik@gmail.com) > *******************************************************************************/ > package org.eclipse.pde.internal.ui.editor.product; > >@@ -16,28 +17,21 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.forms.IManagedForm; >-import org.eclipse.ui.forms.editor.FormEditor; > import org.eclipse.ui.forms.widgets.FormToolkit; > import org.eclipse.ui.forms.widgets.ScrolledForm; > >+/** >+ * @author Bartosz Michalik >+ */ > public class ConfigurationPage extends PDEFormPage { >- > public static final String PLUGIN_ID = "plugin-configuration"; //$NON-NLS-1$ >- public static final String FEATURE_ID = "feature-configuration"; //$NON-NLS-1$ >- >- private boolean fUseFeatures; >- private PluginSection fPluginSection = null; >- >- public ConfigurationPage(FormEditor editor, boolean useFeatures) { >- super(editor, useFeatures ? FEATURE_ID : PLUGIN_ID, PDEUIMessages.Product_ConfigurationPage_title); >- fUseFeatures = useFeatures; >- } > >- /* (non-Javadoc) >- * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource() >+ /** >+ * @param productEditor >+ * @param useFeatures > */ >- protected String getHelpResource() { >- return IPDEUIConstants.PLUGIN_DOC_ROOT + "guide/tools/editors/product_editor/configuration.htm"; //$NON-NLS-1$ >+ public ConfigurationPage(ProductEditor editor, boolean useFeatures) { >+ super(editor, PLUGIN_ID, PDEUIMessages.ConfigurationPageMock_pageTitle); > } > > /* (non-Javadoc) >@@ -48,24 +42,15 @@ > ScrolledForm form = managedForm.getForm(); > FormToolkit toolkit = managedForm.getToolkit(); > form.setImage(PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_FEATURE_OBJ)); >- form.setText(PDEUIMessages.Product_ConfigurationPage_title); >+ form.setText(PDEUIMessages.ConfigurationPageMock_pageTitle); > fillBody(managedForm, toolkit); > PlatformUI.getWorkbench().getHelpSystem().setHelp(form.getBody(), IHelpContextIds.CONFIGURATION_PAGE); > } > > private void fillBody(IManagedForm managedForm, FormToolkit toolkit) { > Composite body = managedForm.getForm().getBody(); >- body.setLayout(FormLayoutFactory.createFormGridLayout(false, 1)); >- >- // sections >- if (fUseFeatures) >- managedForm.addPart(new FeatureSection(this, body)); >- else >- managedForm.addPart(fPluginSection = new PluginSection(this, body)); >+ body.setLayout(FormLayoutFactory.createFormGridLayout(false, 2)); >+ managedForm.addPart(new PluginConfigurationSection(this, body)); > managedForm.addPart(new ConfigurationSection(this, body)); > } >- >- public boolean includeOptionalDependencies() { >- return (fPluginSection != null) ? fPluginSection.includeOptionalDependencies() : false; >- } > } >Index: src/org/eclipse/pde/internal/ui/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v >retrieving revision 1.1010 >diff -u -r1.1010 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 26 Oct 2008 18:24:02 -0000 1.1010 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 7 Nov 2008 16:41:51 -0000 >@@ -535,6 +535,9 @@ > ConfigurationSection_default=Generate a default config.ini file > ConfigurationSection_browse=Browse... > ConfigurationAreaBlock_name=configuration area location >+ConfigurationPageMock_pageTitle=Configuration >+ConfigurationPageMock_sectionTitle=Plug-ins >+ConfigurationPageMock_sectionDesc=Specify plug-ins and their associated start levels. > ConfigurationSection_message=Select a config.ini file: > ConfigurationTemplateBlock_name=template file location > ConfigurationTab_fileSelection=File Selection >@@ -1866,7 +1869,7 @@ > ProductExportWizardPage_browse=Bro&wse... > Product_PluginSection_removeAll=Remove All > Product_PluginSection_newPlugin=New Plug-in... >-Product_ConfigurationPage_title=Configuration >+Product_DependenciesPage_title=Dependencies > ProductFileWizadPage_groupTitle=Initialize the file content > Product_PluginSection_newFragment=New Fragment... > Product_overview_testing=<form>\ >Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v >retrieving revision 1.387 >diff -u -r1.387 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 26 Oct 2008 18:24:03 -0000 1.387 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 7 Nov 2008 16:41:48 -0000 >@@ -2110,7 +2110,7 @@ > public static String ProductExportWizardPage_browse; > public static String Product_PluginSection_removeAll; > public static String Product_PluginSection_newPlugin; >- public static String Product_ConfigurationPage_title; >+ public static String Product_DependenciesPage_title; > public static String ProductFileWizadPage_groupTitle; > public static String Product_PluginSection_newFragment; > public static String Product_overview_testing; >@@ -2416,6 +2416,9 @@ > public static String WorkspaceDataBlock_name; > > public static String ConfigurationAreaBlock_name; >+ public static String ConfigurationPageMock_pageTitle; >+ public static String ConfigurationPageMock_sectionTitle; >+ public static String ConfigurationPageMock_sectionDesc; > > public static String AbstractPluginBlock_counter; > >Index: src/org/eclipse/pde/internal/ui/launcher/EquinoxInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EquinoxInitializer.java,v >retrieving revision 1.7 >diff -u -r1.7 EquinoxInitializer.java >--- src/org/eclipse/pde/internal/ui/launcher/EquinoxInitializer.java 16 Jan 2008 17:08:31 -0000 1.7 >+++ src/org/eclipse/pde/internal/ui/launcher/EquinoxInitializer.java 7 Nov 2008 16:41:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 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 >@@ -40,7 +40,7 @@ > buffer.append("-console"); //$NON-NLS-1$ > } > configuration.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true); >- configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString()); //$NON-NLS-1$ >+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString()); > } > > private void initializeVMArguments(ILaunchConfigurationWorkingCopy configuration) { >Index: src/org/eclipse/pde/internal/ui/wizards/product/ProductDefinitionOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/ProductDefinitionOperation.java,v >retrieving revision 1.34 >diff -u -r1.34 ProductDefinitionOperation.java >--- src/org/eclipse/pde/internal/ui/wizards/product/ProductDefinitionOperation.java 16 Jan 2008 17:08:26 -0000 1.34 >+++ src/org/eclipse/pde/internal/ui/wizards/product/ProductDefinitionOperation.java 7 Nov 2008 16:41:53 -0000 >@@ -443,7 +443,7 @@ > > } > } >- return buffer.length() == 0 ? null : buffer.toString(); //$NON-NLS-1$ >+ return buffer.length() == 0 ? null : buffer.toString(); > } > > private String getForegroundColor() { >Index: src/org/eclipse/pde/internal/ui/editor/product/PluginConfigurationSection.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/product/PluginConfigurationSection.java >diff -N src/org/eclipse/pde/internal/ui/editor/product/PluginConfigurationSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/product/PluginConfigurationSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,421 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Code 9 Corporation - initial API and implementation >+ * Bartosz Michalik <bartosz.michalik@gmail.com> - bug 240737 >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor.product; >+ >+import java.util.ArrayList; >+import org.eclipse.jface.util.Util; >+import org.eclipse.jface.viewers.*; >+import org.eclipse.jface.window.Window; >+import org.eclipse.pde.core.IModelChangedEvent; >+import org.eclipse.pde.core.plugin.IFragmentModel; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.core.FeatureModelManager; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.ifeature.IFeatureModel; >+import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; >+import org.eclipse.pde.internal.core.iproduct.*; >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.ui.editor.PDEFormPage; >+import org.eclipse.pde.internal.ui.editor.TableSection; >+import org.eclipse.pde.internal.ui.parts.TablePart; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.CCombo; >+import org.eclipse.swt.custom.TableEditor; >+import org.eclipse.swt.events.*; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.*; >+import org.eclipse.ui.dialogs.ElementListSelectionDialog; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.forms.widgets.Section; >+ >+public class PluginConfigurationSection extends TableSection { >+ >+ private class ContentProvider implements IStructuredContentProvider { >+ >+ private IProduct fProduct; >+ >+ ContentProvider() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >+ */ >+ public Object[] getElements(Object inputElement) { >+ return fProduct.getPluginConfigurations(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#dispose() >+ */ >+ public void dispose() { >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ if (oldInput == newInput) >+ return; >+ fProduct = (IProduct) newInput; >+ //TODO refresh >+ } >+ >+ } >+ >+ private class LabelProvider extends PDELabelProvider { >+ >+ public Image getColumnImage(Object obj, int index) { >+ if (index == 0) >+ return super.getColumnImage(PluginRegistry.findModel(((IPluginConfiguration) obj).getId()), index); >+ return null; >+ } >+ >+ public String getColumnText(Object obj, int index) { >+ IPluginConfiguration configuration = (IPluginConfiguration) obj; >+ switch (index) { >+ case 0 : >+ return configuration.getId(); >+ //return super.getColumnText(PluginRegistry.findModel(configuration.getId()), index); >+ case 1 : >+ return Integer.toString(configuration.getStartLevel()); >+ case 2 : >+ return Boolean.toString(configuration.isAutoStart()); >+ } >+ return null; >+ } >+ >+ } >+ >+ private TableViewer fConfigurationsTable; >+ private TableEditor fLevelColumnEditor; >+ private TableEditor fAutoColumnEditor; >+ >+ private IStructuredSelection fLastSelection = null; >+ >+ /** >+ * @param page >+ * @param parent >+ */ >+ public PluginConfigurationSection(PDEFormPage page, Composite parent) { >+ super(page, parent, Section.DESCRIPTION, getButtonLabels()); >+ } >+ >+ private static String[] getButtonLabels() { >+ String[] labels = new String[3]; >+ labels[0] = PDEUIMessages.Product_PluginSection_add; >+ labels[1] = PDEUIMessages.PluginSection_remove; >+ labels[2] = PDEUIMessages.Product_PluginSection_removeAll; >+ return labels; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit) >+ */ >+ protected void createClient(Section section, FormToolkit toolkit) { >+ section.setText(PDEUIMessages.ConfigurationPageMock_sectionTitle); >+ section.setDescription(PDEUIMessages.ConfigurationPageMock_sectionDesc); >+ GridData sectionData = new GridData(SWT.FILL, SWT.FILL, true, true); >+ sectionData.horizontalSpan = 2; >+ section.setLayoutData(sectionData); >+ Composite container = createClientContainer(section, 3, toolkit); >+ createViewerPartControl(container, SWT.SINGLE, 3, toolkit); >+ fConfigurationsTable = getTablePart().getTableViewer(); >+ >+ final Table table = fConfigurationsTable.getTable(); >+ final TableColumn column1 = new TableColumn(table, SWT.LEFT); >+ column1.setText(PDEUIMessages.ConfigurationPageMock_sectionTitle); >+ column1.setWidth(300); >+ >+ final TableColumn column2 = new TableColumn(table, SWT.CENTER); >+ column2.setText(PDEUIMessages.EquinoxPluginBlock_levelColumn); >+ >+ final TableColumn column3 = new TableColumn(table, SWT.CENTER); >+ column3.setText(PDEUIMessages.EquinoxPluginBlock_autoColumn); >+ >+ table.addControlListener(new ControlListener() { >+ >+ public void controlMoved(ControlEvent e) { >+ } >+ >+ public void controlResized(ControlEvent e) { >+ int size = table.getSize().x; >+ column1.setWidth(size / 7 * 4); >+ column2.setWidth(size / 7 * 2); >+ column3.setWidth(size / 7 * 1); >+ } >+ >+ }); >+ >+ table.setHeaderVisible(true); >+ toolkit.paintBordersFor(container); >+ fConfigurationsTable.setLabelProvider(getLabelProvider()); >+ fConfigurationsTable.setContentProvider(new ContentProvider()); >+ fConfigurationsTable.setInput(getProduct()); >+ createEditors(); >+ >+ section.setClient(container); >+ getModel().addModelChangedListener(this); >+ updateRemoveButtons(true, true); >+ } >+ >+ protected void buttonSelected(int index) { >+ switch (index) { >+ case 0 : >+ handleAdd(); >+ break; >+ case 1 : >+ handleRemove(); >+ break; >+ case 2 : >+ handleRemoveAll(); >+ break; >+ } >+ } >+ >+ private void handleAdd() { >+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), PDEPlugin.getDefault().getLabelProvider()); >+ ArrayList plugins = new ArrayList(); >+ >+ // TODO there must be a better way to do this! >+ if (getProduct().useFeatures()) { >+ IProductFeature[] features = getProduct().getFeatures(); >+ for (int i = 0; i < features.length; i++) { >+ IProductFeature feature = features[i]; >+ FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); >+ IFeatureModel fModel = manager.findFeatureModel(feature.getId(), feature.getVersion()); >+ IFeaturePlugin[] fPlugins = fModel.getFeature().getPlugins(); >+ for (int j = 0; j < fPlugins.length; j++) { >+ IFeaturePlugin fPlugin = fPlugins[j]; >+ if (!fPlugin.isFragment()) >+ plugins.add(fPlugin); >+ } >+ } >+ dialog.setElements(plugins.toArray(new IFeaturePlugin[plugins.size()])); >+ } else { >+ IProductPlugin[] allPlugins = getProduct().getPlugins(); >+ IPluginConfiguration[] configs = getProduct().getPluginConfigurations(); >+ for (int i = 0; i < allPlugins.length; ++i) { >+ boolean match = false; >+ for (int j = 0; j < configs.length; ++j) { >+ String id = allPlugins[i].getId(); >+ if (PluginRegistry.findModel(id) instanceof IFragmentModel || id.equals(configs[j].getId())) { >+ match = true; >+ break; >+ } >+ } >+ if (!match) { >+ plugins.add(allPlugins[i]); >+ } >+ } >+ dialog.setElements(plugins.toArray(new IProductPlugin[plugins.size()])); >+ } >+ >+ dialog.setTitle(PDEUIMessages.PluginSelectionDialog_title); >+ dialog.setMessage(PDEUIMessages.PluginSelectionDialog_message); >+ dialog.setMultipleSelection(true); >+ if (dialog.open() == Window.OK) { >+ Object[] results = dialog.getResult(); >+ for (int i = 0; i < results.length; i++) { >+ Object result = results[i]; >+ if (result instanceof IProductPlugin) { >+ addPlugin(((IProductPlugin) result).getId()); >+ } else if (result instanceof IFeaturePlugin) { >+ addPlugin(((IFeaturePlugin) result).getId()); >+ } >+ } >+ } >+ >+ } >+ >+ private void handleRemove() { >+ IStructuredSelection ssel = (IStructuredSelection) fConfigurationsTable.getSelection(); >+ if (ssel.size() > 0) { >+ Object[] objects = ssel.toArray(); >+ IPluginConfiguration[] configurations = new IPluginConfiguration[objects.length]; >+ System.arraycopy(objects, 0, configurations, 0, objects.length); >+ getProduct().removePluginConfigurations(configurations); >+ } >+ } >+ >+ private void handleRemoveAll() { >+ IProduct product = getProduct(); >+ product.removePluginConfigurations(product.getPluginConfigurations()); >+ >+ } >+ >+ protected void handleDoubleClick(IStructuredSelection selection) { >+ // Clean up any previous editor control >+ clearEditors(); >+ >+ if (!selection.isEmpty()) { >+ Table table = fConfigurationsTable.getTable(); >+ final IPluginConfiguration ppc = (IPluginConfiguration) selection.getFirstElement(); >+ final TableItem item = table.getSelection()[0]; >+ final Spinner spinner = new Spinner(table, 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) { >+ int selection = spinner.getSelection(); >+ item.setText(1, selection == 0 ? "default" //$NON-NLS-1$ >+ : Integer.toString(selection)); >+ ppc.setStartLevel(selection); >+ } >+ }); >+ fLevelColumnEditor.setEditor(spinner, item, 1); >+ >+ final CCombo combo = new CCombo(table, SWT.BORDER | SWT.READ_ONLY); >+ //TODO is there need for the default options ?? >+ combo.setItems(new String[] {Boolean.toString(true), Boolean.toString(false)}); >+ combo.setText(item.getText(2)); >+ combo.pack(); >+ combo.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ item.setText(2, combo.getText()); >+ ppc.setAutoStart(Boolean.getBoolean(combo.getText())); >+ } >+ }); >+ fAutoColumnEditor.setEditor(combo, item, 2); >+ } >+ } >+ >+ protected void selectionChanged(IStructuredSelection selection) { >+ if (selection == null || !selection.equals(fLastSelection)) { >+ clearEditors(); >+ } >+ updateRemoveButtons(true, false); >+ >+ } >+ >+ private void addPlugin(String id) { >+ IProduct product = getProduct(); >+ IProductModelFactory factory = product.getModel().getFactory(); >+ IPluginConfiguration configuration = factory.createPluginConfiguration(); >+ configuration.setId(id); >+ product.addPluginConfigurations(new IPluginConfiguration[] {configuration}); >+ fConfigurationsTable.setSelection(new StructuredSelection(configuration)); >+ } >+ >+ private ILabelProvider getLabelProvider() { >+ return new LabelProvider(); >+ } >+ >+ private void clearEditors() { >+ Control oldEditor = fLevelColumnEditor.getEditor(); >+ if (oldEditor != null && !oldEditor.isDisposed()) >+ oldEditor.dispose(); >+ >+ oldEditor = fAutoColumnEditor.getEditor(); >+ if (oldEditor != null && !oldEditor.isDisposed()) >+ oldEditor.dispose(); >+ } >+ >+ private void createEditors() { >+ final Table table = fConfigurationsTable.getTable(); >+ >+ fLevelColumnEditor = new TableEditor(table); >+ fLevelColumnEditor.horizontalAlignment = SWT.CENTER; >+ fLevelColumnEditor.minimumWidth = 40; >+ if (Util.isMac()) >+ fLevelColumnEditor.minimumHeight = 27; >+ >+ fAutoColumnEditor = new TableEditor(table); >+ fAutoColumnEditor.horizontalAlignment = SWT.CENTER; >+ fAutoColumnEditor.grabHorizontal = true; >+ fAutoColumnEditor.minimumWidth = 50; >+ } >+ >+ private IProduct getProduct() { >+ return getModel().getProduct(); >+ } >+ >+ private IProductModel getModel() { >+ return (IProductModel) getPage().getPDEEditor().getAggregateModel(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.IPluginModelListener#modelsChanged(org.eclipse.pde.internal.core.PluginModelDelta) >+ */ >+ public void modelChanged(IModelChangedEvent e) { >+ //TODO update modelChanged method >+ // No need to call super, handling world changed event here >+ if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { >+ handleGlobalRefresh(); >+ return; >+ } >+ Table table = fConfigurationsTable.getTable(); >+ int count = table.getItemCount(); >+ Object[] objects = e.getChangedObjects(); >+ boolean refreshRemove = false; >+ boolean refreshRemoveAll = false; >+ if (e.getChangeType() == IModelChangedEvent.INSERT) { >+ if (count == 0) { >+ refreshRemoveAll = true; >+ } >+ for (int i = 0; i < objects.length; i++) { >+ if (objects[i] instanceof IPluginConfiguration) >+ fConfigurationsTable.add(objects[i]); >+ } >+ } else if (e.getChangeType() == IModelChangedEvent.REMOVE) { >+ refreshRemove = refreshRemoveAll = true; >+ int index = table.getSelectionIndex(); >+ boolean global = false; >+ for (int i = 0; i < objects.length; i++) { >+ if (objects[i] instanceof IPluginConfiguration) >+ fConfigurationsTable.remove(objects[i]); >+ else if (objects[i] instanceof IProductPlugin) { >+ global = true; >+ break; >+ } >+ } >+ >+ if (global) >+ handleGlobalRefresh(); >+ >+ // Update Selection >+ >+ if (count == 0) { >+ table.deselectAll(); >+ clearEditors(); >+ } else if (index < count) { >+ table.setSelection(index); >+ } else { >+ table.setSelection(count - 1); >+ } >+ >+ } >+ updateRemoveButtons(refreshRemove, refreshRemoveAll); >+ >+ } >+ >+ private void handleGlobalRefresh() { >+ fConfigurationsTable.setInput(getProduct()); >+ fConfigurationsTable.refresh(); >+ } >+ >+ private void updateRemoveButtons(boolean updateRemove, boolean updateRemoveAll) { >+ TablePart tablePart = getTablePart(); >+ if (updateRemove) { >+ ISelection selection = getViewerSelection(); >+ tablePart.setButtonEnabled(1, isEditable() && !selection.isEmpty()); >+ } >+ int count = fConfigurationsTable.getTable().getItemCount(); >+ if (updateRemoveAll) >+ tablePart.setButtonEnabled(2, isEditable() && count > 0); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/editor/product/DependenciesPage.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/product/DependenciesPage.java >diff -N src/org/eclipse/pde/internal/ui/editor/product/DependenciesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/product/DependenciesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Code 9 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Code 9 Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor.product; >+ >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.ui.editor.FormLayoutFactory; >+import org.eclipse.pde.internal.ui.editor.PDEFormPage; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.forms.IManagedForm; >+import org.eclipse.ui.forms.editor.FormEditor; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.forms.widgets.ScrolledForm; >+ >+public class DependenciesPage extends PDEFormPage { >+ >+ public static final String PLUGIN_ID = "plugin-configuration"; //$NON-NLS-1$ >+ public static final String FEATURE_ID = "feature-configuration"; //$NON-NLS-1$ >+ >+ private boolean fUseFeatures; >+ private PluginSection fPluginSection = null; >+ >+ public DependenciesPage(FormEditor editor, boolean useFeatures) { >+ super(editor, useFeatures ? FEATURE_ID : PLUGIN_ID, PDEUIMessages.Product_DependenciesPage_title); >+ fUseFeatures = useFeatures; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource() >+ */ >+ protected String getHelpResource() { >+ return IPDEUIConstants.PLUGIN_DOC_ROOT + "guide/tools/editors/product_editor/configuration.htm"; //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#createFormContent(org.eclipse.ui.forms.IManagedForm) >+ */ >+ protected void createFormContent(IManagedForm managedForm) { >+ super.createFormContent(managedForm); >+ ScrolledForm form = managedForm.getForm(); >+ FormToolkit toolkit = managedForm.getToolkit(); >+ form.setImage(PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_REQ_PLUGINS_OBJ)); >+ form.setText(PDEUIMessages.Product_DependenciesPage_title); >+ fillBody(managedForm, toolkit); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(form.getBody(), IHelpContextIds.CONFIGURATION_PAGE); >+ } >+ >+ private void fillBody(IManagedForm managedForm, FormToolkit toolkit) { >+ Composite body = managedForm.getForm().getBody(); >+ body.setLayout(FormLayoutFactory.createFormGridLayout(false, 1)); >+ >+ // sections >+ if (fUseFeatures) >+ managedForm.addPart(new FeatureSection(this, body)); >+ else >+ managedForm.addPart(fPluginSection = new PluginSection(this, body)); >+ } >+ >+ public boolean includeOptionalDependencies() { >+ return (fPluginSection != null) ? fPluginSection.includeOptionalDependencies() : false; >+ } >+} >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/iproduct/IProductModelFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IProductModelFactory.java,v >retrieving revision 1.12 >diff -u -r1.12 IProductModelFactory.java >--- src/org/eclipse/pde/internal/core/iproduct/IProductModelFactory.java 2 Jan 2008 15:56:15 -0000 1.12 >+++ src/org/eclipse/pde/internal/core/iproduct/IProductModelFactory.java 7 Nov 2008 16:41:54 -0000 >@@ -18,6 +18,8 @@ > > IProductPlugin createPlugin(); > >+ IPluginConfiguration createPluginConfiguration(); >+ > IProductFeature createFeature(); > > IConfigurationFileInfo createConfigFileInfo(); >Index: src/org/eclipse/pde/internal/core/iproduct/IProduct.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IProduct.java,v >retrieving revision 1.31 >diff -u -r1.31 IProduct.java >--- src/org/eclipse/pde/internal/core/iproduct/IProduct.java 26 Apr 2008 23:28:09 -0000 1.31 >+++ src/org/eclipse/pde/internal/core/iproduct/IProduct.java 7 Nov 2008 16:41:54 -0000 >@@ -52,14 +52,22 @@ > > void addFeatures(IProductFeature[] feature); > >+ void addPluginConfigurations(IPluginConfiguration[] configurations); >+ > void removePlugins(IProductPlugin[] plugins); > > void removeFeatures(IProductFeature[] feature); > >+ void removePluginConfigurations(IPluginConfiguration[] configurations); >+ >+ IPluginConfiguration findPluginConfiguration(String id); >+ > IProductPlugin[] getPlugins(); > > IProductFeature[] getFeatures(); > >+ IPluginConfiguration[] getPluginConfigurations(); >+ > void setId(String id); > > void setVersion(String version); >Index: src/org/eclipse/pde/internal/core/iproduct/IProductPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IProductPlugin.java,v >retrieving revision 1.6 >diff -u -r1.6 IProductPlugin.java >--- src/org/eclipse/pde/internal/core/iproduct/IProductPlugin.java 2 Jan 2008 15:56:15 -0000 1.6 >+++ src/org/eclipse/pde/internal/core/iproduct/IProductPlugin.java 7 Nov 2008 16:41:54 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >+ * Code 9 Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.core.iproduct; > >@@ -15,4 +16,8 @@ > String getId(); > > void setId(String id); >+ >+ String getVersion(); >+ >+ void setVersion(String version); > } >Index: src/org/eclipse/pde/internal/core/product/WorkspaceProductModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/WorkspaceProductModel.java,v >retrieving revision 1.14 >diff -u -r1.14 WorkspaceProductModel.java >--- src/org/eclipse/pde/internal/core/product/WorkspaceProductModel.java 17 Apr 2008 16:17:33 -0000 1.14 >+++ src/org/eclipse/pde/internal/core/product/WorkspaceProductModel.java 7 Nov 2008 16:41:54 -0000 >@@ -124,7 +124,7 @@ > public void save(PrintWriter writer) { > if (isLoaded()) { > writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ >- writer.println("<?pde version=\"3.4\"?>"); //$NON-NLS-1$ >+ writer.println("<?pde version=\"3.5\"?>"); //$NON-NLS-1$ > writer.println(); > getProduct().write("", writer); //$NON-NLS-1$ > } >Index: src/org/eclipse/pde/internal/core/product/ProductPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/ProductPlugin.java,v >retrieving revision 1.12 >diff -u -r1.12 ProductPlugin.java >--- src/org/eclipse/pde/internal/core/product/ProductPlugin.java 2 Jan 2008 15:56:22 -0000 1.12 >+++ src/org/eclipse/pde/internal/core/product/ProductPlugin.java 7 Nov 2008 16:41:54 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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,11 +7,11 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Code 9 Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.core.product; > > import java.io.PrintWriter; >- > import org.eclipse.pde.core.plugin.IFragmentModel; > import org.eclipse.pde.core.plugin.PluginRegistry; > import org.eclipse.pde.internal.core.iproduct.IProductModel; >@@ -23,12 +23,37 @@ > > private static final long serialVersionUID = 1L; > private String fId; >+ private String fVersion; > > public ProductPlugin(IProductModel model) { > super(model); > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProductObject#parse(org.w3c.dom.Node) >+ */ >+ public void parse(Node node) { >+ if (node.getNodeType() == Node.ELEMENT_NODE) { >+ Element element = (Element) node; >+ fId = element.getAttribute("id"); //$NON-NLS-1$ >+ fVersion = element.getAttribute("version"); //$NON-NLS-1$ >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.product.ProductObject#write(java.lang.String, java.io.PrintWriter) >+ */ >+ public void write(String indent, PrintWriter writer) { >+ writer.print(indent + "<plugin id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >+ if (fVersion != null && !fVersion.equals("0.0.0")) { //$NON-NLS-1$ >+ writer.print(" version=\"" + fVersion + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ if (PluginRegistry.findModel(fId) instanceof IFragmentModel) >+ writer.print(" fragment=\"true\""); //$NON-NLS-1$ >+ writer.println("/>"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProductPlugin#getId() > */ > public String getId() { >@@ -42,22 +67,12 @@ > fId = id; > } > >- /* (non-Javadoc) >- * @see org.eclipse.pde.internal.core.iproduct.IProductObject#parse(org.w3c.dom.Node) >- */ >- public void parse(Node node) { >- if (node.getNodeType() == Node.ELEMENT_NODE) >- fId = ((Element) node).getAttribute("id"); //$NON-NLS-1$ >+ public String getVersion() { >+ return fVersion; > } > >- /* (non-Javadoc) >- * @see org.eclipse.pde.internal.core.product.ProductObject#write(java.lang.String, java.io.PrintWriter) >- */ >- public void write(String indent, PrintWriter writer) { >- writer.print(indent + "<plugin id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >- if (PluginRegistry.findModel(fId) instanceof IFragmentModel) >- writer.print(" fragment=\"true\""); //$NON-NLS-1$ >- writer.println("/>"); //$NON-NLS-1$ >+ public void setVersion(String version) { >+ fVersion = version; > } > > } >Index: src/org/eclipse/pde/internal/core/product/Product.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/Product.java,v >retrieving revision 1.40 >diff -u -r1.40 Product.java >--- src/org/eclipse/pde/internal/core/product/Product.java 26 Apr 2008 23:28:09 -0000 1.40 >+++ src/org/eclipse/pde/internal/core/product/Product.java 7 Nov 2008 16:41:54 -0000 >@@ -26,6 +26,7 @@ > private IAboutInfo fAboutInfo; > > private TreeMap fPlugins = new TreeMap(); >+ private TreeMap fPluginConfigurations = new TreeMap(); > private List fFeatures = new ArrayList(); > private IConfigurationFileInfo fConfigIniInfo; > private IJREInfo fJVMInfo; >@@ -202,6 +203,18 @@ > } > > writer.println(); >+ >+ if (fPluginConfigurations.size() > 0) { >+ writer.println(indent + " <configurations>"); //$NON-NLS-1$ >+ iter = fPluginConfigurations.values().iterator(); >+ while (iter.hasNext()) { >+ IPluginConfiguration configuration = (IPluginConfiguration) iter.next(); >+ configuration.write(indent + " ", writer); //$NON-NLS-1$ >+ } >+ writer.println(indent + " </configurations>"); //$NON-NLS-1$ >+ } >+ >+ writer.println(); > writer.println("</product>"); //$NON-NLS-1$ > } > >@@ -222,6 +235,7 @@ > fUseFeatures = false; > fAboutInfo = null; > fPlugins.clear(); >+ fPluginConfigurations.clear(); > fFeatures.clear(); > fConfigIniInfo = null; > fWindowImages = null; >@@ -256,6 +270,8 @@ > parsePlugins(child.getChildNodes()); > } else if (name.equals("features")) { //$NON-NLS-1$ > parseFeatures(child.getChildNodes()); >+ } else if (name.equals("configurations")) { //$NON-NLS-1$ >+ parsePluginConfigurations(child.getChildNodes()); > } else if (name.equals("configIni")) { //$NON-NLS-1$ > fConfigIniInfo = factory.createConfigFileInfo(); > fConfigIniInfo.parse(child); >@@ -296,6 +312,19 @@ > } > } > >+ private void parsePluginConfigurations(NodeList children) { >+ for (int i = 0; i < children.getLength(); i++) { >+ Node child = children.item(i); >+ if (child.getNodeType() == Node.ELEMENT_NODE) { >+ if (child.getNodeName().equals("pluginConfiguration")) { //$NON-NLS-1$ >+ IPluginConfiguration configuration = getModel().getFactory().createPluginConfiguration(); >+ configuration.parse(child); >+ fPluginConfigurations.put(configuration.getId(), configuration); >+ } >+ } >+ } >+ } >+ > private void parseFeatures(NodeList children) { > for (int i = 0; i < children.getLength(); i++) { > Node child = children.item(i); >@@ -332,16 +361,63 @@ > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#addPluginConfigurations(org.eclipse.pde.internal.core.iproduct.IPluginConfiguration[]) >+ */ >+ public void addPluginConfigurations(IPluginConfiguration[] configuration) { >+ boolean modified = false; >+ for (int i = 0; i < configuration.length; i++) { >+ if (configuration[i] == null) >+ continue; >+ String id = configuration[i].getId(); >+ if (id == null || fPluginConfigurations.containsKey(id)) { >+ configuration[i] = null; >+ continue; >+ } >+ >+ configuration[i].setModel(getModel()); >+ fPluginConfigurations.put(id, configuration[i]); >+ modified = true; >+ } >+ if (modified && isEditable()) >+ fireStructureChanged(configuration, IModelChangedEvent.INSERT); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProduct#removePlugins(org.eclipse.pde.internal.core.iproduct.IProductPlugin[]) > */ > public void removePlugins(IProductPlugin[] plugins) { > boolean modified = false; >+ LinkedList removedConfigurations = new LinkedList(); > for (int i = 0; i < plugins.length; i++) { >- if (fPlugins.remove(plugins[i].getId()) != null) >+ final String id = plugins[i].getId(); >+ if (fPlugins.remove(id) != null) { > modified = true; >+ Object configuration = fPluginConfigurations.remove(id); >+ if (configuration != null) >+ removedConfigurations.add(configuration); >+ } >+ } >+ if (isEditable()) { >+ if (modified) >+ fireStructureChanged(plugins, IModelChangedEvent.REMOVE); >+ if (!removedConfigurations.isEmpty()) { >+ fireStructureChanged((IProductObject[]) removedConfigurations.toArray(new IProductObject[removedConfigurations.size()]), IModelChangedEvent.REMOVE); >+ } > } >- if (modified && isEditable()) >- fireStructureChanged(plugins, IModelChangedEvent.REMOVE); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#removePluginConfigurations(org.eclipse.pde.internal.core.iproduct.IProductPluginConfiguration[]) >+ */ >+ public void removePluginConfigurations(IPluginConfiguration[] configurations) { >+ boolean modified = false; >+ for (int i = 0; i < configurations.length; i++) { >+ if (fPluginConfigurations.remove(configurations[i].getId()) != null) { >+ modified = true; >+ } >+ } >+ if (isEditable() && modified) >+ fireStructureChanged(configurations, IModelChangedEvent.REMOVE); > } > > /* (non-Javadoc) >@@ -352,6 +428,13 @@ > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#getPluginConfigurations() >+ */ >+ public IPluginConfiguration[] getPluginConfigurations() { >+ return (IPluginConfiguration[]) fPluginConfigurations.values().toArray(new IPluginConfiguration[fPluginConfigurations.size()]); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProduct#getConfigurationFileInfo() > */ > public IConfigurationFileInfo getConfigurationFileInfo() { >@@ -485,4 +568,11 @@ > fireStructureChanged(feature1, IModelChangedEvent.CHANGE); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#findPluginConfiguration(java.lang.String) >+ */ >+ public IPluginConfiguration findPluginConfiguration(String id) { >+ return (IPluginConfiguration) fPluginConfigurations.get(id); >+ } >+ > } >Index: src/org/eclipse/pde/internal/core/product/ProductModelFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/ProductModelFactory.java,v >retrieving revision 1.13 >diff -u -r1.13 ProductModelFactory.java >--- src/org/eclipse/pde/internal/core/product/ProductModelFactory.java 2 Jan 2008 15:56:22 -0000 1.13 >+++ src/org/eclipse/pde/internal/core/product/ProductModelFactory.java 7 Nov 2008 16:41:54 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -10,19 +10,7 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.core.product; > >-import org.eclipse.pde.internal.core.iproduct.IAboutInfo; >-import org.eclipse.pde.internal.core.iproduct.IArgumentsInfo; >-import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo; >-import org.eclipse.pde.internal.core.iproduct.IIntroInfo; >-import org.eclipse.pde.internal.core.iproduct.IJREInfo; >-import org.eclipse.pde.internal.core.iproduct.ILauncherInfo; >-import org.eclipse.pde.internal.core.iproduct.IProduct; >-import org.eclipse.pde.internal.core.iproduct.IProductFeature; >-import org.eclipse.pde.internal.core.iproduct.IProductModel; >-import org.eclipse.pde.internal.core.iproduct.IProductModelFactory; >-import org.eclipse.pde.internal.core.iproduct.IProductPlugin; >-import org.eclipse.pde.internal.core.iproduct.ISplashInfo; >-import org.eclipse.pde.internal.core.iproduct.IWindowImages; >+import org.eclipse.pde.internal.core.iproduct.*; > > public class ProductModelFactory implements IProductModelFactory { > >@@ -54,6 +42,13 @@ > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProductModelFactory#createPluginConfiguration() >+ */ >+ public IPluginConfiguration createPluginConfiguration() { >+ return new PluginConfiguration(fModel); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProductModelFactory#createConfigFileInfo() > */ > public IConfigurationFileInfo createConfigFileInfo() { >Index: src/org/eclipse/pde/internal/core/iproduct/IPluginConfiguration.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/iproduct/IPluginConfiguration.java >diff -N src/org/eclipse/pde/internal/core/iproduct/IPluginConfiguration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/iproduct/IPluginConfiguration.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Bartosz Michalik 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Bartosz Michalik (bartosz.michalik@gmail.com) >+ *******************************************************************************/ >+package org.eclipse.pde.internal.core.iproduct; >+ >+/** >+ * PluginConfiguration description defines plug-in start level, and other properties that can be used >+ * during product launching/building >+ */ >+public interface IPluginConfiguration extends IProductObject { >+ public static final String P_AUTO_START = "autostart"; //$NON-NLS-1$ >+ public static final String P_START_LEVEL = "startLevel"; //$NON-NLS-1$ >+ >+ String getId(); >+ >+ void setId(String id); >+ >+ void setAutoStart(boolean autostart); >+ >+ boolean isAutoStart(); >+ >+ void setStartLevel(int startLevel); >+ >+ int getStartLevel(); >+ >+ /** >+ * Adds property, if property exists is overridden >+ * @param key >+ * @param value >+ * @throws IllegalArgumentException when key or value is empty >+ */ >+ void addProperty(String key, String value) throws IllegalArgumentException; >+ >+ /** >+ * @param key >+ */ >+ void removeProperty(String key); >+ >+ /** >+ * get property from key >+ * @param key >+ * @return property or <code>null</code> >+ */ >+ String getProperty(String key); >+} >Index: src/org/eclipse/pde/internal/core/product/PluginConfiguration.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/product/PluginConfiguration.java >diff -N src/org/eclipse/pde/internal/core/product/PluginConfiguration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/product/PluginConfiguration.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,164 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Bartosz Michalik (bartosz.michalik@gmail.com) >+ *******************************************************************************/ >+package org.eclipse.pde.internal.core.product; >+ >+import java.io.PrintWriter; >+import java.util.*; >+import org.eclipse.pde.internal.core.iproduct.IProductModel; >+import org.eclipse.pde.internal.core.iproduct.IPluginConfiguration; >+import org.w3c.dom.*; >+ >+public class PluginConfiguration extends ProductObject implements IPluginConfiguration { >+ >+ private static final long serialVersionUID = -3549668957352554876L; >+ private boolean fAutoStart; >+ private int fStartLevel; >+ private String fId; >+ private Map fPropertiesMap; >+ >+ /** >+ * Only for parsing usage >+ * @param model >+ */ >+ PluginConfiguration(IProductModel model) { >+ super(model); >+ fPropertiesMap = new HashMap(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProductObject#parse(org.w3c.dom.Node) >+ */ >+ public void parse(Node node) { >+ if (node.getNodeType() == Node.ELEMENT_NODE) { >+ Element element = (Element) node; >+ fId = element.getAttribute("id"); //$NON-NLS-1$ >+ fAutoStart = Boolean.getBoolean((element.getAttribute(P_AUTO_START))); >+ fStartLevel = Integer.parseInt(element.getAttribute(P_START_LEVEL)); >+ NodeList children = node.getChildNodes(); >+ int length = children.getLength(); >+ for (int i = 0; i < length; ++i) { >+ Node item = children.item(i); >+ if (item.getNodeType() == Node.ELEMENT_NODE) { >+ element = (Element) item; >+ String key = element.getAttribute("key"); //$NON-NLS-1$ >+ String value = element.getAttribute("value"); //$NON-NLS-1$ >+ fPropertiesMap.put(key, value); >+ } >+ } >+ } >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.IWritable#write(java.lang.String, java.io.PrintWriter) >+ */ >+ public void write(String indent, PrintWriter writer) { >+ writer.print(indent + "<pluginConfiguration id=\"" + fId + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >+ writer.print(" autoStart=\"" + fAutoStart + "\""); //$NON-NLS-1$//$NON-NLS-2$ >+ writer.print(" startLevel=\"" + fStartLevel + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >+ if (fPropertiesMap.isEmpty()) >+ writer.println(" />"); //$NON-NLS-1$ >+ else { >+ writer.println(" >"); //$NON-NLS-1$ >+ Iterator i = fPropertiesMap.keySet().iterator(); >+ while (i.hasNext()) { >+ String key = (String) i.next(); >+ writer.println(indent + "<property key=\"" + key + " value=\"" + fPropertiesMap.get(key) + "\" />"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ writer.println("</pluginConfiguration>"); //$NON-NLS-1$ >+ } >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#addProperty(java.lang.String, java.lang.String) >+ */ >+ public void addProperty(String key, String value) throws IllegalArgumentException { >+ if (key == null || key.equals("")) //$NON-NLS-1$ >+ throw new IllegalArgumentException("key cannot empty"); //$NON-NLS-1$ >+ if (value == null || value.equals("")) //$NON-NLS-1$ >+ throw new IllegalArgumentException("value cannot empty"); //$NON-NLS-1$ >+ String oldValue = (String) fPropertiesMap.get(key); >+ fPropertiesMap.put(key, value); >+ if (isEditable() && !value.equals(oldValue)) >+ firePropertyChanged(key, oldValue, value); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#getId() >+ */ >+ public String getId() { >+ return fId; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#getProperty(java.lang.String) >+ */ >+ public String getProperty(String key) { >+ return (String) fPropertiesMap.get(key); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#getStartLevel() >+ */ >+ public int getStartLevel() { >+ return fStartLevel; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#isAutoStart() >+ */ >+ public boolean isAutoStart() { >+ return fAutoStart; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#removeProperty(java.lang.String) >+ */ >+ public void removeProperty(String key) { >+ String oldValue = (String) fPropertiesMap.get(key); >+ fPropertiesMap.remove(key); >+ if (isEditable() && oldValue != null) >+ firePropertyChanged(key, oldValue, null); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#setAutoStart(boolean) >+ */ >+ public void setAutoStart(boolean autostart) { >+ boolean oldValue = fAutoStart; >+ fAutoStart = autostart; >+ if (isEditable() && oldValue != fAutoStart) >+ firePropertyChanged(P_AUTO_START, new Boolean(oldValue), new Boolean(fAutoStart)); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IPluginConfiguration#setStartLevel(java.lang.String) >+ */ >+ public void setStartLevel(int startLevel) { >+ int oldValue = fStartLevel; >+ fStartLevel = startLevel; >+ if (isEditable() && oldValue != fStartLevel) >+ firePropertyChanged(P_START_LEVEL, new Integer(oldValue), new Integer(fStartLevel)); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProductPluginConfiguration#setId(java.lang.String) >+ */ >+ public void setId(String id) { >+ fId = id; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240737
:
108113
|
108188
|
108269
|
108270
|
108283
|
108385
|
109836
|
111676
|
117252
| 117335 |
117405
|
119203
|
122351