Skip to content

Commit

Permalink
List OSGI plugins in the export list
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alshamams committed Oct 13, 2023
1 parent 27cf508 commit 218b72b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public interface ICoreConstants {
/** Constant for the string <code>build.properties</code> */
String BUILD_FILENAME_DESCRIPTOR = "build.properties"; //$NON-NLS-1$

/** Constant for the string <code>pde.bnd</code> */
String BND_FILENAME_DESCRIPTOR = "pde.bnd"; //$NON-NLS-1$

/**
* Default version number for plugin and feature
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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((IPluginModelBase) model))) {
result.add(model);
}
}
Expand All @@ -71,6 +72,16 @@ private boolean hasBuildProperties(IPluginModelBase model) {
return file.exists();
}

private boolean hasPdeBndDescriptor(IPluginModelBase model) {
File bin = new File(model.getInstallLocation());
if (bin.exists()) {
File file = new File(bin.getParent(), ICoreConstants.BND_FILENAME_DESCRIPTOR);
return file.exists();
}
return false;

}

@Override
protected boolean isValidModel(IModel model) {
return model != null && model instanceof IPluginModelBase;
Expand Down

0 comments on commit 218b72b

Please sign in to comment.