Skip to content

Commit

Permalink
Integration Build for Eclipse 4.31
Browse files Browse the repository at this point in the history
- Note that this has to have version 1.7.36 of slf4j
- SplashHandler workaround not needed
  • Loading branch information
Phillipus committed Feb 14, 2024
1 parent 43e21ad commit 8dd5db7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 66 deletions.
13 changes: 8 additions & 5 deletions com.archimatetool.editor.product/archi.target
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
<target name="Archi">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/2023-12"/>
<unit id="org.eclipse.sdk.ide" version="4.30.0.I20231201-0110"/>
<unit id="org.eclipse.emf.compare.feature.group" version="3.3.23.202311200811"/>
<unit id="org.eclipse.jgit.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.ssh.apache.feature.group" version="6.8.0.202311291450-r"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.31-I-builds"/>
<unit id="org.eclipse.sdk.ide" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/2024-03"/>
<unit id="org.eclipse.emf.compare.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jgit.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jgit.ssh.apache.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/tools/orbit/simrel/maven-osgi/release/4.30.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.splash.AbstractSplashHandler;

import com.archimatetool.editor.utils.PlatformUtils;

/**
* Splash Handler
*/
Expand All @@ -31,9 +25,6 @@ public SplashHandler() {
public void init(Shell shell) {
super.init(shell);

// Check for Mac bug
checkMacBackgroundImageInverted(shell);

shell.setBackgroundMode(SWT.INHERIT_FORCE);

String version = Messages.SplashHandler_0 + " " + ArchiPlugin.INSTANCE.getVersion(); //$NON-NLS-1$
Expand All @@ -47,55 +38,5 @@ public void init(Shell shell) {
e.gc.setForeground(new Color(35, 35, 140));
e.gc.drawString(version, 19, 166, true);
});
}

/**
* macOS Sonoma 14 flips background images on Control#setBackgroundImage
* See https://github.com/eclipse-platform/eclipse.platform.swt/issues/772
*/
private void checkMacBackgroundImageInverted(Shell shell) {
// This was partially fixed for Eclipse 4.30 in org.eclipse.ui.internal.Workbench but that only checks for macOS 14
// So that fix won't work on macOS 15 and greater.
// https://github.com/eclipse-platform/eclipse.platform.ui/pull/1355/commits/884bb26a23374c5c1def95ca70b7abc74f395382
// However, there is a better macOS version check in Eclipse 4.31.
// So we'll compare with macOS 15.
// TODO: remove this if and when we target Eclipse 4.31 or greater
if(PlatformUtils.isMac() && PlatformUtils.compareOSVersion("15.0") >= 0) { //$NON-NLS-1$
// Flip the image
shell.setBackgroundImage(flipImage(shell.getDisplay(), shell.getBackgroundImage()));

// We are now responsible for disposing the new image
shell.addDisposeListener(e -> {
shell.getBackgroundImage().dispose();
});
}
}

/**
* From https://github.com/knime/knime-product/commit/095c88e22ba6d84e22a480f50734141836098169
*/
private Image flipImage(Display display, Image srcImage) {
Rectangle bounds = srcImage.getBounds();
Image newImage = new Image(display, bounds.width, bounds.height);

GC gc = new GC(newImage);
gc.setAdvanced(true);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);

Transform transform = new Transform(display);
// flip down
transform.setElements(1, 0, 0, -1, 0, 0);
// move up
transform.translate(0, -bounds.height);
gc.setTransform(transform);

gc.drawImage(srcImage, 0, 0, bounds.width, bounds.height,
0, 0, bounds.width, bounds.height);

gc.dispose();
transform.dispose();

return newImage;
}
}
}
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
</properties>

<repositories>
<repository>
<id>Eclipse I-build</id>
<layout>p2</layout>
<url>https://download.eclipse.org/eclipse/updates/4.31-I-builds</url>
</repository>
<repository>
<id>Eclipse</id>
<layout>p2</layout>
<url>https://download.eclipse.org/releases/2023-12</url>
<url>https://download.eclipse.org/releases/2024-03</url>
</repository>
</repositories>

Expand Down

0 comments on commit 8dd5db7

Please sign in to comment.