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 111676 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), 46.47 KB, created by
Chris Aniszczyk
on 2008-09-04 11:16:32 EDT
(
hide
)
Description:
org.eclipse.pde.patch
Filename:
MIME Type:
Creator:
Chris Aniszczyk
Created:
2008-09-04 11:16:32 EDT
Size:
46.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >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 4 Sep 2008 15:15:52 -0000 >@@ -112,10 +112,11 @@ > protected void addEditorPages() { > try { > addPage(new OverviewPage(this)); >- addPage(new ConfigurationPage(this, useFeatures())); >+ addPage(new DependencidesPage(this, useFeatures())); > addPage(new LaunchingPage(this)); > addPage(new SplashPage(this)); > addPage(new BrandingPage(this)); >+ addPage(new ConfigurationPage(this, false)); > } catch (PartInitException e) { > PDEPlugin.logException(e); > } >@@ -124,7 +125,7 @@ > public void updateConfigurationPage() { > try { > removePage(1); >- addPage(1, new ConfigurationPage(this, useFeatures())); >+ addPage(1, new DependencidesPage(this, useFeatures())); > } catch (PartInitException e) { > } > } >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 4 Sep 2008 15:15:52 -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(DependencidesPage.PLUGIN_ID); > if (page != null) >- includeOptional = ((ConfigurationPage) page).includeOptionalDependencies(); >+ includeOptional = ((DependencidesPage) 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 4 Sep 2008 15:15:52 -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() ? DependencidesPage.FEATURE_ID : DependencidesPage.PLUGIN_ID; > getEditor().setActivePage(pageId); > } else > super.linkActivated(e); >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 4 Sep 2008 15:15:53 -0000 >@@ -24,8 +24,8 @@ > } > > protected Object[] getChildren(Object parent) { >- if (parent instanceof ConfigurationPage) { >- ConfigurationPage page = (ConfigurationPage) parent; >+ if (parent instanceof DependencidesPage) { >+ DependencidesPage page = (DependencidesPage) 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 DependencidesPage.PLUGIN_ID; > if (item instanceof IProductFeature) >- return ConfigurationPage.FEATURE_ID; >+ return DependencidesPage.FEATURE_ID; > return super.getParentPageId(item); > } > >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 4 Sep 2008 15:15:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * 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 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Bartosz Michalik (bartosz.michalik@gmail.com) > *******************************************************************************/ > package org.eclipse.pde.internal.ui.editor.product; > >@@ -16,28 +17,22 @@ > 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 +43,14 @@ > 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)); >- managedForm.addPart(new ConfigurationSection(this, body)); >- } >- >- public boolean includeOptionalDependencies() { >- return (fPluginSection != null) ? fPluginSection.includeOptionalDependencies() : false; >+ body.setLayout(FormLayoutFactory.createFormGridLayout(false, 2)); >+ managedForm.addPart(new PluginConfigurationSection(this, body)); > } > } >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 4 Sep 2008 15:15:53 -0000 >@@ -307,7 +307,7 @@ > } > > public void linkActivated(HyperlinkEvent e) { >- String pageId = fPluginButton.getSelection() ? ConfigurationPage.PLUGIN_ID : ConfigurationPage.FEATURE_ID; >+ String pageId = fPluginButton.getSelection() ? DependencidesPage.PLUGIN_ID : DependencidesPage.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 DependencidesPage) { > getPage().getEditor().setActivePage(OverviewPage.PAGE_ID); > } > ((ProductEditor) getPage().getEditor()).updateConfigurationPage(); >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.1003 >diff -u -r1.1003 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 18 Aug 2008 16:41:00 -0000 1.1003 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 4 Sep 2008 15:15:52 -0000 >@@ -533,6 +533,8 @@ > ConfigurationSection_default=Generate a default config.ini file > ConfigurationSection_browse=Browse... > ConfigurationAreaBlock_name=configuration area location >+ConfigurationPageMock_pageTitle=Configuration >+ConfigurationPageMock_sectionTitle=Plug-ins > ConfigurationSection_message=Select a config.ini file: > ConfigurationTemplateBlock_name=template file location > ConfigurationTab_fileSelection=File Selection >@@ -1862,7 +1864,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.380 >diff -u -r1.380 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 18 Aug 2008 15:33:31 -0000 1.380 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 4 Sep 2008 15:15:50 -0000 >@@ -2107,7 +2107,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; >@@ -2414,6 +2414,10 @@ > > public static String ConfigurationAreaBlock_name; > >+ public static String ConfigurationPageMock_pageTitle; >+ >+ public static String ConfigurationPageMock_sectionTitle; >+ > public static String AbstractPluginBlock_counter; > > public static String EquinoxPluginBlock_levelColumn; >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,390 @@ >+/******************************************************************************* >+ * 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.ui.editor.product; >+ >+import org.eclipse.jface.viewers.*; >+import org.eclipse.jface.window.Window; >+import org.eclipse.pde.core.IModelChangedEvent; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+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; >+ >+/** >+ * @author Bartosz Michalik >+ * >+ */ >+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(((IProductPluginConfiguration) obj).getId()), index); >+ return null; >+ } >+ >+ public String getColumnText(Object obj, int index) { >+ IProductPluginConfiguration configuration = (IProductPluginConfiguration) obj; >+ switch (index) { >+ case 0 : >+ 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); >+ 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()); >+ IProductPlugin[] allPlugins = getProduct().getPlugins(); >+ IProductPluginConfiguration[] configs = getProduct().getPluginConfigurations(); >+ IProductPlugin[] filtered = new IProductPlugin[allPlugins.length - configs.length]; >+ int filteredIdx = 0; >+ for (int i = 0; i < allPlugins.length; ++i) { >+ boolean match = false; >+ for (int j = 0; j < configs.length; ++j) { >+ if (allPlugins[i].getId().equals(configs[j].getId())) { >+ match = true; >+ break; >+ } >+ } >+ if (!match) { >+ filtered[filteredIdx++] = allPlugins[i]; >+ } >+ } >+ dialog.setElements(filtered); >+ dialog.setTitle(PDEUIMessages.PluginSelectionDialog_title); >+ dialog.setMessage(PDEUIMessages.PluginSelectionDialog_message); >+ dialog.setMultipleSelection(true); >+ if (dialog.open() == Window.OK) { >+ Object[] plugins = dialog.getResult(); >+ for (int i = 0; i < plugins.length; i++) { >+ addPlugin(((IProductPlugin) plugins[i]).getId()); >+ } >+ } >+ >+ } >+ >+ private void handleRemove() { >+ IStructuredSelection ssel = (IStructuredSelection) fConfigurationsTable.getSelection(); >+ if (ssel.size() > 0) { >+ Object[] objects = ssel.toArray(); >+ IProductPluginConfiguration[] configurations = new IProductPluginConfiguration[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 IProductPluginConfiguration ppc = (IProductPluginConfiguration) 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(); >+ IProductPluginConfiguration configuration = factory.createPluginConfiguration(); >+ configuration.setId(id); >+ product.addPluginConfigurations(new IProductPluginConfiguration[] {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 = 30; >+ >+ 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 IProductPluginConfiguration) >+ 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 IProductPluginConfiguration) >+ 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/DependencidesPage.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/product/DependencidesPage.java >diff -N src/org/eclipse/pde/internal/ui/editor/product/DependencidesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/product/DependencidesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * Copyright (c) 2005, 2007 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 >+ *******************************************************************************/ >+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 DependencidesPage 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 DependencidesPage(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_FEATURE_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)); >+ managedForm.addPart(new ConfigurationSection(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 4 Sep 2008 15:15:54 -0000 >@@ -18,6 +18,8 @@ > > IProductPlugin createPlugin(); > >+ IProductPluginConfiguration 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 4 Sep 2008 15:15:54 -0000 >@@ -52,14 +52,22 @@ > > void addFeatures(IProductFeature[] feature); > >+ void addPluginConfigurations(IProductPluginConfiguration[] configurations); >+ > void removePlugins(IProductPlugin[] plugins); > > void removeFeatures(IProductFeature[] feature); > >+ void removePluginConfigurations(IProductPluginConfiguration[] configurations); >+ >+ IProductPluginConfiguration findPluginConfiguration(String id); >+ > IProductPlugin[] getPlugins(); > > IProductFeature[] getFeatures(); > >+ IProductPluginConfiguration[] getPluginConfigurations(); >+ > void setId(String id); > > void setVersion(String 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 4 Sep 2008 15:15: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; >@@ -201,6 +202,14 @@ > writer.println(indent + " </features>"); //$NON-NLS-1$ > } > >+ writer.println(indent + " <configurations>"); //$NON-NLS-1$ >+ iter = fPluginConfigurations.values().iterator(); >+ while (iter.hasNext()) { >+ IProductPluginConfiguration configuration = (IProductPluginConfiguration) 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 +231,7 @@ > fUseFeatures = false; > fAboutInfo = null; > fPlugins.clear(); >+ fPluginConfigurations.clear(); > fFeatures.clear(); > fConfigIniInfo = null; > fWindowImages = null; >@@ -256,6 +266,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 +308,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$ >+ IProductPluginConfiguration 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 +357,63 @@ > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#addPluginConfigurations(org.eclipse.pde.internal.core.iproduct.IPluginConfiguration[]) >+ */ >+ public void addPluginConfigurations(IProductPluginConfiguration[] 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(IProductPluginConfiguration[] 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 +424,13 @@ > } > > /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#getPluginConfigurations() >+ */ >+ public IProductPluginConfiguration[] getPluginConfigurations() { >+ return (IProductPluginConfiguration[]) fPluginConfigurations.values().toArray(new IProductPluginConfiguration[fPluginConfigurations.size()]); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProduct#getConfigurationFileInfo() > */ > public IConfigurationFileInfo getConfigurationFileInfo() { >@@ -485,4 +564,11 @@ > fireStructureChanged(feature1, IModelChangedEvent.CHANGE); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.core.iproduct.IProduct#findPluginConfiguration(java.lang.String) >+ */ >+ public IProductPluginConfiguration findPluginConfiguration(String id) { >+ return (IProductPluginConfiguration) 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 4 Sep 2008 15:15:54 -0000 >@@ -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 IProductPluginConfiguration createPluginConfiguration() { >+ return new ProductPluginConfiguration(fModel); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.pde.internal.core.iproduct.IProductModelFactory#createConfigFileInfo() > */ > public IConfigurationFileInfo createConfigFileInfo() { >Index: src/org/eclipse/pde/internal/core/iproduct/IProductPluginConfiguration.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/iproduct/IProductPluginConfiguration.java >diff -N src/org/eclipse/pde/internal/core/iproduct/IProductPluginConfiguration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/iproduct/IProductPluginConfiguration.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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 >+ * @author Bartosz Michalik >+ */ >+public interface IProductPluginConfiguration 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/ProductPluginConfiguration.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/product/ProductPluginConfiguration.java >diff -N src/org/eclipse/pde/internal/core/product/ProductPluginConfiguration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/product/ProductPluginConfiguration.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.IProductPluginConfiguration; >+import org.w3c.dom.*; >+ >+public class ProductPluginConfiguration extends ProductObject implements IProductPluginConfiguration { >+ >+ private static final long serialVersionUID = -3549668957352554876L; >+ private boolean fAutoStart; >+ private int fStartLevel; >+ private String fId; >+ private Map fPropertiesMap; >+ >+ /** >+ * Only for parsing usage >+ * @param model >+ */ >+ ProductPluginConfiguration(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("<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