Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
java: [ 21, 25 ]
java: [ 24, 25 ]
include:
- java: 21
- java: 24
target: 2024-06
- java: 25
target: master
Expand Down
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-Dtycho.version=5.0.0
-Dtycho.version=5.0.1
-Djdk.xml.totalEntitySizeLimit=1000000
-Djdk.xml.maxGeneralEntitySizeLimit=1000000
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pipeline {

tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk21-latest'
jdk 'temurin-jdk25-latest'
}

environment {
Expand Down
6 changes: 6 additions & 0 deletions org.eclipse.wb.doc.user/html-src/whatsnew/v123.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ endif::[]

= What's New - v1.23.0

== General

- [Linux] FFMA when using Java 24 or higher

The Linux-specific fragment will use the Foreign Function and Memory API when used with Java 24 or higher.

What's new - xref:v122.adoc[*v1.22.0*]
7 changes: 6 additions & 1 deletion org.eclipse.wb.os.linux/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-24"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_java24">
<attributes>
<attribute name="release" value="24"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions org.eclipse.wb.os.linux/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Import-Package: org.apache.commons.io;version="[2.16.1,3.0.0)",
org.apache.commons.lang3;version="[3.14.0,4.0.0)",
org.apache.commons.lang3.function;version="[3.14.0,4.0.0)",
org.eclipse.wb.os
Automatic-Module-Name: org.eclipse.wb.os.linux
Multi-Release: true
Provide-Capability: wbp;type=os
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*******************************************************************************
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Google, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.internal.os.linux;

import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.plugin.AbstractUIPlugin;

import org.apache.commons.io.IOUtils;
import org.osgi.framework.BundleContext;

import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
* The activator class controls the plug-in life cycle.
*
* @author mitin_aa
* @coverage os.linux
*/
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.wb.os.linux";
//
private static Activator m_plugin;

////////////////////////////////////////////////////////////////////////////
//
// Life cycle
//
////////////////////////////////////////////////////////////////////////////
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
m_plugin = this;
}

@Override
public void stop(BundleContext context) throws Exception {
m_plugin = null;
super.stop(context);
}

/**
* Returns the shared instance.
*/
public static Activator getDefault() {
return m_plugin;
}

public static void logError(String text, Throwable error) {
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, text, error));
}

////////////////////////////////////////////////////////////////////////////
//
// Files
//
////////////////////////////////////////////////////////////////////////////
/**
* @return the {@link InputStream} for file from plugin directory.
*/
public static InputStream getFile(String path) {
try {
URL url = new URL(getInstallURL(), path);
return url.openStream();
} catch (Throwable e) {
throw ReflectionUtils.propagate(e);
}
}

/**
* @return the install {@link URL} for this {@link Plugin}.
*/
public static URL getInstallURL() {
return getInstallUrl(getDefault());
}

/**
* @return the install {@link URL} for given {@link Plugin}.
*/
private static URL getInstallUrl(Plugin plugin) {
return plugin.getBundle().getEntry("/");
}

////////////////////////////////////////////////////////////////////////////
//
// Images
//
////////////////////////////////////////////////////////////////////////////
private static final Map<String, Image> m_nameToIconMap = new HashMap<>();

