-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add adapter for IProject > (bnd) Project #918
Conversation
Test Results 264 files - 6 264 suites - 6 41m 22s ⏱️ - 14m 16s For more details on these failures, see this check. Results for commit e3359e4. ± Comparison against base commit 62e8a76. ♻️ This comment has been updated with latest results. |
ff700f2
to
f788a35
Compare
try { | ||
return adapterType.cast(BndProjectManager.getBndProject(project).orElse(null)); | ||
} catch (Exception e) { | ||
// can't adapt then... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be logged at least?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add a logging but this mostly means there is some error already visible for the user in the workspace so an additional logging (possibly multiple times) seem not so useful.
The general contract of adapting is to try adapt and getting null
if it is not possible, but there is no way to let the caller know why it didn't work out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Maybe I'm just confused by BndProjectManager.getBndProject(project)
returning an optional yet declaring an undocumented Exception to be possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Exception
is sadly a burden from the BND project that uses throws Exception all the time :-
In this case it actually should never happen but if it does something is wrong and caller can just give up as we can't decide whats going wrong.
ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bnd/PdeBndAdapter.java
Outdated
Show resolved
Hide resolved
f788a35
to
386b2d6
Compare
If one wants to write generic UI components then there is often the question to answer to what (bnd) project an Eclipse IProject belongs (if any). This adds an Adapter that can adapt from IProject > (bnd) Project if the IProject is a PDE Bnd backed project. See also - https://bnd.discourse.group/t/announcement-bnd-and-pde-cooperation/372
efc55f8
to
e3359e4
Compare
If one wants to write generic UI components then there is often the question to answer to what (bnd) project an Eclipse IProject belongs (if any).
This adds an Adapter that can adapt from IProject > (bnd) Project if the IProject is a PDE Bnd backed project.
See also