diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDELabelProvider.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDELabelProvider.java index cae56f226c..47407a2784 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDELabelProvider.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDELabelProvider.java @@ -16,6 +16,7 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui; +import java.util.HashMap; import java.util.Locale; import org.eclipse.core.resources.IProject; @@ -86,6 +87,7 @@ import org.eclipse.pde.internal.core.text.bundle.ImportPackageObject; import org.eclipse.pde.internal.core.text.bundle.PackageObject; import org.eclipse.pde.internal.core.util.VersionUtil; +import org.eclipse.pde.internal.ui.dialogs.PluginSelectionDialog; import org.eclipse.pde.internal.ui.elements.NamedElement; import org.eclipse.pde.internal.ui.util.SWTUtil; import org.eclipse.pde.internal.ui.util.SharedLabelProvider; @@ -96,6 +98,11 @@ public class PDELabelProvider extends SharedLabelProvider { private static final String SYSTEM_BUNDLE = "system.bundle"; //$NON-NLS-1$ + private IPluginModelBase currentModel; + + public IPluginModelBase getCurrentPluginModel() { + return currentModel; + } public PDELabelProvider() { } @@ -203,6 +210,13 @@ public String getObjectText(IPluginBase pluginBase) { } if (pluginBase.getModel() != null && !pluginBase.getModel().isInSync()) text += " " + PDEUIMessages.PluginModelManager_outOfSync; //$NON-NLS-1$ + + HashMap existingImports = PluginSelectionDialog.getExistingImports(currentModel, false); + if (existingImports.get(pluginBase.getId()) != null && existingImports.get(pluginBase.getId())) { + text += " " + PDEUIMessages.PluginModelManager_alreadyAddedViaReexport; //$NON-NLS-1$ + } else if (existingImports.get(pluginBase.getId()) != null && !existingImports.get(pluginBase.getId())) { + text += " " + PDEUIMessages.PluginModelManager_alreadyAdded; //$NON-NLS-1$ + } return text; } @@ -952,4 +966,7 @@ public static String formatVersion(String versionRange) { return versionRange; } + public void setCurrentModel(IPluginModelBase currentModel) { + this.currentModel = currentModel; + } } 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 3eea5272e9..b8c2abc15d 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 @@ -26,6 +26,14 @@ public class PDEUIMessages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.pde.internal.ui.pderesources";//$NON-NLS-1$ + public static String PluginModelManager_alreadyImported; + + public static String PluginModelManager_alreadyAdded; + + public static String PluginModelManager_alreadyAddedViaReexport; + + public static String PluginModelManager_alreadyExported; + public static String AbstractLauncherToolbar_noProblems; public static String AbstractLauncherToolbar_noSelection; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/PluginSelectionDialog.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/PluginSelectionDialog.java index 9ed54a2e67..6bf137f8e5 100755 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/PluginSelectionDialog.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/PluginSelectionDialog.java @@ -18,7 +18,6 @@ import java.util.Comparator; import java.util.HashMap; -import java.util.HashSet; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -26,6 +25,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.osgi.service.resolver.ExportPackageDescription; import org.eclipse.pde.core.plugin.IFragment; import org.eclipse.pde.core.plugin.IFragmentModel; @@ -42,6 +42,7 @@ import org.eclipse.pde.internal.ui.IHelpContextIds; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; @@ -137,6 +138,11 @@ public PluginSelectionDialog(Shell parentShell, IPluginModelBase[] models, boole setListLabelProvider(PDEPlugin.getDefault().getLabelProvider()); } + public PluginSelectionDialog(Shell activeWorkbenchShell, IPluginModelBase[] availablePlugins, + boolean multipleSelection, IPluginModelBase model) { + this(activeWorkbenchShell, availablePlugins, multipleSelection); + PDEPlugin.getDefault().getLabelProvider().setCurrentModel(model); + } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); @@ -153,8 +159,8 @@ private static IPluginModelBase[] getElements(boolean includeFragments) { return PluginRegistry.getActiveModels(includeFragments); } - public static HashSet getExistingImports(IPluginModelBase model, boolean includeImportPkg) { - HashSet existingImports = new HashSet<>(); + public static HashMap getExistingImports(IPluginModelBase model, boolean includeImportPkg) { + HashMap existingImports = new HashMap<>(); addSelfAndDirectImports(existingImports, model); if (model instanceof IFragmentModel) { IFragment fragment = ((IFragmentModel) model).getFragment(); @@ -169,33 +175,34 @@ public static HashSet getExistingImports(IPluginModelBase model, boolean return existingImports; } - private static void addSelfAndDirectImports(HashSet set, IPluginModelBase model) { + private static void addSelfAndDirectImports(HashMap existingImports, IPluginModelBase model) { if (model == null) { return; } - set.add(model.getPluginBase().getId()); + existingImports.put(model.getPluginBase().getId(), false); IPluginImport[] imports = model.getPluginBase().getImports(); for (IPluginImport pImport : imports) { String id = pImport.getId(); - if (set.add(id)) { - addReexportedImport(set, id); - } + existingImports.put(id, false); + addReexportedImport(existingImports, id); + } } - private static void addReexportedImport(HashSet set, String id) { + private static void addReexportedImport(HashMap existingImports, String id) { IPluginModelBase model = PluginRegistry.findModel(id); if (model != null) { IPluginImport[] imports = model.getPluginBase().getImports(); for (IPluginImport pImport : imports) { - if (pImport.isReexported() && set.add(pImport.getId())) { - addReexportedImport(set, pImport.getId()); + if (pImport.isReexported()) { + existingImports.put(pImport.getId(), true); + addReexportedImport(existingImports, pImport.getId()); } } } } - private static void addImportedPackages(IBundlePluginModelBase base, HashSet existingImports) { + private static void addImportedPackages(IBundlePluginModelBase base, HashMap existingImports) { HashMap map = getImportPackages(base); if (map == null) { return; @@ -221,7 +228,7 @@ private static void addImportedPackages(IBundlePluginModelBase base, HashSet existingImports = PluginSelectionDialog + .getExistingImports(PDEPlugin.getDefault().getLabelProvider().getCurrentPluginModel(), false); + if (!currentSelection.isEmpty()) + okButton.setEnabled(false); + for (Object selection : currentSelection) { + if (selection instanceof IPluginModelBase + && !(existingImports.keySet().contains(((IPluginModelBase) selection).getPluginBase().getId()))) { + okButton.setEnabled(true); + break; + } + + } + } +} \ No newline at end of file diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java index 0f161405f1..bf0e83f04c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java @@ -26,6 +26,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.JavaCore; @@ -41,6 +42,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; @@ -402,10 +404,10 @@ private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); final IProject project = model.getUnderlyingResource().getProject(); if (PluginProject.isJavaProject(project)) { - ILabelProvider labelProvider = new JavaElementLabelProvider(); + ILabelProvider labelProvider = new ExportPackgeLabelProvider(); final ConditionalListSelectionDialog dialog = new ConditionalListSelectionDialog( PDEPlugin.getActiveWorkbenchShell(), labelProvider, - PDEUIMessages.ExportPackageSection_dialogButtonLabel); + PDEUIMessages.ExportPackageSection_dialogButtonLabel,fHeader); final Collection pckgs = fHeader == null ? Collections.emptySet() : fHeader.getPackageNames(); final boolean allowJava = "true".equals(getBundle().getHeader(ICoreConstants.ECLIPSE_JREBUNDLE)); //$NON-NLS-1$ Runnable runnable = () -> { @@ -437,7 +439,9 @@ private void handleAdd() { if (fHeader != null) { for (Object selectedObject : selected) { IPackageFragment candidate = (IPackageFragment) selectedObject; + if (!fHeader.getPackageNames().contains(candidate.getElementName())){ fHeader.addPackage(new ExportPackageObject(fHeader, candidate, getVersionAttribute())); + } } } else { getBundle().setHeader(getExportedPackageHeader(), getValue(selected)); @@ -620,4 +624,22 @@ private void calculateUses() { Action action = new CalculateUsesAction(proj, (IBundlePluginModelBase) getPage().getModel()); action.run(); } + + class ExportPackgeLabelProvider extends LabelProvider { + JavaElementLabelProvider javaElementLabel = new JavaElementLabelProvider(); + @Override + public String getText(Object element) { + + if (element instanceof IJavaElement javaElement) { + String text = javaElementLabel.getText(javaElement); + final Collection pckgs = fHeader == null ? Collections.emptySet() : fHeader.getPackageNames(); + if (!pckgs.isEmpty() && pckgs.contains(text)) { + return text + " " + PDEUIMessages.PluginModelManager_alreadyExported; //$NON-NLS-1$ + } + + } + return javaElementLabel.getText(element); + } + } + } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java index 14455b631f..91f83a46d9 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java @@ -114,13 +114,21 @@ public class ImportPackageSection extends TableSection { private ImportPackageHeader fHeader; - static class ImportItemWrapper { + public static class ImportItemWrapper { Object fUnderlying; + private boolean isImported = false; + + public boolean isAlreadyImported() { + return isImported; + } public ImportItemWrapper(Object underlying) { fUnderlying = underlying; } + public void setAlreadyImported() { + this.isImported = true; + } @Override public String toString() { return getName(); @@ -180,7 +188,7 @@ public Object[] getElements(Object parent) { } } - static class ImportPackageDialogLabelProvider extends LabelProvider { + class ImportPackageDialogLabelProvider extends LabelProvider { @Override public Image getImage(Object element) { return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_PACKAGE); @@ -201,6 +209,10 @@ public String getText(Object element) { buffer.append(' '); buffer.append(PDELabelProvider.formatVersion(version.toString())); } + if (p.isAlreadyImported() && fHeader != null && fHeader.hasPackage(p.getName())) { + buffer.append(' '); + buffer.append(PDEUIMessages.PluginModelManager_alreadyImported); + } return buffer.toString(); } } @@ -464,7 +476,8 @@ private void handleAdd() { Set names = new HashSet<>(); // set of String names, do not allow the same package to be added twice for (int i = 0; i < selected.length; i++) { ImportPackageObject impObject = null; - if (selected[i] instanceof ImportItemWrapper) + if (selected[i] instanceof ImportItemWrapper + && !((ImportItemWrapper) selected[i]).isAlreadyImported()) selected[i] = ((ImportItemWrapper) selected[i]).fUnderlying; if (selected[i] instanceof ExportPackageDescription) @@ -530,8 +543,14 @@ private void setElements(ConditionalListSelectionDialog dialog) { NameVersionDescriptor nameVersion = new NameVersionDescriptor(exportedPackage.getName(), exportedPackage.getVersion().toString(), NameVersionDescriptor.TYPE_PACKAGE); if (("java".equals(name) || name.startsWith("java.")) && !allowJava) //$NON-NLS-1$ //$NON-NLS-2$ continue; - if (nameVersions.add(nameVersion) && (fHeader == null || !fHeader.hasPackage(name))) - elements.add(new ImportItemWrapper(exportedPackage)); + if (nameVersions.add(nameVersion)) { + ImportItemWrapper importItemWrapper = new ImportItemWrapper(exportedPackage); + elements.add(importItemWrapper); + if (fHeader != null && fHeader.hasPackage(name)) { + importItemWrapper.setAlreadyImported(); + } + } + } IPluginModelBase model = (IPluginModelBase) getPage().getPDEEditor().getAggregateModel(); if (model instanceof IBundlePluginModelBase) { @@ -544,8 +563,13 @@ private void setElements(ConditionalListSelectionDialog dialog) { String name = pkg.getName(); String version = pkg.getVersion(); NameVersionDescriptor nameVersion = new NameVersionDescriptor(name, version, NameVersionDescriptor.TYPE_PACKAGE); - if (nameVersions.add(nameVersion) && (fHeader == null || !fHeader.hasPackage(name))) - elements.add(new ImportItemWrapper(pkg)); + if (nameVersions.add(nameVersion)) { + ImportItemWrapper importItemWrapper = new ImportItemWrapper(pkg); + elements.add(importItemWrapper); + if (fHeader != null && fHeader.hasPackage(name)) { + importItemWrapper.setAlreadyImported(); + } + } } } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java index d7f521346c..4a53c88fbe 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java @@ -20,8 +20,10 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; -import java.util.Set; +import java.util.List; +import java.util.Map; import java.util.Vector; import org.eclipse.core.runtime.CoreException; @@ -288,7 +290,7 @@ public boolean doGlobalAction(String actionId) { @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { - Set existingImportsSet = null; + Map existingImportsMap = null; // Only import objects that are not already existing imports can be // pasted for (Object sourceObject : sourceObjects) { @@ -298,12 +300,12 @@ protected boolean canPaste(Object targetObject, Object[] sourceObjects) { } // Get the current import objects and store them for searching // purposes - if (existingImportsSet == null) { - existingImportsSet = PluginSelectionDialog.getExistingImports(getModel(), false); + if (existingImportsMap == null) { + existingImportsMap = PluginSelectionDialog.getExistingImports(getModel(), false); } // Only import object that do not exist are allowed ImportObject importObject = (ImportObject) sourceObject; - if (existingImportsSet.contains(importObject.getImport().getId())) { + if (existingImportsMap.keySet().contains(importObject.getImport().getId())) { return false; } } @@ -427,21 +429,28 @@ else if (base instanceof PluginBaseNode) private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); - PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), true); + PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), true, model); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); - IPluginImport[] imports = new IPluginImport[models.length]; + List imports = new ArrayList<>(); + HashMap existingImports = PluginSelectionDialog.getExistingImports(model, false); try { for (int i = 0; i < models.length; i++) { + if (!existingImports.keySet().contains(((IPluginModel) models[i]).getPluginBase().getId())) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); - imports[i] = importNode; + imports.add(importNode); + } + } + if (imports.size() > 0) { + IPluginImport[] pluginImports = new IPluginImport[imports.size()]; + pluginImports = imports.toArray(pluginImports); + addImports(model.getPluginBase(), pluginImports); } - addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } @@ -497,15 +506,14 @@ public void swap(int index1, int index2) { private IPluginModelBase[] getAvailablePlugins(IPluginModelBase model) { IPluginModelBase[] plugins = PluginRegistry.getActiveModels(false); - Set existingImports = PluginSelectionDialog.getExistingImports(model, false); + HashMap existingImports = PluginSelectionDialog.getExistingImports(model, false); ArrayList result = new ArrayList<>(); for (int i = 0; i < plugins.length; i++) { - if (!existingImports.contains(plugins[i].getPluginBase().getId())) { + if (!getModel().getPluginBase().getId().equals(plugins[i].getPluginBase().getId())) result.add(plugins[i]); - } } - if (!existingImports.contains("system.bundle")) //$NON-NLS-1$ + if (!existingImports.keySet().contains("system.bundle")) //$NON-NLS-1$ addSystemBundle(result); return result.toArray(new IPluginModelBase[result.size()]); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ConditionalListSelectionDialog.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ConditionalListSelectionDialog.java index f955c75713..bf12f320d8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ConditionalListSelectionDialog.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ConditionalListSelectionDialog.java @@ -16,10 +16,14 @@ import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.text.StringMatcher; +import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.pde.internal.core.text.bundle.ExportPackageHeader; import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.editor.plugin.ImportPackageSection; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -34,12 +38,19 @@ public class ConditionalListSelectionDialog extends ElementListSelectionDialog { private final String fButtonText; private Object[] fElements; private Object[] fConditionalElements; + private ExportPackageHeader exportPackageHeader; public ConditionalListSelectionDialog(Shell parent, ILabelProvider renderer, String buttonText) { super(parent, renderer); fButtonText = buttonText; } + public ConditionalListSelectionDialog(Shell activeWorkbenchShell, ILabelProvider labelProvider, + String exportPackageSection_dialogButtonLabel, ExportPackageHeader fHeader) { + this(activeWorkbenchShell, labelProvider, exportPackageSection_dialogButtonLabel); + exportPackageHeader = fHeader; + } + @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); @@ -62,6 +73,7 @@ protected Control createDialogArea(Composite parent) { else setListElements(fElements); })); + button.setSelection(true); return comp; } @@ -111,4 +123,32 @@ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } + @Override + protected void updateButtonsEnableState(IStatus status) { + super.updateButtonsEnableState(status); + Button okButton = getOkButton(); + Object[] currentSelection = fFilteredList.getSelection(); + if(currentSelection.length>0) + okButton.setEnabled(false); + for (Object selection : currentSelection) { + if (selection instanceof ImportPackageSection.ImportItemWrapper) { + if (!((ImportPackageSection.ImportItemWrapper) selection).isAlreadyImported()) { + okButton.setEnabled(true); + break; + } + } + else if (selection instanceof IPackageFragment) { + if (exportPackageHeader == null || exportPackageHeader.getPackageNames().isEmpty()) { + okButton.setEnabled(true); + break; + } + else if (!exportPackageHeader.getPackageNames() + .contains(((IPackageFragment) selection).getElementName())) { + okButton.setEnabled(true); + break; + } + } + } + } + } 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 b1ef2e0fa9..6a18b4f9a5 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 @@ -46,6 +46,10 @@ UpdateManager_op_change= Property Change ######################################################## PluginModelManager_outOfSync = (out of sync) +PluginModelManager_alreadyImported = [already imported] +PluginModelManager_alreadyAdded = [already added] +PluginModelManager_alreadyAddedViaReexport = [already added via re-export] +PluginModelManager_alreadyExported = [already exported] ###### Status text ##################################### ExportDestinationTab_InstallIntoCurrentPlatform=&Install into host. Repository: diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/extension/PointSelectionPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/extension/PointSelectionPage.java index 182a64d2ca..ad08a1fc77 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/extension/PointSelectionPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/extension/PointSelectionPage.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Locale; -import java.util.Set; +import java.util.Map; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; @@ -122,7 +122,7 @@ public class PointSelectionPage extends BaseWizardSelectionPage { private final IPluginModelBase fModel; private Button fFilterCheck; private IPluginExtensionPoint fCurrentPoint; - private final Set fAvailableImports; + private final Map fAvailableImports; private final IProject fProject; private Label fTemplateLabel; private ExtensionTreeSelectionPage fWizardsPage; @@ -147,7 +147,7 @@ public boolean select(Viewer viewer, Object parentElement, Object element) { if (point instanceof PluginExtensionPointNode) return true; - return fAvailableImports.contains(point.getPluginBase().getId()); + return fAvailableImports.keySet().contains(point.getPluginBase().getId()); } } @@ -511,7 +511,7 @@ public boolean finish() { } String pluginID = fCurrentPoint.getPluginBase().getId(); - if (!(fCurrentPoint instanceof PluginExtensionPointNode) && !fAvailableImports.contains(pluginID) && !(fCurrentPoint.getPluginBase() instanceof IFragment)) { + if (!(fCurrentPoint instanceof PluginExtensionPointNode) && !fAvailableImports.keySet().contains(pluginID) && !(fCurrentPoint.getPluginBase() instanceof IFragment)) { if (MessageDialog.openQuestion(getShell(), PDEUIMessages.NewExtensionWizard_PointSelectionPage_dependencyTitle, NLS.bind(PDEUIMessages.NewExtensionWizard_PointSelectionPage_dependencyMessage, new String[] {pluginID, fCurrentPoint.getId()}))) { IPluginImport importNode = fModel.getPluginFactory().createImport(); importNode.setId(pluginID);