/**
* @return the {@link Image} from "icons" directory.
*/
public static Image getImage(String path) {
Image image = m_nameToIconMap.get(path);
if (image == null) {
InputStream is = getFile("icons/" + path);
try {
image = new Image(Display.getCurrent(), is);
m_nameToIconMap.put(path, image);
} finally {
IOUtils.closeQuietly(is);
}
}
return image;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2025 Patrick Ziegler and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Patrick Ziegler - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.internal.os.linux;

import org.eclipse.wb.internal.os.linux.cairo.CairoContext;
import org.eclipse.wb.internal.os.linux.cairo.CairoRegion;

import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.SymbolLookup;
import java.lang.foreign.ValueLayout;
import java.lang.invoke.MethodHandle;

/**
* The GDK toolkit
*/
public class GDK extends Native {
protected static final SymbolLookup GDK;

static {
if (isGtk4()) {
GDK = SymbolLookup.libraryLookup("libgdk-4.so.0", Arena.ofAuto());
} else {
GDK = SymbolLookup.libraryLookup("libgdk-3.so.0", Arena.ofAuto());
}
}

private static class InstanceHolder {
private static final MethodHandle gdk_cairo_region = createHandle(GDK, "gdk_cairo_region",
FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS));
}

/**
* Adds the given region to the current path of {@code cr}.
*
* @param cr A cairo context.
* @param region A {@code cairo_region_t}.
*/
public static void gdk_cairo_region(CairoContext cr, CairoRegion region) {
runSafe(() -> InstanceHolder.gdk_cairo_region.invoke(cr.segment(), region.segment()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*******************************************************************************
* Copyright (c) 2025 Patrick Ziegler and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Patrick Ziegler - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.internal.os.linux;

import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.SymbolLookup;
import java.lang.foreign.ValueLayout;
import java.lang.invoke.MethodHandle;

/**
* The GTK toolkit
*/
public abstract class GTK extends Native {
protected static final SymbolLookup GTK;

static {
if (isGtk4()) {
GTK = SymbolLookup.libraryLookup("libgtk-4.so.0", Arena.ofAuto());
} else {
GTK = SymbolLookup.libraryLookup("libgtk-3.so.0", Arena.ofAuto());
}
}

private static class InstanceHolder {
private static final MethodHandle gtk_widget_get_allocated_baseline = createHandle(GTK, "gtk_widget_get_allocated_baseline",
FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS));

private static final MethodHandle gtk_get_major_version = createHandle(GTK, "gtk_get_major_version",
FunctionDescriptor.of(ValueLayout.JAVA_INT));

private static final MethodHandle gtk_get_minor_version = createHandle(GTK, "gtk_get_minor_version",
FunctionDescriptor.of(ValueLayout.JAVA_INT));

private static final MethodHandle gtk_get_micro_version = createHandle(GTK, "gtk_get_micro_version",
FunctionDescriptor.of(ValueLayout.JAVA_INT));

private static final MethodHandle gtk_widget_get_allocation = createHandle(GTK, "gtk_widget_get_allocation",
FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS));

private static final MethodHandle gtk_widget_hide = createHandle(GTK, "gtk_widget_hide",
FunctionDescriptor.ofVoid(ValueLayout.ADDRESS));
}

/**
* @return The major version number of the GTK+ library.
*/
public static int gtk_get_major_version() {
return (int) callSafe(() -> InstanceHolder.gtk_get_major_version.invoke());
}

/**
* @return The minor version number of the GTK+ library.
*/
public static int gtk_get_minor_version() {
return (int) callSafe(() -> InstanceHolder.gtk_get_minor_version.invoke());
}

/**
* @return The micro version number of the GTK+ library.
*/
public static int gtk_get_micro_version() {
return (int) callSafe(() -> InstanceHolder.gtk_get_micro_version.invoke());
}

/**
* Retrieves the widget’s allocation.
*
* Note, when implementing a {@code GtkContainer}: a widget’s allocation will be
* its “adjusted” allocation, that is, the widget’s parent container typically
* calls {@code gtk_widget_size_allocate()} with an allocation, and that
* allocation is then adjusted (to handle margin and alignment for example)
* before assignment to the widget.
*
* {@code gtk_widget_get_allocation()} returns the adjusted allocation that was
* actually assigned to the widget. The adjusted allocation is guaranteed to be
* completely contained within the {@code gtk_widget_size_allocate()}
* allocation, however.
*
* So a {@code GtkContainer} is guaranteed that its children stay inside the
* assigned bounds, but not that they have exactly the bounds the container
* assigned. There is no way to get the original allocation assigned by
* {@code gtk_widget_size_allocate()}, since it isn’t stored; if a container
* implementation needs that information it will have to track it itself.
*/
public static void gtk_widget_get_allocation(GtkWidget widget, GtkAllocation allocation) {
runSafe(() -> InstanceHolder.gtk_widget_get_allocation.invoke(widget.segment(), allocation.segment()));
}

/**
* Reverses the effects of {@code gtk_widget_show()}, causing the {@code widget}
* to be hidden (invisible to the user).
*/
public static void gtk_widget_hide(GtkWidget widget) {
runSafe(() -> InstanceHolder.gtk_widget_hide.invoke(widget.segment()));
}

/**
* Returns the baseline that has currently been allocated to {@code widget} or
* -1, if none.
*/
public static int gtk_widget_get_allocated_baseline(GtkWidget widget) {
return (int) callSafe(() -> InstanceHolder.gtk_widget_get_allocated_baseline.invoke(widget.segment()));
}
}
Loading
Loading