Skip to content

Easy way to check if SVG is supported by SWT #2084

Closed Answered by ptziegler
ptziegler asked this question in Q&A
Discussion options

You must be logged in to vote

To answer my own question: SVG support can be required via the following entry in the manifest header:

Require-Capability: eclipse.swt;filter:="(image.format=svg)";resolution:=optional

This capability must be marked as optional, to remain backwards compatible. To then check whether SVG is supported, following snippet can be used:

private static Boolean isSvgSupported;

public static boolean isSvgSupported() {
    if (isSvgSupported != null) {
        return isSvgSupported;
    }

    isSvgSupported = false;
    BundleWiring wiring = FrameworkUtil.getBundle(InternalGEFPlugin.class).adapt(BundleWiring.class);
    if (wiring == null) {
        return false;
    }

    List<BundleRequirement> 

Replies: 1 comment 3 replies

Comment options

ptziegler
May 2, 2025
Collaborator Author

You must be logged in to vote
3 replies
@HannesWell
Comment options

@ptziegler
Comment options

ptziegler May 2, 2025
Collaborator Author

@laeubi
Comment options

laeubi May 2, 2025
Collaborator

Answer selected by ptziegler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants