Skip to content
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

[Modernize Code] use generic version of getAdapter #101

Merged
merged 1 commit into from
Aug 24, 2022

Conversation

azoitl
Copy link
Contributor

@azoitl azoitl commented Aug 19, 2022

This pull request updates all getAdapter methods to the generic version also used in the Eclipse Platform. This greatly improves the usability of the Adapter interface in GEF, as clients do not need to to perform instanceof and casts any more.

@vogella @Phillipus if you have time I would be happy for a quick look. But I think I followed the Eclipse Platforms style and therefore it shouldn't have an impact on users.

I tested with Eclipse 4diac IDE where we make quite some use of the getAdapter interface and it worked as expected.

@Phillipus
Copy link
Contributor

Phillipus commented Aug 19, 2022

I tried to do this exact thing recently in my GEF fork. Down-stream classes that extend the changed classes and over-ride getAdapter with the old method signature might now get warnings that need to be suppressed with "unchecked" and/or "rawtypes". I don't think there were any other side-effects. I need to double-check.

@Phillipus
Copy link
Contributor

I've just gone through all of our GEF forked code and made the same changes. All our unit tests pass, and the RCP app seems to be working all OK.

@azoitl
Copy link
Contributor Author

azoitl commented Aug 19, 2022

@Phillipus thanks for testing. Would it be a lot of work and duplicate your test setup so that I have a second RCP?

@Phillipus
Copy link
Contributor

Would it be a lot of work and duplicate your test setup so that I have a second RCP?

Not sure what you mean? Archi code is here:

https://github.com/archimatetool/archi

We have our version of GEF/Draw2d/Zest as bundles that I copied last year.

@azoitl
Copy link
Contributor Author

azoitl commented Aug 21, 2022

Would it be a lot of work and duplicate your test setup so that I have a second RCP?

Not sure what you mean? Archi code is here:

https://github.com/archimatetool/archi

We have our version of GEF/Draw2d/Zest as bundles that I copied last year.

Ah yes. Sorry didn't remember that. But for testing I would always need to merge my changes into your repo. I guess this is not the right place here, but what can we do that you don't need a full GEF classic copy anymore?

@Phillipus
Copy link
Contributor

Phillipus commented Aug 21, 2022

but what can we do that you don't need a full GEF classic copy anymore?

My copy has bug fixes, theme colors for palette, and most importantly an option not to use ScaledGraphics in Draw2d (it causes problems with font clipping at higher zoom and scaling):

See https://github.com/archimatetool/archi/commits/master/org.eclipse.draw2d

@azoitl
Copy link
Contributor Author

azoitl commented Aug 21, 2022

but what can we do that you don't need a full GEF classic copy anymore?

My copy has bug fixes, theme colors for palette, and most importantly an option not to use ScaledGraphics in Draw2d (it causes problems with font clipping at higher zoom and scaling):

See https://github.com/archimatetool/archi/commits/master/org.eclipse.draw2d

Ah yes the infamouse ScaledGraphics problems. Thanks for tracking this down. We also deactivated the ScaledGraphics in 4diac IDE based on your findings. But it seems you had more issue then we had.

@Phillipus
Copy link
Contributor

Ah yes the infamouse ScaledGraphics problems. Thanks for tracking this down. We also deactivated the ScaledGraphics in 4diac IDE based on your findings. But it seems you had more issue then we had.

Opened #106 so we can carry on there...

@azoitl
Copy link
Contributor Author

azoitl commented Aug 24, 2022

Given the feedback and my tests I'll merge this PR now.

@azoitl azoitl merged commit 7dda92a into eclipse:master Aug 24, 2022
@azoitl azoitl deleted the GenericGetAdapter branch August 24, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants