From 167e2af280c0e7535b000a0f3899ee51f6ddcff9 Mon Sep 17 00:00:00 2001 From: Wim Jongman Date: Wed, 27 Nov 2024 18:04:19 +0100 Subject: [PATCH] TitledSeparator shows no separator on linux #606 (#621) made snippet standalone by inlining the image removed background setting which did nothing on windows and hid the separator on linux --- .../snippets/TitledSeparatorSnippet.java | 26 ++++++++++++++++-- .../opal/titledseparator/snippets/user.png | Bin 687 -> 0 bytes .../opal/titledseparator/TitledSeparator.java | 3 +- 3 files changed, 25 insertions(+), 4 deletions(-) delete mode 100644 widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/user.png diff --git a/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/TitledSeparatorSnippet.java b/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/TitledSeparatorSnippet.java index 4b1d20773..57bbf4702 100644 --- a/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/TitledSeparatorSnippet.java +++ b/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/TitledSeparatorSnippet.java @@ -12,6 +12,9 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.opal.titledseparator.snippets; +import java.io.ByteArrayInputStream; +import java.util.Base64; + import org.eclipse.nebula.widgets.opal.commons.SWTGraphicUtil; import org.eclipse.nebula.widgets.opal.titledseparator.TitledSeparator; import org.eclipse.swt.SWT; @@ -28,6 +31,24 @@ */ public class TitledSeparatorSnippet { + private static final String IMAGE = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M" + + "/3AAAAB3RJTUUH2woHCQsOaNepFwAAAAlwSFlzAAAewgAAHsIBbtB1" + + "PgAAAARnQU1BAACxjwv8YQUAAAI+SURBVHjalVF7SNNRFP5+mzhkGbX" + + "IZSqyBg2igtQFTsyBKURJjB7EgkhSe+wP6QG9/7WCaaRgFEWjKKEsMh" + + "2Z6VZiVKQLVKYVuVyauWCQSkG636l7ZXev+qMP7j2H8/ju/c6RiAgMC" + + "nY1nygjSUS0pZ3U+nKIwCLnCxdSuUlLzOcll5xfqedTCLKvG6InDM42" + + "7aylPaWZ8xlWce/4Fnr9PjjPMdVmp4rZQzx51FUY4fC03yfXdRv3v/" + + "2QccEZkJifFCYf839G1dlGxIMz5FnraF91BbxQIjDB/4H8LwT9utHIE" + + "xcfDJLjrpf7qiVquA8UQL1mkZSgIx7iD/Ydy0i9OBlTw9+x8rADFotF" + + "EsIZDKadMOZsRjBVhVb7wUSGomIzt6dNJXje9SxWBRu7PnsFvPXbedD" + + "mqcZkx0b+hMRGODFF6JxTCYkZ8gy6m2+h984RSYGGEtxseiKSYbh3U+QJ" + + "hm3HmmjkFSBnKrGrWIeTlUYppiAa0XsJTf6EUpsCvfWykJ6wimiwea2dm" + + "Ub/glTRzCwbz5xSi9pHAzEkSfGMuuzlKDp1A/l+F/zjclTcjMeOyoTfKuI" + + "DPsMZtNWUcz8rSycOa2a5f0po6QvS/pohuBry4CMF2sd+iSI2YXP6LHI1I" + + "ZTZ+nD1XA625moiQ3xbZySDvgCNgQ14s3QT0tLlmLXI40Fuh/8otib7UZ1" + + "2G4NdPVhf3yvxqlV7r/HAaL8bHx56eDMjETozNPwEWgaQMvIU7z6+wOqqK3" + + "/fwv/iN7ZiFLq3HVKbAAAAAElFTkSuQmCC"; + /** * @param args */ @@ -35,8 +56,9 @@ public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); - - final Image icon = new Image(display, TitledSeparatorSnippet.class.getResourceAsStream("user.png")); + + final byte[] imageBytes = Base64.getDecoder().decode(IMAGE); + final Image icon = new Image(display, new ByteArrayInputStream(imageBytes)); final Font font = new Font(display, "Courier New", 18, SWT.BOLD | SWT.ITALIC); // Default separator (no image, title aligned on the left) diff --git a/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/user.png b/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator.snippets/src/org/eclipse/nebula/widgets/opal/titledseparator/snippets/user.png deleted file mode 100644 index 212cb868d1fb15113c94d3b25ca767f79c646487..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 687 zcmV;g0#N;lP)OW zNkp`zoz(hrh`=J}3l~zkNlVPl%OLX;t%#6%SgRA8B@dGvGTA3 z7K=p^!Wj&voiOHXMle-{R{Oz3hN5CKx2H`dc;59aRs|coK6?ec_1k&S=BdVH$435y z#6~zVMd+MU35gl<47!_dq4&-aNr8qE+-!Oxl3}=aQ{)MTZO58uhDWEE~_9Qj6M012H5?@r=6cFPL%7ou4;sZXz8MM`ub3ZFfCk|_7xqnJ%=?l{SnjyFv^57!{+Q)v0 zA~s=j`YduaA(YwraP?dcw&rRgLws9jB!j*Hje!k#vvd>E(&d=7$m2n7hyN(HCi_vH zb{m6TJy>7gEAgsTd#~}pXulgD9(s5)BM~|?H2efw29PrH6z@L1!0M_if8WCY;y1Qp V6uP$^Qkwt(002ovPDHLkV1g^gGw}cb diff --git a/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator/src/org/eclipse/nebula/widgets/opal/titledseparator/TitledSeparator.java b/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator/src/org/eclipse/nebula/widgets/opal/titledseparator/TitledSeparator.java index 434572f15..b677cfbca 100644 --- a/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator/src/org/eclipse/nebula/widgets/opal/titledseparator/TitledSeparator.java +++ b/widgets/opal/titledseparator/org.eclipse.nebula.widgets.opal.titledseparator/src/org/eclipse/nebula/widgets/opal/titledseparator/TitledSeparator.java @@ -146,9 +146,8 @@ private void createContent() { * Create a separator */ private void createSeparator() { - final Label separator = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_OUT); + final Label separator = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - separator.setBackground(getBackground()); } /**