diff options
| author | Julian Honnen | 2019-05-15 14:07:07 +0000 |
|---|---|---|
| committer | Julian Honnen | 2019-05-15 15:22:55 +0000 |
| commit | db2e1df66be7124f65f2bd0055f1f857bba2d8e1 (patch) | |
| tree | c1d30f8d6eef77d6281e422b430d45e991fabfca | |
| parent | 49c2dd972654fbd6d5f43085b4bb831b093d1925 (diff) | |
| download | eclipse.pde.ui-db2e1df66be7124f65f2bd0055f1f857bba2d8e1.tar.gz eclipse.pde.ui-db2e1df66be7124f65f2bd0055f1f857bba2d8e1.tar.xz eclipse.pde.ui-db2e1df66be7124f65f2bd0055f1f857bba2d8e1.zip | |
Bug 547222 - [category] added details section also for plug-ins
Extracted super class out of FeatureDetailsSection to reuse common logic
for bundle details.
Change-Id: I9cbb7110a6da842cb357a917b2a0f495fb3c0552
Signed-off-by: Julian Honnen <julian.honnen@vector.com>
7 files changed, 331 insertions, 245 deletions
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 9b4e3011b1..e7dbe5b2a3 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -1927,11 +1927,14 @@ public class PDEUIMessages extends NLS { public static String FeatureDetails_title; public static String FeatureDetails_sectionDescription; - public static String FeatureDetails_id; - public static String FeatureDetails_version; + public static String SiteContentDetails_id; + public static String SiteContentDetails_version; public static String FeatureDetails_url; public static String FeatureDetails_include_url; + public static String BundleDetails_title; + public static String BundleDetails_sectionDescription; + public static String FeaturesPage_title; public static String FeaturesPage_header; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/BundleDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/BundleDetailsSection.java new file mode 100644 index 0000000000..58637e8e2a --- /dev/null +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/BundleDetailsSection.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2019 Julian Honnen + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Julian Honnen <julian.honnen@vector.com> - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.internal.ui.editor.category; + +import org.eclipse.pde.internal.core.isite.ISiteBundle; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.editor.PDEFormPage; +import org.eclipse.swt.widgets.Composite; + +public class BundleDetailsSection extends IUDetailsSection<ISiteBundle> { + + public BundleDetailsSection(PDEFormPage page, Composite parent) { + super(page, parent, PDEUIMessages.BundleDetails_title, PDEUIMessages.BundleDetails_sectionDescription, + BundleDetailsSection::extractFromSelection); + } + + private static ISiteBundle extractFromSelection(Object o) { + if (o instanceof ISiteBundle) { + return (ISiteBundle) o; + } else if (o instanceof SiteBundleAdapter) { + return ((SiteBundleAdapter) o).bundle; + } + return null; + } +} diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/FeatureDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/FeatureDetailsSection.java index e72b3fe384..206110f962 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/FeatureDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/FeatureDetailsSection.java @@ -16,154 +16,50 @@ package org.eclipse.pde.internal.ui.editor.category; import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.pde.internal.core.isite.ISiteFeature; -import org.eclipse.pde.internal.core.isite.ISiteModel; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.pde.internal.ui.editor.*; +import org.eclipse.pde.internal.ui.editor.FormLayoutFactory; +import org.eclipse.pde.internal.ui.editor.PDEFormPage; import org.eclipse.pde.internal.ui.parts.FormEntry; import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.*; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.IFormPart; -import org.eclipse.ui.forms.IPartSelectionListener; import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Section; import org.osgi.framework.Version; -public class FeatureDetailsSection extends PDESection implements IPartSelectionListener { +public class FeatureDetailsSection extends IUDetailsSection<ISiteFeature> { - private static final String PROPERTY_ID = "id"; //$NON-NLS-1$ - private static final String PROPERTY_VERSION = "version"; //$NON-NLS-1$ - private static final String PROPERTY_URL = "url"; //$NON-NLS-1$ - - private ISiteFeature fCurrentSiteFeature; - private FormEntry fIdText; - private FormEntry fVersionText; private FormEntry fUrlText; private Button fIncludeUrlCheckbox; private SelectionListener fRecomputeAdapter; public FeatureDetailsSection(PDEFormPage page, Composite parent) { - this(page, parent, PDEUIMessages.FeatureDetails_title, PDEUIMessages.FeatureDetails_sectionDescription, - SWT.NULL); - - } + super(page, parent, PDEUIMessages.FeatureDetails_title, PDEUIMessages.FeatureDetails_sectionDescription, + FeatureDetailsSection::extractFromSelection); - public FeatureDetailsSection(PDEFormPage page, Composite parent, String title, String desc, int toggleStyle) { - super(page, parent, Section.DESCRIPTION | toggleStyle); - getSection().setText(title); - getSection().setDescription(desc); - createClient(getSection(), page.getManagedForm().getToolkit()); } - private void applyValue(String property, String value) throws CoreException { - if (fCurrentSiteFeature == null) { - return; - } - if (property.equals(PROPERTY_ID)) { - fCurrentSiteFeature.setId(value); - } else if (property.equals(PROPERTY_VERSION)) { - fCurrentSiteFeature.setVersion(value); - } else if (property.equals(PROPERTY_URL)) { - fCurrentSiteFeature.setURL(value); + private static ISiteFeature extractFromSelection(Object o) { + if (o instanceof ISiteFeature) { + return (ISiteFeature) o; + } else if (o instanceof SiteFeatureAdapter) { + return ((SiteFeatureAdapter) o).feature; } + return null; } @Override - public void cancelEdit() { - fIdText.cancelEdit(); - fVersionText.cancelEdit(); - super.cancelEdit(); - } - - @Override - public boolean canPaste(Clipboard clipboard) { - TransferData[] types = clipboard.getAvailableTypes(); - Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; - for (TransferData type : types) { - for (Transfer transfer : transfers) { - if (transfer.isSupportedType(type)) { - return true; - } - } - } - return false; - } - - private void clearField(String property) { - if (property.equals(PROPERTY_ID)) { - fIdText.setValue(null, true); - } else if (property.equals(PROPERTY_VERSION)) { - fVersionText.setValue(null, true); - } else if (property.equals(PROPERTY_URL)) { - fUrlText.setValue(null, true); - fIncludeUrlCheckbox.setSelection(false); - } - } - - private void clearFields() { - fIdText.setValue(null, true); - fVersionText.setValue(null, true); + protected void clearFields() { + super.clearFields(); fUrlText.setValue(null, true); fIncludeUrlCheckbox.setSelection(false); } @Override - public void commit(boolean onSave) { - fIdText.commit(); - fVersionText.commit(); - super.commit(onSave); - } - - @Override - public void createClient(Section section, FormToolkit toolkit) { - section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); - Composite container = toolkit.createComposite(section); - container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2)); - container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - GridData data = new GridData(GridData.FILL_BOTH); - section.setLayoutData(data); - - fIdText = new FormEntry(container, toolkit, PDEUIMessages.FeatureDetails_id, null, false); - fIdText.setFormEntryListener(new FormEntryAdapter(this) { - @Override - public void textValueChanged(FormEntry text) { - try { - applyValue(PROPERTY_ID, text.getValue()); - if (fIncludeUrlCheckbox.getSelection()) { - applyUrl(true); - } - } catch (CoreException e) { - PDEPlugin.logException(e); - } - } - }); - limitTextWidth(fIdText); - fIdText.setEditable(isEditable()); - - fVersionText = new FormEntry(container, toolkit, PDEUIMessages.FeatureDetails_version, null, false); - fVersionText.setFormEntryListener(new FormEntryAdapter(this) { - - @Override - public void textValueChanged(FormEntry text) { - applyVersion(text.getValue()); - if (fIncludeUrlCheckbox.getSelection()) { - applyUrl(true); - } - } - - }); - limitTextWidth(fVersionText); - fVersionText.setEditable(isEditable()); - + protected void onCreateClient(Composite container, FormToolkit toolkit) { fUrlText = new FormEntry(container, toolkit, PDEUIMessages.FeatureDetails_url, null, false); limitTextWidth(fUrlText); fUrlText.setEditable(false); @@ -173,54 +69,52 @@ public class FeatureDetailsSection extends PDESection implements IPartSelectionL GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; fIncludeUrlCheckbox.setLayoutData(gd); - fRecomputeAdapter = widgetSelectedAdapter(e -> applyUrl(fIncludeUrlCheckbox.getSelection())); + fRecomputeAdapter = widgetSelectedAdapter(e -> { + try { + applyUrl(fIncludeUrlCheckbox.getSelection()); + } catch (CoreException ex) { + PDEPlugin.logException(ex); + } + }); fIncludeUrlCheckbox.addSelectionListener(fRecomputeAdapter); fIncludeUrlCheckbox.setEnabled(isEditable()); + } - toolkit.paintBordersFor(container); - section.setClient(container); - - ISiteModel model = (ISiteModel) getPage().getModel(); - if (model != null) { - model.addModelChangedListener(this); - } + @Override + protected void applyId(String value) throws CoreException { + super.applyId(value); + onUrlDependencyChanged(value); } - private void applyVersion(String version) { - String value = version; - if (value != null && value.isEmpty()) { - // do not store empty version - value = null; - } - if (value == null) { - applyUrl(false); - } - try { - applyValue(PROPERTY_VERSION, value); - } catch (CoreException e) { - PDEPlugin.logException(e); - } + @Override + protected void applyVersion(String value) throws CoreException { + super.applyVersion(value); + onUrlDependencyChanged(value); + } + private void onUrlDependencyChanged(String dependencyValue) throws CoreException { + boolean includeUrl = (dependencyValue != null) && fIncludeUrlCheckbox.getSelection(); + applyUrl(includeUrl); updateUrlEnablement(); } - private void applyUrl(boolean include) { - String value = include ? recomputeUrl() : null; - try { - applyValue(PROPERTY_URL, value); - } catch (CoreException e) { - PDEPlugin.logException(e); + private void applyUrl(boolean include) throws CoreException { + ISiteFeature feature = getCurrentItem(); + if (feature != null) { + String value = include ? recomputeUrl() : null; + feature.setURL(value); } } private String recomputeUrl() { - if (fCurrentSiteFeature == null) { + ISiteFeature feature = getCurrentItem(); + if (feature == null) { return null; } StringBuilder sb = new StringBuilder(); - sb.append("features/").append(fCurrentSiteFeature.getId()).append("_"); //$NON-NLS-1$ //$NON-NLS-2$ + sb.append("features/").append(feature.getId()).append("_"); //$NON-NLS-1$ //$NON-NLS-2$ try { - sb.append(new Version(fCurrentSiteFeature.getVersion())); + sb.append(new Version(feature.getVersion())); } catch (Exception e) { sb.append("0.0.0"); //$NON-NLS-1$ } @@ -229,80 +123,22 @@ public class FeatureDetailsSection extends PDESection implements IPartSelectionL } private void updateUrlEnablement() { - fIncludeUrlCheckbox.setEnabled(isEditable() && !fVersionText.getValue().isEmpty()); + ISiteFeature feature = getCurrentItem(); + boolean hasVersionAndId = (feature != null) && (feature.getId() != null) && (feature.getVersion() != null); + fIncludeUrlCheckbox.setEnabled(isEditable() && hasVersionAndId); } @Override - public void dispose() { - ISiteModel model = (ISiteModel) getPage().getModel(); - if (model != null) { - model.removeModelChangedListener(this); - } - super.dispose(); - } + protected void fillControls(ISiteFeature currentItem) { + super.fillControls(currentItem); - private void limitTextWidth(FormEntry entry) { - GridData gd = (GridData) entry.getText().getLayoutData(); - gd.widthHint = 30; - } - - @Override - public void modelChanged(IModelChangedEvent e) { - markStale(); - } + fIncludeUrlCheckbox.removeSelectionListener(fRecomputeAdapter); + String url = currentItem.getURL(); + fIncludeUrlCheckbox.setSelection(url != null); + fUrlText.setValue(url, true); + fIncludeUrlCheckbox.addSelectionListener(fRecomputeAdapter); - @Override - public void refresh() { - if (fCurrentSiteFeature == null) { - clearFields(); - super.refresh(); - return; - } - setValue(PROPERTY_ID); - setValue(PROPERTY_VERSION); - setValue(PROPERTY_URL); updateUrlEnablement(); - super.refresh(); - } - - @Override - public void selectionChanged(IFormPart part, ISelection selection) { - ISiteFeature siteFeature = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structured = (IStructuredSelection) selection; - Object o = structured.getFirstElement(); - if (o instanceof ISiteFeature) { - siteFeature = (ISiteFeature) o; - } else if (o instanceof SiteFeatureAdapter) { - siteFeature = ((SiteFeatureAdapter) o).feature; - } - } - fCurrentSiteFeature = siteFeature; - refresh(); } - @Override - public void setFocus() { - if (fIdText != null) { - fIdText.getText().setFocus(); - } - } - - private void setValue(String property) { - if (fCurrentSiteFeature == null) { - clearField(property); - } else { - if (property.equals(PROPERTY_ID)) { - fIdText.setValue(fCurrentSiteFeature.getId(), true); - } else if (property.equals(PROPERTY_VERSION)) { - fVersionText.setValue(fCurrentSiteFeature.getVersion(), true); - } else if (property.equals(PROPERTY_URL)) { - fIncludeUrlCheckbox.removeSelectionListener(fRecomputeAdapter); - String url = fCurrentSiteFeature.getURL(); - fIncludeUrlCheckbox.setSelection(url != null); - fUrlText.setValue(url, true); - fIncludeUrlCheckbox.addSelectionListener(fRecomputeAdapter); - } - } - } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUDetailsSection.java new file mode 100644 index 0000000000..250c75b9d3 --- /dev/null +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUDetailsSection.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * Copyright (c) 2019 Julian Honnen + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Julian Honnen <julian.honnen@vector.com> - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.internal.ui.editor.category; + +import java.util.function.Function; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.pde.core.IModelChangedEvent; +import org.eclipse.pde.internal.core.ifeature.IVersionable; +import org.eclipse.pde.internal.core.isite.ISiteModel; +import org.eclipse.pde.internal.ui.PDEPlugin; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.editor.*; +import org.eclipse.pde.internal.ui.parts.FormEntry; +import org.eclipse.swt.dnd.*; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.forms.IFormPart; +import org.eclipse.ui.forms.IPartSelectionListener; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.eclipse.ui.forms.widgets.Section; + +abstract class IUDetailsSection<T extends IVersionable> extends PDESection implements IPartSelectionListener { + + private final Function<Object, T> fSelectionExtractor; + + private T fCurrentItem; + + private FormEntry fIdText; + private FormEntry fVersionText; + + public IUDetailsSection(PDEFormPage page, Composite parent, String title, String desc, + Function<Object, T> selectionExtractor) { + super(page, parent, Section.DESCRIPTION); + fSelectionExtractor = selectionExtractor; + getSection().setText(title); + getSection().setDescription(desc); + createClient(getSection(), page.getManagedForm().getToolkit()); + } + + @Override + public void cancelEdit() { + fIdText.cancelEdit(); + fVersionText.cancelEdit(); + super.cancelEdit(); + } + + @Override + public boolean canPaste(Clipboard clipboard) { + TransferData[] types = clipboard.getAvailableTypes(); + Transfer[] transfers = new Transfer[] { TextTransfer.getInstance(), RTFTransfer.getInstance() }; + for (TransferData type : types) { + for (Transfer transfer : transfers) { + if (transfer.isSupportedType(type)) { + return true; + } + } + } + return false; + } + + @Override + public void commit(boolean onSave) { + fIdText.commit(); + fVersionText.commit(); + super.commit(onSave); + } + + @Override + public final void createClient(Section section, FormToolkit toolkit) { + section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); + Composite container = toolkit.createComposite(section); + container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2)); + container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + GridData data = new GridData(GridData.FILL_BOTH); + section.setLayoutData(data); + + fIdText = new FormEntry(container, toolkit, PDEUIMessages.SiteContentDetails_id, null, false); + fIdText.setFormEntryListener(new FormEntryAdapter(this) { + @Override + public void textValueChanged(FormEntry text) { + if (fCurrentItem != null) { + try { + String value = text.getValue(); + applyId(value.isEmpty() ? null : value); + } catch (CoreException e) { + PDEPlugin.logException(e); + } + } + } + }); + limitTextWidth(fIdText); + fIdText.setEditable(isEditable()); + + fVersionText = new FormEntry(container, toolkit, PDEUIMessages.SiteContentDetails_version, null, false); + fVersionText.setFormEntryListener(new FormEntryAdapter(this) { + + @Override + public void textValueChanged(FormEntry text) { + if (fCurrentItem != null) { + try { + String value = text.getValue(); + applyVersion(value.isEmpty() ? null : value); + } catch (CoreException e) { + PDEPlugin.logException(e); + } + } + } + + }); + limitTextWidth(fVersionText); + fVersionText.setEditable(isEditable()); + + onCreateClient(container, toolkit); + + toolkit.paintBordersFor(container); + section.setClient(container); + + ISiteModel model = (ISiteModel) getPage().getModel(); + if (model != null) { + model.addModelChangedListener(this); + } + } + + protected void onCreateClient(Composite container, FormToolkit toolkit) { + } + + protected void applyId(String value) throws CoreException { + fCurrentItem.setId(value); + } + + protected void applyVersion(String value) throws CoreException { + fCurrentItem.setVersion(value); + } + + @Override + public void modelChanged(IModelChangedEvent e) { + markStale(); + } + + @Override + public final void refresh() { + if (fCurrentItem == null) { + clearFields(); + } else { + fillControls(fCurrentItem); + } + + super.refresh(); + } + + protected void fillControls(T currentItem) { + fIdText.setValue(currentItem.getId(), true); + fVersionText.setValue(currentItem.getVersion(), true); + } + + @Override + public void selectionChanged(IFormPart part, ISelection selection) { + T item = null; + if (selection instanceof IStructuredSelection) { + IStructuredSelection structured = (IStructuredSelection) selection; + item = fSelectionExtractor.apply(structured.getFirstElement()); + } + fCurrentItem = item; + refresh(); + } + + @Override + public void setFocus() { + if (fIdText != null) { + fIdText.getText().setFocus(); + } + } + + protected void clearFields() { + fIdText.setValue(null, true); + fVersionText.setValue(null, true); + } + + @Override + public void dispose() { + ISiteModel model = (ISiteModel) getPage().getModel(); + if (model != null) { + model.removeModelChangedListener(this); + } + super.dispose(); + } + + protected void limitTextWidth(FormEntry entry) { + GridData gd = (GridData) entry.getText().getLayoutData(); + gd.widthHint = 30; + } + + protected T getCurrentItem() { + return fCurrentItem; + } +} diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUsPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUsPage.java index 3ff21fc4d4..fa8fad323b 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUsPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/IUsPage.java @@ -17,8 +17,7 @@ ******************************************************************************/ package org.eclipse.pde.internal.ui.editor.category; -import org.eclipse.pde.internal.core.isite.ISiteCategoryDefinition; -import org.eclipse.pde.internal.core.isite.ISiteFeature; +import org.eclipse.pde.internal.core.isite.*; import org.eclipse.pde.internal.ui.*; import org.eclipse.pde.internal.ui.editor.*; import org.eclipse.swt.widgets.Composite; @@ -67,6 +66,8 @@ public class IUsPage extends PDEFormPage { return createCategoryDetails(); } else if (key.equals(ISiteFeature.class) || key.equals(SiteFeatureAdapter.class)) { return createFeatureDetails(); + } else if (key.equals(ISiteBundle.class) || key.equals(SiteBundleAdapter.class)) { + return createBundleDetails(); } return null; } @@ -94,7 +95,7 @@ public class IUsPage extends PDEFormPage { return new PDEDetailsSections() { @Override protected PDESection[] createSections(PDEFormPage page, Composite parent) { - return new PDESection[] {new CategoryDetailsSection(getPage(), parent)}; + return new PDESection[] { new CategoryDetailsSection(getPage(), parent) }; } @Override @@ -118,6 +119,20 @@ public class IUsPage extends PDEFormPage { }; } + private IDetailsPage createBundleDetails() { + return new PDEDetailsSections() { + @Override + protected PDESection[] createSections(PDEFormPage page, Composite parent) { + return new PDESection[] { new BundleDetailsSection(getPage(), parent) }; + } + + @Override + public String getContextId() { + return CategoryInputContext.CONTEXT_ID; + } + }; + } + @Override protected String getHelpResource() { return IHelpContextIds.CATEGORY_EDITOR; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/SiteBundleAdapter.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/SiteBundleAdapter.java index c9811474cb..1e7fb754ab 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/SiteBundleAdapter.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/SiteBundleAdapter.java @@ -15,6 +15,7 @@ package org.eclipse.pde.internal.ui.editor.category; import java.io.PrintWriter; import java.io.Serializable; +import java.util.Objects; import org.eclipse.pde.core.IWritable; import org.eclipse.pde.internal.core.isite.ISiteBundle; @@ -45,32 +46,13 @@ public class SiteBundleAdapter implements Serializable, IWritable { public boolean equals(Object obj) { if (obj instanceof SiteBundleAdapter) { SiteBundleAdapter adapter = (SiteBundleAdapter) obj; - String id = bundle.getId(); - String id2 = adapter.bundle.getId(); - boolean sameBundle = id != null && id2 != null && id.equals(id2); - if (sameBundle) { - String version = bundle.getVersion(); - String version2 = adapter.bundle.getVersion(); - sameBundle = version != null && version2 != null && version.equals(version2); - } - boolean sameCategory = adapter.category != null && category != null ? adapter.category.equals(category) : true; - return sameBundle && sameCategory; + return Objects.equals(bundle, adapter.bundle); } return super.equals(obj); } @Override public int hashCode() { - if (bundle.getId() == null) { - return super.hashCode(); - } - int code = bundle.getId().hashCode(); - if (bundle.getVersion() != null) { - code += bundle.getVersion().hashCode(); - } - if (category != null) { - code += category.hashCode(); - } - return code; + return bundle.hashCode(); } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 93dd22d2fd..cfd934dcc3 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -1746,11 +1746,15 @@ CategoryDetails_alreadyExists_title = Invalid category id FeatureDetails_title = Feature Properties FeatureDetails_sectionDescription = Provide an identifier and a version for each feature.\n\ "*" denotes a required field. -FeatureDetails_id = &ID*: -FeatureDetails_version = &Version: +SiteContentDetails_id=&ID*: +SiteContentDetails_version=&Version: FeatureDetails_url = URL FeatureDetails_include_url=Include URL +BundleDetails_title = Plug-in Properties +BundleDetails_sectionDescription = Provide an identifier and a version for each plug-in.\n\ +"*" denotes a required field. + FeaturesPage_title = Site Map FeaturesPage_header = Update Site Map |
