From 4904fdaba1bb826d4f339d5c3b7364121d0ea617 Mon Sep 17 00:00:00 2001 From: Alshama M S Date: Fri, 13 Oct 2023 11:35:10 +0530 Subject: [PATCH] List OSGI plugins in the export list The commit fixes OSGi plugins (that have been created using standard OSGi framework with 'Generate OSGi metadata automatically' feature) not being displayed in the export dialog box. This happens because an OSGi project has a pde.bnd file, unlike the eclipse plugins, which has build.properties. Therefore the previous behaviour was to check for the presence of a build.properties file for validating a plugin project. This assumption breaks with the new type. --- .../ui/wizards/exports/PluginExportWizardPage.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizardPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizardPage.java index 92c7d0627b..06e5d8861c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizardPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizardPage.java @@ -27,6 +27,7 @@ import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.WorkspaceModelManager; +import org.eclipse.pde.internal.core.bnd.BndProjectManager; import org.eclipse.pde.internal.ui.IHelpContextIds; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.pde.internal.ui.util.PersistablePluginObject; @@ -53,7 +54,8 @@ public Object[] getListElements() { for (int i = 0; i < projects.length; i++) { if (!WorkspaceModelManager.isBinaryProject(projects[i]) && WorkspaceModelManager.isPluginProject(projects[i])) { IModel model = PluginRegistry.findModel(projects[i]); - if (model != null && isValidModel(model) && hasBuildProperties((IPluginModelBase) model)) { + if (model != null && isValidModel(model) && (hasBuildProperties((IPluginModelBase) model) + || hasPdeBndDescriptor(projects[i]))) { result.add(model); } } @@ -71,6 +73,15 @@ private boolean hasBuildProperties(IPluginModelBase model) { return file.exists(); } + private boolean hasPdeBndDescriptor(IProject project) { + try { + return BndProjectManager.getBndProject(project).isPresent(); + } catch (Exception e) { + return false; + } + + } + @Override protected boolean isValidModel(IModel model) { return model != null && model instanceof IPluginModelBase;